From 6aeacaefa805103e52cd9af41da23aedd0561a67 Mon Sep 17 00:00:00 2001 From: pipedrive-bot Date: Mon, 23 Mar 2026 11:26:03 +0000 Subject: [PATCH 1/3] Build 319 - version-minor --- CHANGELOG.md | 6 + 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/FullTaskObject.md | 3 +- 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/Model/TaskObjectFragment.md | 3 +- docs/versions/v1/Model/TaskPostObject.md | 3 +- docs/versions/v1/Model/TaskPutObject.md | 3 +- docs/versions/v1/Model/TaskResponseObject.md | 3 +- docs/versions/v1/README.md | 249 +- docs/versions/v2/Api/DealsApi.md | 2 +- docs/versions/v2/Api/OrganizationsApi.md | 4 +- docs/versions/v2/Model/BaseInstallment.md | 2 +- docs/versions/v2/Model/BaseProduct.md | 2 +- docs/versions/v2/Model/BaseProductAllOf.md | 2 +- .../v2/Model/CreateDealFieldRequest.md | 2 +- .../Model/CreateOrganizationFieldRequest.md | 2 +- .../v2/Model/CreatePersonFieldRequest.md | 2 +- .../v2/Model/CreateProductFieldRequest.md | 2 +- docs/versions/v2/Model/Deal.md | 40 + docs/versions/v2/Model/DealItem.md | 1 + .../v2/Model/InstallmentRequestBody.md | 2 +- docs/versions/v2/Model/Person.md | 28 + docs/versions/v2/Model/PersonEmails.md | 11 + docs/versions/v2/Model/PersonIm.md | 11 + docs/versions/v2/Model/PersonItem.md | 8 +- docs/versions/v2/Model/PersonPhones.md | 11 + docs/versions/v2/Model/PersonPostalAddress.md | 18 + docs/versions/v2/Model/PersonRequestBody.md | 4 +- docs/versions/v2/Model/PostFollower.md | 2 +- docs/versions/v2/Model/PostFollowerAllOf.md | 2 +- .../versions/v2/Model/PostPatchGetActivity.md | 2 +- docs/versions/v2/Model/PostPatchGetDeal.md | 2 +- .../v2/Model/PostPatchGetOrganization.md | 2 +- docs/versions/v2/Model/PostPatchGetPerson.md | 2 +- .../v2/Model/ProductWithArrayPrices.md | 2 +- .../v2/Model/UpsertActivityResponseData.md | 2 +- .../v2/Model/UpsertDealResponseData.md | 2 +- .../Model/UpsertOrganizationResponseData.md | 2 +- .../v2/Model/UpsertPersonResponseData.md | 2 +- docs/versions/v2/README.md | 10 +- 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 +- lib/versions/v1/Model/FullTaskObject.php | 40 +- .../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/v1/Model/TaskObjectFragment.php | 40 +- lib/versions/v1/Model/TaskPostObject.php | 40 +- lib/versions/v1/Model/TaskPutObject.php | 40 +- lib/versions/v1/Model/TaskResponseObject.php | 40 +- lib/versions/v2/Api/OrganizationsApi.php | 10 +- lib/versions/v2/Model/BaseInstallment.php | 2 +- lib/versions/v2/Model/BaseProduct.php | 2 +- lib/versions/v2/Model/BaseProductAllOf.php | 2 +- .../v2/Model/CreateDealFieldRequest.php | 2 +- .../Model/CreateOrganizationFieldRequest.php | 2 +- .../v2/Model/CreatePersonFieldRequest.php | 2 +- .../v2/Model/CreateProductFieldRequest.php | 2 +- lib/versions/v2/Model/Deal.php | 1275 +++ lib/versions/v2/Model/DealItem.php | 30 + .../v2/Model/InstallmentRequestBody.php | 2 +- lib/versions/v2/Model/Person.php | 915 +++ lib/versions/v2/Model/PersonEmails.php | 405 + lib/versions/v2/Model/PersonIm.php | 405 + lib/versions/v2/Model/PersonItem.php | 24 +- lib/versions/v2/Model/PersonPhones.php | 405 + lib/versions/v2/Model/PersonPostalAddress.php | 616 ++ lib/versions/v2/Model/PersonRequestBody.php | 12 +- .../v2/Model/ProductWithArrayPrices.php | 2 +- 105 files changed, 8736 insertions(+), 22732 deletions(-) create mode 100644 docs/versions/v1/Model/PictureDataWithID1Pictures.md create mode 100644 docs/versions/v1/Model/PictureDataWithID2.md create mode 100644 docs/versions/v2/Model/Deal.md create mode 100644 docs/versions/v2/Model/Person.md create mode 100644 docs/versions/v2/Model/PersonEmails.md create mode 100644 docs/versions/v2/Model/PersonIm.md create mode 100644 docs/versions/v2/Model/PersonPhones.md create mode 100644 docs/versions/v2/Model/PersonPostalAddress.md create mode 100644 lib/versions/v1/Model/PictureDataWithID1Pictures.php create mode 100644 lib/versions/v1/Model/PictureDataWithID2.php create mode 100644 lib/versions/v2/Model/Deal.php create mode 100644 lib/versions/v2/Model/Person.php create mode 100644 lib/versions/v2/Model/PersonEmails.php create mode 100644 lib/versions/v2/Model/PersonIm.php create mode 100644 lib/versions/v2/Model/PersonPhones.php create mode 100644 lib/versions/v2/Model/PersonPostalAddress.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 3251b199..197c33cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ 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] +### Added +- Added `assignee_ids` field to Tasks endpoints: + - `GET /v1/tasks` + - `GET /v1/tasks/{id}` + - `POST /v1/tasks` + - `PUT /v1/tasks/{id}` ## [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/FullTaskObject.md b/docs/versions/v1/Model/FullTaskObject.md index 68586b3b..b988eceb 100644 --- a/docs/versions/v1/Model/FullTaskObject.md +++ b/docs/versions/v1/Model/FullTaskObject.md @@ -8,7 +8,8 @@ Name | Type | Description | Notes **project_id** | **float** | The ID of the project this task is associated with | [optional] **description** | **string** | The description of the task | [optional] **parent_task_id** | **float** | The ID of a parent task. Can not be ID of a task which is already a subtask. | [optional] -**assignee_id** | **float** | The ID of the user who will be the assignee of the task | [optional] +**assignee_id** | **float** | The ID of the user assigned to the task. When the `assignee_id` field is updated, the `assignee_ids` field value will be overwritten by the `assignee_id` field value. | [optional] +**assignee_ids** | **float[]** | The IDs of users assigned to the task. When the `assignee_ids` field is updated, the `assignee_id` field value will be set to the first value of the `assignee_ids` field, or `null` if the list is empty. | [optional] **done** | [**NumberBoolean**](NumberBoolean.md) | Whether the task is done or not. 0 = Not done, 1 = Done. | [optional] **due_date** | **\DateTime** | The due date of the task. Format: YYYY-MM-DD. | [optional] **creator_id** | **float** | The creator of a task | [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/Model/TaskObjectFragment.md b/docs/versions/v1/Model/TaskObjectFragment.md index 341bbe5c..481375c1 100644 --- a/docs/versions/v1/Model/TaskObjectFragment.md +++ b/docs/versions/v1/Model/TaskObjectFragment.md @@ -6,7 +6,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **description** | **string** | The description of the task | [optional] **parent_task_id** | **float** | The ID of a parent task. Can not be ID of a task which is already a subtask. | [optional] -**assignee_id** | **float** | The ID of the user who will be the assignee of the task | [optional] +**assignee_id** | **float** | The ID of the user assigned to the task. When the `assignee_id` field is updated, the `assignee_ids` field value will be overwritten by the `assignee_id` field value. | [optional] +**assignee_ids** | **float[]** | The IDs of users assigned to the task. When the `assignee_ids` field is updated, the `assignee_id` field value will be set to the first value of the `assignee_ids` field, or `null` if the list is empty. | [optional] **done** | [**NumberBoolean**](NumberBoolean.md) | Whether the task is done or not. 0 = Not done, 1 = Done. | [optional] **due_date** | **\DateTime** | The due date of the task. Format: YYYY-MM-DD. | [optional] diff --git a/docs/versions/v1/Model/TaskPostObject.md b/docs/versions/v1/Model/TaskPostObject.md index 64284992..ad5cdd79 100644 --- a/docs/versions/v1/Model/TaskPostObject.md +++ b/docs/versions/v1/Model/TaskPostObject.md @@ -8,7 +8,8 @@ Name | Type | Description | Notes **project_id** | **float** | The ID of a project | **description** | **string** | The description of the task | [optional] **parent_task_id** | **float** | The ID of a parent task. Can not be ID of a task which is already a subtask. | [optional] -**assignee_id** | **float** | The ID of the user who will be the assignee of the task | [optional] +**assignee_id** | **float** | The ID of the user assigned to the task. When the `assignee_id` field is updated, the `assignee_ids` field value will be overwritten by the `assignee_id` field value. | [optional] +**assignee_ids** | **float[]** | The IDs of users assigned to the task. When the `assignee_ids` field is updated, the `assignee_id` field value will be set to the first value of the `assignee_ids` field, or `null` if the list is empty. | [optional] **done** | [**NumberBoolean**](NumberBoolean.md) | Whether the task is done or not. 0 = Not done, 1 = Done. | [optional] **due_date** | **\DateTime** | The due date of the task. Format: YYYY-MM-DD. | [optional] diff --git a/docs/versions/v1/Model/TaskPutObject.md b/docs/versions/v1/Model/TaskPutObject.md index 0e4608fa..168b6a08 100644 --- a/docs/versions/v1/Model/TaskPutObject.md +++ b/docs/versions/v1/Model/TaskPutObject.md @@ -8,7 +8,8 @@ Name | Type | Description | Notes **project_id** | **float** | The ID of the project this task is associated with | [optional] **description** | **string** | The description of the task | [optional] **parent_task_id** | **float** | The ID of a parent task. Can not be ID of a task which is already a subtask. | [optional] -**assignee_id** | **float** | The ID of the user who will be the assignee of the task | [optional] +**assignee_id** | **float** | The ID of the user assigned to the task. When the `assignee_id` field is updated, the `assignee_ids` field value will be overwritten by the `assignee_id` field value. | [optional] +**assignee_ids** | **float[]** | The IDs of users assigned to the task. When the `assignee_ids` field is updated, the `assignee_id` field value will be set to the first value of the `assignee_ids` field, or `null` if the list is empty. | [optional] **done** | [**NumberBoolean**](NumberBoolean.md) | Whether the task is done or not. 0 = Not done, 1 = Done. | [optional] **due_date** | **\DateTime** | The due date of the task. Format: YYYY-MM-DD. | [optional] diff --git a/docs/versions/v1/Model/TaskResponseObject.md b/docs/versions/v1/Model/TaskResponseObject.md index 4b169bb9..8cb61f29 100644 --- a/docs/versions/v1/Model/TaskResponseObject.md +++ b/docs/versions/v1/Model/TaskResponseObject.md @@ -9,7 +9,8 @@ Name | Type | Description | Notes **project_id** | **float** | The ID of the project this task is associated with | [optional] **description** | **string** | The description of the task | [optional] **parent_task_id** | **float** | The ID of a parent task. Can not be ID of a task which is already a subtask. | [optional] -**assignee_id** | **float** | The ID of the user who will be the assignee of the task | [optional] +**assignee_id** | **float** | The ID of the user assigned to the task. When the `assignee_id` field is updated, the `assignee_ids` field value will be overwritten by the `assignee_id` field value. | [optional] +**assignee_ids** | **float[]** | The IDs of users assigned to the task. When the `assignee_ids` field is updated, the `assignee_id` field value will be set to the first value of the `assignee_ids` field, or `null` if the list is empty. | [optional] **done** | [**NumberBoolean**](NumberBoolean.md) | Whether the task is done or not. 0 = Not done, 1 = Done. | [optional] **due_date** | **\DateTime** | The due date of the task. Format: YYYY-MM-DD. | [optional] **creator_id** | **float** | The creator of a task | [optional] 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/Api/DealsApi.md b/docs/versions/v2/Api/DealsApi.md index ed947151..f88e5682 100644 --- a/docs/versions/v2/Api/DealsApi.md +++ b/docs/versions/v2/Api/DealsApi.md @@ -1520,7 +1520,7 @@ postAdditionalDiscount($id, $body): \Pipedrive\versions\v2\Model\AddAdditionalDi Add a discount to a deal -Adds a discount to a deal changing, the deal value if the deal has one-time products attached. +Adds a discount to a deal, changing the deal value if the deal has one-time products attached. ### Example diff --git a/docs/versions/v2/Api/OrganizationsApi.md b/docs/versions/v2/Api/OrganizationsApi.md index 78ad0549..b67f8d54 100644 --- a/docs/versions/v2/Api/OrganizationsApi.md +++ b/docs/versions/v2/Api/OrganizationsApi.md @@ -521,7 +521,7 @@ $apiInstance = new Pipedrive\versions\v2\Api\OrganizationsApi( ); $filter_id = 56; // int | If supplied, only organizations matching the specified filter are returned $ids = 'ids_example'; // string | Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. -$owner_id = 56; // int | If supplied, only organization owned by the specified user are returned. If filter_id is provided, this is ignored. +$owner_id = 56; // int | If supplied, only organizations owned by the specified user are returned. If filter_id is provided, this is ignored. $updated_since = 'updated_since_example'; // string | If set, only organizations with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. $updated_until = 'updated_until_example'; // string | If set, only organizations with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. $sort_by = 'id'; // string | The field to sort by. Supported fields: `id`, `update_time`, `add_time`. @@ -545,7 +545,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **filter_id** | **int**| If supplied, only organizations matching the specified filter are returned | [optional] **ids** | **string**| Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. | [optional] - **owner_id** | **int**| If supplied, only organization owned by the specified user are returned. If filter_id is provided, this is ignored. | [optional] + **owner_id** | **int**| If supplied, only organizations owned by the specified user are returned. If filter_id is provided, this is ignored. | [optional] **updated_since** | **string**| If set, only organizations with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. | [optional] **updated_until** | **string**| If set, only organizations with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. | [optional] **sort_by** | **string**| The field to sort by. Supported fields: `id`, `update_time`, `add_time`. | [optional] [default to 'id'] diff --git a/docs/versions/v2/Model/BaseInstallment.md b/docs/versions/v2/Model/BaseInstallment.md index 7439cb92..606ac4f0 100644 --- a/docs/versions/v2/Model/BaseInstallment.md +++ b/docs/versions/v2/Model/BaseInstallment.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **int** | The ID of the installment | [optional] **amount** | **float** | The installment amount. | [optional] -**billing_date** | **string** | The date which the installment will be charged. | [optional] +**billing_date** | **string** | The date on which the installment will be charged. | [optional] **description** | **string** | The name of installment. | [optional] **deal_id** | **int** | The ID of the deal the installment was added to. | [optional] diff --git a/docs/versions/v2/Model/BaseProduct.md b/docs/versions/v2/Model/BaseProduct.md index 98993724..c46c279a 100644 --- a/docs/versions/v2/Model/BaseProduct.md +++ b/docs/versions/v2/Model/BaseProduct.md @@ -9,7 +9,7 @@ Name | Type | Description | Notes **code** | **string** | The product code | [optional] **unit** | **string** | The unit in which this product is sold | [optional] **tax** | **float** | The tax percentage | [optional] [default to 0] -**is_deleted** | **bool** | Whether this product will be made marked as deleted or not | [optional] [default to false] +**is_deleted** | **bool** | Whether this product will be marked as deleted or not | [optional] [default to false] **is_linkable** | **bool** | Whether this product can be added to a deal or not | [optional] [default to true] **visible_to** | [**VisibleTo**](VisibleTo.md) | Visibility of the product | [optional] **owner_id** | **int** | Information about the Pipedrive user who owns the product | [optional] diff --git a/docs/versions/v2/Model/BaseProductAllOf.md b/docs/versions/v2/Model/BaseProductAllOf.md index ee6f2933..dbce82f4 100644 --- a/docs/versions/v2/Model/BaseProductAllOf.md +++ b/docs/versions/v2/Model/BaseProductAllOf.md @@ -9,7 +9,7 @@ Name | Type | Description | Notes **code** | **string** | The product code | [optional] **unit** | **string** | The unit in which this product is sold | [optional] **tax** | **float** | The tax percentage | [optional] [default to 0] -**is_deleted** | **bool** | Whether this product will be made marked as deleted or not | [optional] [default to false] +**is_deleted** | **bool** | Whether this product will be marked as deleted or not | [optional] [default to false] **is_linkable** | **bool** | Whether this product can be added to a deal or not | [optional] [default to true] **visible_to** | [**VisibleTo**](VisibleTo.md) | Visibility of the product | [optional] **owner_id** | **int** | Information about the Pipedrive user who owns the product | [optional] diff --git a/docs/versions/v2/Model/CreateDealFieldRequest.md b/docs/versions/v2/Model/CreateDealFieldRequest.md index 29da64fa..a974f5b0 100644 --- a/docs/versions/v2/Model/CreateDealFieldRequest.md +++ b/docs/versions/v2/Model/CreateDealFieldRequest.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **field_name** | **string** | Field name | -**field_type** | **string** | The type of the field<table><tr><th>Value</th><th>Description</th></tr><tr><td>`varchar`</td><td>Text (up to 255 characters)</td><tr><td>`varchar_auto`</td><td>Autocomplete text (up to 255 characters)</td><tr><td>`text`</td><td>Long text (up to 65k characters)</td><tr><td>`double`</td><td>Numeric value</td><tr><td>`monetary`</td><td>Monetary field (has a numeric value and a currency value)</td><tr><td>`date`</td><td>Date (format YYYY-MM-DD)</td><tr><td>`set`</td><td>Options field with a possibility of having multiple chosen options</td><tr><td>`enum`</td><td>Options field with a single possible chosen option</td><tr><td>`user`</td><td>User field (contains a user ID of another Pipedrive user)</td><tr><td>`org`</td><td>Organization field (contains an organization ID which is stored on the same account)</td><tr><td>`people`</td><td>Person field (contains a product ID which is stored on the same account)</td><tr><td>`phone`</td><td>Phone field (up to 255 numbers and/or characters)</td><tr><td>`time`</td><td>Time field (format HH:MM:SS)</td><tr><td>`timerange`</td><td>Time-range field (has a start time and end time value, both HH:MM:SS)</td><tr><td>`daterange`</td><td>Date-range field (has a start date and end date value, both YYYY-MM-DD)</td><tr><td>`address`</td><td>Address field</dd></table> | +**field_type** | **string** | The type of the field<table><tr><th>Value</th><th>Description</th></tr><tr><td>`varchar`</td><td>Text (up to 255 characters)</td><tr><td>`varchar_auto`</td><td>Autocomplete text (up to 255 characters)</td><tr><td>`text`</td><td>Long text (up to 65k characters)</td><tr><td>`double`</td><td>Numeric value</td><tr><td>`monetary`</td><td>Monetary field (has a numeric value and a currency value)</td><tr><td>`date`</td><td>Date (format YYYY-MM-DD)</td><tr><td>`set`</td><td>Options field with a possibility of having multiple chosen options</td><tr><td>`enum`</td><td>Options field with a single possible chosen option</td><tr><td>`user`</td><td>User field (contains a user ID of another Pipedrive user)</td><tr><td>`org`</td><td>Organization field (contains an organization ID which is stored on the same account)</td><tr><td>`people`</td><td>Person field (contains a person ID which is stored on the same account)</td><tr><td>`phone`</td><td>Phone field (up to 255 numbers and/or characters)</td><tr><td>`time`</td><td>Time field (format HH:MM:SS)</td><tr><td>`timerange`</td><td>Time-range field (has a start time and end time value, both HH:MM:SS)</td><tr><td>`daterange`</td><td>Date-range field (has a start date and end date value, both YYYY-MM-DD)</td><tr><td>`address`</td><td>Address field</dd></table> | **options** | [**\Pipedrive\versions\v2\Model\CreateDealFieldRequestOptions[]**](CreateDealFieldRequestOptions.md) | Field options (required for enum and set field types) | [optional] **ui_visibility** | **array** | UI visibility settings for the field. Controls where the field appears in the Pipedrive web UI. | [optional] **important_fields** | **array** | Configuration for highlighting the field at specific stages. | [optional] diff --git a/docs/versions/v2/Model/CreateOrganizationFieldRequest.md b/docs/versions/v2/Model/CreateOrganizationFieldRequest.md index 1d16e4eb..11dc3697 100644 --- a/docs/versions/v2/Model/CreateOrganizationFieldRequest.md +++ b/docs/versions/v2/Model/CreateOrganizationFieldRequest.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **field_name** | **string** | Field name | -**field_type** | **string** | The type of the field<table><tr><th>Value</th><th>Description</th></tr><tr><td>`varchar`</td><td>Text (up to 255 characters)</td><tr><td>`varchar_auto`</td><td>Autocomplete text (up to 255 characters)</td><tr><td>`text`</td><td>Long text (up to 65k characters)</td><tr><td>`double`</td><td>Numeric value</td><tr><td>`monetary`</td><td>Monetary field (has a numeric value and a currency value)</td><tr><td>`date`</td><td>Date (format YYYY-MM-DD)</td><tr><td>`set`</td><td>Options field with a possibility of having multiple chosen options</td><tr><td>`enum`</td><td>Options field with a single possible chosen option</td><tr><td>`user`</td><td>User field (contains a user ID of another Pipedrive user)</td><tr><td>`org`</td><td>Organization field (contains an organization ID which is stored on the same account)</td><tr><td>`people`</td><td>Person field (contains a product ID which is stored on the same account)</td><tr><td>`phone`</td><td>Phone field (up to 255 numbers and/or characters)</td><tr><td>`time`</td><td>Time field (format HH:MM:SS)</td><tr><td>`timerange`</td><td>Time-range field (has a start time and end time value, both HH:MM:SS)</td><tr><td>`daterange`</td><td>Date-range field (has a start date and end date value, both YYYY-MM-DD)</td><tr><td>`address`</td><td>Address field</dd></table> | +**field_type** | **string** | The type of the field<table><tr><th>Value</th><th>Description</th></tr><tr><td>`varchar`</td><td>Text (up to 255 characters)</td><tr><td>`varchar_auto`</td><td>Autocomplete text (up to 255 characters)</td><tr><td>`text`</td><td>Long text (up to 65k characters)</td><tr><td>`double`</td><td>Numeric value</td><tr><td>`monetary`</td><td>Monetary field (has a numeric value and a currency value)</td><tr><td>`date`</td><td>Date (format YYYY-MM-DD)</td><tr><td>`set`</td><td>Options field with a possibility of having multiple chosen options</td><tr><td>`enum`</td><td>Options field with a single possible chosen option</td><tr><td>`user`</td><td>User field (contains a user ID of another Pipedrive user)</td><tr><td>`org`</td><td>Organization field (contains an organization ID which is stored on the same account)</td><tr><td>`people`</td><td>Person field (contains a person ID which is stored on the same account)</td><tr><td>`phone`</td><td>Phone field (up to 255 numbers and/or characters)</td><tr><td>`time`</td><td>Time field (format HH:MM:SS)</td><tr><td>`timerange`</td><td>Time-range field (has a start time and end time value, both HH:MM:SS)</td><tr><td>`daterange`</td><td>Date-range field (has a start date and end date value, both YYYY-MM-DD)</td><tr><td>`address`</td><td>Address field</dd></table> | **options** | [**\Pipedrive\versions\v2\Model\CreateDealFieldRequestOptions[]**](CreateDealFieldRequestOptions.md) | Field options (required for enum and set field types) | [optional] **ui_visibility** | **array** | UI visibility settings for the field. Controls where the field appears in the Pipedrive web UI. | [optional] **important_fields** | **array** | Configuration for highlighting the field at specific stages. | [optional] diff --git a/docs/versions/v2/Model/CreatePersonFieldRequest.md b/docs/versions/v2/Model/CreatePersonFieldRequest.md index 1a36fe09..15b1c294 100644 --- a/docs/versions/v2/Model/CreatePersonFieldRequest.md +++ b/docs/versions/v2/Model/CreatePersonFieldRequest.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **field_name** | **string** | Field name | -**field_type** | **string** | The type of the field<table><tr><th>Value</th><th>Description</th></tr><tr><td>`varchar`</td><td>Text (up to 255 characters)</td><tr><td>`varchar_auto`</td><td>Autocomplete text (up to 255 characters)</td><tr><td>`text`</td><td>Long text (up to 65k characters)</td><tr><td>`double`</td><td>Numeric value</td><tr><td>`monetary`</td><td>Monetary field (has a numeric value and a currency value)</td><tr><td>`date`</td><td>Date (format YYYY-MM-DD)</td><tr><td>`set`</td><td>Options field with a possibility of having multiple chosen options</td><tr><td>`enum`</td><td>Options field with a single possible chosen option</td><tr><td>`user`</td><td>User field (contains a user ID of another Pipedrive user)</td><tr><td>`org`</td><td>Organization field (contains an organization ID which is stored on the same account)</td><tr><td>`people`</td><td>Person field (contains a product ID which is stored on the same account)</td><tr><td>`phone`</td><td>Phone field (up to 255 numbers and/or characters)</td><tr><td>`time`</td><td>Time field (format HH:MM:SS)</td><tr><td>`timerange`</td><td>Time-range field (has a start time and end time value, both HH:MM:SS)</td><tr><td>`daterange`</td><td>Date-range field (has a start date and end date value, both YYYY-MM-DD)</td><tr><td>`address`</td><td>Address field</dd></table> | +**field_type** | **string** | The type of the field<table><tr><th>Value</th><th>Description</th></tr><tr><td>`varchar`</td><td>Text (up to 255 characters)</td><tr><td>`varchar_auto`</td><td>Autocomplete text (up to 255 characters)</td><tr><td>`text`</td><td>Long text (up to 65k characters)</td><tr><td>`double`</td><td>Numeric value</td><tr><td>`monetary`</td><td>Monetary field (has a numeric value and a currency value)</td><tr><td>`date`</td><td>Date (format YYYY-MM-DD)</td><tr><td>`set`</td><td>Options field with a possibility of having multiple chosen options</td><tr><td>`enum`</td><td>Options field with a single possible chosen option</td><tr><td>`user`</td><td>User field (contains a user ID of another Pipedrive user)</td><tr><td>`org`</td><td>Organization field (contains an organization ID which is stored on the same account)</td><tr><td>`people`</td><td>Person field (contains a person ID which is stored on the same account)</td><tr><td>`phone`</td><td>Phone field (up to 255 numbers and/or characters)</td><tr><td>`time`</td><td>Time field (format HH:MM:SS)</td><tr><td>`timerange`</td><td>Time-range field (has a start time and end time value, both HH:MM:SS)</td><tr><td>`daterange`</td><td>Date-range field (has a start date and end date value, both YYYY-MM-DD)</td><tr><td>`address`</td><td>Address field</dd></table> | **options** | [**\Pipedrive\versions\v2\Model\CreateDealFieldRequestOptions[]**](CreateDealFieldRequestOptions.md) | Field options (required for enum and set field types) | [optional] **ui_visibility** | **array** | UI visibility settings for the field. Controls where the field appears in the Pipedrive web UI. | [optional] **important_fields** | **array** | Configuration for highlighting the field at specific stages. | [optional] diff --git a/docs/versions/v2/Model/CreateProductFieldRequest.md b/docs/versions/v2/Model/CreateProductFieldRequest.md index b1302804..9c967ebe 100644 --- a/docs/versions/v2/Model/CreateProductFieldRequest.md +++ b/docs/versions/v2/Model/CreateProductFieldRequest.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **field_name** | **string** | Field name | -**field_type** | **string** | The type of the field<table><tr><th>Value</th><th>Description</th></tr><tr><td>`varchar`</td><td>Text (up to 255 characters)</td><tr><td>`varchar_auto`</td><td>Autocomplete text (up to 255 characters)</td><tr><td>`text`</td><td>Long text (up to 65k characters)</td><tr><td>`double`</td><td>Numeric value</td><tr><td>`monetary`</td><td>Monetary field (has a numeric value and a currency value)</td><tr><td>`date`</td><td>Date (format YYYY-MM-DD)</td><tr><td>`set`</td><td>Options field with a possibility of having multiple chosen options</td><tr><td>`enum`</td><td>Options field with a single possible chosen option</td><tr><td>`user`</td><td>User field (contains a user ID of another Pipedrive user)</td><tr><td>`org`</td><td>Organization field (contains an organization ID which is stored on the same account)</td><tr><td>`people`</td><td>Person field (contains a product ID which is stored on the same account)</td><tr><td>`phone`</td><td>Phone field (up to 255 numbers and/or characters)</td><tr><td>`time`</td><td>Time field (format HH:MM:SS)</td><tr><td>`timerange`</td><td>Time-range field (has a start time and end time value, both HH:MM:SS)</td><tr><td>`daterange`</td><td>Date-range field (has a start date and end date value, both YYYY-MM-DD)</td><tr><td>`address`</td><td>Address field</dd></table> | +**field_type** | **string** | The type of the field<table><tr><th>Value</th><th>Description</th></tr><tr><td>`varchar`</td><td>Text (up to 255 characters)</td><tr><td>`varchar_auto`</td><td>Autocomplete text (up to 255 characters)</td><tr><td>`text`</td><td>Long text (up to 65k characters)</td><tr><td>`double`</td><td>Numeric value</td><tr><td>`monetary`</td><td>Monetary field (has a numeric value and a currency value)</td><tr><td>`date`</td><td>Date (format YYYY-MM-DD)</td><tr><td>`set`</td><td>Options field with a possibility of having multiple chosen options</td><tr><td>`enum`</td><td>Options field with a single possible chosen option</td><tr><td>`user`</td><td>User field (contains a user ID of another Pipedrive user)</td><tr><td>`org`</td><td>Organization field (contains an organization ID which is stored on the same account)</td><tr><td>`people`</td><td>Person field (contains a person ID which is stored on the same account)</td><tr><td>`phone`</td><td>Phone field (up to 255 numbers and/or characters)</td><tr><td>`time`</td><td>Time field (format HH:MM:SS)</td><tr><td>`timerange`</td><td>Time-range field (has a start time and end time value, both HH:MM:SS)</td><tr><td>`daterange`</td><td>Date-range field (has a start date and end date value, both YYYY-MM-DD)</td><tr><td>`address`</td><td>Address field</dd></table> | **options** | [**\Pipedrive\versions\v2\Model\CreateDealFieldRequestOptions[]**](CreateDealFieldRequestOptions.md) | Field options (required for enum and set field types) | [optional] **ui_visibility** | **array** | UI visibility settings for the field. Controls where the field appears in the Pipedrive web UI. Note that products have a simpler visibility model than other entity types. | [optional] **description** | **string** | Field description | [optional] diff --git a/docs/versions/v2/Model/Deal.md b/docs/versions/v2/Model/Deal.md new file mode 100644 index 00000000..80b3aea0 --- /dev/null +++ b/docs/versions/v2/Model/Deal.md @@ -0,0 +1,40 @@ +# # Deal + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The ID of the deal | [optional] +**title** | **string** | The title of the deal | [optional] +**owner_id** | **int** | The ID of the user who owns the deal | [optional] +**person_id** | **int** | The ID of the person linked to the deal | [optional] +**org_id** | **int** | The ID of the organization linked to the deal | [optional] +**pipeline_id** | **int** | The ID of the pipeline associated with the deal | [optional] +**stage_id** | **int** | The ID of the deal stage | [optional] +**value** | **float** | The value of the deal | [optional] +**currency** | **string** | The currency associated with the deal | [optional] +**add_time** | **string** | The creation date and time of the deal | [optional] +**update_time** | **string** | The last updated date and time of the deal | [optional] +**stage_change_time** | **string** | The last updated date and time of the deal stage | [optional] +**is_deleted** | **bool** | Whether the deal is deleted or not | [optional] +**is_archived** | **bool** | Whether the deal is archived or not | [optional] +**status** | **string** | The status of the deal | [optional] +**probability** | **float** | The success probability percentage of the deal | [optional] +**lost_reason** | **string** | The reason for losing the deal | [optional] +**visible_to** | **int** | The visibility of the deal | [optional] +**close_time** | **string** | The date and time of closing the deal | [optional] +**won_time** | **string** | The date and time of changing the deal status as won | [optional] +**lost_time** | **string** | The date and time of changing the deal status as lost | [optional] +**expected_close_date** | **\DateTime** | The expected close date of the deal | [optional] +**label_ids** | **int[]** | The IDs of labels assigned to the deal | [optional] +**origin** | **string** | The way this Deal was created. `origin` field is set by Pipedrive when Deal is created and cannot be changed. | [optional] +**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] +**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes | [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/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/docs/versions/v2/Model/InstallmentRequestBody.md b/docs/versions/v2/Model/InstallmentRequestBody.md index 9ed48553..c3068850 100644 --- a/docs/versions/v2/Model/InstallmentRequestBody.md +++ b/docs/versions/v2/Model/InstallmentRequestBody.md @@ -6,6 +6,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **description** | **string** | The name of the installment. | [optional] **amount** | **float** | The installment amount. Must be a positive number (excluding 0). | [optional] -**billing_date** | **string** | The date which the installment will be charged. Must be in the format YYYY-MM-DD. | [optional] +**billing_date** | **string** | The date on which the installment will be charged. Must be in the format YYYY-MM-DD. | [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/v2/Model/Person.md b/docs/versions/v2/Model/Person.md new file mode 100644 index 00000000..d8b178ce --- /dev/null +++ b/docs/versions/v2/Model/Person.md @@ -0,0 +1,28 @@ +# # Person + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The ID of the person | [optional] +**name** | **string** | The name of the person | [optional] +**first_name** | **string** | The first name of the person | [optional] +**last_name** | **string** | The last name of the person | [optional] +**owner_id** | **int** | The ID of the user who owns the person | [optional] +**org_id** | **int** | The ID of the organization linked to the person | [optional] +**add_time** | **string** | The creation date and time of the person | [optional] +**update_time** | **string** | The last updated date and time of the person | [optional] +**emails** | [**\Pipedrive\versions\v2\Model\PersonEmails[]**](PersonEmails.md) | The emails of the person | [optional] +**phones** | [**\Pipedrive\versions\v2\Model\PersonPhones[]**](PersonPhones.md) | The phones of the person | [optional] +**is_deleted** | **bool** | Whether the person is deleted or not | [optional] +**visible_to** | **int** | The visibility of the person | [optional] +**label_ids** | **int[]** | The IDs of labels assigned to the person | [optional] +**picture_id** | **int** | The ID of the picture associated with the person | [optional] +**postal_address** | [**\Pipedrive\versions\v2\Model\PersonPostalAddress**](PersonPostalAddress.md) | | [optional] +**notes** | **string** | Contact sync notes of the person, maximum 10 000 characters, included if contact sync is enabled for the company | [optional] +**im** | [**\Pipedrive\versions\v2\Model\PersonIm[]**](PersonIm.md) | The instant messaging accounts of the person, included if contact sync is enabled for the company | [optional] +**birthday** | **string** | The birthday of the person, included if contact sync is enabled for the company | [optional] +**job_title** | **string** | The job title of the person, included if contact sync is enabled for the company | [optional] +**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes | [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/v2/Model/PersonEmails.md b/docs/versions/v2/Model/PersonEmails.md new file mode 100644 index 00000000..4f005ca3 --- /dev/null +++ b/docs/versions/v2/Model/PersonEmails.md @@ -0,0 +1,11 @@ +# # PersonEmails + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**value** | **string** | The email address of the person | [optional] +**primary** | **bool** | Whether the email is primary or not | [optional] +**label** | **string** | The email address classification label | [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/v2/Model/PersonIm.md b/docs/versions/v2/Model/PersonIm.md new file mode 100644 index 00000000..669027b4 --- /dev/null +++ b/docs/versions/v2/Model/PersonIm.md @@ -0,0 +1,11 @@ +# # PersonIm + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**value** | **string** | The instant messaging account of the person | [optional] +**primary** | **bool** | Whether the instant messaging account is primary or not | [optional] +**label** | **string** | The instant messaging account classification label | [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/v2/Model/PersonItem.md b/docs/versions/v2/Model/PersonItem.md index 5ee527a4..8ef3ee44 100644 --- a/docs/versions/v2/Model/PersonItem.md +++ b/docs/versions/v2/Model/PersonItem.md @@ -12,15 +12,15 @@ Name | Type | Description | Notes **org_id** | **int** | The ID of the organization linked to the person | [optional] **add_time** | **string** | The creation date and time of the person | [optional] **update_time** | **string** | The last updated date and time of the person | [optional] -**emails** | [**\Pipedrive\versions\v2\Model\PersonItemEmails[]**](PersonItemEmails.md) | The emails of the person | [optional] -**phones** | [**\Pipedrive\versions\v2\Model\PersonItemPhones[]**](PersonItemPhones.md) | The phones of the person | [optional] +**emails** | [**\Pipedrive\versions\v2\Model\PersonEmails[]**](PersonEmails.md) | The emails of the person | [optional] +**phones** | [**\Pipedrive\versions\v2\Model\PersonPhones[]**](PersonPhones.md) | The phones of the person | [optional] **is_deleted** | **bool** | Whether the person is deleted or not | [optional] **visible_to** | **int** | The visibility of the person | [optional] **label_ids** | **int[]** | The IDs of labels assigned to the person | [optional] **picture_id** | **int** | The ID of the picture associated with the person | [optional] -**postal_address** | [**\Pipedrive\versions\v2\Model\PersonItemPostalAddress**](PersonItemPostalAddress.md) | | [optional] +**postal_address** | [**\Pipedrive\versions\v2\Model\PersonPostalAddress**](PersonPostalAddress.md) | | [optional] **notes** | **string** | Contact sync notes of the person, maximum 10 000 characters, included if contact sync is enabled for the company | [optional] -**im** | [**\Pipedrive\versions\v2\Model\PersonItemIm[]**](PersonItemIm.md) | The instant messaging accounts of the person, included if contact sync is enabled for the company | [optional] +**im** | [**\Pipedrive\versions\v2\Model\PersonIm[]**](PersonIm.md) | The instant messaging accounts of the person, included if contact sync is enabled for the company | [optional] **birthday** | **string** | The birthday of the person, included if contact sync is enabled for the company | [optional] **job_title** | **string** | The job title of the person, included if contact sync is enabled for the company | [optional] **custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes | [optional] diff --git a/docs/versions/v2/Model/PersonPhones.md b/docs/versions/v2/Model/PersonPhones.md new file mode 100644 index 00000000..e8710121 --- /dev/null +++ b/docs/versions/v2/Model/PersonPhones.md @@ -0,0 +1,11 @@ +# # PersonPhones + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**value** | **string** | The phone number of the person | [optional] +**primary** | **bool** | Whether the phone number is primary or not | [optional] +**label** | **string** | The phone number classification label | [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/v2/Model/PersonPostalAddress.md b/docs/versions/v2/Model/PersonPostalAddress.md new file mode 100644 index 00000000..6ec59c30 --- /dev/null +++ b/docs/versions/v2/Model/PersonPostalAddress.md @@ -0,0 +1,18 @@ +# # PersonPostalAddress + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**value** | **string** | The full address of the person | [optional] +**country** | **string** | Country of the person | [optional] +**admin_area_level_1** | **string** | Admin area level 1 (e.g. state) of the person | [optional] +**admin_area_level_2** | **string** | Admin area level 2 (e.g. county) of the person | [optional] +**locality** | **string** | Locality (e.g. city) of the person | [optional] +**sublocality** | **string** | Sublocality (e.g. neighborhood) of the person | [optional] +**route** | **string** | Route (e.g. street) of the person | [optional] +**street_number** | **string** | Street number of the person | [optional] +**subpremise** | **string** | Subpremise (e.g. apartment/suite number) of the person | [optional] +**postal_code** | **string** | Postal code of the person | [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/v2/Model/PersonRequestBody.md b/docs/versions/v2/Model/PersonRequestBody.md index c420824e..4cfa8849 100644 --- a/docs/versions/v2/Model/PersonRequestBody.md +++ b/docs/versions/v2/Model/PersonRequestBody.md @@ -9,8 +9,8 @@ Name | Type | Description | Notes **org_id** | **int** | The ID of the organization linked to the person | [optional] **add_time** | **string** | The creation date and time of the person | [optional] **update_time** | **string** | The last updated date and time of the person | [optional] -**emails** | [**\Pipedrive\versions\v2\Model\PersonItemEmails[]**](PersonItemEmails.md) | The emails of the person | [optional] -**phones** | [**\Pipedrive\versions\v2\Model\PersonItemPhones[]**](PersonItemPhones.md) | The phones of the person | [optional] +**emails** | [**\Pipedrive\versions\v2\Model\PersonEmails[]**](PersonEmails.md) | The emails of the person | [optional] +**phones** | [**\Pipedrive\versions\v2\Model\PersonPhones[]**](PersonPhones.md) | The phones of the person | [optional] **visible_to** | **int** | The visibility of the person | [optional] **label_ids** | **int[]** | The IDs of labels assigned to the person | [optional] **marketing_status** | **string** | If the person does not have a valid email address, then the marketing status is **not set** and `no_consent` is returned for the `marketing_status` value when the new person is created. If the change is forbidden, the status will remain unchanged for every call that tries to modify the marketing status. Please be aware that it is only allowed **once** to change the marketing status from an old status to a new one.<table><tr><th>Value</th><th>Description</th></tr><tr><td>`no_consent`</td><td>The customer has not given consent to receive any marketing communications</td></tr><tr><td>`unsubscribed`</td><td>The customers have unsubscribed from ALL marketing communications</td></tr><tr><td>`subscribed`</td><td>The customers are subscribed and are counted towards marketing caps</td></tr><tr><td>`archived`</td><td>The customers with `subscribed` status can be moved to `archived` to save consent, but they are not paid for</td></tr></table> | [optional] diff --git a/docs/versions/v2/Model/PostFollower.md b/docs/versions/v2/Model/PostFollower.md index 2ab5d493..1a3df21e 100644 --- a/docs/versions/v2/Model/PostFollower.md +++ b/docs/versions/v2/Model/PostFollower.md @@ -5,6 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **success** | **bool** | If the response is successful or not | [optional] -**data** | [**\Pipedrive\versions\v2\Model\FollowerItem**](.md) | | [optional] +**data** | [**\Pipedrive\versions\v2\Model\FollowerItem**](FollowerItem.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/v2/Model/PostFollowerAllOf.md b/docs/versions/v2/Model/PostFollowerAllOf.md index a00f1377..a207c2e3 100644 --- a/docs/versions/v2/Model/PostFollowerAllOf.md +++ b/docs/versions/v2/Model/PostFollowerAllOf.md @@ -4,6 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**data** | [**\Pipedrive\versions\v2\Model\FollowerItem**](.md) | | [optional] +**data** | [**\Pipedrive\versions\v2\Model\FollowerItem**](FollowerItem.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/v2/Model/PostPatchGetActivity.md b/docs/versions/v2/Model/PostPatchGetActivity.md index 2a9cf0da..95c4a258 100644 --- a/docs/versions/v2/Model/PostPatchGetActivity.md +++ b/docs/versions/v2/Model/PostPatchGetActivity.md @@ -5,6 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **success** | **bool** | If the response is successful or not | [optional] -**data** | [**\Pipedrive\versions\v2\Model\ActivityItem**](.md) | | [optional] +**data** | [**\Pipedrive\versions\v2\Model\ActivityItem**](ActivityItem.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/v2/Model/PostPatchGetDeal.md b/docs/versions/v2/Model/PostPatchGetDeal.md index a67358f2..3b10dc76 100644 --- a/docs/versions/v2/Model/PostPatchGetDeal.md +++ b/docs/versions/v2/Model/PostPatchGetDeal.md @@ -5,6 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **success** | **bool** | If the response is successful or not | [optional] -**data** | [**\Pipedrive\versions\v2\Model\DealItem**](.md) | | [optional] +**data** | [**\Pipedrive\versions\v2\Model\DealItem**](DealItem.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/v2/Model/PostPatchGetOrganization.md b/docs/versions/v2/Model/PostPatchGetOrganization.md index bc806e1f..03591d41 100644 --- a/docs/versions/v2/Model/PostPatchGetOrganization.md +++ b/docs/versions/v2/Model/PostPatchGetOrganization.md @@ -5,6 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **success** | **bool** | If the response is successful or not | [optional] -**data** | [**\Pipedrive\versions\v2\Model\OrganizationItem**](.md) | | [optional] +**data** | [**\Pipedrive\versions\v2\Model\OrganizationItem**](OrganizationItem.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/v2/Model/PostPatchGetPerson.md b/docs/versions/v2/Model/PostPatchGetPerson.md index 905019f9..00978866 100644 --- a/docs/versions/v2/Model/PostPatchGetPerson.md +++ b/docs/versions/v2/Model/PostPatchGetPerson.md @@ -5,6 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **success** | **bool** | If the response is successful or not | [optional] -**data** | [**\Pipedrive\versions\v2\Model\PersonItem**](.md) | | [optional] +**data** | [**\Pipedrive\versions\v2\Model\PersonItem**](PersonItem.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/v2/Model/ProductWithArrayPrices.md b/docs/versions/v2/Model/ProductWithArrayPrices.md index 0e633964..a30a7491 100644 --- a/docs/versions/v2/Model/ProductWithArrayPrices.md +++ b/docs/versions/v2/Model/ProductWithArrayPrices.md @@ -9,7 +9,7 @@ Name | Type | Description | Notes **code** | **string** | The product code | [optional] **unit** | **string** | The unit in which this product is sold | [optional] **tax** | **float** | The tax percentage | [optional] [default to 0] -**is_deleted** | **bool** | Whether this product will be made marked as deleted or not | [optional] [default to false] +**is_deleted** | **bool** | Whether this product will be marked as deleted or not | [optional] [default to false] **is_linkable** | **bool** | Whether this product can be added to a deal or not | [optional] [default to true] **visible_to** | [**VisibleTo**](VisibleTo.md) | Visibility of the product | [optional] **owner_id** | **int** | Information about the Pipedrive user who owns the product | [optional] diff --git a/docs/versions/v2/Model/UpsertActivityResponseData.md b/docs/versions/v2/Model/UpsertActivityResponseData.md index 99906c3d..9f32477e 100644 --- a/docs/versions/v2/Model/UpsertActivityResponseData.md +++ b/docs/versions/v2/Model/UpsertActivityResponseData.md @@ -4,6 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**data** | [**\Pipedrive\versions\v2\Model\ActivityItem**](.md) | | [optional] +**data** | [**\Pipedrive\versions\v2\Model\ActivityItem**](ActivityItem.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/v2/Model/UpsertDealResponseData.md b/docs/versions/v2/Model/UpsertDealResponseData.md index aac8cd24..c6d7f9bd 100644 --- a/docs/versions/v2/Model/UpsertDealResponseData.md +++ b/docs/versions/v2/Model/UpsertDealResponseData.md @@ -4,6 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**data** | [**\Pipedrive\versions\v2\Model\DealItem**](.md) | | [optional] +**data** | [**\Pipedrive\versions\v2\Model\DealItem**](DealItem.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/v2/Model/UpsertOrganizationResponseData.md b/docs/versions/v2/Model/UpsertOrganizationResponseData.md index 2c0fa94a..d2e44d77 100644 --- a/docs/versions/v2/Model/UpsertOrganizationResponseData.md +++ b/docs/versions/v2/Model/UpsertOrganizationResponseData.md @@ -4,6 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**data** | [**\Pipedrive\versions\v2\Model\OrganizationItem**](.md) | | [optional] +**data** | [**\Pipedrive\versions\v2\Model\OrganizationItem**](OrganizationItem.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/v2/Model/UpsertPersonResponseData.md b/docs/versions/v2/Model/UpsertPersonResponseData.md index fb409c17..f31ffadd 100644 --- a/docs/versions/v2/Model/UpsertPersonResponseData.md +++ b/docs/versions/v2/Model/UpsertPersonResponseData.md @@ -4,6 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**data** | [**\Pipedrive\versions\v2\Model\PersonItem**](.md) | | [optional] +**data** | [**\Pipedrive\versions\v2\Model\PersonItem**](PersonItem.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/v2/README.md b/docs/versions/v2/README.md index 43fcdb47..352c51c0 100644 --- a/docs/versions/v2/README.md +++ b/docs/versions/v2/README.md @@ -438,6 +438,7 @@ Class | Method | HTTP request | Description - [CreatePersonFieldRequest](Model/CreatePersonFieldRequest.md) - [CreateProductField](Model/CreateProductField.md) - [CreateProductFieldRequest](Model/CreateProductFieldRequest.md) + - [Deal](Model/Deal.md) - [DealFieldItem](Model/DealFieldItem.md) - [DealFieldItemImportantFields](Model/DealFieldItemImportantFields.md) - [DealFieldItemRequiredFields](Model/DealFieldItemRequiredFields.md) @@ -553,19 +554,20 @@ Class | Method | HTTP request | Description - [OrganizationRequestBody](Model/OrganizationRequestBody.md) - [OrganizationSearchItem](Model/OrganizationSearchItem.md) - [OrganizationSearchItemItem](Model/OrganizationSearchItemItem.md) + - [Person](Model/Person.md) + - [PersonEmails](Model/PersonEmails.md) - [PersonFieldItem](Model/PersonFieldItem.md) - [PersonFieldItemImportantFields](Model/PersonFieldItemImportantFields.md) - [PersonFieldItemRequiredFields](Model/PersonFieldItemRequiredFields.md) - [PersonFieldItemUiVisibility](Model/PersonFieldItemUiVisibility.md) - [PersonFieldItemUiVisibilityShowInAddDealDialog](Model/PersonFieldItemUiVisibilityShowInAddDealDialog.md) + - [PersonIm](Model/PersonIm.md) - [PersonItem](Model/PersonItem.md) - - [PersonItemEmails](Model/PersonItemEmails.md) - - [PersonItemIm](Model/PersonItemIm.md) - - [PersonItemPhones](Model/PersonItemPhones.md) - - [PersonItemPostalAddress](Model/PersonItemPostalAddress.md) + - [PersonPhones](Model/PersonPhones.md) - [PersonPictureItem](Model/PersonPictureItem.md) - [PersonPictureItemPictures](Model/PersonPictureItemPictures.md) - [PersonPictureResponse](Model/PersonPictureResponse.md) + - [PersonPostalAddress](Model/PersonPostalAddress.md) - [PersonRequestBody](Model/PersonRequestBody.md) - [PersonSearchItem](Model/PersonSearchItem.md) - [PersonSearchItemItem](Model/PersonSearchItemItem.md) 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/FullTaskObject.php b/lib/versions/v1/Model/FullTaskObject.php index 76107978..30decb82 100644 --- a/lib/versions/v1/Model/FullTaskObject.php +++ b/lib/versions/v1/Model/FullTaskObject.php @@ -71,6 +71,7 @@ class FullTaskObject implements ModelInterface, ArrayAccess, JsonSerializable 'description' => 'string', 'parent_task_id' => 'float', 'assignee_id' => 'float', + 'assignee_ids' => 'float[]', 'done' => '\Pipedrive\versions\v1\Model\NumberBoolean', 'due_date' => '\DateTime', 'creator_id' => 'float', @@ -92,6 +93,7 @@ class FullTaskObject implements ModelInterface, ArrayAccess, JsonSerializable 'description' => null, 'parent_task_id' => null, 'assignee_id' => null, + 'assignee_ids' => null, 'done' => null, 'due_date' => 'date', 'creator_id' => null, @@ -136,6 +138,7 @@ public static function openAPIFormats(): array 'description' => 'description', 'parent_task_id' => 'parent_task_id', 'assignee_id' => 'assignee_id', + 'assignee_ids' => 'assignee_ids', 'done' => 'done', 'due_date' => 'due_date', 'creator_id' => 'creator_id', @@ -155,6 +158,7 @@ public static function openAPIFormats(): array 'description' => 'setDescription', 'parent_task_id' => 'setParentTaskId', 'assignee_id' => 'setAssigneeId', + 'assignee_ids' => 'setAssigneeIds', 'done' => 'setDone', 'due_date' => 'setDueDate', 'creator_id' => 'setCreatorId', @@ -174,6 +178,7 @@ public static function openAPIFormats(): array 'description' => 'getDescription', 'parent_task_id' => 'getParentTaskId', 'assignee_id' => 'getAssigneeId', + 'assignee_ids' => 'getAssigneeIds', 'done' => 'getDone', 'due_date' => 'getDueDate', 'creator_id' => 'getCreatorId', @@ -254,6 +259,7 @@ public function __construct(array $data = null) $this->container['description'] = $data['description'] ?? null; $this->container['parent_task_id'] = $data['parent_task_id'] ?? null; $this->container['assignee_id'] = $data['assignee_id'] ?? null; + $this->container['assignee_ids'] = $data['assignee_ids'] ?? null; $this->container['done'] = $data['done'] ?? null; $this->container['due_date'] = $data['due_date'] ?? null; $this->container['creator_id'] = $data['creator_id'] ?? null; @@ -273,6 +279,10 @@ public function listInvalidProperties(): array { $invalidProperties = []; + if (!is_null($this->container['assignee_ids']) && (count($this->container['assignee_ids']) > 10)) { + $invalidProperties[] = "invalid value for 'assignee_ids', number of items must be less than or equal to 10."; + } + return $invalidProperties; } @@ -397,7 +407,7 @@ public function getAssigneeId() /** * Sets assignee_id * - * @param float|null $assignee_id The ID of the user who will be the assignee of the task + * @param float|null $assignee_id The ID of the user assigned to the task. When the `assignee_id` field is updated, the `assignee_ids` field value will be overwritten by the `assignee_id` field value. * * @return self */ @@ -408,6 +418,34 @@ public function setAssigneeId($assignee_id): self return $this; } + /** + * Gets assignee_ids + * + * @return float[]|null + */ + public function getAssigneeIds() + { + return $this->container['assignee_ids']; + } + + /** + * Sets assignee_ids + * + * @param float[]|null $assignee_ids The IDs of users assigned to the task. When the `assignee_ids` field is updated, the `assignee_id` field value will be set to the first value of the `assignee_ids` field, or `null` if the list is empty. + * + * @return self + */ + public function setAssigneeIds($assignee_ids): self + { + + if (!is_null($assignee_ids) && (count($assignee_ids) > 10)) { + throw new \InvalidArgumentException('invalid value for $assignee_ids when calling FullTaskObject., number of items must be less than or equal to 10.'); + } + $this->container['assignee_ids'] = $assignee_ids; + + return $this; + } + /** * Gets done * 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/v1/Model/TaskObjectFragment.php b/lib/versions/v1/Model/TaskObjectFragment.php index 59a81115..18d4e44e 100644 --- a/lib/versions/v1/Model/TaskObjectFragment.php +++ b/lib/versions/v1/Model/TaskObjectFragment.php @@ -69,6 +69,7 @@ class TaskObjectFragment implements ModelInterface, ArrayAccess, JsonSerializabl 'description' => 'string', 'parent_task_id' => 'float', 'assignee_id' => 'float', + 'assignee_ids' => 'float[]', 'done' => '\Pipedrive\versions\v1\Model\NumberBoolean', 'due_date' => '\DateTime' ]; @@ -84,6 +85,7 @@ class TaskObjectFragment implements ModelInterface, ArrayAccess, JsonSerializabl 'description' => null, 'parent_task_id' => null, 'assignee_id' => null, + 'assignee_ids' => null, 'done' => null, 'due_date' => 'date' ]; @@ -122,6 +124,7 @@ public static function openAPIFormats(): array 'description' => 'description', 'parent_task_id' => 'parent_task_id', 'assignee_id' => 'assignee_id', + 'assignee_ids' => 'assignee_ids', 'done' => 'done', 'due_date' => 'due_date' ]; @@ -135,6 +138,7 @@ public static function openAPIFormats(): array 'description' => 'setDescription', 'parent_task_id' => 'setParentTaskId', 'assignee_id' => 'setAssigneeId', + 'assignee_ids' => 'setAssigneeIds', 'done' => 'setDone', 'due_date' => 'setDueDate' ]; @@ -148,6 +152,7 @@ public static function openAPIFormats(): array 'description' => 'getDescription', 'parent_task_id' => 'getParentTaskId', 'assignee_id' => 'getAssigneeId', + 'assignee_ids' => 'getAssigneeIds', 'done' => 'getDone', 'due_date' => 'getDueDate' ]; @@ -222,6 +227,7 @@ public function __construct(array $data = null) $this->container['description'] = $data['description'] ?? null; $this->container['parent_task_id'] = $data['parent_task_id'] ?? null; $this->container['assignee_id'] = $data['assignee_id'] ?? null; + $this->container['assignee_ids'] = $data['assignee_ids'] ?? null; $this->container['done'] = $data['done'] ?? null; $this->container['due_date'] = $data['due_date'] ?? null; } @@ -237,6 +243,10 @@ public function listInvalidProperties(): array { $invalidProperties = []; + if (!is_null($this->container['assignee_ids']) && (count($this->container['assignee_ids']) > 10)) { + $invalidProperties[] = "invalid value for 'assignee_ids', number of items must be less than or equal to 10."; + } + return $invalidProperties; } @@ -313,7 +323,7 @@ public function getAssigneeId() /** * Sets assignee_id * - * @param float|null $assignee_id The ID of the user who will be the assignee of the task + * @param float|null $assignee_id The ID of the user assigned to the task. When the `assignee_id` field is updated, the `assignee_ids` field value will be overwritten by the `assignee_id` field value. * * @return self */ @@ -324,6 +334,34 @@ public function setAssigneeId($assignee_id): self return $this; } + /** + * Gets assignee_ids + * + * @return float[]|null + */ + public function getAssigneeIds() + { + return $this->container['assignee_ids']; + } + + /** + * Sets assignee_ids + * + * @param float[]|null $assignee_ids The IDs of users assigned to the task. When the `assignee_ids` field is updated, the `assignee_id` field value will be set to the first value of the `assignee_ids` field, or `null` if the list is empty. + * + * @return self + */ + public function setAssigneeIds($assignee_ids): self + { + + if (!is_null($assignee_ids) && (count($assignee_ids) > 10)) { + throw new \InvalidArgumentException('invalid value for $assignee_ids when calling TaskObjectFragment., number of items must be less than or equal to 10.'); + } + $this->container['assignee_ids'] = $assignee_ids; + + return $this; + } + /** * Gets done * diff --git a/lib/versions/v1/Model/TaskPostObject.php b/lib/versions/v1/Model/TaskPostObject.php index 7c4195b8..80559f82 100644 --- a/lib/versions/v1/Model/TaskPostObject.php +++ b/lib/versions/v1/Model/TaskPostObject.php @@ -71,6 +71,7 @@ class TaskPostObject implements ModelInterface, ArrayAccess, JsonSerializable 'description' => 'string', 'parent_task_id' => 'float', 'assignee_id' => 'float', + 'assignee_ids' => 'float[]', 'done' => '\Pipedrive\versions\v1\Model\NumberBoolean', 'due_date' => '\DateTime' ]; @@ -88,6 +89,7 @@ class TaskPostObject implements ModelInterface, ArrayAccess, JsonSerializable 'description' => null, 'parent_task_id' => null, 'assignee_id' => null, + 'assignee_ids' => null, 'done' => null, 'due_date' => 'date' ]; @@ -128,6 +130,7 @@ public static function openAPIFormats(): array 'description' => 'description', 'parent_task_id' => 'parent_task_id', 'assignee_id' => 'assignee_id', + 'assignee_ids' => 'assignee_ids', 'done' => 'done', 'due_date' => 'due_date' ]; @@ -143,6 +146,7 @@ public static function openAPIFormats(): array 'description' => 'setDescription', 'parent_task_id' => 'setParentTaskId', 'assignee_id' => 'setAssigneeId', + 'assignee_ids' => 'setAssigneeIds', 'done' => 'setDone', 'due_date' => 'setDueDate' ]; @@ -158,6 +162,7 @@ public static function openAPIFormats(): array 'description' => 'getDescription', 'parent_task_id' => 'getParentTaskId', 'assignee_id' => 'getAssigneeId', + 'assignee_ids' => 'getAssigneeIds', 'done' => 'getDone', 'due_date' => 'getDueDate' ]; @@ -234,6 +239,7 @@ public function __construct(array $data = null) $this->container['description'] = $data['description'] ?? null; $this->container['parent_task_id'] = $data['parent_task_id'] ?? null; $this->container['assignee_id'] = $data['assignee_id'] ?? null; + $this->container['assignee_ids'] = $data['assignee_ids'] ?? null; $this->container['done'] = $data['done'] ?? null; $this->container['due_date'] = $data['due_date'] ?? null; } @@ -255,6 +261,10 @@ public function listInvalidProperties(): array if ($this->container['project_id'] === null) { $invalidProperties[] = "'project_id' can't be null"; } + if (!is_null($this->container['assignee_ids']) && (count($this->container['assignee_ids']) > 10)) { + $invalidProperties[] = "invalid value for 'assignee_ids', number of items must be less than or equal to 10."; + } + return $invalidProperties; } @@ -379,7 +389,7 @@ public function getAssigneeId() /** * Sets assignee_id * - * @param float|null $assignee_id The ID of the user who will be the assignee of the task + * @param float|null $assignee_id The ID of the user assigned to the task. When the `assignee_id` field is updated, the `assignee_ids` field value will be overwritten by the `assignee_id` field value. * * @return self */ @@ -390,6 +400,34 @@ public function setAssigneeId($assignee_id): self return $this; } + /** + * Gets assignee_ids + * + * @return float[]|null + */ + public function getAssigneeIds() + { + return $this->container['assignee_ids']; + } + + /** + * Sets assignee_ids + * + * @param float[]|null $assignee_ids The IDs of users assigned to the task. When the `assignee_ids` field is updated, the `assignee_id` field value will be set to the first value of the `assignee_ids` field, or `null` if the list is empty. + * + * @return self + */ + public function setAssigneeIds($assignee_ids): self + { + + if (!is_null($assignee_ids) && (count($assignee_ids) > 10)) { + throw new \InvalidArgumentException('invalid value for $assignee_ids when calling TaskPostObject., number of items must be less than or equal to 10.'); + } + $this->container['assignee_ids'] = $assignee_ids; + + return $this; + } + /** * Gets done * diff --git a/lib/versions/v1/Model/TaskPutObject.php b/lib/versions/v1/Model/TaskPutObject.php index 55f782c4..f1d0cf5a 100644 --- a/lib/versions/v1/Model/TaskPutObject.php +++ b/lib/versions/v1/Model/TaskPutObject.php @@ -71,6 +71,7 @@ class TaskPutObject implements ModelInterface, ArrayAccess, JsonSerializable 'description' => 'string', 'parent_task_id' => 'float', 'assignee_id' => 'float', + 'assignee_ids' => 'float[]', 'done' => '\Pipedrive\versions\v1\Model\NumberBoolean', 'due_date' => '\DateTime' ]; @@ -88,6 +89,7 @@ class TaskPutObject implements ModelInterface, ArrayAccess, JsonSerializable 'description' => null, 'parent_task_id' => null, 'assignee_id' => null, + 'assignee_ids' => null, 'done' => null, 'due_date' => 'date' ]; @@ -128,6 +130,7 @@ public static function openAPIFormats(): array 'description' => 'description', 'parent_task_id' => 'parent_task_id', 'assignee_id' => 'assignee_id', + 'assignee_ids' => 'assignee_ids', 'done' => 'done', 'due_date' => 'due_date' ]; @@ -143,6 +146,7 @@ public static function openAPIFormats(): array 'description' => 'setDescription', 'parent_task_id' => 'setParentTaskId', 'assignee_id' => 'setAssigneeId', + 'assignee_ids' => 'setAssigneeIds', 'done' => 'setDone', 'due_date' => 'setDueDate' ]; @@ -158,6 +162,7 @@ public static function openAPIFormats(): array 'description' => 'getDescription', 'parent_task_id' => 'getParentTaskId', 'assignee_id' => 'getAssigneeId', + 'assignee_ids' => 'getAssigneeIds', 'done' => 'getDone', 'due_date' => 'getDueDate' ]; @@ -234,6 +239,7 @@ public function __construct(array $data = null) $this->container['description'] = $data['description'] ?? null; $this->container['parent_task_id'] = $data['parent_task_id'] ?? null; $this->container['assignee_id'] = $data['assignee_id'] ?? null; + $this->container['assignee_ids'] = $data['assignee_ids'] ?? null; $this->container['done'] = $data['done'] ?? null; $this->container['due_date'] = $data['due_date'] ?? null; } @@ -249,6 +255,10 @@ public function listInvalidProperties(): array { $invalidProperties = []; + if (!is_null($this->container['assignee_ids']) && (count($this->container['assignee_ids']) > 10)) { + $invalidProperties[] = "invalid value for 'assignee_ids', number of items must be less than or equal to 10."; + } + return $invalidProperties; } @@ -373,7 +383,7 @@ public function getAssigneeId() /** * Sets assignee_id * - * @param float|null $assignee_id The ID of the user who will be the assignee of the task + * @param float|null $assignee_id The ID of the user assigned to the task. When the `assignee_id` field is updated, the `assignee_ids` field value will be overwritten by the `assignee_id` field value. * * @return self */ @@ -384,6 +394,34 @@ public function setAssigneeId($assignee_id): self return $this; } + /** + * Gets assignee_ids + * + * @return float[]|null + */ + public function getAssigneeIds() + { + return $this->container['assignee_ids']; + } + + /** + * Sets assignee_ids + * + * @param float[]|null $assignee_ids The IDs of users assigned to the task. When the `assignee_ids` field is updated, the `assignee_id` field value will be set to the first value of the `assignee_ids` field, or `null` if the list is empty. + * + * @return self + */ + public function setAssigneeIds($assignee_ids): self + { + + if (!is_null($assignee_ids) && (count($assignee_ids) > 10)) { + throw new \InvalidArgumentException('invalid value for $assignee_ids when calling TaskPutObject., number of items must be less than or equal to 10.'); + } + $this->container['assignee_ids'] = $assignee_ids; + + return $this; + } + /** * Gets done * diff --git a/lib/versions/v1/Model/TaskResponseObject.php b/lib/versions/v1/Model/TaskResponseObject.php index b85fd478..628500b2 100644 --- a/lib/versions/v1/Model/TaskResponseObject.php +++ b/lib/versions/v1/Model/TaskResponseObject.php @@ -72,6 +72,7 @@ class TaskResponseObject implements ModelInterface, ArrayAccess, JsonSerializabl 'description' => 'string', 'parent_task_id' => 'float', 'assignee_id' => 'float', + 'assignee_ids' => 'float[]', 'done' => '\Pipedrive\versions\v1\Model\NumberBoolean', 'due_date' => '\DateTime', 'creator_id' => 'float', @@ -94,6 +95,7 @@ class TaskResponseObject implements ModelInterface, ArrayAccess, JsonSerializabl 'description' => null, 'parent_task_id' => null, 'assignee_id' => null, + 'assignee_ids' => null, 'done' => null, 'due_date' => 'date', 'creator_id' => null, @@ -139,6 +141,7 @@ public static function openAPIFormats(): array 'description' => 'description', 'parent_task_id' => 'parent_task_id', 'assignee_id' => 'assignee_id', + 'assignee_ids' => 'assignee_ids', 'done' => 'done', 'due_date' => 'due_date', 'creator_id' => 'creator_id', @@ -159,6 +162,7 @@ public static function openAPIFormats(): array 'description' => 'setDescription', 'parent_task_id' => 'setParentTaskId', 'assignee_id' => 'setAssigneeId', + 'assignee_ids' => 'setAssigneeIds', 'done' => 'setDone', 'due_date' => 'setDueDate', 'creator_id' => 'setCreatorId', @@ -179,6 +183,7 @@ public static function openAPIFormats(): array 'description' => 'getDescription', 'parent_task_id' => 'getParentTaskId', 'assignee_id' => 'getAssigneeId', + 'assignee_ids' => 'getAssigneeIds', 'done' => 'getDone', 'due_date' => 'getDueDate', 'creator_id' => 'getCreatorId', @@ -260,6 +265,7 @@ public function __construct(array $data = null) $this->container['description'] = $data['description'] ?? null; $this->container['parent_task_id'] = $data['parent_task_id'] ?? null; $this->container['assignee_id'] = $data['assignee_id'] ?? null; + $this->container['assignee_ids'] = $data['assignee_ids'] ?? null; $this->container['done'] = $data['done'] ?? null; $this->container['due_date'] = $data['due_date'] ?? null; $this->container['creator_id'] = $data['creator_id'] ?? null; @@ -279,6 +285,10 @@ public function listInvalidProperties(): array { $invalidProperties = []; + if (!is_null($this->container['assignee_ids']) && (count($this->container['assignee_ids']) > 10)) { + $invalidProperties[] = "invalid value for 'assignee_ids', number of items must be less than or equal to 10."; + } + return $invalidProperties; } @@ -427,7 +437,7 @@ public function getAssigneeId() /** * Sets assignee_id * - * @param float|null $assignee_id The ID of the user who will be the assignee of the task + * @param float|null $assignee_id The ID of the user assigned to the task. When the `assignee_id` field is updated, the `assignee_ids` field value will be overwritten by the `assignee_id` field value. * * @return self */ @@ -438,6 +448,34 @@ public function setAssigneeId($assignee_id): self return $this; } + /** + * Gets assignee_ids + * + * @return float[]|null + */ + public function getAssigneeIds() + { + return $this->container['assignee_ids']; + } + + /** + * Sets assignee_ids + * + * @param float[]|null $assignee_ids The IDs of users assigned to the task. When the `assignee_ids` field is updated, the `assignee_id` field value will be set to the first value of the `assignee_ids` field, or `null` if the list is empty. + * + * @return self + */ + public function setAssigneeIds($assignee_ids): self + { + + if (!is_null($assignee_ids) && (count($assignee_ids) > 10)) { + throw new \InvalidArgumentException('invalid value for $assignee_ids when calling TaskResponseObject., number of items must be less than or equal to 10.'); + } + $this->container['assignee_ids'] = $assignee_ids; + + return $this; + } + /** * Gets done * diff --git a/lib/versions/v2/Api/OrganizationsApi.php b/lib/versions/v2/Api/OrganizationsApi.php index 706018f1..59067ead 100644 --- a/lib/versions/v2/Api/OrganizationsApi.php +++ b/lib/versions/v2/Api/OrganizationsApi.php @@ -2301,7 +2301,7 @@ public function getOrganizationFollowersChangelogRequest($id, $limit = null, $cu * * @param int|null $filter_id If supplied, only organizations matching the specified filter are returned (optional) * @param string|null $ids Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. (optional) - * @param int|null $owner_id If supplied, only organization owned by the specified user are returned. If filter_id is provided, this is ignored. (optional) + * @param int|null $owner_id If supplied, only organizations owned by the specified user are returned. If filter_id is provided, this is ignored. (optional) * @param string|null $updated_since If set, only organizations with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) * @param string|null $updated_until If set, only organizations with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) * @param string|'id' $sort_by The field to sort by. Supported fields: `id`, `update_time`, `add_time`. (optional, default to 'id') @@ -2328,7 +2328,7 @@ public function getOrganizations($filter_id = null, $ids = null, $owner_id = nul * * @param int|null $filter_id If supplied, only organizations matching the specified filter are returned (optional) * @param string|null $ids Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. (optional) - * @param int|null $owner_id If supplied, only organization owned by the specified user are returned. If filter_id is provided, this is ignored. (optional) + * @param int|null $owner_id If supplied, only organizations owned by the specified user are returned. If filter_id is provided, this is ignored. (optional) * @param string|null $updated_since If set, only organizations with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) * @param string|null $updated_until If set, only organizations with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) * @param string|'id' $sort_by The field to sort by. Supported fields: `id`, `update_time`, `add_time`. (optional, default to 'id') @@ -2439,7 +2439,7 @@ public function getOrganizationsWithHttpInfo($filter_id = null, $ids = null, $ow * * @param int|null $filter_id If supplied, only organizations matching the specified filter are returned (optional) * @param string|null $ids Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. (optional) - * @param int|null $owner_id If supplied, only organization owned by the specified user are returned. If filter_id is provided, this is ignored. (optional) + * @param int|null $owner_id If supplied, only organizations owned by the specified user are returned. If filter_id is provided, this is ignored. (optional) * @param string|null $updated_since If set, only organizations with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) * @param string|null $updated_until If set, only organizations with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) * @param string|'id' $sort_by The field to sort by. Supported fields: `id`, `update_time`, `add_time`. (optional, default to 'id') @@ -2469,7 +2469,7 @@ function ($response) { * * @param int|null $filter_id If supplied, only organizations matching the specified filter are returned (optional) * @param string|null $ids Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. (optional) - * @param int|null $owner_id If supplied, only organization owned by the specified user are returned. If filter_id is provided, this is ignored. (optional) + * @param int|null $owner_id If supplied, only organizations owned by the specified user are returned. If filter_id is provided, this is ignored. (optional) * @param string|null $updated_since If set, only organizations with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) * @param string|null $updated_until If set, only organizations with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) * @param string|'id' $sort_by The field to sort by. Supported fields: `id`, `update_time`, `add_time`. (optional, default to 'id') @@ -2526,7 +2526,7 @@ function ($exception) { * * @param int|null $filter_id If supplied, only organizations matching the specified filter are returned (optional) * @param string|null $ids Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. (optional) - * @param int|null $owner_id If supplied, only organization owned by the specified user are returned. If filter_id is provided, this is ignored. (optional) + * @param int|null $owner_id If supplied, only organizations owned by the specified user are returned. If filter_id is provided, this is ignored. (optional) * @param string|null $updated_since If set, only organizations with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) * @param string|null $updated_until If set, only organizations with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) * @param string|'id' $sort_by The field to sort by. Supported fields: `id`, `update_time`, `add_time`. (optional, default to 'id') diff --git a/lib/versions/v2/Model/BaseInstallment.php b/lib/versions/v2/Model/BaseInstallment.php index eeea7730..736372ea 100644 --- a/lib/versions/v2/Model/BaseInstallment.php +++ b/lib/versions/v2/Model/BaseInstallment.php @@ -313,7 +313,7 @@ public function getBillingDate() /** * Sets billing_date * - * @param string|null $billing_date The date which the installment will be charged. + * @param string|null $billing_date The date on which the installment will be charged. * * @return self */ diff --git a/lib/versions/v2/Model/BaseProduct.php b/lib/versions/v2/Model/BaseProduct.php index d4b8d774..36306da6 100644 --- a/lib/versions/v2/Model/BaseProduct.php +++ b/lib/versions/v2/Model/BaseProduct.php @@ -427,7 +427,7 @@ public function getIsDeleted() /** * Sets is_deleted * - * @param bool|null $is_deleted Whether this product will be made marked as deleted or not + * @param bool|null $is_deleted Whether this product will be marked as deleted or not * * @return self */ diff --git a/lib/versions/v2/Model/BaseProductAllOf.php b/lib/versions/v2/Model/BaseProductAllOf.php index bd821318..cb1cc119 100644 --- a/lib/versions/v2/Model/BaseProductAllOf.php +++ b/lib/versions/v2/Model/BaseProductAllOf.php @@ -415,7 +415,7 @@ public function getIsDeleted() /** * Sets is_deleted * - * @param bool|null $is_deleted Whether this product will be made marked as deleted or not + * @param bool|null $is_deleted Whether this product will be marked as deleted or not * * @return self */ diff --git a/lib/versions/v2/Model/CreateDealFieldRequest.php b/lib/versions/v2/Model/CreateDealFieldRequest.php index 72362b4c..ec5fce7e 100644 --- a/lib/versions/v2/Model/CreateDealFieldRequest.php +++ b/lib/versions/v2/Model/CreateDealFieldRequest.php @@ -376,7 +376,7 @@ public function getFieldType() /** * Sets field_type * - * @param string $field_type The type of the field
ValueDescription
`varchar`Text (up to 255 characters)
`varchar_auto`Autocomplete text (up to 255 characters)
`text`Long text (up to 65k characters)
`double`Numeric value
`monetary`Monetary field (has a numeric value and a currency value)
`date`Date (format YYYY-MM-DD)
`set`Options field with a possibility of having multiple chosen options
`enum`Options field with a single possible chosen option
`user`User field (contains a user ID of another Pipedrive user)
`org`Organization field (contains an organization ID which is stored on the same account)
`people`Person field (contains a product ID which is stored on the same account)
`phone`Phone field (up to 255 numbers and/or characters)
`time`Time field (format HH:MM:SS)
`timerange`Time-range field (has a start time and end time value, both HH:MM:SS)
`daterange`Date-range field (has a start date and end date value, both YYYY-MM-DD)
`address`Address field
+ * @param string $field_type The type of the field
ValueDescription
`varchar`Text (up to 255 characters)
`varchar_auto`Autocomplete text (up to 255 characters)
`text`Long text (up to 65k characters)
`double`Numeric value
`monetary`Monetary field (has a numeric value and a currency value)
`date`Date (format YYYY-MM-DD)
`set`Options field with a possibility of having multiple chosen options
`enum`Options field with a single possible chosen option
`user`User field (contains a user ID of another Pipedrive user)
`org`Organization field (contains an organization ID which is stored on the same account)
`people`Person field (contains a person ID which is stored on the same account)
`phone`Phone field (up to 255 numbers and/or characters)
`time`Time field (format HH:MM:SS)
`timerange`Time-range field (has a start time and end time value, both HH:MM:SS)
`daterange`Date-range field (has a start date and end date value, both YYYY-MM-DD)
`address`Address field
* * @return self */ diff --git a/lib/versions/v2/Model/CreateOrganizationFieldRequest.php b/lib/versions/v2/Model/CreateOrganizationFieldRequest.php index 945ef25c..54f322b8 100644 --- a/lib/versions/v2/Model/CreateOrganizationFieldRequest.php +++ b/lib/versions/v2/Model/CreateOrganizationFieldRequest.php @@ -376,7 +376,7 @@ public function getFieldType() /** * Sets field_type * - * @param string $field_type The type of the field
ValueDescription
`varchar`Text (up to 255 characters)
`varchar_auto`Autocomplete text (up to 255 characters)
`text`Long text (up to 65k characters)
`double`Numeric value
`monetary`Monetary field (has a numeric value and a currency value)
`date`Date (format YYYY-MM-DD)
`set`Options field with a possibility of having multiple chosen options
`enum`Options field with a single possible chosen option
`user`User field (contains a user ID of another Pipedrive user)
`org`Organization field (contains an organization ID which is stored on the same account)
`people`Person field (contains a product ID which is stored on the same account)
`phone`Phone field (up to 255 numbers and/or characters)
`time`Time field (format HH:MM:SS)
`timerange`Time-range field (has a start time and end time value, both HH:MM:SS)
`daterange`Date-range field (has a start date and end date value, both YYYY-MM-DD)
`address`Address field
+ * @param string $field_type The type of the field
ValueDescription
`varchar`Text (up to 255 characters)
`varchar_auto`Autocomplete text (up to 255 characters)
`text`Long text (up to 65k characters)
`double`Numeric value
`monetary`Monetary field (has a numeric value and a currency value)
`date`Date (format YYYY-MM-DD)
`set`Options field with a possibility of having multiple chosen options
`enum`Options field with a single possible chosen option
`user`User field (contains a user ID of another Pipedrive user)
`org`Organization field (contains an organization ID which is stored on the same account)
`people`Person field (contains a person ID which is stored on the same account)
`phone`Phone field (up to 255 numbers and/or characters)
`time`Time field (format HH:MM:SS)
`timerange`Time-range field (has a start time and end time value, both HH:MM:SS)
`daterange`Date-range field (has a start date and end date value, both YYYY-MM-DD)
`address`Address field
* * @return self */ diff --git a/lib/versions/v2/Model/CreatePersonFieldRequest.php b/lib/versions/v2/Model/CreatePersonFieldRequest.php index 05b66bad..6d407000 100644 --- a/lib/versions/v2/Model/CreatePersonFieldRequest.php +++ b/lib/versions/v2/Model/CreatePersonFieldRequest.php @@ -376,7 +376,7 @@ public function getFieldType() /** * Sets field_type * - * @param string $field_type The type of the field
ValueDescription
`varchar`Text (up to 255 characters)
`varchar_auto`Autocomplete text (up to 255 characters)
`text`Long text (up to 65k characters)
`double`Numeric value
`monetary`Monetary field (has a numeric value and a currency value)
`date`Date (format YYYY-MM-DD)
`set`Options field with a possibility of having multiple chosen options
`enum`Options field with a single possible chosen option
`user`User field (contains a user ID of another Pipedrive user)
`org`Organization field (contains an organization ID which is stored on the same account)
`people`Person field (contains a product ID which is stored on the same account)
`phone`Phone field (up to 255 numbers and/or characters)
`time`Time field (format HH:MM:SS)
`timerange`Time-range field (has a start time and end time value, both HH:MM:SS)
`daterange`Date-range field (has a start date and end date value, both YYYY-MM-DD)
`address`Address field
+ * @param string $field_type The type of the field
ValueDescription
`varchar`Text (up to 255 characters)
`varchar_auto`Autocomplete text (up to 255 characters)
`text`Long text (up to 65k characters)
`double`Numeric value
`monetary`Monetary field (has a numeric value and a currency value)
`date`Date (format YYYY-MM-DD)
`set`Options field with a possibility of having multiple chosen options
`enum`Options field with a single possible chosen option
`user`User field (contains a user ID of another Pipedrive user)
`org`Organization field (contains an organization ID which is stored on the same account)
`people`Person field (contains a person ID which is stored on the same account)
`phone`Phone field (up to 255 numbers and/or characters)
`time`Time field (format HH:MM:SS)
`timerange`Time-range field (has a start time and end time value, both HH:MM:SS)
`daterange`Date-range field (has a start date and end date value, both YYYY-MM-DD)
`address`Address field
* * @return self */ diff --git a/lib/versions/v2/Model/CreateProductFieldRequest.php b/lib/versions/v2/Model/CreateProductFieldRequest.php index 9f288911..117d9a50 100644 --- a/lib/versions/v2/Model/CreateProductFieldRequest.php +++ b/lib/versions/v2/Model/CreateProductFieldRequest.php @@ -364,7 +364,7 @@ public function getFieldType() /** * Sets field_type * - * @param string $field_type The type of the field
ValueDescription
`varchar`Text (up to 255 characters)
`varchar_auto`Autocomplete text (up to 255 characters)
`text`Long text (up to 65k characters)
`double`Numeric value
`monetary`Monetary field (has a numeric value and a currency value)
`date`Date (format YYYY-MM-DD)
`set`Options field with a possibility of having multiple chosen options
`enum`Options field with a single possible chosen option
`user`User field (contains a user ID of another Pipedrive user)
`org`Organization field (contains an organization ID which is stored on the same account)
`people`Person field (contains a product ID which is stored on the same account)
`phone`Phone field (up to 255 numbers and/or characters)
`time`Time field (format HH:MM:SS)
`timerange`Time-range field (has a start time and end time value, both HH:MM:SS)
`daterange`Date-range field (has a start date and end date value, both YYYY-MM-DD)
`address`Address field
+ * @param string $field_type The type of the field
ValueDescription
`varchar`Text (up to 255 characters)
`varchar_auto`Autocomplete text (up to 255 characters)
`text`Long text (up to 65k characters)
`double`Numeric value
`monetary`Monetary field (has a numeric value and a currency value)
`date`Date (format YYYY-MM-DD)
`set`Options field with a possibility of having multiple chosen options
`enum`Options field with a single possible chosen option
`user`User field (contains a user ID of another Pipedrive user)
`org`Organization field (contains an organization ID which is stored on the same account)
`people`Person field (contains a person ID which is stored on the same account)
`phone`Phone field (up to 255 numbers and/or characters)
`time`Time field (format HH:MM:SS)
`timerange`Time-range field (has a start time and end time value, both HH:MM:SS)
`daterange`Date-range field (has a start date and end date value, both YYYY-MM-DD)
`address`Address field
* * @return self */ diff --git a/lib/versions/v2/Model/Deal.php b/lib/versions/v2/Model/Deal.php new file mode 100644 index 00000000..77aeb405 --- /dev/null +++ b/lib/versions/v2/Model/Deal.php @@ -0,0 +1,1275 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class Deal implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'Deal'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'id' => 'int', + 'title' => 'string', + 'owner_id' => 'int', + 'person_id' => 'int', + 'org_id' => 'int', + 'pipeline_id' => 'int', + 'stage_id' => 'int', + 'value' => 'float', + 'currency' => 'string', + 'add_time' => 'string', + 'update_time' => 'string', + 'stage_change_time' => 'string', + 'is_deleted' => 'bool', + 'is_archived' => 'bool', + 'status' => 'string', + 'probability' => 'float', + 'lost_reason' => 'string', + 'visible_to' => 'int', + 'close_time' => 'string', + 'won_time' => 'string', + 'lost_time' => 'string', + 'expected_close_date' => '\DateTime', + 'label_ids' => 'int[]', + 'origin' => 'string', + 'origin_id' => 'string', + 'channel' => 'int', + 'channel_id' => 'string', + 'source_lead_id' => 'string', + 'arr' => 'float', + 'mrr' => 'float', + 'acv' => 'float', + 'custom_fields' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'title' => null, + 'owner_id' => null, + 'person_id' => null, + 'org_id' => null, + 'pipeline_id' => null, + 'stage_id' => null, + 'value' => null, + 'currency' => null, + 'add_time' => null, + 'update_time' => null, + 'stage_change_time' => null, + 'is_deleted' => null, + 'is_archived' => null, + 'status' => null, + 'probability' => null, + 'lost_reason' => null, + 'visible_to' => null, + 'close_time' => null, + 'won_time' => null, + 'lost_time' => null, + 'expected_close_date' => 'date', + 'label_ids' => null, + 'origin' => null, + 'origin_id' => null, + 'channel' => null, + 'channel_id' => null, + 'source_lead_id' => 'uuid', + 'arr' => null, + 'mrr' => null, + 'acv' => null, + 'custom_fields' => 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', + 'title' => 'title', + 'owner_id' => 'owner_id', + 'person_id' => 'person_id', + 'org_id' => 'org_id', + 'pipeline_id' => 'pipeline_id', + 'stage_id' => 'stage_id', + 'value' => 'value', + 'currency' => 'currency', + 'add_time' => 'add_time', + 'update_time' => 'update_time', + 'stage_change_time' => 'stage_change_time', + 'is_deleted' => 'is_deleted', + 'is_archived' => 'is_archived', + 'status' => 'status', + 'probability' => 'probability', + 'lost_reason' => 'lost_reason', + 'visible_to' => 'visible_to', + 'close_time' => 'close_time', + 'won_time' => 'won_time', + 'lost_time' => 'lost_time', + 'expected_close_date' => 'expected_close_date', + 'label_ids' => 'label_ids', + 'origin' => 'origin', + 'origin_id' => 'origin_id', + 'channel' => 'channel', + 'channel_id' => 'channel_id', + 'source_lead_id' => 'source_lead_id', + 'arr' => 'arr', + 'mrr' => 'mrr', + 'acv' => 'acv', + 'custom_fields' => 'custom_fields' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'title' => 'setTitle', + 'owner_id' => 'setOwnerId', + 'person_id' => 'setPersonId', + 'org_id' => 'setOrgId', + 'pipeline_id' => 'setPipelineId', + 'stage_id' => 'setStageId', + 'value' => 'setValue', + 'currency' => 'setCurrency', + 'add_time' => 'setAddTime', + 'update_time' => 'setUpdateTime', + 'stage_change_time' => 'setStageChangeTime', + 'is_deleted' => 'setIsDeleted', + 'is_archived' => 'setIsArchived', + 'status' => 'setStatus', + 'probability' => 'setProbability', + 'lost_reason' => 'setLostReason', + 'visible_to' => 'setVisibleTo', + 'close_time' => 'setCloseTime', + 'won_time' => 'setWonTime', + 'lost_time' => 'setLostTime', + 'expected_close_date' => 'setExpectedCloseDate', + 'label_ids' => 'setLabelIds', + 'origin' => 'setOrigin', + 'origin_id' => 'setOriginId', + 'channel' => 'setChannel', + 'channel_id' => 'setChannelId', + 'source_lead_id' => 'setSourceLeadId', + 'arr' => 'setArr', + 'mrr' => 'setMrr', + 'acv' => 'setAcv', + 'custom_fields' => 'setCustomFields' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'title' => 'getTitle', + 'owner_id' => 'getOwnerId', + 'person_id' => 'getPersonId', + 'org_id' => 'getOrgId', + 'pipeline_id' => 'getPipelineId', + 'stage_id' => 'getStageId', + 'value' => 'getValue', + 'currency' => 'getCurrency', + 'add_time' => 'getAddTime', + 'update_time' => 'getUpdateTime', + 'stage_change_time' => 'getStageChangeTime', + 'is_deleted' => 'getIsDeleted', + 'is_archived' => 'getIsArchived', + 'status' => 'getStatus', + 'probability' => 'getProbability', + 'lost_reason' => 'getLostReason', + 'visible_to' => 'getVisibleTo', + 'close_time' => 'getCloseTime', + 'won_time' => 'getWonTime', + 'lost_time' => 'getLostTime', + 'expected_close_date' => 'getExpectedCloseDate', + 'label_ids' => 'getLabelIds', + 'origin' => 'getOrigin', + 'origin_id' => 'getOriginId', + 'channel' => 'getChannel', + 'channel_id' => 'getChannelId', + 'source_lead_id' => 'getSourceLeadId', + 'arr' => 'getArr', + 'mrr' => 'getMrr', + 'acv' => 'getAcv', + 'custom_fields' => 'getCustomFields' + ]; + + /** + * 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; + $this->container['title'] = $data['title'] ?? null; + $this->container['owner_id'] = $data['owner_id'] ?? null; + $this->container['person_id'] = $data['person_id'] ?? null; + $this->container['org_id'] = $data['org_id'] ?? null; + $this->container['pipeline_id'] = $data['pipeline_id'] ?? null; + $this->container['stage_id'] = $data['stage_id'] ?? null; + $this->container['value'] = $data['value'] ?? null; + $this->container['currency'] = $data['currency'] ?? null; + $this->container['add_time'] = $data['add_time'] ?? null; + $this->container['update_time'] = $data['update_time'] ?? null; + $this->container['stage_change_time'] = $data['stage_change_time'] ?? null; + $this->container['is_deleted'] = $data['is_deleted'] ?? null; + $this->container['is_archived'] = $data['is_archived'] ?? null; + $this->container['status'] = $data['status'] ?? null; + $this->container['probability'] = $data['probability'] ?? null; + $this->container['lost_reason'] = $data['lost_reason'] ?? null; + $this->container['visible_to'] = $data['visible_to'] ?? null; + $this->container['close_time'] = $data['close_time'] ?? null; + $this->container['won_time'] = $data['won_time'] ?? null; + $this->container['lost_time'] = $data['lost_time'] ?? null; + $this->container['expected_close_date'] = $data['expected_close_date'] ?? null; + $this->container['label_ids'] = $data['label_ids'] ?? null; + $this->container['origin'] = $data['origin'] ?? 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; + $this->container['custom_fields'] = $data['custom_fields'] ?? 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 deal + * + * @return self + */ + public function setId($id): self + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the deal + * + * @return self + */ + public function setTitle($title): self + { + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets owner_id + * + * @return int|null + */ + public function getOwnerId() + { + return $this->container['owner_id']; + } + + /** + * Sets owner_id + * + * @param int|null $owner_id The ID of the user who owns the deal + * + * @return self + */ + public function setOwnerId($owner_id): self + { + $this->container['owner_id'] = $owner_id; + + return $this; + } + + /** + * Gets person_id + * + * @return int|null + */ + public function getPersonId() + { + return $this->container['person_id']; + } + + /** + * Sets person_id + * + * @param int|null $person_id The ID of the person linked to the deal + * + * @return self + */ + public function setPersonId($person_id): self + { + $this->container['person_id'] = $person_id; + + return $this; + } + + /** + * Gets org_id + * + * @return int|null + */ + public function getOrgId() + { + return $this->container['org_id']; + } + + /** + * Sets org_id + * + * @param int|null $org_id The ID of the organization linked to the deal + * + * @return self + */ + public function setOrgId($org_id): self + { + $this->container['org_id'] = $org_id; + + return $this; + } + + /** + * Gets pipeline_id + * + * @return int|null + */ + public function getPipelineId() + { + return $this->container['pipeline_id']; + } + + /** + * Sets pipeline_id + * + * @param int|null $pipeline_id The ID of the pipeline associated with the deal + * + * @return self + */ + public function setPipelineId($pipeline_id): self + { + $this->container['pipeline_id'] = $pipeline_id; + + return $this; + } + + /** + * Gets stage_id + * + * @return int|null + */ + public function getStageId() + { + return $this->container['stage_id']; + } + + /** + * Sets stage_id + * + * @param int|null $stage_id The ID of the deal stage + * + * @return self + */ + public function setStageId($stage_id): self + { + $this->container['stage_id'] = $stage_id; + + return $this; + } + + /** + * Gets value + * + * @return float|null + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param float|null $value The value of the deal + * + * @return self + */ + public function setValue($value): self + { + $this->container['value'] = $value; + + return $this; + } + + /** + * Gets currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency The currency associated with the deal + * + * @return self + */ + public function setCurrency($currency): self + { + $this->container['currency'] = $currency; + + 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 creation date and time of the deal + * + * @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 last updated date and time of the deal + * + * @return self + */ + public function setUpdateTime($update_time): self + { + $this->container['update_time'] = $update_time; + + return $this; + } + + /** + * Gets stage_change_time + * + * @return string|null + */ + public function getStageChangeTime() + { + return $this->container['stage_change_time']; + } + + /** + * Sets stage_change_time + * + * @param string|null $stage_change_time The last updated date and time of the deal stage + * + * @return self + */ + public function setStageChangeTime($stage_change_time): self + { + $this->container['stage_change_time'] = $stage_change_time; + + return $this; + } + + /** + * Gets is_deleted + * + * @return bool|null + */ + public function getIsDeleted() + { + return $this->container['is_deleted']; + } + + /** + * Sets is_deleted + * + * @param bool|null $is_deleted Whether the deal is deleted or not + * + * @return self + */ + public function setIsDeleted($is_deleted): self + { + $this->container['is_deleted'] = $is_deleted; + + return $this; + } + + /** + * Gets is_archived + * + * @return bool|null + */ + public function getIsArchived() + { + return $this->container['is_archived']; + } + + /** + * Sets is_archived + * + * @param bool|null $is_archived Whether the deal is archived or not + * + * @return self + */ + public function setIsArchived($is_archived): self + { + $this->container['is_archived'] = $is_archived; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status The status of the deal + * + * @return self + */ + public function setStatus($status): self + { + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets probability + * + * @return float|null + */ + public function getProbability() + { + return $this->container['probability']; + } + + /** + * Sets probability + * + * @param float|null $probability The success probability percentage of the deal + * + * @return self + */ + public function setProbability($probability): self + { + $this->container['probability'] = $probability; + + return $this; + } + + /** + * Gets lost_reason + * + * @return string|null + */ + public function getLostReason() + { + return $this->container['lost_reason']; + } + + /** + * Sets lost_reason + * + * @param string|null $lost_reason The reason for losing the deal + * + * @return self + */ + public function setLostReason($lost_reason): self + { + $this->container['lost_reason'] = $lost_reason; + + return $this; + } + + /** + * Gets visible_to + * + * @return int|null + */ + public function getVisibleTo() + { + return $this->container['visible_to']; + } + + /** + * Sets visible_to + * + * @param int|null $visible_to The visibility of the deal + * + * @return self + */ + public function setVisibleTo($visible_to): self + { + $this->container['visible_to'] = $visible_to; + + return $this; + } + + /** + * Gets close_time + * + * @return string|null + */ + public function getCloseTime() + { + return $this->container['close_time']; + } + + /** + * Sets close_time + * + * @param string|null $close_time The date and time of closing the deal + * + * @return self + */ + public function setCloseTime($close_time): self + { + $this->container['close_time'] = $close_time; + + return $this; + } + + /** + * Gets won_time + * + * @return string|null + */ + public function getWonTime() + { + return $this->container['won_time']; + } + + /** + * Sets won_time + * + * @param string|null $won_time The date and time of changing the deal status as won + * + * @return self + */ + public function setWonTime($won_time): self + { + $this->container['won_time'] = $won_time; + + return $this; + } + + /** + * Gets lost_time + * + * @return string|null + */ + public function getLostTime() + { + return $this->container['lost_time']; + } + + /** + * Sets lost_time + * + * @param string|null $lost_time The date and time of changing the deal status as lost + * + * @return self + */ + public function setLostTime($lost_time): self + { + $this->container['lost_time'] = $lost_time; + + return $this; + } + + /** + * Gets expected_close_date + * + * @return \DateTime|null + */ + public function getExpectedCloseDate() + { + return $this->container['expected_close_date']; + } + + /** + * Sets expected_close_date + * + * @param \DateTime|null $expected_close_date The expected close date of the deal + * + * @return self + */ + public function setExpectedCloseDate($expected_close_date): self + { + $this->container['expected_close_date'] = $expected_close_date; + + 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 deal + * + * @return self + */ + public function setLabelIds($label_ids): self + { + $this->container['label_ids'] = $label_ids; + + return $this; + } + + /** + * Gets origin + * + * @return string|null + */ + public function getOrigin() + { + return $this->container['origin']; + } + + /** + * Sets origin + * + * @param string|null $origin The way this Deal was created. `origin` field is set by Pipedrive when Deal is created and cannot be changed. + * + * @return self + */ + public function setOrigin($origin): self + { + $this->container['origin'] = $origin; + + return $this; + } + + /** + * Gets origin_id + * + * @return string|null + */ + public function getOriginId() + { + return $this->container['origin_id']; + } + + /** + * Sets origin_id + * + * @param string|null $origin_id The optional ID to further distinguish the origin of the deal - e.g. Which API integration created this Deal. + * + * @return self + */ + public function setOriginId($origin_id): self + { + $this->container['origin_id'] = $origin_id; + + return $this; + } + + /** + * Gets channel + * + * @return int|null + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param int|null $channel The ID of your Marketing channel this Deal was created from. Recognized Marketing channels can be configured in your Company settings. + * + * @return self + */ + public function setChannel($channel): self + { + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets channel_id + * + * @return string|null + */ + public function getChannelId() + { + return $this->container['channel_id']; + } + + /** + * Sets channel_id + * + * @param string|null $channel_id The optional ID to further distinguish the Marketing channel. + * + * @return self + */ + public function setChannelId($channel_id): self + { + $this->container['channel_id'] = $channel_id; + + 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 + * + * @return float|null + */ + public function getArr() + { + return $this->container['arr']; + } + + /** + * Sets arr + * + * @param float|null $arr Only available in Growth and above plans The Annual Recurring Revenue of the deal Null if there are no products attached to the deal + * + * @return self + */ + public function setArr($arr): self + { + $this->container['arr'] = $arr; + + return $this; + } + + /** + * Gets mrr + * + * @return float|null + */ + public function getMrr() + { + return $this->container['mrr']; + } + + /** + * Sets mrr + * + * @param float|null $mrr Only available in Growth and above plans The Monthly Recurring Revenue of the deal Null if there are no products attached to the deal + * + * @return self + */ + public function setMrr($mrr): self + { + $this->container['mrr'] = $mrr; + + return $this; + } + + /** + * Gets acv + * + * @return float|null + */ + public function getAcv() + { + return $this->container['acv']; + } + + /** + * Sets acv + * + * @param float|null $acv Only available in Growth and above plans The Annual Contract Value of the deal Null if there are no products attached to the deal + * + * @return self + */ + public function setAcv($acv): self + { + $this->container['acv'] = $acv; + + return $this; + } + + /** + * Gets custom_fields + * + * @return array|null + */ + public function getCustomFields() + { + return $this->container['custom_fields']; + } + + /** + * Sets custom_fields + * + * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes + * + * @return self + */ + public function setCustomFields($custom_fields): self + { + $this->container['custom_fields'] = $custom_fields; + + 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/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 * diff --git a/lib/versions/v2/Model/InstallmentRequestBody.php b/lib/versions/v2/Model/InstallmentRequestBody.php index 590d261f..318f2e6d 100644 --- a/lib/versions/v2/Model/InstallmentRequestBody.php +++ b/lib/versions/v2/Model/InstallmentRequestBody.php @@ -301,7 +301,7 @@ public function getBillingDate() /** * Sets billing_date * - * @param string|null $billing_date The date which the installment will be charged. Must be in the format YYYY-MM-DD. + * @param string|null $billing_date The date on which the installment will be charged. Must be in the format YYYY-MM-DD. * * @return self */ diff --git a/lib/versions/v2/Model/Person.php b/lib/versions/v2/Model/Person.php new file mode 100644 index 00000000..c3cc77f5 --- /dev/null +++ b/lib/versions/v2/Model/Person.php @@ -0,0 +1,915 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class Person implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'Person'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'id' => 'int', + 'name' => 'string', + 'first_name' => 'string', + 'last_name' => 'string', + 'owner_id' => 'int', + 'org_id' => 'int', + 'add_time' => 'string', + 'update_time' => 'string', + 'emails' => '\Pipedrive\versions\v2\Model\PersonEmails[]', + 'phones' => '\Pipedrive\versions\v2\Model\PersonPhones[]', + 'is_deleted' => 'bool', + 'visible_to' => 'int', + 'label_ids' => 'int[]', + 'picture_id' => 'int', + 'postal_address' => '\Pipedrive\versions\v2\Model\PersonPostalAddress', + 'notes' => 'string', + 'im' => '\Pipedrive\versions\v2\Model\PersonIm[]', + 'birthday' => 'string', + 'job_title' => 'string', + 'custom_fields' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'first_name' => null, + 'last_name' => null, + 'owner_id' => null, + 'org_id' => null, + 'add_time' => null, + 'update_time' => null, + 'emails' => null, + 'phones' => null, + 'is_deleted' => null, + 'visible_to' => null, + 'label_ids' => null, + 'picture_id' => null, + 'postal_address' => null, + 'notes' => null, + 'im' => null, + 'birthday' => null, + 'job_title' => null, + 'custom_fields' => 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', + 'name' => 'name', + 'first_name' => 'first_name', + 'last_name' => 'last_name', + 'owner_id' => 'owner_id', + 'org_id' => 'org_id', + 'add_time' => 'add_time', + 'update_time' => 'update_time', + 'emails' => 'emails', + 'phones' => 'phones', + 'is_deleted' => 'is_deleted', + 'visible_to' => 'visible_to', + 'label_ids' => 'label_ids', + 'picture_id' => 'picture_id', + 'postal_address' => 'postal_address', + 'notes' => 'notes', + 'im' => 'im', + 'birthday' => 'birthday', + 'job_title' => 'job_title', + 'custom_fields' => 'custom_fields' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'first_name' => 'setFirstName', + 'last_name' => 'setLastName', + 'owner_id' => 'setOwnerId', + 'org_id' => 'setOrgId', + 'add_time' => 'setAddTime', + 'update_time' => 'setUpdateTime', + 'emails' => 'setEmails', + 'phones' => 'setPhones', + 'is_deleted' => 'setIsDeleted', + 'visible_to' => 'setVisibleTo', + 'label_ids' => 'setLabelIds', + 'picture_id' => 'setPictureId', + 'postal_address' => 'setPostalAddress', + 'notes' => 'setNotes', + 'im' => 'setIm', + 'birthday' => 'setBirthday', + 'job_title' => 'setJobTitle', + 'custom_fields' => 'setCustomFields' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'first_name' => 'getFirstName', + 'last_name' => 'getLastName', + 'owner_id' => 'getOwnerId', + 'org_id' => 'getOrgId', + 'add_time' => 'getAddTime', + 'update_time' => 'getUpdateTime', + 'emails' => 'getEmails', + 'phones' => 'getPhones', + 'is_deleted' => 'getIsDeleted', + 'visible_to' => 'getVisibleTo', + 'label_ids' => 'getLabelIds', + 'picture_id' => 'getPictureId', + 'postal_address' => 'getPostalAddress', + 'notes' => 'getNotes', + 'im' => 'getIm', + 'birthday' => 'getBirthday', + 'job_title' => 'getJobTitle', + 'custom_fields' => 'getCustomFields' + ]; + + /** + * 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; + $this->container['name'] = $data['name'] ?? null; + $this->container['first_name'] = $data['first_name'] ?? null; + $this->container['last_name'] = $data['last_name'] ?? null; + $this->container['owner_id'] = $data['owner_id'] ?? null; + $this->container['org_id'] = $data['org_id'] ?? null; + $this->container['add_time'] = $data['add_time'] ?? null; + $this->container['update_time'] = $data['update_time'] ?? null; + $this->container['emails'] = $data['emails'] ?? null; + $this->container['phones'] = $data['phones'] ?? null; + $this->container['is_deleted'] = $data['is_deleted'] ?? null; + $this->container['visible_to'] = $data['visible_to'] ?? null; + $this->container['label_ids'] = $data['label_ids'] ?? null; + $this->container['picture_id'] = $data['picture_id'] ?? null; + $this->container['postal_address'] = $data['postal_address'] ?? null; + $this->container['notes'] = $data['notes'] ?? null; + $this->container['im'] = $data['im'] ?? null; + $this->container['birthday'] = $data['birthday'] ?? null; + $this->container['job_title'] = $data['job_title'] ?? null; + $this->container['custom_fields'] = $data['custom_fields'] ?? 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 person + * + * @return self + */ + public function setId($id): self + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The name of the person + * + * @return self + */ + public function setName($name): self + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets first_name + * + * @return string|null + */ + public function getFirstName() + { + return $this->container['first_name']; + } + + /** + * Sets first_name + * + * @param string|null $first_name The first name of the person + * + * @return self + */ + public function setFirstName($first_name): self + { + $this->container['first_name'] = $first_name; + + return $this; + } + + /** + * Gets last_name + * + * @return string|null + */ + public function getLastName() + { + return $this->container['last_name']; + } + + /** + * Sets last_name + * + * @param string|null $last_name The last name of the person + * + * @return self + */ + public function setLastName($last_name): self + { + $this->container['last_name'] = $last_name; + + return $this; + } + + /** + * Gets owner_id + * + * @return int|null + */ + public function getOwnerId() + { + return $this->container['owner_id']; + } + + /** + * Sets owner_id + * + * @param int|null $owner_id The ID of the user who owns the person + * + * @return self + */ + public function setOwnerId($owner_id): self + { + $this->container['owner_id'] = $owner_id; + + return $this; + } + + /** + * Gets org_id + * + * @return int|null + */ + public function getOrgId() + { + return $this->container['org_id']; + } + + /** + * Sets org_id + * + * @param int|null $org_id The ID of the organization linked to the person + * + * @return self + */ + public function setOrgId($org_id): self + { + $this->container['org_id'] = $org_id; + + 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 creation date and time of the person + * + * @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 last updated date and time of the person + * + * @return self + */ + public function setUpdateTime($update_time): self + { + $this->container['update_time'] = $update_time; + + return $this; + } + + /** + * Gets emails + * + * @return \Pipedrive\versions\v2\Model\PersonEmails[]|null + */ + public function getEmails() + { + return $this->container['emails']; + } + + /** + * Sets emails + * + * @param \Pipedrive\versions\v2\Model\PersonEmails[]|null $emails The emails of the person + * + * @return self + */ + public function setEmails($emails): self + { + $this->container['emails'] = $emails; + + return $this; + } + + /** + * Gets phones + * + * @return \Pipedrive\versions\v2\Model\PersonPhones[]|null + */ + public function getPhones() + { + return $this->container['phones']; + } + + /** + * Sets phones + * + * @param \Pipedrive\versions\v2\Model\PersonPhones[]|null $phones The phones of the person + * + * @return self + */ + public function setPhones($phones): self + { + $this->container['phones'] = $phones; + + return $this; + } + + /** + * Gets is_deleted + * + * @return bool|null + */ + public function getIsDeleted() + { + return $this->container['is_deleted']; + } + + /** + * Sets is_deleted + * + * @param bool|null $is_deleted Whether the person is deleted or not + * + * @return self + */ + public function setIsDeleted($is_deleted): self + { + $this->container['is_deleted'] = $is_deleted; + + return $this; + } + + /** + * Gets visible_to + * + * @return int|null + */ + public function getVisibleTo() + { + return $this->container['visible_to']; + } + + /** + * Sets visible_to + * + * @param int|null $visible_to The visibility of the person + * + * @return self + */ + public function setVisibleTo($visible_to): self + { + $this->container['visible_to'] = $visible_to; + + 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 person + * + * @return self + */ + public function setLabelIds($label_ids): self + { + $this->container['label_ids'] = $label_ids; + + return $this; + } + + /** + * Gets picture_id + * + * @return int|null + */ + public function getPictureId() + { + return $this->container['picture_id']; + } + + /** + * Sets picture_id + * + * @param int|null $picture_id The ID of the picture associated with the person + * + * @return self + */ + public function setPictureId($picture_id): self + { + $this->container['picture_id'] = $picture_id; + + return $this; + } + + /** + * Gets postal_address + * + * @return \Pipedrive\versions\v2\Model\PersonPostalAddress|null + */ + public function getPostalAddress() + { + return $this->container['postal_address']; + } + + /** + * Sets postal_address + * + * @param \Pipedrive\versions\v2\Model\PersonPostalAddress|null $postal_address postal_address + * + * @return self + */ + public function setPostalAddress($postal_address): self + { + $this->container['postal_address'] = $postal_address; + + return $this; + } + + /** + * Gets notes + * + * @return string|null + */ + public function getNotes() + { + return $this->container['notes']; + } + + /** + * Sets notes + * + * @param string|null $notes Contact sync notes of the person, maximum 10 000 characters, included if contact sync is enabled for the company + * + * @return self + */ + public function setNotes($notes): self + { + $this->container['notes'] = $notes; + + return $this; + } + + /** + * Gets im + * + * @return \Pipedrive\versions\v2\Model\PersonIm[]|null + */ + public function getIm() + { + return $this->container['im']; + } + + /** + * Sets im + * + * @param \Pipedrive\versions\v2\Model\PersonIm[]|null $im The instant messaging accounts of the person, included if contact sync is enabled for the company + * + * @return self + */ + public function setIm($im): self + { + $this->container['im'] = $im; + + return $this; + } + + /** + * Gets birthday + * + * @return string|null + */ + public function getBirthday() + { + return $this->container['birthday']; + } + + /** + * Sets birthday + * + * @param string|null $birthday The birthday of the person, included if contact sync is enabled for the company + * + * @return self + */ + public function setBirthday($birthday): self + { + $this->container['birthday'] = $birthday; + + return $this; + } + + /** + * Gets job_title + * + * @return string|null + */ + public function getJobTitle() + { + return $this->container['job_title']; + } + + /** + * Sets job_title + * + * @param string|null $job_title The job title of the person, included if contact sync is enabled for the company + * + * @return self + */ + public function setJobTitle($job_title): self + { + $this->container['job_title'] = $job_title; + + return $this; + } + + /** + * Gets custom_fields + * + * @return array|null + */ + public function getCustomFields() + { + return $this->container['custom_fields']; + } + + /** + * Sets custom_fields + * + * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes + * + * @return self + */ + public function setCustomFields($custom_fields): self + { + $this->container['custom_fields'] = $custom_fields; + + 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/v2/Model/PersonEmails.php b/lib/versions/v2/Model/PersonEmails.php new file mode 100644 index 00000000..983e75ad --- /dev/null +++ b/lib/versions/v2/Model/PersonEmails.php @@ -0,0 +1,405 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class PersonEmails implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'Person_emails'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'value' => 'string', + 'primary' => 'bool', + 'label' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'value' => null, + 'primary' => null, + 'label' => 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 = [ + 'value' => 'value', + 'primary' => 'primary', + 'label' => 'label' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'value' => 'setValue', + 'primary' => 'setPrimary', + 'label' => 'setLabel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'value' => 'getValue', + 'primary' => 'getPrimary', + 'label' => 'getLabel' + ]; + + /** + * 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['value'] = $data['value'] ?? null; + $this->container['primary'] = $data['primary'] ?? null; + $this->container['label'] = $data['label'] ?? 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 value + * + * @return string|null + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string|null $value The email address of the person + * + * @return self + */ + public function setValue($value): self + { + $this->container['value'] = $value; + + return $this; + } + + /** + * Gets primary + * + * @return bool|null + */ + public function getPrimary() + { + return $this->container['primary']; + } + + /** + * Sets primary + * + * @param bool|null $primary Whether the email is primary or not + * + * @return self + */ + public function setPrimary($primary): self + { + $this->container['primary'] = $primary; + + return $this; + } + + /** + * Gets label + * + * @return string|null + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string|null $label The email address classification label + * + * @return self + */ + public function setLabel($label): self + { + $this->container['label'] = $label; + + 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/v2/Model/PersonIm.php b/lib/versions/v2/Model/PersonIm.php new file mode 100644 index 00000000..418d99b6 --- /dev/null +++ b/lib/versions/v2/Model/PersonIm.php @@ -0,0 +1,405 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class PersonIm implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'Person_im'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'value' => 'string', + 'primary' => 'bool', + 'label' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'value' => null, + 'primary' => null, + 'label' => 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 = [ + 'value' => 'value', + 'primary' => 'primary', + 'label' => 'label' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'value' => 'setValue', + 'primary' => 'setPrimary', + 'label' => 'setLabel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'value' => 'getValue', + 'primary' => 'getPrimary', + 'label' => 'getLabel' + ]; + + /** + * 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['value'] = $data['value'] ?? null; + $this->container['primary'] = $data['primary'] ?? null; + $this->container['label'] = $data['label'] ?? 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 value + * + * @return string|null + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string|null $value The instant messaging account of the person + * + * @return self + */ + public function setValue($value): self + { + $this->container['value'] = $value; + + return $this; + } + + /** + * Gets primary + * + * @return bool|null + */ + public function getPrimary() + { + return $this->container['primary']; + } + + /** + * Sets primary + * + * @param bool|null $primary Whether the instant messaging account is primary or not + * + * @return self + */ + public function setPrimary($primary): self + { + $this->container['primary'] = $primary; + + return $this; + } + + /** + * Gets label + * + * @return string|null + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string|null $label The instant messaging account classification label + * + * @return self + */ + public function setLabel($label): self + { + $this->container['label'] = $label; + + 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/v2/Model/PersonItem.php b/lib/versions/v2/Model/PersonItem.php index 4474324c..8863bd14 100644 --- a/lib/versions/v2/Model/PersonItem.php +++ b/lib/versions/v2/Model/PersonItem.php @@ -74,15 +74,15 @@ class PersonItem implements ModelInterface, ArrayAccess, JsonSerializable 'org_id' => 'int', 'add_time' => 'string', 'update_time' => 'string', - 'emails' => '\Pipedrive\versions\v2\Model\PersonItemEmails[]', - 'phones' => '\Pipedrive\versions\v2\Model\PersonItemPhones[]', + 'emails' => '\Pipedrive\versions\v2\Model\PersonEmails[]', + 'phones' => '\Pipedrive\versions\v2\Model\PersonPhones[]', 'is_deleted' => 'bool', 'visible_to' => 'int', 'label_ids' => 'int[]', 'picture_id' => 'int', - 'postal_address' => '\Pipedrive\versions\v2\Model\PersonItemPostalAddress', + 'postal_address' => '\Pipedrive\versions\v2\Model\PersonPostalAddress', 'notes' => 'string', - 'im' => '\Pipedrive\versions\v2\Model\PersonItemIm[]', + 'im' => '\Pipedrive\versions\v2\Model\PersonIm[]', 'birthday' => 'string', 'job_title' => 'string', 'custom_fields' => 'array' @@ -537,7 +537,7 @@ public function setUpdateTime($update_time): self /** * Gets emails * - * @return \Pipedrive\versions\v2\Model\PersonItemEmails[]|null + * @return \Pipedrive\versions\v2\Model\PersonEmails[]|null */ public function getEmails() { @@ -547,7 +547,7 @@ public function getEmails() /** * Sets emails * - * @param \Pipedrive\versions\v2\Model\PersonItemEmails[]|null $emails The emails of the person + * @param \Pipedrive\versions\v2\Model\PersonEmails[]|null $emails The emails of the person * * @return self */ @@ -561,7 +561,7 @@ public function setEmails($emails): self /** * Gets phones * - * @return \Pipedrive\versions\v2\Model\PersonItemPhones[]|null + * @return \Pipedrive\versions\v2\Model\PersonPhones[]|null */ public function getPhones() { @@ -571,7 +571,7 @@ public function getPhones() /** * Sets phones * - * @param \Pipedrive\versions\v2\Model\PersonItemPhones[]|null $phones The phones of the person + * @param \Pipedrive\versions\v2\Model\PersonPhones[]|null $phones The phones of the person * * @return self */ @@ -681,7 +681,7 @@ public function setPictureId($picture_id): self /** * Gets postal_address * - * @return \Pipedrive\versions\v2\Model\PersonItemPostalAddress|null + * @return \Pipedrive\versions\v2\Model\PersonPostalAddress|null */ public function getPostalAddress() { @@ -691,7 +691,7 @@ public function getPostalAddress() /** * Sets postal_address * - * @param \Pipedrive\versions\v2\Model\PersonItemPostalAddress|null $postal_address postal_address + * @param \Pipedrive\versions\v2\Model\PersonPostalAddress|null $postal_address postal_address * * @return self */ @@ -729,7 +729,7 @@ public function setNotes($notes): self /** * Gets im * - * @return \Pipedrive\versions\v2\Model\PersonItemIm[]|null + * @return \Pipedrive\versions\v2\Model\PersonIm[]|null */ public function getIm() { @@ -739,7 +739,7 @@ public function getIm() /** * Sets im * - * @param \Pipedrive\versions\v2\Model\PersonItemIm[]|null $im The instant messaging accounts of the person, included if contact sync is enabled for the company + * @param \Pipedrive\versions\v2\Model\PersonIm[]|null $im The instant messaging accounts of the person, included if contact sync is enabled for the company * * @return self */ diff --git a/lib/versions/v2/Model/PersonPhones.php b/lib/versions/v2/Model/PersonPhones.php new file mode 100644 index 00000000..541e30e1 --- /dev/null +++ b/lib/versions/v2/Model/PersonPhones.php @@ -0,0 +1,405 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class PersonPhones implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'Person_phones'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'value' => 'string', + 'primary' => 'bool', + 'label' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'value' => null, + 'primary' => null, + 'label' => 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 = [ + 'value' => 'value', + 'primary' => 'primary', + 'label' => 'label' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'value' => 'setValue', + 'primary' => 'setPrimary', + 'label' => 'setLabel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'value' => 'getValue', + 'primary' => 'getPrimary', + 'label' => 'getLabel' + ]; + + /** + * 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['value'] = $data['value'] ?? null; + $this->container['primary'] = $data['primary'] ?? null; + $this->container['label'] = $data['label'] ?? 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 value + * + * @return string|null + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string|null $value The phone number of the person + * + * @return self + */ + public function setValue($value): self + { + $this->container['value'] = $value; + + return $this; + } + + /** + * Gets primary + * + * @return bool|null + */ + public function getPrimary() + { + return $this->container['primary']; + } + + /** + * Sets primary + * + * @param bool|null $primary Whether the phone number is primary or not + * + * @return self + */ + public function setPrimary($primary): self + { + $this->container['primary'] = $primary; + + return $this; + } + + /** + * Gets label + * + * @return string|null + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string|null $label The phone number classification label + * + * @return self + */ + public function setLabel($label): self + { + $this->container['label'] = $label; + + 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/v2/Model/PersonPostalAddress.php b/lib/versions/v2/Model/PersonPostalAddress.php new file mode 100644 index 00000000..d63e8aa7 --- /dev/null +++ b/lib/versions/v2/Model/PersonPostalAddress.php @@ -0,0 +1,616 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class PersonPostalAddress implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'Person_postal_address'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'value' => 'string', + 'country' => 'string', + 'admin_area_level_1' => 'string', + 'admin_area_level_2' => 'string', + 'locality' => 'string', + 'sublocality' => 'string', + 'route' => 'string', + 'street_number' => 'string', + 'subpremise' => 'string', + 'postal_code' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'value' => null, + 'country' => null, + 'admin_area_level_1' => null, + 'admin_area_level_2' => null, + 'locality' => null, + 'sublocality' => null, + 'route' => null, + 'street_number' => null, + 'subpremise' => null, + 'postal_code' => 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 = [ + 'value' => 'value', + 'country' => 'country', + 'admin_area_level_1' => 'admin_area_level_1', + 'admin_area_level_2' => 'admin_area_level_2', + 'locality' => 'locality', + 'sublocality' => 'sublocality', + 'route' => 'route', + 'street_number' => 'street_number', + 'subpremise' => 'subpremise', + 'postal_code' => 'postal_code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'value' => 'setValue', + 'country' => 'setCountry', + 'admin_area_level_1' => 'setAdminAreaLevel1', + 'admin_area_level_2' => 'setAdminAreaLevel2', + 'locality' => 'setLocality', + 'sublocality' => 'setSublocality', + 'route' => 'setRoute', + 'street_number' => 'setStreetNumber', + 'subpremise' => 'setSubpremise', + 'postal_code' => 'setPostalCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'value' => 'getValue', + 'country' => 'getCountry', + 'admin_area_level_1' => 'getAdminAreaLevel1', + 'admin_area_level_2' => 'getAdminAreaLevel2', + 'locality' => 'getLocality', + 'sublocality' => 'getSublocality', + 'route' => 'getRoute', + 'street_number' => 'getStreetNumber', + 'subpremise' => 'getSubpremise', + 'postal_code' => 'getPostalCode' + ]; + + /** + * 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['value'] = $data['value'] ?? null; + $this->container['country'] = $data['country'] ?? null; + $this->container['admin_area_level_1'] = $data['admin_area_level_1'] ?? null; + $this->container['admin_area_level_2'] = $data['admin_area_level_2'] ?? null; + $this->container['locality'] = $data['locality'] ?? null; + $this->container['sublocality'] = $data['sublocality'] ?? null; + $this->container['route'] = $data['route'] ?? null; + $this->container['street_number'] = $data['street_number'] ?? null; + $this->container['subpremise'] = $data['subpremise'] ?? null; + $this->container['postal_code'] = $data['postal_code'] ?? 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 value + * + * @return string|null + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string|null $value The full address of the person + * + * @return self + */ + public function setValue($value): self + { + $this->container['value'] = $value; + + return $this; + } + + /** + * Gets country + * + * @return string|null + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string|null $country Country of the person + * + * @return self + */ + public function setCountry($country): self + { + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets admin_area_level_1 + * + * @return string|null + */ + public function getAdminAreaLevel1() + { + return $this->container['admin_area_level_1']; + } + + /** + * Sets admin_area_level_1 + * + * @param string|null $admin_area_level_1 Admin area level 1 (e.g. state) of the person + * + * @return self + */ + public function setAdminAreaLevel1($admin_area_level_1): self + { + $this->container['admin_area_level_1'] = $admin_area_level_1; + + return $this; + } + + /** + * Gets admin_area_level_2 + * + * @return string|null + */ + public function getAdminAreaLevel2() + { + return $this->container['admin_area_level_2']; + } + + /** + * Sets admin_area_level_2 + * + * @param string|null $admin_area_level_2 Admin area level 2 (e.g. county) of the person + * + * @return self + */ + public function setAdminAreaLevel2($admin_area_level_2): self + { + $this->container['admin_area_level_2'] = $admin_area_level_2; + + return $this; + } + + /** + * Gets locality + * + * @return string|null + */ + public function getLocality() + { + return $this->container['locality']; + } + + /** + * Sets locality + * + * @param string|null $locality Locality (e.g. city) of the person + * + * @return self + */ + public function setLocality($locality): self + { + $this->container['locality'] = $locality; + + return $this; + } + + /** + * Gets sublocality + * + * @return string|null + */ + public function getSublocality() + { + return $this->container['sublocality']; + } + + /** + * Sets sublocality + * + * @param string|null $sublocality Sublocality (e.g. neighborhood) of the person + * + * @return self + */ + public function setSublocality($sublocality): self + { + $this->container['sublocality'] = $sublocality; + + return $this; + } + + /** + * Gets route + * + * @return string|null + */ + public function getRoute() + { + return $this->container['route']; + } + + /** + * Sets route + * + * @param string|null $route Route (e.g. street) of the person + * + * @return self + */ + public function setRoute($route): self + { + $this->container['route'] = $route; + + return $this; + } + + /** + * Gets street_number + * + * @return string|null + */ + public function getStreetNumber() + { + return $this->container['street_number']; + } + + /** + * Sets street_number + * + * @param string|null $street_number Street number of the person + * + * @return self + */ + public function setStreetNumber($street_number): self + { + $this->container['street_number'] = $street_number; + + return $this; + } + + /** + * Gets subpremise + * + * @return string|null + */ + public function getSubpremise() + { + return $this->container['subpremise']; + } + + /** + * Sets subpremise + * + * @param string|null $subpremise Subpremise (e.g. apartment/suite number) of the person + * + * @return self + */ + public function setSubpremise($subpremise): self + { + $this->container['subpremise'] = $subpremise; + + return $this; + } + + /** + * Gets postal_code + * + * @return string|null + */ + public function getPostalCode() + { + return $this->container['postal_code']; + } + + /** + * Sets postal_code + * + * @param string|null $postal_code Postal code of the person + * + * @return self + */ + public function setPostalCode($postal_code): self + { + $this->container['postal_code'] = $postal_code; + + 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/v2/Model/PersonRequestBody.php b/lib/versions/v2/Model/PersonRequestBody.php index 172c8643..cf2072e8 100644 --- a/lib/versions/v2/Model/PersonRequestBody.php +++ b/lib/versions/v2/Model/PersonRequestBody.php @@ -71,8 +71,8 @@ class PersonRequestBody implements ModelInterface, ArrayAccess, JsonSerializable 'org_id' => 'int', 'add_time' => 'string', 'update_time' => 'string', - 'emails' => '\Pipedrive\versions\v2\Model\PersonItemEmails[]', - 'phones' => '\Pipedrive\versions\v2\Model\PersonItemPhones[]', + 'emails' => '\Pipedrive\versions\v2\Model\PersonEmails[]', + 'phones' => '\Pipedrive\versions\v2\Model\PersonPhones[]', 'visible_to' => 'int', 'label_ids' => 'int[]', 'marketing_status' => 'string', @@ -441,7 +441,7 @@ public function setUpdateTime($update_time): self /** * Gets emails * - * @return \Pipedrive\versions\v2\Model\PersonItemEmails[]|null + * @return \Pipedrive\versions\v2\Model\PersonEmails[]|null */ public function getEmails() { @@ -451,7 +451,7 @@ public function getEmails() /** * Sets emails * - * @param \Pipedrive\versions\v2\Model\PersonItemEmails[]|null $emails The emails of the person + * @param \Pipedrive\versions\v2\Model\PersonEmails[]|null $emails The emails of the person * * @return self */ @@ -465,7 +465,7 @@ public function setEmails($emails): self /** * Gets phones * - * @return \Pipedrive\versions\v2\Model\PersonItemPhones[]|null + * @return \Pipedrive\versions\v2\Model\PersonPhones[]|null */ public function getPhones() { @@ -475,7 +475,7 @@ public function getPhones() /** * Sets phones * - * @param \Pipedrive\versions\v2\Model\PersonItemPhones[]|null $phones The phones of the person + * @param \Pipedrive\versions\v2\Model\PersonPhones[]|null $phones The phones of the person * * @return self */ diff --git a/lib/versions/v2/Model/ProductWithArrayPrices.php b/lib/versions/v2/Model/ProductWithArrayPrices.php index 0eedc62d..adc6252f 100644 --- a/lib/versions/v2/Model/ProductWithArrayPrices.php +++ b/lib/versions/v2/Model/ProductWithArrayPrices.php @@ -433,7 +433,7 @@ public function getIsDeleted() /** * Sets is_deleted * - * @param bool|null $is_deleted Whether this product will be made marked as deleted or not + * @param bool|null $is_deleted Whether this product will be marked as deleted or not * * @return self */ From 21aa01c283184c0cbf5a2aa41842a9c1f796dc5b Mon Sep 17 00:00:00 2001 From: pipedrive-bot Date: Mon, 4 May 2026 09:06:14 +0000 Subject: [PATCH 2/3] Build 325 - version-major --- CHANGELOG.md | 10 + docs/versions/v1/Api/NotesApi.md | 8 +- docs/versions/v1/Api/ProjectBoardsApi.md | 136 + docs/versions/v1/Api/ProjectPhasesApi.md | 139 + docs/versions/v1/Api/ProjectTemplatesApi.md | 132 - docs/versions/v1/Api/ProjectsApi.md | 129 - docs/versions/v1/Model/AddNoteRequest.md | 12 +- docs/versions/v1/Model/AddNoteRequestAllOf.md | 11 +- docs/versions/v1/Model/BaseNote.md | 3 + docs/versions/v1/Model/BaseNoteTask.md | 9 + docs/versions/v1/Model/Note.md | 2 + docs/versions/v1/Model/NoteConnectToParams.md | 1 + docs/versions/v1/Model/NoteParams.md | 1 + docs/versions/v1/README.md | 9 +- docs/versions/v2/Api/BetaApi.md | 1097 +++- docs/versions/v2/Api/DealInstallmentsApi.md | 287 + docs/versions/v2/Api/DealProductsApi.md | 497 ++ docs/versions/v2/Api/DealsApi.md | 1130 +--- docs/versions/v2/Api/OrganizationsApi.md | 16 +- docs/versions/v2/Api/PersonsApi.md | 16 +- docs/versions/v2/Api/ProjectBoardsApi.md | 336 + docs/versions/v2/Api/ProjectFieldsApi.md | 545 ++ docs/versions/v2/Api/ProjectPhasesApi.md | 339 + docs/versions/v2/Api/ProjectTemplatesApi.md | 141 + docs/versions/v2/Api/ProjectsApi.md | 701 ++ docs/versions/v2/Api/TasksApi.md | 351 ++ .../v2/Model/AddProductRequestBody.md | 2 +- docs/versions/v2/Model/AddTaskResponse.md | 11 + docs/versions/v2/Model/BaseProduct.md | 2 +- docs/versions/v2/Model/BaseProductAllOf.md | 2 +- docs/versions/v2/Model/BoardItem.md | 13 + docs/versions/v2/Model/BoardRequestBody.md | 10 + docs/versions/v2/Model/CreateProjectField.md | 10 + .../v2/Model/CreateProjectFieldRequest.md | 14 + docs/versions/v2/Model/Deal.md | 2 +- docs/versions/v2/Model/DealItem.md | 2 +- docs/versions/v2/Model/DealRequestBody.md | 2 +- .../v2/Model/DeleteProjectBoardResponse.md | 10 + .../Model/DeleteProjectBoardResponseData.md | 9 + docs/versions/v2/Model/DeleteProjectField.md | 10 + .../v2/Model/DeleteProjectFieldData.md | 15 + .../v2/Model/DeleteProjectPhaseResponse.md | 10 + .../Model/DeleteProjectPhaseResponseData.md | 9 + .../v2/Model/DeleteProjectResponse.md | 10 + .../v2/Model/DeleteProjectResponseData.md | 9 + docs/versions/v2/Model/DeleteTaskResponse.md | 11 + .../v2/Model/DeleteTaskResponseData.md | 9 + docs/versions/v2/Model/GetBoards.md | 11 + docs/versions/v2/Model/GetPhases.md | 11 + docs/versions/v2/Model/GetProjectField.md | 10 + docs/versions/v2/Model/GetProjectFields.md | 11 + .../Model/GetProjectPermittedUsersResponse.md | 10 + .../v2/Model/GetProjectTemplateResponse.md | 11 + .../v2/Model/GetProjectTemplatesResponse.md | 11 + docs/versions/v2/Model/GetProjects.md | 11 + docs/versions/v2/Model/GetProjectsAllOf.md | 10 + docs/versions/v2/Model/GetTaskResponse.md | 11 + docs/versions/v2/Model/GetTasksResponse.md | 11 + docs/versions/v2/Model/OrganizationItem.md | 2 +- .../v2/Model/OrganizationRequestBody.md | 2 +- docs/versions/v2/Model/Person.md | 2 +- docs/versions/v2/Model/PersonItem.md | 2 +- docs/versions/v2/Model/PersonRequestBody.md | 2 +- docs/versions/v2/Model/PhaseItem.md | 14 + docs/versions/v2/Model/PhaseRequestBody.md | 11 + docs/versions/v2/Model/PostPatchGetBoard.md | 10 + docs/versions/v2/Model/PostPatchGetPhase.md | 10 + docs/versions/v2/Model/PostPatchGetProject.md | 10 + .../v2/Model/PostPatchGetProjectAllOf.md | 9 + docs/versions/v2/Model/ProductRequest.md | 2 +- .../v2/Model/ProductWithArrayPrices.md | 2 +- .../v2/Model/ProjectChangelogResponse.md | 11 + .../v2/Model/ProjectChangelogResponseData.md | 14 + docs/versions/v2/Model/ProjectFieldItem.md | 18 + .../v2/Model/ProjectFieldItemUiVisibility.md | 10 + docs/versions/v2/Model/ProjectItem.md | 27 + docs/versions/v2/Model/ProjectRequestBody.md | 22 + docs/versions/v2/Model/ProjectSearchItem.md | 10 + .../v2/Model/ProjectSearchItemItem.md | 23 + .../v2/Model/ProjectSearchItemItemDeal.md | 10 + .../ProjectSearchItemItemOrganization.md | 11 + .../v2/Model/ProjectSearchItemItemOwner.md | 9 + .../v2/Model/ProjectSearchItemItemPerson.md | 10 + .../v2/Model/ProjectSearchItemItemPhase.md | 10 + .../v2/Model/ProjectSearchResponse.md | 11 + .../v2/Model/ProjectSearchResponseAllOf.md | 10 + .../Model/ProjectSearchResponseAllOfData.md | 9 + docs/versions/v2/Model/ProjectTemplateItem.md | 15 + docs/versions/v2/Model/TaskItem.md | 23 + docs/versions/v2/Model/TaskPatchRequest.md | 19 + docs/versions/v2/Model/TaskPostRequest.md | 19 + .../Model/UpdateOrganizationFieldRequest.md | 1 - .../v2/Model/UpdateProductRequestBody.md | 2 +- .../v2/Model/UpdateProjectFieldRequest.md | 12 + docs/versions/v2/Model/UpdateTaskResponse.md | 11 + docs/versions/v2/README.md | 136 +- lib/versions/v1/Api/NotesApi.php | 46 +- lib/versions/v1/Api/ProjectBoardsApi.php | 715 +++ lib/versions/v1/Api/ProjectPhasesApi.php | 735 +++ lib/versions/v1/Api/ProjectTemplatesApi.php | 592 -- lib/versions/v1/Api/ProjectsApi.php | 572 -- lib/versions/v1/Model/AddNoteRequest.php | 80 +- lib/versions/v1/Model/AddNoteRequestAllOf.php | 50 +- lib/versions/v1/Model/BaseNote.php | 90 + lib/versions/v1/Model/BaseNoteTask.php | 346 + lib/versions/v1/Model/Note.php | 70 +- lib/versions/v1/Model/NoteConnectToParams.php | 40 +- lib/versions/v1/Model/NoteParams.php | 40 +- lib/versions/v2/Api/BetaApi.php | 5013 +++++++++++++-- lib/versions/v2/Api/DealInstallmentsApi.php | 1441 +++++ lib/versions/v2/Api/DealProductsApi.php | 2405 +++++++ lib/versions/v2/Api/DealsApi.php | 5612 +++-------------- lib/versions/v2/Api/OrganizationsApi.php | 92 +- lib/versions/v2/Api/PersonsApi.php | 92 +- lib/versions/v2/Api/ProjectBoardsApi.php | 1612 +++++ lib/versions/v2/Api/ProjectFieldsApi.php | 2587 ++++++++ lib/versions/v2/Api/ProjectPhasesApi.php | 1632 +++++ lib/versions/v2/Api/ProjectTemplatesApi.php | 741 +++ lib/versions/v2/Api/ProjectsApi.php | 3306 ++++++++++ lib/versions/v2/Api/TasksApi.php | 1703 +++++ .../v2/Model/AddProductRequestBody.php | 2 +- lib/versions/v2/Model/AddTaskResponse.php | 405 ++ lib/versions/v2/Model/BaseProduct.php | 2 +- lib/versions/v2/Model/BaseProductAllOf.php | 2 +- lib/versions/v2/Model/BoardItem.php | 465 ++ lib/versions/v2/Model/BoardRequestBody.php | 384 ++ lib/versions/v2/Model/CreateProjectField.php | 375 ++ .../v2/Model/CreateProjectFieldRequest.php | 580 ++ lib/versions/v2/Model/Deal.php | 2 +- lib/versions/v2/Model/DealItem.php | 2 +- lib/versions/v2/Model/DealRequestBody.php | 2 +- .../v2/Model/DeleteProjectBoardResponse.php | 375 ++ .../Model/DeleteProjectBoardResponseData.php | 345 + lib/versions/v2/Model/DeleteProjectField.php | 375 ++ .../v2/Model/DeleteProjectFieldData.php | 540 ++ .../v2/Model/DeleteProjectPhaseResponse.php | 375 ++ .../Model/DeleteProjectPhaseResponseData.php | 345 + .../v2/Model/DeleteProjectResponse.php | 375 ++ .../v2/Model/DeleteProjectResponseData.php | 345 + lib/versions/v2/Model/DeleteTaskResponse.php | 405 ++ .../v2/Model/DeleteTaskResponseData.php | 345 + lib/versions/v2/Model/GetBoards.php | 405 ++ lib/versions/v2/Model/GetPhases.php | 405 ++ lib/versions/v2/Model/GetProjectField.php | 375 ++ lib/versions/v2/Model/GetProjectFields.php | 405 ++ .../GetProjectPermittedUsersResponse.php | 375 ++ .../v2/Model/GetProjectTemplateResponse.php | 405 ++ .../v2/Model/GetProjectTemplatesResponse.php | 405 ++ lib/versions/v2/Model/GetProjects.php | 405 ++ lib/versions/v2/Model/GetProjectsAllOf.php | 375 ++ lib/versions/v2/Model/GetTaskResponse.php | 405 ++ lib/versions/v2/Model/GetTasksResponse.php | 405 ++ lib/versions/v2/Model/OrganizationItem.php | 2 +- .../v2/Model/OrganizationRequestBody.php | 2 +- lib/versions/v2/Model/Person.php | 2 +- lib/versions/v2/Model/PersonItem.php | 2 +- lib/versions/v2/Model/PersonRequestBody.php | 2 +- lib/versions/v2/Model/PhaseItem.php | 495 ++ lib/versions/v2/Model/PhaseRequestBody.php | 414 ++ lib/versions/v2/Model/PostPatchGetBoard.php | 375 ++ lib/versions/v2/Model/PostPatchGetPhase.php | 375 ++ lib/versions/v2/Model/PostPatchGetProject.php | 375 ++ .../v2/Model/PostPatchGetProjectAllOf.php | 345 + lib/versions/v2/Model/ProductRequest.php | 2 +- .../v2/Model/ProductWithArrayPrices.php | 2 +- .../v2/Model/ProjectChangelogResponse.php | 405 ++ .../v2/Model/ProjectChangelogResponseData.php | 495 ++ lib/versions/v2/Model/ProjectFieldItem.php | 728 +++ .../v2/Model/ProjectFieldItemUiVisibility.php | 376 ++ lib/versions/v2/Model/ProjectItem.php | 885 +++ lib/versions/v2/Model/ProjectRequestBody.php | 735 +++ lib/versions/v2/Model/ProjectSearchItem.php | 375 ++ .../v2/Model/ProjectSearchItemItem.php | 765 +++ .../v2/Model/ProjectSearchItemItemDeal.php | 375 ++ .../ProjectSearchItemItemOrganization.php | 405 ++ .../v2/Model/ProjectSearchItemItemOwner.php | 345 + .../v2/Model/ProjectSearchItemItemPerson.php | 375 ++ .../v2/Model/ProjectSearchItemItemPhase.php | 375 ++ .../v2/Model/ProjectSearchResponse.php | 405 ++ .../v2/Model/ProjectSearchResponseAllOf.php | 375 ++ .../Model/ProjectSearchResponseAllOfData.php | 345 + lib/versions/v2/Model/ProjectTemplateItem.php | 525 ++ lib/versions/v2/Model/TaskItem.php | 789 +++ lib/versions/v2/Model/TaskPatchRequest.php | 749 +++ lib/versions/v2/Model/TaskPostRequest.php | 755 +++ .../Model/UpdateOrganizationFieldRequest.php | 40 +- .../v2/Model/UpdateProductRequestBody.php | 2 +- .../v2/Model/UpdateProjectFieldRequest.php | 450 ++ lib/versions/v2/Model/UpdateTaskResponse.php | 405 ++ 189 files changed, 52822 insertions(+), 7952 deletions(-) create mode 100644 docs/versions/v1/Api/ProjectBoardsApi.md create mode 100644 docs/versions/v1/Api/ProjectPhasesApi.md create mode 100644 docs/versions/v1/Model/BaseNoteTask.md create mode 100644 docs/versions/v2/Api/DealInstallmentsApi.md create mode 100644 docs/versions/v2/Api/DealProductsApi.md create mode 100644 docs/versions/v2/Api/ProjectBoardsApi.md create mode 100644 docs/versions/v2/Api/ProjectFieldsApi.md create mode 100644 docs/versions/v2/Api/ProjectPhasesApi.md create mode 100644 docs/versions/v2/Api/ProjectTemplatesApi.md create mode 100644 docs/versions/v2/Api/ProjectsApi.md create mode 100644 docs/versions/v2/Api/TasksApi.md create mode 100644 docs/versions/v2/Model/AddTaskResponse.md create mode 100644 docs/versions/v2/Model/BoardItem.md create mode 100644 docs/versions/v2/Model/BoardRequestBody.md create mode 100644 docs/versions/v2/Model/CreateProjectField.md create mode 100644 docs/versions/v2/Model/CreateProjectFieldRequest.md create mode 100644 docs/versions/v2/Model/DeleteProjectBoardResponse.md create mode 100644 docs/versions/v2/Model/DeleteProjectBoardResponseData.md create mode 100644 docs/versions/v2/Model/DeleteProjectField.md create mode 100644 docs/versions/v2/Model/DeleteProjectFieldData.md create mode 100644 docs/versions/v2/Model/DeleteProjectPhaseResponse.md create mode 100644 docs/versions/v2/Model/DeleteProjectPhaseResponseData.md create mode 100644 docs/versions/v2/Model/DeleteProjectResponse.md create mode 100644 docs/versions/v2/Model/DeleteProjectResponseData.md create mode 100644 docs/versions/v2/Model/DeleteTaskResponse.md create mode 100644 docs/versions/v2/Model/DeleteTaskResponseData.md create mode 100644 docs/versions/v2/Model/GetBoards.md create mode 100644 docs/versions/v2/Model/GetPhases.md create mode 100644 docs/versions/v2/Model/GetProjectField.md create mode 100644 docs/versions/v2/Model/GetProjectFields.md create mode 100644 docs/versions/v2/Model/GetProjectPermittedUsersResponse.md create mode 100644 docs/versions/v2/Model/GetProjectTemplateResponse.md create mode 100644 docs/versions/v2/Model/GetProjectTemplatesResponse.md create mode 100644 docs/versions/v2/Model/GetProjects.md create mode 100644 docs/versions/v2/Model/GetProjectsAllOf.md create mode 100644 docs/versions/v2/Model/GetTaskResponse.md create mode 100644 docs/versions/v2/Model/GetTasksResponse.md create mode 100644 docs/versions/v2/Model/PhaseItem.md create mode 100644 docs/versions/v2/Model/PhaseRequestBody.md create mode 100644 docs/versions/v2/Model/PostPatchGetBoard.md create mode 100644 docs/versions/v2/Model/PostPatchGetPhase.md create mode 100644 docs/versions/v2/Model/PostPatchGetProject.md create mode 100644 docs/versions/v2/Model/PostPatchGetProjectAllOf.md create mode 100644 docs/versions/v2/Model/ProjectChangelogResponse.md create mode 100644 docs/versions/v2/Model/ProjectChangelogResponseData.md create mode 100644 docs/versions/v2/Model/ProjectFieldItem.md create mode 100644 docs/versions/v2/Model/ProjectFieldItemUiVisibility.md create mode 100644 docs/versions/v2/Model/ProjectItem.md create mode 100644 docs/versions/v2/Model/ProjectRequestBody.md create mode 100644 docs/versions/v2/Model/ProjectSearchItem.md create mode 100644 docs/versions/v2/Model/ProjectSearchItemItem.md create mode 100644 docs/versions/v2/Model/ProjectSearchItemItemDeal.md create mode 100644 docs/versions/v2/Model/ProjectSearchItemItemOrganization.md create mode 100644 docs/versions/v2/Model/ProjectSearchItemItemOwner.md create mode 100644 docs/versions/v2/Model/ProjectSearchItemItemPerson.md create mode 100644 docs/versions/v2/Model/ProjectSearchItemItemPhase.md create mode 100644 docs/versions/v2/Model/ProjectSearchResponse.md create mode 100644 docs/versions/v2/Model/ProjectSearchResponseAllOf.md create mode 100644 docs/versions/v2/Model/ProjectSearchResponseAllOfData.md create mode 100644 docs/versions/v2/Model/ProjectTemplateItem.md create mode 100644 docs/versions/v2/Model/TaskItem.md create mode 100644 docs/versions/v2/Model/TaskPatchRequest.md create mode 100644 docs/versions/v2/Model/TaskPostRequest.md create mode 100644 docs/versions/v2/Model/UpdateProjectFieldRequest.md create mode 100644 docs/versions/v2/Model/UpdateTaskResponse.md create mode 100644 lib/versions/v1/Api/ProjectBoardsApi.php create mode 100644 lib/versions/v1/Api/ProjectPhasesApi.php create mode 100644 lib/versions/v1/Model/BaseNoteTask.php create mode 100644 lib/versions/v2/Api/DealInstallmentsApi.php create mode 100644 lib/versions/v2/Api/DealProductsApi.php create mode 100644 lib/versions/v2/Api/ProjectBoardsApi.php create mode 100644 lib/versions/v2/Api/ProjectFieldsApi.php create mode 100644 lib/versions/v2/Api/ProjectPhasesApi.php create mode 100644 lib/versions/v2/Api/ProjectTemplatesApi.php create mode 100644 lib/versions/v2/Api/ProjectsApi.php create mode 100644 lib/versions/v2/Api/TasksApi.php create mode 100644 lib/versions/v2/Model/AddTaskResponse.php create mode 100644 lib/versions/v2/Model/BoardItem.php create mode 100644 lib/versions/v2/Model/BoardRequestBody.php create mode 100644 lib/versions/v2/Model/CreateProjectField.php create mode 100644 lib/versions/v2/Model/CreateProjectFieldRequest.php create mode 100644 lib/versions/v2/Model/DeleteProjectBoardResponse.php create mode 100644 lib/versions/v2/Model/DeleteProjectBoardResponseData.php create mode 100644 lib/versions/v2/Model/DeleteProjectField.php create mode 100644 lib/versions/v2/Model/DeleteProjectFieldData.php create mode 100644 lib/versions/v2/Model/DeleteProjectPhaseResponse.php create mode 100644 lib/versions/v2/Model/DeleteProjectPhaseResponseData.php create mode 100644 lib/versions/v2/Model/DeleteProjectResponse.php create mode 100644 lib/versions/v2/Model/DeleteProjectResponseData.php create mode 100644 lib/versions/v2/Model/DeleteTaskResponse.php create mode 100644 lib/versions/v2/Model/DeleteTaskResponseData.php create mode 100644 lib/versions/v2/Model/GetBoards.php create mode 100644 lib/versions/v2/Model/GetPhases.php create mode 100644 lib/versions/v2/Model/GetProjectField.php create mode 100644 lib/versions/v2/Model/GetProjectFields.php create mode 100644 lib/versions/v2/Model/GetProjectPermittedUsersResponse.php create mode 100644 lib/versions/v2/Model/GetProjectTemplateResponse.php create mode 100644 lib/versions/v2/Model/GetProjectTemplatesResponse.php create mode 100644 lib/versions/v2/Model/GetProjects.php create mode 100644 lib/versions/v2/Model/GetProjectsAllOf.php create mode 100644 lib/versions/v2/Model/GetTaskResponse.php create mode 100644 lib/versions/v2/Model/GetTasksResponse.php create mode 100644 lib/versions/v2/Model/PhaseItem.php create mode 100644 lib/versions/v2/Model/PhaseRequestBody.php create mode 100644 lib/versions/v2/Model/PostPatchGetBoard.php create mode 100644 lib/versions/v2/Model/PostPatchGetPhase.php create mode 100644 lib/versions/v2/Model/PostPatchGetProject.php create mode 100644 lib/versions/v2/Model/PostPatchGetProjectAllOf.php create mode 100644 lib/versions/v2/Model/ProjectChangelogResponse.php create mode 100644 lib/versions/v2/Model/ProjectChangelogResponseData.php create mode 100644 lib/versions/v2/Model/ProjectFieldItem.php create mode 100644 lib/versions/v2/Model/ProjectFieldItemUiVisibility.php create mode 100644 lib/versions/v2/Model/ProjectItem.php create mode 100644 lib/versions/v2/Model/ProjectRequestBody.php create mode 100644 lib/versions/v2/Model/ProjectSearchItem.php create mode 100644 lib/versions/v2/Model/ProjectSearchItemItem.php create mode 100644 lib/versions/v2/Model/ProjectSearchItemItemDeal.php create mode 100644 lib/versions/v2/Model/ProjectSearchItemItemOrganization.php create mode 100644 lib/versions/v2/Model/ProjectSearchItemItemOwner.php create mode 100644 lib/versions/v2/Model/ProjectSearchItemItemPerson.php create mode 100644 lib/versions/v2/Model/ProjectSearchItemItemPhase.php create mode 100644 lib/versions/v2/Model/ProjectSearchResponse.php create mode 100644 lib/versions/v2/Model/ProjectSearchResponseAllOf.php create mode 100644 lib/versions/v2/Model/ProjectSearchResponseAllOfData.php create mode 100644 lib/versions/v2/Model/ProjectTemplateItem.php create mode 100644 lib/versions/v2/Model/TaskItem.php create mode 100644 lib/versions/v2/Model/TaskPatchRequest.php create mode 100644 lib/versions/v2/Model/TaskPostRequest.php create mode 100644 lib/versions/v2/Model/UpdateProjectFieldRequest.php create mode 100644 lib/versions/v2/Model/UpdateTaskResponse.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 27623756..79a8bdc0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] ### Added +- Added projects v2 API +- Added project boards v2 API +- Added project phases v2 API +- Added project tasks v2 API +- Added project search v2 API +- Added project templates v2 API +- Added project fields v2 API +- Added `include_option_labels` parameter for v2 GET deal, person and organization endpoints +- Added `include_labels` parameter to v2 GET deal, person, and organization endpoints +### Added - Added `include_field_code` query parameter to Filters endpoints: - `GET /v1/filters/{id}` - `PUT /v1/filters/{id}` diff --git a/docs/versions/v1/Api/NotesApi.md b/docs/versions/v1/Api/NotesApi.md index 0c1af19c..25635ea9 100644 --- a/docs/versions/v1/Api/NotesApi.md +++ b/docs/versions/v1/Api/NotesApi.md @@ -484,7 +484,7 @@ Name | Type | Description | Notes ## `getNotes()` ```php -getNotes($user_id, $lead_id, $deal_id, $person_id, $org_id, $project_id, $start, $limit, $sort, $start_date, $end_date, $updated_since, $pinned_to_lead_flag, $pinned_to_deal_flag, $pinned_to_organization_flag, $pinned_to_person_flag, $pinned_to_project_flag): \Pipedrive\versions\v1\Model\GetNotes +getNotes($user_id, $lead_id, $deal_id, $person_id, $org_id, $project_id, $task_id, $start, $limit, $sort, $start_date, $end_date, $updated_since, $pinned_to_lead_flag, $pinned_to_deal_flag, $pinned_to_organization_flag, $pinned_to_person_flag, $pinned_to_project_flag, $pinned_to_task_flag): \Pipedrive\versions\v1\Model\GetNotes ``` Get all notes @@ -519,6 +519,7 @@ $deal_id = 56; // int | The ID of the deal which notes to fetch. If omitted, not $person_id = 56; // int | The ID of the person whose notes to fetch. If omitted, notes about all persons will be returned. $org_id = 56; // int | The ID of the organization which notes to fetch. If omitted, notes about all organizations will be returned. $project_id = 56; // int | The ID of the project which notes to fetch. If omitted, notes about all projects will be returned. +$task_id = 56; // int | The ID of the task which notes to fetch. If omitted, notes about all tasks will be returned. $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). Supported fields: `id`, `user_id`, `deal_id`, `person_id`, `org_id`, `content`, `add_time`, `update_time`. @@ -530,9 +531,10 @@ $pinned_to_deal_flag = new \Pipedrive\versions\v1\Model\\Pipedrive\versions\v1\M $pinned_to_organization_flag = new \Pipedrive\versions\v1\Model\\Pipedrive\versions\v1\Model\NumberBoolean(); // \Pipedrive\versions\v1\Model\NumberBoolean | If set, the results are filtered by note to organization pinning state $pinned_to_person_flag = new \Pipedrive\versions\v1\Model\\Pipedrive\versions\v1\Model\NumberBoolean(); // \Pipedrive\versions\v1\Model\NumberBoolean | If set, the results are filtered by note to person pinning state $pinned_to_project_flag = new \Pipedrive\versions\v1\Model\\Pipedrive\versions\v1\Model\NumberBoolean(); // \Pipedrive\versions\v1\Model\NumberBoolean | If set, the results are filtered by note to project pinning state +$pinned_to_task_flag = new \Pipedrive\versions\v1\Model\\Pipedrive\versions\v1\Model\NumberBoolean(); // \Pipedrive\versions\v1\Model\NumberBoolean | If set, the results are filtered by note to task pinning state try { - $result = $apiInstance->getNotes($user_id, $lead_id, $deal_id, $person_id, $org_id, $project_id, $start, $limit, $sort, $start_date, $end_date, $updated_since, $pinned_to_lead_flag, $pinned_to_deal_flag, $pinned_to_organization_flag, $pinned_to_person_flag, $pinned_to_project_flag); + $result = $apiInstance->getNotes($user_id, $lead_id, $deal_id, $person_id, $org_id, $project_id, $task_id, $start, $limit, $sort, $start_date, $end_date, $updated_since, $pinned_to_lead_flag, $pinned_to_deal_flag, $pinned_to_organization_flag, $pinned_to_person_flag, $pinned_to_project_flag, $pinned_to_task_flag); print_r($result); } catch (Exception $e) { echo 'Exception when calling NotesApi->getNotes: ', $e->getMessage(), PHP_EOL; @@ -549,6 +551,7 @@ Name | Type | Description | Notes **person_id** | **int**| The ID of the person whose notes to fetch. If omitted, notes about all persons will be returned. | [optional] **org_id** | **int**| The ID of the organization which notes to fetch. If omitted, notes about all organizations will be returned. | [optional] **project_id** | **int**| The ID of the project which notes to fetch. If omitted, notes about all projects will be returned. | [optional] + **task_id** | **int**| The ID of the task which notes to fetch. If omitted, notes about all tasks will be returned. | [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). Supported fields: `id`, `user_id`, `deal_id`, `person_id`, `org_id`, `content`, `add_time`, `update_time`. | [optional] @@ -560,6 +563,7 @@ Name | Type | Description | Notes **pinned_to_organization_flag** | [**\Pipedrive\versions\v1\Model\NumberBoolean**](../Model/.md)| If set, the results are filtered by note to organization pinning state | [optional] **pinned_to_person_flag** | [**\Pipedrive\versions\v1\Model\NumberBoolean**](../Model/.md)| If set, the results are filtered by note to person pinning state | [optional] **pinned_to_project_flag** | [**\Pipedrive\versions\v1\Model\NumberBoolean**](../Model/.md)| If set, the results are filtered by note to project pinning state | [optional] + **pinned_to_task_flag** | [**\Pipedrive\versions\v1\Model\NumberBoolean**](../Model/.md)| If set, the results are filtered by note to task pinning state | [optional] ### Return type diff --git a/docs/versions/v1/Api/ProjectBoardsApi.md b/docs/versions/v1/Api/ProjectBoardsApi.md new file mode 100644 index 00000000..45e44d79 --- /dev/null +++ b/docs/versions/v1/Api/ProjectBoardsApi.md @@ -0,0 +1,136 @@ +# Pipedrive\versions\v1\ProjectBoardsApi + +All URIs are relative to https://api.pipedrive.com/v1. + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**getProjectsBoard()**](ProjectBoardsApi.md#getProjectsBoard) | **GET** /projects/boards/{id} | Get details of a board +[**getProjectsBoards()**](ProjectBoardsApi.md#getProjectsBoards) | **GET** /projects/boards | Get all project boards + + +## `getProjectsBoard()` + +```php +getProjectsBoard($id): \Pipedrive\versions\v1\Model\GetProjectBoardResponse +``` + +Get details of a board + +Returns the details of a specific project board. + +### 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\ProjectBoardsApi( + // 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 project board + +try { + $result = $apiInstance->getProjectsBoard($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectBoardsApi->getProjectsBoard: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| The ID of the project board | + +### Return type + +[**\Pipedrive\versions\v1\Model\GetProjectBoardResponse**](../Model/GetProjectBoardResponse.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) + +## `getProjectsBoards()` + +```php +getProjectsBoards(): \Pipedrive\versions\v1\Model\GetProjectBoardsResponse +``` + +Get all project boards + +Returns all projects boards that are not 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\ProjectBoardsApi( + // 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->getProjectsBoards(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectBoardsApi->getProjectsBoards: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Pipedrive\versions\v1\Model\GetProjectBoardsResponse**](../Model/GetProjectBoardsResponse.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) diff --git a/docs/versions/v1/Api/ProjectPhasesApi.md b/docs/versions/v1/Api/ProjectPhasesApi.md new file mode 100644 index 00000000..a1d91677 --- /dev/null +++ b/docs/versions/v1/Api/ProjectPhasesApi.md @@ -0,0 +1,139 @@ +# Pipedrive\versions\v1\ProjectPhasesApi + +All URIs are relative to https://api.pipedrive.com/v1. + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**getProjectsPhase()**](ProjectPhasesApi.md#getProjectsPhase) | **GET** /projects/phases/{id} | Get details of a phase +[**getProjectsPhases()**](ProjectPhasesApi.md#getProjectsPhases) | **GET** /projects/phases | Get project phases + + +## `getProjectsPhase()` + +```php +getProjectsPhase($id): \Pipedrive\versions\v1\Model\GetProjectPhaseResponse +``` + +Get details of a phase + +Returns the details of a specific project phase. + +### 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\ProjectPhasesApi( + // 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 project phase + +try { + $result = $apiInstance->getProjectsPhase($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectPhasesApi->getProjectsPhase: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| The ID of the project phase | + +### Return type + +[**\Pipedrive\versions\v1\Model\GetProjectPhaseResponse**](../Model/GetProjectPhaseResponse.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) + +## `getProjectsPhases()` + +```php +getProjectsPhases($board_id): \Pipedrive\versions\v1\Model\GetProjectPhasesResponse +``` + +Get project phases + +Returns all active project phases under a specific board. + +### 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\ProjectPhasesApi( + // 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 +); +$board_id = 1; // int | ID of the board for which phases are requested + +try { + $result = $apiInstance->getProjectsPhases($board_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectPhasesApi->getProjectsPhases: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **board_id** | **int**| ID of the board for which phases are requested | + +### Return type + +[**\Pipedrive\versions\v1\Model\GetProjectPhasesResponse**](../Model/GetProjectPhasesResponse.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) diff --git a/docs/versions/v1/Api/ProjectTemplatesApi.md b/docs/versions/v1/Api/ProjectTemplatesApi.md index 1c328251..47c92532 100644 --- a/docs/versions/v1/Api/ProjectTemplatesApi.md +++ b/docs/versions/v1/Api/ProjectTemplatesApi.md @@ -6,8 +6,6 @@ Method | HTTP request | Description ------------- | ------------- | ------------- [**getProjectTemplate()**](ProjectTemplatesApi.md#getProjectTemplate) | **GET** /projectTemplates/{id} | Get details of a template [**getProjectTemplates()**](ProjectTemplatesApi.md#getProjectTemplates) | **GET** /projectTemplates | Get all project templates -[**getProjectsBoard()**](ProjectTemplatesApi.md#getProjectsBoard) | **GET** /projects/boards/{id} | Get details of a board -[**getProjectsPhase()**](ProjectTemplatesApi.md#getProjectsPhase) | **GET** /projects/phases/{id} | Get details of a phase ## `getProjectTemplate()` @@ -141,133 +139,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) - -## `getProjectsBoard()` - -```php -getProjectsBoard($id): \Pipedrive\versions\v1\Model\GetProjectBoardResponse -``` - -Get details of a board - -Returns the details of a specific project board. - -### 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\ProjectTemplatesApi( - // 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 project board - -try { - $result = $apiInstance->getProjectsBoard($id); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ProjectTemplatesApi->getProjectsBoard: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the project board | - -### Return type - -[**\Pipedrive\versions\v1\Model\GetProjectBoardResponse**](../Model/GetProjectBoardResponse.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) - -## `getProjectsPhase()` - -```php -getProjectsPhase($id): \Pipedrive\versions\v1\Model\GetProjectPhaseResponse -``` - -Get details of a phase - -Returns the details of a specific project phase. - -### 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\ProjectTemplatesApi( - // 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 project phase - -try { - $result = $apiInstance->getProjectsPhase($id); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ProjectTemplatesApi->getProjectsPhase: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the project phase | - -### Return type - -[**\Pipedrive\versions\v1\Model\GetProjectPhaseResponse**](../Model/GetProjectPhaseResponse.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) diff --git a/docs/versions/v1/Api/ProjectsApi.md b/docs/versions/v1/Api/ProjectsApi.md index 07af26b5..4bc18578 100644 --- a/docs/versions/v1/Api/ProjectsApi.md +++ b/docs/versions/v1/Api/ProjectsApi.md @@ -13,8 +13,6 @@ Method | HTTP request | Description [**getProjectPlan()**](ProjectsApi.md#getProjectPlan) | **GET** /projects/{id}/plan | Returns project plan [**getProjectTasks()**](ProjectsApi.md#getProjectTasks) | **GET** /projects/{id}/tasks | Returns project tasks [**getProjects()**](ProjectsApi.md#getProjects) | **GET** /projects | Get all projects -[**getProjectsBoards()**](ProjectsApi.md#getProjectsBoards) | **GET** /projects/boards | Get all project boards -[**getProjectsPhases()**](ProjectsApi.md#getProjectsPhases) | **GET** /projects/phases | Get project phases [**putProjectPlanActivity()**](ProjectsApi.md#putProjectPlanActivity) | **PUT** /projects/{id}/plan/activities/{activityId} | Update activity in project plan [**putProjectPlanTask()**](ProjectsApi.md#putProjectPlanTask) | **PUT** /projects/{id}/plan/tasks/{taskId} | Update task in project plan [**updateProject()**](ProjectsApi.md#updateProject) | **PUT** /projects/{id} | Update a project @@ -615,133 +613,6 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getProjectsBoards()` - -```php -getProjectsBoards(): \Pipedrive\versions\v1\Model\GetProjectBoardsResponse -``` - -Get all project boards - -Returns all projects boards that are not 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\ProjectsApi( - // 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->getProjectsBoards(); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ProjectsApi->getProjectsBoards: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -This endpoint does not need any parameter. - -### Return type - -[**\Pipedrive\versions\v1\Model\GetProjectBoardsResponse**](../Model/GetProjectBoardsResponse.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) - -## `getProjectsPhases()` - -```php -getProjectsPhases($board_id): \Pipedrive\versions\v1\Model\GetProjectPhasesResponse -``` - -Get project phases - -Returns all active project phases under a specific board. - -### 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\ProjectsApi( - // 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 -); -$board_id = 1; // int | ID of the board for which phases are requested - -try { - $result = $apiInstance->getProjectsPhases($board_id); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ProjectsApi->getProjectsPhases: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **board_id** | **int**| ID of the board for which phases are requested | - -### Return type - -[**\Pipedrive\versions\v1\Model\GetProjectPhasesResponse**](../Model/GetProjectPhasesResponse.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) - ## `putProjectPlanActivity()` ```php diff --git a/docs/versions/v1/Model/AddNoteRequest.md b/docs/versions/v1/Model/AddNoteRequest.md index cb0efa1c..dd0e1d48 100644 --- a/docs/versions/v1/Model/AddNoteRequest.md +++ b/docs/versions/v1/Model/AddNoteRequest.md @@ -5,11 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **content** | **string** | The content of the note in HTML format. Subject to sanitization on the back-end. | -**lead_id** | **string** | The ID of the lead the note will be attached to. This property is required unless one of (`deal_id/person_id/org_id/project_id`) is specified. | [optional] -**deal_id** | **int** | The ID of the deal the note will be attached to. This property is required unless one of (`lead_id/person_id/org_id/project_id`) is specified. | [optional] -**person_id** | **int** | The ID of the person this note will be attached to. This property is required unless one of (`deal_id/lead_id/org_id/project_id`) is specified. | [optional] -**org_id** | **int** | The ID of the organization this note will be attached to. This property is required unless one of (`deal_id/lead_id/person_id/project_id`) is specified. | [optional] -**project_id** | **int** | The ID of the project the note will be attached to. This property is required unless one of (`deal_id/lead_id/person_id/org_id`) is specified. | [optional] +**lead_id** | **string** | The ID of the lead the note will be attached to. This property is required unless one of (`deal_id/person_id/org_id/project_id/task_id`) is specified. | [optional] +**deal_id** | **int** | The ID of the deal the note will be attached to. This property is required unless one of (`lead_id/person_id/org_id/project_id/task_id`) is specified. | [optional] +**person_id** | **int** | The ID of the person this note will be attached to. This property is required unless one of (`deal_id/lead_id/org_id/project_id/task_id`) is specified. | [optional] +**org_id** | **int** | The ID of the organization this note will be attached to. This property is required unless one of (`deal_id/lead_id/person_id/project_id/task_id`) is specified. | [optional] +**project_id** | **int** | The ID of the project the note will be attached to. This property is required unless one of (`deal_id/lead_id/person_id/org_id/task_id`) is specified. | [optional] +**task_id** | **int** | The ID of the task the note will be attached to. This property is required unless one of (`deal_id/lead_id/person_id/org_id/project_id`) is specified. | [optional] **user_id** | **int** | The ID of the user who will be marked as the author of the note. Only an admin can change the author. | [optional] **add_time** | **string** | The optional creation date & time of the note in UTC. Can be set in the past or in the future. Format: YYYY-MM-DD HH:MM:SS | [optional] **pinned_to_lead_flag** | [**NumberBoolean**](NumberBoolean.md) | If set, the results are filtered by note to lead pinning state (`lead_id` is also required) | [optional] @@ -17,5 +18,6 @@ Name | Type | Description | Notes **pinned_to_organization_flag** | [**NumberBoolean**](NumberBoolean.md) | If set, the results are filtered by note to organization pinning state (`org_id` is also required) | [optional] **pinned_to_person_flag** | [**NumberBoolean**](NumberBoolean.md) | If set, the results are filtered by note to person pinning state (`person_id` is also required) | [optional] **pinned_to_project_flag** | [**NumberBoolean**](NumberBoolean.md) | If set, the results are filtered by note to project pinning state (`project_id` is also required) | [optional] +**pinned_to_task_flag** | [**NumberBoolean**](NumberBoolean.md) | If set, the results are filtered by note to task pinning state (`task_id` is also required) | [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/AddNoteRequestAllOf.md b/docs/versions/v1/Model/AddNoteRequestAllOf.md index dfcf1e90..c37c6774 100644 --- a/docs/versions/v1/Model/AddNoteRequestAllOf.md +++ b/docs/versions/v1/Model/AddNoteRequestAllOf.md @@ -5,10 +5,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **content** | **string** | The content of the note in HTML format. Subject to sanitization on the back-end. | -**lead_id** | **string** | The ID of the lead the note will be attached to. This property is required unless one of (`deal_id/person_id/org_id/project_id`) is specified. | [optional] -**deal_id** | **int** | The ID of the deal the note will be attached to. This property is required unless one of (`lead_id/person_id/org_id/project_id`) is specified. | [optional] -**person_id** | **int** | The ID of the person this note will be attached to. This property is required unless one of (`deal_id/lead_id/org_id/project_id`) is specified. | [optional] -**org_id** | **int** | The ID of the organization this note will be attached to. This property is required unless one of (`deal_id/lead_id/person_id/project_id`) is specified. | [optional] -**project_id** | **int** | The ID of the project the note will be attached to. This property is required unless one of (`deal_id/lead_id/person_id/org_id`) is specified. | [optional] +**lead_id** | **string** | The ID of the lead the note will be attached to. This property is required unless one of (`deal_id/person_id/org_id/project_id/task_id`) is specified. | [optional] +**deal_id** | **int** | The ID of the deal the note will be attached to. This property is required unless one of (`lead_id/person_id/org_id/project_id/task_id`) is specified. | [optional] +**person_id** | **int** | The ID of the person this note will be attached to. This property is required unless one of (`deal_id/lead_id/org_id/project_id/task_id`) is specified. | [optional] +**org_id** | **int** | The ID of the organization this note will be attached to. This property is required unless one of (`deal_id/lead_id/person_id/project_id/task_id`) is specified. | [optional] +**project_id** | **int** | The ID of the project the note will be attached to. This property is required unless one of (`deal_id/lead_id/person_id/org_id/task_id`) is specified. | [optional] +**task_id** | **int** | The ID of the task the note will be attached to. This property is required unless one of (`deal_id/lead_id/person_id/org_id/project_id`) is specified. | [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/BaseNote.md b/docs/versions/v1/Model/BaseNote.md index 830af4d3..efd66d5c 100644 --- a/docs/versions/v1/Model/BaseNote.md +++ b/docs/versions/v1/Model/BaseNote.md @@ -18,10 +18,13 @@ Name | Type | Description | Notes **person_id** | **int** | The ID of the person the note is attached to | [optional] **project_id** | **int** | The ID of the project the note is attached to | [optional] **project** | [**\Pipedrive\versions\v1\Model\BaseNoteProject**](BaseNoteProject.md) | | [optional] +**task_id** | **int** | The ID of the task the note is attached to | [optional] +**task** | [**\Pipedrive\versions\v1\Model\BaseNoteTask**](BaseNoteTask.md) | | [optional] **pinned_to_deal_flag** | **bool** | If true, the results are filtered by note to deal pinning state | [optional] **pinned_to_organization_flag** | **bool** | If true, the results are filtered by note to organization pinning state | [optional] **pinned_to_person_flag** | **bool** | If true, the results are filtered by note to person pinning state | [optional] **pinned_to_project_flag** | **bool** | If true, the results are filtered by note to project pinning state | [optional] +**pinned_to_task_flag** | **bool** | If true, the results are filtered by note to task pinning state | [optional] **update_time** | **string** | The last updated date and time of the note | [optional] **user** | [**\Pipedrive\versions\v1\Model\NoteCreatorUser**](NoteCreatorUser.md) | | [optional] **user_id** | **int** | The ID of the note creator | [optional] diff --git a/docs/versions/v1/Model/BaseNoteTask.md b/docs/versions/v1/Model/BaseNoteTask.md new file mode 100644 index 00000000..b5301445 --- /dev/null +++ b/docs/versions/v1/Model/BaseNoteTask.md @@ -0,0 +1,9 @@ +# # BaseNoteTask + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | The title of the task the note is attached to | [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/Note.md b/docs/versions/v1/Model/Note.md index 2db2dcda..abb13093 100644 --- a/docs/versions/v1/Model/Note.md +++ b/docs/versions/v1/Model/Note.md @@ -10,6 +10,7 @@ Name | Type | Description | Notes **person_id** | **int** | The ID of the person the note will be attached to | [optional] **org_id** | **int** | The ID of the organization the note will be attached to | [optional] **project_id** | **int** | The ID of the project the note will be attached to | [optional] +**task_id** | **int** | The ID of the task the note will be attached to | [optional] **user_id** | **int** | The ID of the user who will be marked as the author of the note. Only an admin can change the author. | [optional] **add_time** | **string** | The optional creation date & time of the note in UTC. Can be set in the past or in the future. Format: YYYY-MM-DD HH:MM:SS | [optional] **pinned_to_lead_flag** | [**NumberBoolean**](NumberBoolean.md) | If set, the results are filtered by note to lead pinning state (`lead_id` is also required) | [optional] @@ -17,5 +18,6 @@ Name | Type | Description | Notes **pinned_to_organization_flag** | [**NumberBoolean**](NumberBoolean.md) | If set, the results are filtered by note to organization pinning state (`org_id` is also required) | [optional] **pinned_to_person_flag** | [**NumberBoolean**](NumberBoolean.md) | If set, the results are filtered by note to person pinning state (`person_id` is also required) | [optional] **pinned_to_project_flag** | [**NumberBoolean**](NumberBoolean.md) | If set, the results are filtered by note to project pinning state (`project_id` is also required) | [optional] +**pinned_to_task_flag** | [**NumberBoolean**](NumberBoolean.md) | If set, the results are filtered by note to task pinning state (`task_id` is also required) | [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/NoteConnectToParams.md b/docs/versions/v1/Model/NoteConnectToParams.md index 44ae5e57..c5ab855e 100644 --- a/docs/versions/v1/Model/NoteConnectToParams.md +++ b/docs/versions/v1/Model/NoteConnectToParams.md @@ -9,5 +9,6 @@ Name | Type | Description | Notes **person_id** | **int** | The ID of the person the note will be attached to | [optional] **org_id** | **int** | The ID of the organization the note will be attached to | [optional] **project_id** | **int** | The ID of the project the note will be attached to | [optional] +**task_id** | **int** | The ID of the task the note will be attached to | [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/NoteParams.md b/docs/versions/v1/Model/NoteParams.md index 30a58627..5790cbc2 100644 --- a/docs/versions/v1/Model/NoteParams.md +++ b/docs/versions/v1/Model/NoteParams.md @@ -11,5 +11,6 @@ Name | Type | Description | Notes **pinned_to_organization_flag** | [**NumberBoolean**](NumberBoolean.md) | If set, the results are filtered by note to organization pinning state (`org_id` is also required) | [optional] **pinned_to_person_flag** | [**NumberBoolean**](NumberBoolean.md) | If set, the results are filtered by note to person pinning state (`person_id` is also required) | [optional] **pinned_to_project_flag** | [**NumberBoolean**](NumberBoolean.md) | If set, the results are filtered by note to project pinning state (`project_id` is also required) | [optional] +**pinned_to_task_flag** | [**NumberBoolean**](NumberBoolean.md) | If set, the results are filtered by note to task pinning state (`task_id` is also required) | [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/README.md b/docs/versions/v1/README.md index 6d743037..3d388d14 100644 --- a/docs/versions/v1/README.md +++ b/docs/versions/v1/README.md @@ -423,10 +423,12 @@ Class | Method | HTTP request | Description *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 +*ProjectBoardsApi* | [**getProjectsBoard**](Api/ProjectBoardsApi.md#getprojectsboard) | **GET** /projects/boards/{id} | Get details of a board +*ProjectBoardsApi* | [**getProjectsBoards**](Api/ProjectBoardsApi.md#getprojectsboards) | **GET** /projects/boards | Get all project boards +*ProjectPhasesApi* | [**getProjectsPhase**](Api/ProjectPhasesApi.md#getprojectsphase) | **GET** /projects/phases/{id} | Get details of a phase +*ProjectPhasesApi* | [**getProjectsPhases**](Api/ProjectPhasesApi.md#getprojectsphases) | **GET** /projects/phases | Get project phases *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 -*ProjectTemplatesApi* | [**getProjectsPhase**](Api/ProjectTemplatesApi.md#getprojectsphase) | **GET** /projects/phases/{id} | Get details of a phase *ProjectsApi* | [**addProject**](Api/ProjectsApi.md#addproject) | **POST** /projects | Add a project *ProjectsApi* | [**archiveProject**](Api/ProjectsApi.md#archiveproject) | **POST** /projects/{id}/archive | Archive a project *ProjectsApi* | [**deleteProject**](Api/ProjectsApi.md#deleteproject) | **DELETE** /projects/{id} | Delete a project @@ -436,8 +438,6 @@ Class | Method | HTTP request | Description *ProjectsApi* | [**getProjectPlan**](Api/ProjectsApi.md#getprojectplan) | **GET** /projects/{id}/plan | Returns project plan *ProjectsApi* | [**getProjectTasks**](Api/ProjectsApi.md#getprojecttasks) | **GET** /projects/{id}/tasks | Returns project tasks *ProjectsApi* | [**getProjects**](Api/ProjectsApi.md#getprojects) | **GET** /projects | Get all projects -*ProjectsApi* | [**getProjectsBoards**](Api/ProjectsApi.md#getprojectsboards) | **GET** /projects/boards | Get all project boards -*ProjectsApi* | [**getProjectsPhases**](Api/ProjectsApi.md#getprojectsphases) | **GET** /projects/phases | Get project phases *ProjectsApi* | [**putProjectPlanActivity**](Api/ProjectsApi.md#putprojectplanactivity) | **PUT** /projects/{id}/plan/activities/{activityId} | Update activity in project plan *ProjectsApi* | [**putProjectPlanTask**](Api/ProjectsApi.md#putprojectplantask) | **PUT** /projects/{id}/plan/tasks/{taskId} | Update task in project plan *ProjectsApi* | [**updateProject**](Api/ProjectsApi.md#updateproject) | **PUT** /projects/{id} | Update a project @@ -551,6 +551,7 @@ Class | Method | HTTP request | Description - [BaseNoteOrganization](Model/BaseNoteOrganization.md) - [BaseNotePerson](Model/BaseNotePerson.md) - [BaseNoteProject](Model/BaseNoteProject.md) + - [BaseNoteTask](Model/BaseNoteTask.md) - [BaseOrganizationItem](Model/BaseOrganizationItem.md) - [BaseOrganizationItemFields](Model/BaseOrganizationItemFields.md) - [BaseOrganizationRelationshipItem](Model/BaseOrganizationRelationshipItem.md) diff --git a/docs/versions/v2/Api/BetaApi.md b/docs/versions/v2/Api/BetaApi.md index 85853945..0638e41b 100644 --- a/docs/versions/v2/Api/BetaApi.md +++ b/docs/versions/v2/Api/BetaApi.md @@ -4,29 +4,565 @@ All URIs are relative to https://api.pipedrive.com/api/v2. Method | HTTP request | Description ------------- | ------------- | ------------- -[**convertDealToLead()**](BetaApi.md#convertDealToLead) | **POST** /deals/{id}/convert/lead | Convert a deal to a lead (BETA) -[**convertLeadToDeal()**](BetaApi.md#convertLeadToDeal) | **POST** /leads/{id}/convert/deal | Convert a lead to a deal (BETA) -[**deleteInstallment()**](BetaApi.md#deleteInstallment) | **DELETE** /deals/{id}/installments/{installment_id} | Delete an installment from a deal -[**deleteProductImage()**](BetaApi.md#deleteProductImage) | **DELETE** /products/{id}/images | Delete an image of a product -[**getDealConversionStatus()**](BetaApi.md#getDealConversionStatus) | **GET** /deals/{id}/convert/status/{conversion_id} | Get Deal conversion status (BETA) -[**getInstallments()**](BetaApi.md#getInstallments) | **GET** /deals/installments | List installments added to a list of deals -[**getLeadConversionStatus()**](BetaApi.md#getLeadConversionStatus) | **GET** /leads/{id}/convert/status/{conversion_id} | Get Lead conversion status (BETA) -[**getProductImage()**](BetaApi.md#getProductImage) | **GET** /products/{id}/images | Get image of a product -[**postInstallment()**](BetaApi.md#postInstallment) | **POST** /deals/{id}/installments | Add an installment to a deal -[**updateInstallment()**](BetaApi.md#updateInstallment) | **PATCH** /deals/{id}/installments/{installment_id} | Update an installment added to a deal -[**updateProductImage()**](BetaApi.md#updateProductImage) | **PUT** /products/{id}/images | Update an image for a product -[**uploadProductImage()**](BetaApi.md#uploadProductImage) | **POST** /products/{id}/images | Upload an image for a product +[**addProjectBoard()**](BetaApi.md#addProjectBoard) | **POST** /boards | Add a project board +[**addProjectField()**](BetaApi.md#addProjectField) | **POST** /projectFields | Create one project field +[**addProjectFieldOptions()**](BetaApi.md#addProjectFieldOptions) | **POST** /projectFields/{field_code}/options | Add project field options in bulk +[**addProjectPhase()**](BetaApi.md#addProjectPhase) | **POST** /phases | Add a project phase +[**addTask()**](BetaApi.md#addTask) | **POST** /tasks | Add a task +[**deleteProjectBoard()**](BetaApi.md#deleteProjectBoard) | **DELETE** /boards/{id} | Delete a project board +[**deleteProjectField()**](BetaApi.md#deleteProjectField) | **DELETE** /projectFields/{field_code} | Delete one project field +[**deleteProjectFieldOptions()**](BetaApi.md#deleteProjectFieldOptions) | **DELETE** /projectFields/{field_code}/options | Delete project field options in bulk +[**deleteProjectPhase()**](BetaApi.md#deleteProjectPhase) | **DELETE** /phases/{id} | Delete a project phase +[**deleteTask()**](BetaApi.md#deleteTask) | **DELETE** /tasks/{id} | Delete a task +[**getProjectField()**](BetaApi.md#getProjectField) | **GET** /projectFields/{field_code} | Get one project field +[**getProjectFields()**](BetaApi.md#getProjectFields) | **GET** /projectFields | Get all project fields +[**getProjectsBoard()**](BetaApi.md#getProjectsBoard) | **GET** /boards/{id} | Get details of a project board +[**getProjectsBoards()**](BetaApi.md#getProjectsBoards) | **GET** /boards | Get all project boards +[**getProjectsPhase()**](BetaApi.md#getProjectsPhase) | **GET** /phases/{id} | Get details of a project phase +[**getProjectsPhases()**](BetaApi.md#getProjectsPhases) | **GET** /phases | Get project phases +[**getTask()**](BetaApi.md#getTask) | **GET** /tasks/{id} | Get details of a task +[**getTasks()**](BetaApi.md#getTasks) | **GET** /tasks | Get all tasks +[**searchProjects()**](BetaApi.md#searchProjects) | **GET** /projects/search | Search projects +[**updateProjectBoard()**](BetaApi.md#updateProjectBoard) | **PATCH** /boards/{id} | Update a project board +[**updateProjectField()**](BetaApi.md#updateProjectField) | **PATCH** /projectFields/{field_code} | Update one project field +[**updateProjectFieldOptions()**](BetaApi.md#updateProjectFieldOptions) | **PATCH** /projectFields/{field_code}/options | Update project field options in bulk +[**updateProjectPhase()**](BetaApi.md#updateProjectPhase) | **PATCH** /phases/{id} | Update a project phase +[**updateTask()**](BetaApi.md#updateTask) | **PATCH** /tasks/{id} | Update a task + + +## `addProjectBoard()` +```php +addProjectBoard($board_request_body): \Pipedrive\versions\v2\Model\PostPatchGetBoard +``` + +Add a project board + +Adds a new project board. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\BetaApi( + // 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 +); +$board_request_body = new \Pipedrive\versions\v2\Model\BoardRequestBody(); // \Pipedrive\versions\v2\Model\BoardRequestBody + +try { + $result = $apiInstance->addProjectBoard($board_request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BetaApi->addProjectBoard: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **board_request_body** | [**\Pipedrive\versions\v2\Model\BoardRequestBody**](../Model/BoardRequestBody.md)| | + +### Return type + +[**\Pipedrive\versions\v2\Model\PostPatchGetBoard**](../Model/PostPatchGetBoard.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) + +## `addProjectField()` + +```php +addProjectField($create_project_field_request): \Pipedrive\versions\v2\Model\CreateProjectField +``` + +Create one project field + +Creates a new project custom 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\BetaApi( + // 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 +); +$create_project_field_request = new \Pipedrive\versions\v2\Model\CreateProjectFieldRequest(); // \Pipedrive\versions\v2\Model\CreateProjectFieldRequest + +try { + $result = $apiInstance->addProjectField($create_project_field_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BetaApi->addProjectField: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **create_project_field_request** | [**\Pipedrive\versions\v2\Model\CreateProjectFieldRequest**](../Model/CreateProjectFieldRequest.md)| | + +### Return type + +[**\Pipedrive\versions\v2\Model\CreateProjectField**](../Model/CreateProjectField.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) + +## `addProjectFieldOptions()` + +```php +addProjectFieldOptions($field_code, $request_body): \Pipedrive\versions\v2\Model\InlineResponse200 +``` + +Add project field options in bulk + +Adds new options to a project custom field that supports options (enum or set field types). This operation is atomic - all options are added or none are added. Returns only the newly added options. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\BetaApi( + // 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 +); +$field_code = 'field_code_example'; // string | The unique code identifying the field +$request_body = array(new \stdClass); // object[] + +try { + $result = $apiInstance->addProjectFieldOptions($field_code, $request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BetaApi->addProjectFieldOptions: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **field_code** | **string**| The unique code identifying the field | + **request_body** | [**object[]**](../Model/object.md)| | + +### Return type + +[**\Pipedrive\versions\v2\Model\InlineResponse200**](../Model/InlineResponse200.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) + +## `addProjectPhase()` + +```php +addProjectPhase($phase_request_body): \Pipedrive\versions\v2\Model\PostPatchGetPhase +``` + +Add a project phase + +Adds a new project phase to a board. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\BetaApi( + // 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 +); +$phase_request_body = new \Pipedrive\versions\v2\Model\PhaseRequestBody(); // \Pipedrive\versions\v2\Model\PhaseRequestBody + +try { + $result = $apiInstance->addProjectPhase($phase_request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BetaApi->addProjectPhase: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **phase_request_body** | [**\Pipedrive\versions\v2\Model\PhaseRequestBody**](../Model/PhaseRequestBody.md)| | + +### Return type + +[**\Pipedrive\versions\v2\Model\PostPatchGetPhase**](../Model/PostPatchGetPhase.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) + +## `addTask()` + +```php +addTask($task_post_request): \Pipedrive\versions\v2\Model\AddTaskResponse +``` + +Add a task + +Adds a new task. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\BetaApi( + // 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 +); +$task_post_request = new \Pipedrive\versions\v2\Model\TaskPostRequest(); // \Pipedrive\versions\v2\Model\TaskPostRequest + +try { + $result = $apiInstance->addTask($task_post_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BetaApi->addTask: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **task_post_request** | [**\Pipedrive\versions\v2\Model\TaskPostRequest**](../Model/TaskPostRequest.md)| | + +### Return type + +[**\Pipedrive\versions\v2\Model\AddTaskResponse**](../Model/AddTaskResponse.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) + +## `deleteProjectBoard()` + +```php +deleteProjectBoard($id): \Pipedrive\versions\v2\Model\DeleteProjectBoardResponse +``` + +Delete a project board + +Marks a project board 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\BetaApi( + // 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 project board + +try { + $result = $apiInstance->deleteProjectBoard($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BetaApi->deleteProjectBoard: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| The ID of the project board | + +### Return type + +[**\Pipedrive\versions\v2\Model\DeleteProjectBoardResponse**](../Model/DeleteProjectBoardResponse.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) + +## `deleteProjectField()` + +```php +deleteProjectField($field_code): \Pipedrive\versions\v2\Model\DeleteProjectField +``` + +Delete one project field + +Marks a custom field 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\BetaApi( + // 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 +); +$field_code = 'field_code_example'; // string | The unique code identifying the field + +try { + $result = $apiInstance->deleteProjectField($field_code); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BetaApi->deleteProjectField: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **field_code** | **string**| The unique code identifying the field | + +### Return type + +[**\Pipedrive\versions\v2\Model\DeleteProjectField**](../Model/DeleteProjectField.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) + +## `deleteProjectFieldOptions()` + +```php +deleteProjectFieldOptions($field_code, $request_body): \Pipedrive\versions\v2\Model\InlineResponse200 +``` + +Delete project field options in bulk + +Removes existing options from a project custom field. This operation is atomic and fails if any of the specified option IDs do not exist. Returns only the deleted options. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\BetaApi( + // 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 +); +$field_code = 'field_code_example'; // string | The unique code identifying the field +$request_body = array(new \stdClass); // object[] + +try { + $result = $apiInstance->deleteProjectFieldOptions($field_code, $request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BetaApi->deleteProjectFieldOptions: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **field_code** | **string**| The unique code identifying the field | + **request_body** | [**object[]**](../Model/object.md)| | + +### Return type + +[**\Pipedrive\versions\v2\Model\InlineResponse200**](../Model/InlineResponse200.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) -## `convertDealToLead()` +## `deleteProjectPhase()` ```php -convertDealToLead($id): \Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse +deleteProjectPhase($id): \Pipedrive\versions\v2\Model\DeleteProjectPhaseResponse ``` -Convert a deal to a lead (BETA) +Delete a project phase -Initiates a conversion of a deal to a lead. The return value is an ID of a job that was assigned to perform the conversion. Related entities (notes, files, emails, activities, ...) are transferred during the process to the target entity. There are exceptions for entities like invoices or history that are not transferred and remain linked to the original deal. If the conversion is successful, the deal is marked as deleted. To retrieve the created entity ID and the result of the conversion, call the /api/v2/deals/{deal_id}/convert/status/{conversion_id} endpoint. +Marks a project phase as deleted. ### Example @@ -50,13 +586,13 @@ $apiInstance = new Pipedrive\versions\v2\Api\BetaApi( new GuzzleHttp\Client(), $config ); -$id = 56; // int | The ID of the deal to convert +$id = 56; // int | The ID of the project phase try { - $result = $apiInstance->convertDealToLead($id); + $result = $apiInstance->deleteProjectPhase($id); print_r($result); } catch (Exception $e) { - echo 'Exception when calling BetaApi->convertDealToLead: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling BetaApi->deleteProjectPhase: ', $e->getMessage(), PHP_EOL; } ``` @@ -64,11 +600,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the deal to convert | + **id** | **int**| The ID of the project phase | ### Return type -[**\Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse**](../Model/AddConvertDealToLeadResponse.md) +[**\Pipedrive\versions\v2\Model\DeleteProjectPhaseResponse**](../Model/DeleteProjectPhaseResponse.md) ### Authorization @@ -83,15 +619,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `convertLeadToDeal()` +## `deleteTask()` ```php -convertLeadToDeal($id, $inline_object): \Pipedrive\versions\v2\Model\AddConvertLeadToDealResponse +deleteTask($id): \Pipedrive\versions\v2\Model\DeleteTaskResponse ``` -Convert a lead to a deal (BETA) +Delete a task -Initiates a conversion of a lead to a deal. The return value is an ID of a job that was assigned to perform the conversion. Related entities (notes, files, emails, activities, ...) are transferred during the process to the target entity. If the conversion is successful, the lead is marked as deleted. To retrieve the created entity ID and the result of the conversion, call the /api/v2/leads/{lead_id}/convert/status/{conversion_id} endpoint. +Marks a task as deleted. If the task has subtasks, those will also be deleted. ### Example @@ -115,14 +651,13 @@ $apiInstance = new Pipedrive\versions\v2\Api\BetaApi( new GuzzleHttp\Client(), $config ); -$id = 'id_example'; // string | The ID of the lead to convert -$inline_object = new \Pipedrive\versions\v2\Model\InlineObject(); // \Pipedrive\versions\v2\Model\InlineObject +$id = 56; // int | The ID of the task try { - $result = $apiInstance->convertLeadToDeal($id, $inline_object); + $result = $apiInstance->deleteTask($id); print_r($result); } catch (Exception $e) { - echo 'Exception when calling BetaApi->convertLeadToDeal: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling BetaApi->deleteTask: ', $e->getMessage(), PHP_EOL; } ``` @@ -130,12 +665,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **string**| The ID of the lead to convert | - **inline_object** | [**\Pipedrive\versions\v2\Model\InlineObject**](../Model/InlineObject.md)| | [optional] + **id** | **int**| The ID of the task | ### Return type -[**\Pipedrive\versions\v2\Model\AddConvertLeadToDealResponse**](../Model/AddConvertLeadToDealResponse.md) +[**\Pipedrive\versions\v2\Model\DeleteTaskResponse**](../Model/DeleteTaskResponse.md) ### Authorization @@ -143,22 +677,219 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: `application/json` +- **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) + +## `getProjectField()` + +```php +getProjectField($field_code): \Pipedrive\versions\v2\Model\GetProjectField +``` + +Get one project field + +Returns metadata about a specific project 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\BetaApi( + // 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 +); +$field_code = 'field_code_example'; // string | The unique code identifying the field + +try { + $result = $apiInstance->getProjectField($field_code); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BetaApi->getProjectField: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **field_code** | **string**| The unique code identifying the field | + +### Return type + +[**\Pipedrive\versions\v2\Model\GetProjectField**](../Model/GetProjectField.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) + +## `getProjectFields()` + +```php +getProjectFields($limit, $cursor): \Pipedrive\versions\v2\Model\GetProjectFields +``` + +Get all project fields + +Returns metadata about all project fields in the company. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\BetaApi( + // 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 +); +$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. +$cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page + +try { + $result = $apiInstance->getProjectFields($limit, $cursor); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BetaApi->getProjectFields: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **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] + **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] + +### Return type + +[**\Pipedrive\versions\v2\Model\GetProjectFields**](../Model/GetProjectFields.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) + +## `getProjectsBoard()` + +```php +getProjectsBoard($id): \Pipedrive\versions\v2\Model\PostPatchGetBoard +``` + +Get details of a project board + +Returns the details of a specific project board. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\BetaApi( + // 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 project board + +try { + $result = $apiInstance->getProjectsBoard($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BetaApi->getProjectsBoard: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| The ID of the project board | + +### Return type + +[**\Pipedrive\versions\v2\Model\PostPatchGetBoard**](../Model/PostPatchGetBoard.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) -## `deleteInstallment()` +## `getProjectsBoards()` ```php -deleteInstallment($id, $installment_id): \Pipedrive\versions\v2\Model\DeleteInstallmentResponse +getProjectsBoards(): \Pipedrive\versions\v2\Model\GetBoards ``` -Delete an installment from a deal +Get all project boards -Removes an installment from a deal. Only available in Growth and above plans. +Returns all active project boards. ### Example @@ -182,14 +913,75 @@ $apiInstance = new Pipedrive\versions\v2\Api\BetaApi( new GuzzleHttp\Client(), $config ); -$id = 56; // int | The ID of the deal -$installment_id = 56; // int | The ID of the installment try { - $result = $apiInstance->deleteInstallment($id, $installment_id); + $result = $apiInstance->getProjectsBoards(); print_r($result); } catch (Exception $e) { - echo 'Exception when calling BetaApi->deleteInstallment: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling BetaApi->getProjectsBoards: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Pipedrive\versions\v2\Model\GetBoards**](../Model/GetBoards.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) + +## `getProjectsPhase()` + +```php +getProjectsPhase($id): \Pipedrive\versions\v2\Model\PostPatchGetPhase +``` + +Get details of a project phase + +Returns the details of a specific project phase. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\BetaApi( + // 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 project phase + +try { + $result = $apiInstance->getProjectsPhase($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BetaApi->getProjectsPhase: ', $e->getMessage(), PHP_EOL; } ``` @@ -197,12 +989,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the deal | - **installment_id** | **int**| The ID of the installment | + **id** | **int**| The ID of the project phase | ### Return type -[**\Pipedrive\versions\v2\Model\DeleteInstallmentResponse**](../Model/DeleteInstallmentResponse.md) +[**\Pipedrive\versions\v2\Model\PostPatchGetPhase**](../Model/PostPatchGetPhase.md) ### Authorization @@ -217,15 +1008,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `deleteProductImage()` +## `getProjectsPhases()` ```php -deleteProductImage($id): \Pipedrive\versions\v2\Model\DeleteProductImageResponse +getProjectsPhases($board_id): \Pipedrive\versions\v2\Model\GetPhases ``` -Delete an image of a product +Get project phases -Deletes the image of a product. +Returns all active project phases under a specific board. ### Example @@ -249,13 +1040,13 @@ $apiInstance = new Pipedrive\versions\v2\Api\BetaApi( new GuzzleHttp\Client(), $config ); -$id = 56; // int | The ID of the product +$board_id = 1; // int | The ID of the board for which phases are requested try { - $result = $apiInstance->deleteProductImage($id); + $result = $apiInstance->getProjectsPhases($board_id); print_r($result); } catch (Exception $e) { - echo 'Exception when calling BetaApi->deleteProductImage: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling BetaApi->getProjectsPhases: ', $e->getMessage(), PHP_EOL; } ``` @@ -263,11 +1054,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the product | + **board_id** | **int**| The ID of the board for which phases are requested | ### Return type -[**\Pipedrive\versions\v2\Model\DeleteProductImageResponse**](../Model/DeleteProductImageResponse.md) +[**\Pipedrive\versions\v2\Model\GetPhases**](../Model/GetPhases.md) ### Authorization @@ -282,15 +1073,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getDealConversionStatus()` +## `getTask()` ```php -getDealConversionStatus($id, $conversion_id) +getTask($id): \Pipedrive\versions\v2\Model\GetTaskResponse ``` -Get Deal conversion status (BETA) +Get details of a task -Returns information about the conversion. Status is always present and its value (not_started, running, completed, failed, rejected) represents the current state of the conversion. Lead ID is only present if the conversion was successfully finished. This data is only temporary and removed after a few days. +Returns the details of a specific task. ### Example @@ -314,13 +1105,13 @@ $apiInstance = new Pipedrive\versions\v2\Api\BetaApi( new GuzzleHttp\Client(), $config ); -$id = 56; // int | The ID of a deal -$conversion_id = 'conversion_id_example'; // string | The ID of the conversion +$id = 56; // int | The ID of the task try { - $apiInstance->getDealConversionStatus($id, $conversion_id); + $result = $apiInstance->getTask($id); + print_r($result); } catch (Exception $e) { - echo 'Exception when calling BetaApi->getDealConversionStatus: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling BetaApi->getTask: ', $e->getMessage(), PHP_EOL; } ``` @@ -328,12 +1119,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of a deal | - **conversion_id** | **string**| The ID of the conversion | + **id** | **int**| The ID of the task | ### Return type -void (empty response body) +[**\Pipedrive\versions\v2\Model\GetTaskResponse**](../Model/GetTaskResponse.md) ### Authorization @@ -348,15 +1138,15 @@ void (empty response body) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getInstallments()` +## `getTasks()` ```php -getInstallments($deal_ids, $cursor, $limit, $sort_by, $sort_direction): \Pipedrive\versions\v2\Model\InstallmentsResponse +getTasks($cursor, $limit, $is_done, $is_milestone, $assignee_id, $project_id, $parent_task_id): \Pipedrive\versions\v2\Model\GetTasksResponse ``` -List installments added to a list of deals +Get all tasks -Lists installments attached to a list of deals. Only available in Growth and above plans. +Returns all tasks. ### Example @@ -380,17 +1170,19 @@ $apiInstance = new Pipedrive\versions\v2\Api\BetaApi( new GuzzleHttp\Client(), $config ); -$deal_ids = array(56); // int[] | An array of integers with the IDs of the deals for which the attached installments will be returned. A maximum of 100 deal IDs can be provided. $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. -$sort_by = 'id'; // string | The field to sort by. Supported fields: `id`, `billing_date`, `deal_id`. -$sort_direction = 'asc'; // string | The sorting direction. Supported values: `asc`, `desc`. +$is_done = True; // bool | Whether the task is done or not. If omitted, both done and not done tasks are returned. +$is_milestone = True; // bool | Whether the task is a milestone or not. If omitted, both milestone and non-milestone tasks are returned. +$assignee_id = 56; // int | If supplied, only tasks assigned to this user are returned +$project_id = 56; // int | If supplied, only tasks belonging to this project are returned +$parent_task_id = 'parent_task_id_example'; // string | If `null` is supplied, only root-level tasks (without a parent) are returned. If an integer is supplied, only subtasks of that specific task are returned. By default all tasks are returned. try { - $result = $apiInstance->getInstallments($deal_ids, $cursor, $limit, $sort_by, $sort_direction); + $result = $apiInstance->getTasks($cursor, $limit, $is_done, $is_milestone, $assignee_id, $project_id, $parent_task_id); print_r($result); } catch (Exception $e) { - echo 'Exception when calling BetaApi->getInstallments: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling BetaApi->getTasks: ', $e->getMessage(), PHP_EOL; } ``` @@ -398,15 +1190,17 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **deal_ids** | [**int[]**](../Model/int.md)| An array of integers with the IDs of the deals for which the attached installments will be returned. A maximum of 100 deal IDs can be provided. | **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] - **sort_by** | **string**| The field to sort by. Supported fields: `id`, `billing_date`, `deal_id`. | [optional] [default to 'id'] - **sort_direction** | **string**| The sorting direction. Supported values: `asc`, `desc`. | [optional] [default to 'asc'] + **is_done** | **bool**| Whether the task is done or not. If omitted, both done and not done tasks are returned. | [optional] + **is_milestone** | **bool**| Whether the task is a milestone or not. If omitted, both milestone and non-milestone tasks are returned. | [optional] + **assignee_id** | **int**| If supplied, only tasks assigned to this user are returned | [optional] + **project_id** | **int**| If supplied, only tasks belonging to this project are returned | [optional] + **parent_task_id** | **string**| If `null` is supplied, only root-level tasks (without a parent) are returned. If an integer is supplied, only subtasks of that specific task are returned. By default all tasks are returned. | [optional] ### Return type -[**\Pipedrive\versions\v2\Model\InstallmentsResponse**](../Model/InstallmentsResponse.md) +[**\Pipedrive\versions\v2\Model\GetTasksResponse**](../Model/GetTasksResponse.md) ### Authorization @@ -421,15 +1215,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getLeadConversionStatus()` +## `searchProjects()` ```php -getLeadConversionStatus($id, $conversion_id) +searchProjects($term, $fields, $exact_match, $person_id, $organization_id, $limit, $cursor): \Pipedrive\versions\v2\Model\ProjectSearchResponse ``` -Get Lead conversion status (BETA) +Search projects -Returns data about the conversion. Status is always present and its value (not_started, running, completed, failed, rejected) represents the current state of the conversion. Deal ID is only present if the conversion was successfully finished. This data is only temporary and removed after a few days. +Searches all projects by title, description, notes and/or custom fields. This endpoint is a wrapper of /v1/itemSearch with a narrower OAuth scope. Found projects can be filtered by person ID or organization ID. ### Example @@ -453,13 +1247,19 @@ $apiInstance = new Pipedrive\versions\v2\Api\BetaApi( new GuzzleHttp\Client(), $config ); -$id = 'id_example'; // string | The ID of a lead -$conversion_id = 'conversion_id_example'; // string | The ID of the conversion +$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 projects by the provided person ID +$organization_id = 56; // int | Will filter projects by the provided organization ID +$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. +$cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page try { - $apiInstance->getLeadConversionStatus($id, $conversion_id); + $result = $apiInstance->searchProjects($term, $fields, $exact_match, $person_id, $organization_id, $limit, $cursor); + print_r($result); } catch (Exception $e) { - echo 'Exception when calling BetaApi->getLeadConversionStatus: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling BetaApi->searchProjects: ', $e->getMessage(), PHP_EOL; } ``` @@ -467,12 +1267,17 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **string**| The ID of a lead | - **conversion_id** | **string**| The ID of the conversion | + **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 projects by the provided person ID | [optional] + **organization_id** | **int**| Will filter projects by the provided organization ID | [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] + **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] ### Return type -void (empty response body) +[**\Pipedrive\versions\v2\Model\ProjectSearchResponse**](../Model/ProjectSearchResponse.md) ### Authorization @@ -487,15 +1292,15 @@ void (empty response body) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getProductImage()` +## `updateProjectBoard()` ```php -getProductImage($id): \Pipedrive\versions\v2\Model\ProductImageResponse +updateProjectBoard($id, $board_request_body): \Pipedrive\versions\v2\Model\PostPatchGetBoard ``` -Get image of a product +Update a project board -Retrieves the image of a product. The public URL has a limited lifetime of 7 days. +Updates the properties of a project board. ### Example @@ -519,13 +1324,14 @@ $apiInstance = new Pipedrive\versions\v2\Api\BetaApi( new GuzzleHttp\Client(), $config ); -$id = 56; // int | The ID of the product +$id = 56; // int | The ID of the project board +$board_request_body = new \Pipedrive\versions\v2\Model\BoardRequestBody(); // \Pipedrive\versions\v2\Model\BoardRequestBody try { - $result = $apiInstance->getProductImage($id); + $result = $apiInstance->updateProjectBoard($id, $board_request_body); print_r($result); } catch (Exception $e) { - echo 'Exception when calling BetaApi->getProductImage: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling BetaApi->updateProjectBoard: ', $e->getMessage(), PHP_EOL; } ``` @@ -533,11 +1339,12 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the product | + **id** | **int**| The ID of the project board | + **board_request_body** | [**\Pipedrive\versions\v2\Model\BoardRequestBody**](../Model/BoardRequestBody.md)| | [optional] ### Return type -[**\Pipedrive\versions\v2\Model\ProductImageResponse**](../Model/ProductImageResponse.md) +[**\Pipedrive\versions\v2\Model\PostPatchGetBoard**](../Model/PostPatchGetBoard.md) ### Authorization @@ -545,22 +1352,22 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: Not defined +- **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) -## `postInstallment()` +## `updateProjectField()` ```php -postInstallment($id, $body): \Pipedrive\versions\v2\Model\AddInstallmentResponse +updateProjectField($field_code, $update_project_field_request): \Pipedrive\versions\v2\Model\GetProjectField ``` -Add an installment to a deal +Update one project field -Adds an installment to a deal. An installment can only be added if the deal includes at least one one-time product. If the deal contains at least one recurring product, adding installments is not allowed. Only available in Growth and above plans. +Updates a project custom field. The field_code and field_type cannot be changed. At least one field must be provided in the request body. ### Example @@ -584,14 +1391,14 @@ $apiInstance = new Pipedrive\versions\v2\Api\BetaApi( new GuzzleHttp\Client(), $config ); -$id = 56; // int | The ID of the deal -$body = new \stdClass; // object +$field_code = 'field_code_example'; // string | The unique code identifying the field +$update_project_field_request = new \Pipedrive\versions\v2\Model\UpdateProjectFieldRequest(); // \Pipedrive\versions\v2\Model\UpdateProjectFieldRequest try { - $result = $apiInstance->postInstallment($id, $body); + $result = $apiInstance->updateProjectField($field_code, $update_project_field_request); print_r($result); } catch (Exception $e) { - echo 'Exception when calling BetaApi->postInstallment: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling BetaApi->updateProjectField: ', $e->getMessage(), PHP_EOL; } ``` @@ -599,12 +1406,12 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the deal | - **body** | **object**| | [optional] + **field_code** | **string**| The unique code identifying the field | + **update_project_field_request** | [**\Pipedrive\versions\v2\Model\UpdateProjectFieldRequest**](../Model/UpdateProjectFieldRequest.md)| | ### Return type -[**\Pipedrive\versions\v2\Model\AddInstallmentResponse**](../Model/AddInstallmentResponse.md) +[**\Pipedrive\versions\v2\Model\GetProjectField**](../Model/GetProjectField.md) ### Authorization @@ -619,15 +1426,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `updateInstallment()` +## `updateProjectFieldOptions()` ```php -updateInstallment($id, $installment_id, $body): \Pipedrive\versions\v2\Model\UpdateInstallmentResponse +updateProjectFieldOptions($field_code, $request_body): \Pipedrive\versions\v2\Model\InlineResponse200 ``` -Update an installment added to a deal +Update project field options in bulk -Edits an installment added to a deal. Only available in Growth and above plans. +Updates existing options for a project custom field. This operation is atomic and fails if any of the specified option IDs do not exist. Returns only the updated options. ### Example @@ -651,15 +1458,14 @@ $apiInstance = new Pipedrive\versions\v2\Api\BetaApi( new GuzzleHttp\Client(), $config ); -$id = 56; // int | The ID of the deal -$installment_id = 56; // int | The ID of the installment -$body = new \stdClass; // object +$field_code = 'field_code_example'; // string | The unique code identifying the field +$request_body = array(new \stdClass); // object[] try { - $result = $apiInstance->updateInstallment($id, $installment_id, $body); + $result = $apiInstance->updateProjectFieldOptions($field_code, $request_body); print_r($result); } catch (Exception $e) { - echo 'Exception when calling BetaApi->updateInstallment: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling BetaApi->updateProjectFieldOptions: ', $e->getMessage(), PHP_EOL; } ``` @@ -667,13 +1473,12 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the deal | - **installment_id** | **int**| The ID of the installment | - **body** | **object**| | [optional] + **field_code** | **string**| The unique code identifying the field | + **request_body** | [**object[]**](../Model/object.md)| | ### Return type -[**\Pipedrive\versions\v2\Model\UpdateInstallmentResponse**](../Model/UpdateInstallmentResponse.md) +[**\Pipedrive\versions\v2\Model\InlineResponse200**](../Model/InlineResponse200.md) ### Authorization @@ -688,15 +1493,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `updateProductImage()` +## `updateProjectPhase()` ```php -updateProductImage($id, $data): \Pipedrive\versions\v2\Model\UpdateProductImageResponse +updateProjectPhase($id, $phase_request_body): \Pipedrive\versions\v2\Model\PostPatchGetPhase ``` -Update an image for a product +Update a project phase -Updates the image of a product. +Updates the properties of a project phase. ### Example @@ -720,14 +1525,14 @@ $apiInstance = new Pipedrive\versions\v2\Api\BetaApi( new GuzzleHttp\Client(), $config ); -$id = 56; // int | The ID of the product -$data = "/path/to/file.txt"; // \SplFileObject | One image supplied in the multipart/form-data encoding +$id = 56; // int | The ID of the project phase +$phase_request_body = new \Pipedrive\versions\v2\Model\PhaseRequestBody(); // \Pipedrive\versions\v2\Model\PhaseRequestBody try { - $result = $apiInstance->updateProductImage($id, $data); + $result = $apiInstance->updateProjectPhase($id, $phase_request_body); print_r($result); } catch (Exception $e) { - echo 'Exception when calling BetaApi->updateProductImage: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling BetaApi->updateProjectPhase: ', $e->getMessage(), PHP_EOL; } ``` @@ -735,12 +1540,12 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the product | - **data** | **\SplFileObject****\SplFileObject**| One image supplied in the multipart/form-data encoding | + **id** | **int**| The ID of the project phase | + **phase_request_body** | [**\Pipedrive\versions\v2\Model\PhaseRequestBody**](../Model/PhaseRequestBody.md)| | [optional] ### Return type -[**\Pipedrive\versions\v2\Model\UpdateProductImageResponse**](../Model/UpdateProductImageResponse.md) +[**\Pipedrive\versions\v2\Model\PostPatchGetPhase**](../Model/PostPatchGetPhase.md) ### Authorization @@ -748,22 +1553,22 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: `multipart/form-data` +- **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) -## `uploadProductImage()` +## `updateTask()` ```php -uploadProductImage($id, $data): \Pipedrive\versions\v2\Model\AddProductImageResponse +updateTask($id, $task_patch_request): \Pipedrive\versions\v2\Model\UpdateTaskResponse ``` -Upload an image for a product +Update a task -Uploads an image for a product. +Updates a task. ### Example @@ -787,14 +1592,14 @@ $apiInstance = new Pipedrive\versions\v2\Api\BetaApi( new GuzzleHttp\Client(), $config ); -$id = 56; // int | The ID of the product -$data = "/path/to/file.txt"; // \SplFileObject | One image supplied in the multipart/form-data encoding +$id = 56; // int | The ID of the task +$task_patch_request = new \Pipedrive\versions\v2\Model\TaskPatchRequest(); // \Pipedrive\versions\v2\Model\TaskPatchRequest try { - $result = $apiInstance->uploadProductImage($id, $data); + $result = $apiInstance->updateTask($id, $task_patch_request); print_r($result); } catch (Exception $e) { - echo 'Exception when calling BetaApi->uploadProductImage: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling BetaApi->updateTask: ', $e->getMessage(), PHP_EOL; } ``` @@ -802,12 +1607,12 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the product | - **data** | **\SplFileObject****\SplFileObject**| One image supplied in the multipart/form-data encoding | + **id** | **int**| The ID of the task | + **task_patch_request** | [**\Pipedrive\versions\v2\Model\TaskPatchRequest**](../Model/TaskPatchRequest.md)| | [optional] ### Return type -[**\Pipedrive\versions\v2\Model\AddProductImageResponse**](../Model/AddProductImageResponse.md) +[**\Pipedrive\versions\v2\Model\UpdateTaskResponse**](../Model/UpdateTaskResponse.md) ### Authorization @@ -815,7 +1620,7 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: `multipart/form-data` +- **Content-Type**: `application/json` - **Accept**: `application/json` [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) diff --git a/docs/versions/v2/Api/DealInstallmentsApi.md b/docs/versions/v2/Api/DealInstallmentsApi.md new file mode 100644 index 00000000..cef0bb13 --- /dev/null +++ b/docs/versions/v2/Api/DealInstallmentsApi.md @@ -0,0 +1,287 @@ +# Pipedrive\versions\v2\DealInstallmentsApi + +All URIs are relative to https://api.pipedrive.com/api/v2. + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**deleteInstallment()**](DealInstallmentsApi.md#deleteInstallment) | **DELETE** /deals/{id}/installments/{installment_id} | Delete an installment from a deal +[**getInstallments()**](DealInstallmentsApi.md#getInstallments) | **GET** /deals/installments | List installments added to a list of deals +[**postInstallment()**](DealInstallmentsApi.md#postInstallment) | **POST** /deals/{id}/installments | Add an installment to a deal +[**updateInstallment()**](DealInstallmentsApi.md#updateInstallment) | **PATCH** /deals/{id}/installments/{installment_id} | Update an installment added to a deal + + +## `deleteInstallment()` + +```php +deleteInstallment($id, $installment_id): \Pipedrive\versions\v2\Model\DeleteInstallmentResponse +``` + +Delete an installment from a deal + +Removes an installment from a deal. Only available in Growth and above plans. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\DealInstallmentsApi( + // 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 +$installment_id = 56; // int | The ID of the installment + +try { + $result = $apiInstance->deleteInstallment($id, $installment_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DealInstallmentsApi->deleteInstallment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| The ID of the deal | + **installment_id** | **int**| The ID of the installment | + +### Return type + +[**\Pipedrive\versions\v2\Model\DeleteInstallmentResponse**](../Model/DeleteInstallmentResponse.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) + +## `getInstallments()` + +```php +getInstallments($deal_ids, $cursor, $limit, $sort_by, $sort_direction): \Pipedrive\versions\v2\Model\InstallmentsResponse +``` + +List installments added to a list of deals + +Lists installments attached to a list of deals. Only available in Growth and above plans. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\DealInstallmentsApi( + // 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 +); +$deal_ids = array(56); // int[] | An array of integers with the IDs of the deals for which the attached installments will be returned. A maximum of 100 deal IDs can be provided. +$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. +$sort_by = 'id'; // string | The field to sort by. Supported fields: `id`, `billing_date`, `deal_id`. +$sort_direction = 'asc'; // string | The sorting direction. Supported values: `asc`, `desc`. + +try { + $result = $apiInstance->getInstallments($deal_ids, $cursor, $limit, $sort_by, $sort_direction); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DealInstallmentsApi->getInstallments: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **deal_ids** | [**int[]**](../Model/int.md)| An array of integers with the IDs of the deals for which the attached installments will be returned. A maximum of 100 deal IDs can be provided. | + **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] + **sort_by** | **string**| The field to sort by. Supported fields: `id`, `billing_date`, `deal_id`. | [optional] [default to 'id'] + **sort_direction** | **string**| The sorting direction. Supported values: `asc`, `desc`. | [optional] [default to 'asc'] + +### Return type + +[**\Pipedrive\versions\v2\Model\InstallmentsResponse**](../Model/InstallmentsResponse.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) + +## `postInstallment()` + +```php +postInstallment($id, $body): \Pipedrive\versions\v2\Model\AddInstallmentResponse +``` + +Add an installment to a deal + +Adds an installment to a deal. An installment can only be added if the deal includes at least one one-time product. If the deal contains at least one recurring product, adding installments is not allowed. Only available in Growth and above plans. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\DealInstallmentsApi( + // 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 +$body = new \stdClass; // object + +try { + $result = $apiInstance->postInstallment($id, $body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DealInstallmentsApi->postInstallment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| The ID of the deal | + **body** | **object**| | [optional] + +### Return type + +[**\Pipedrive\versions\v2\Model\AddInstallmentResponse**](../Model/AddInstallmentResponse.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) + +## `updateInstallment()` + +```php +updateInstallment($id, $installment_id, $body): \Pipedrive\versions\v2\Model\UpdateInstallmentResponse +``` + +Update an installment added to a deal + +Edits an installment added to a deal. Only available in Growth and above plans. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\DealInstallmentsApi( + // 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 +$installment_id = 56; // int | The ID of the installment +$body = new \stdClass; // object + +try { + $result = $apiInstance->updateInstallment($id, $installment_id, $body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DealInstallmentsApi->updateInstallment: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| The ID of the deal | + **installment_id** | **int**| The ID of the installment | + **body** | **object**| | [optional] + +### Return type + +[**\Pipedrive\versions\v2\Model\UpdateInstallmentResponse**](../Model/UpdateInstallmentResponse.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/v2/Api/DealProductsApi.md b/docs/versions/v2/Api/DealProductsApi.md new file mode 100644 index 00000000..b3d61d23 --- /dev/null +++ b/docs/versions/v2/Api/DealProductsApi.md @@ -0,0 +1,497 @@ +# Pipedrive\versions\v2\DealProductsApi + +All URIs are relative to https://api.pipedrive.com/api/v2. + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addDealProduct()**](DealProductsApi.md#addDealProduct) | **POST** /deals/{id}/products | Add a product to a deal +[**addManyDealProducts()**](DealProductsApi.md#addManyDealProducts) | **POST** /deals/{id}/products/bulk | Add multiple products to a deal +[**deleteDealProduct()**](DealProductsApi.md#deleteDealProduct) | **DELETE** /deals/{id}/products/{product_attachment_id} | Delete an attached product from a deal +[**deleteManyDealProducts()**](DealProductsApi.md#deleteManyDealProducts) | **DELETE** /deals/{id}/products | Delete many products from a deal +[**getDealProducts()**](DealProductsApi.md#getDealProducts) | **GET** /deals/{id}/products | List products attached to a deal +[**getDealsProducts()**](DealProductsApi.md#getDealsProducts) | **GET** /deals/products | Get deal products of several deals +[**updateDealProduct()**](DealProductsApi.md#updateDealProduct) | **PATCH** /deals/{id}/products/{product_attachment_id} | Update the product attached to a deal + + +## `addDealProduct()` + +```php +addDealProduct($id, $new_deal_product_request_body): \Pipedrive\versions\v2\Model\AddDealProductResponse +``` + +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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\DealProductsApi( + // 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_request_body = new \Pipedrive\versions\v2\Model\NewDealProductRequestBody(); // \Pipedrive\versions\v2\Model\NewDealProductRequestBody + +try { + $result = $apiInstance->addDealProduct($id, $new_deal_product_request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DealProductsApi->addDealProduct: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| The ID of the deal | + **new_deal_product_request_body** | [**\Pipedrive\versions\v2\Model\NewDealProductRequestBody**](../Model/NewDealProductRequestBody.md)| | [optional] + +### Return type + +[**\Pipedrive\versions\v2\Model\AddDealProductResponse**](../Model/AddDealProductResponse.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) + +## `addManyDealProducts()` + +```php +addManyDealProducts($id, $create_many_deal_product_request_body): \Pipedrive\versions\v2\Model\CreateManyDealProductResponse +``` + +Add multiple products to a deal + +Adds multiple products to a deal in a single request. Maximum of 100 products allowed per request. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\DealProductsApi( + // 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 +$create_many_deal_product_request_body = new \Pipedrive\versions\v2\Model\CreateManyDealProductRequestBody(); // \Pipedrive\versions\v2\Model\CreateManyDealProductRequestBody + +try { + $result = $apiInstance->addManyDealProducts($id, $create_many_deal_product_request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DealProductsApi->addManyDealProducts: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| The ID of the deal | + **create_many_deal_product_request_body** | [**\Pipedrive\versions\v2\Model\CreateManyDealProductRequestBody**](../Model/CreateManyDealProductRequestBody.md)| | [optional] + +### Return type + +[**\Pipedrive\versions\v2\Model\CreateManyDealProductResponse**](../Model/CreateManyDealProductResponse.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) + +## `deleteDealProduct()` + +```php +deleteDealProduct($id, $product_attachment_id): \Pipedrive\versions\v2\Model\DeleteDealProduct +``` + +Delete an attached product from a deal + +Deletes a product attachment from a deal, using the `product_attachment_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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\DealProductsApi( + // 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 DealProductsApi->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\v2\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) + +## `deleteManyDealProducts()` + +```php +deleteManyDealProducts($id, $ids): \Pipedrive\versions\v2\Model\DeleteManyDealProductResponse +``` + +Delete many products from a deal + +Deletes multiple products from a deal. If no product IDs are specified, up to 100 products will be removed from the deal. A maximum of 100 product IDs can be provided per request. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\DealProductsApi( + // 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 +$ids = 1,2,3; // string | Comma-separated list of deal product IDs to delete. If not provided, all deal products will be deleted up to 100 items. Maximum 100 IDs allowed. + +try { + $result = $apiInstance->deleteManyDealProducts($id, $ids); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DealProductsApi->deleteManyDealProducts: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| The ID of the deal | + **ids** | **string**| Comma-separated list of deal product IDs to delete. If not provided, all deal products will be deleted up to 100 items. Maximum 100 IDs allowed. | [optional] + +### Return type + +[**\Pipedrive\versions\v2\Model\DeleteManyDealProductResponse**](../Model/DeleteManyDealProductResponse.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) + +## `getDealProducts()` + +```php +getDealProducts($id, $cursor, $limit, $sort_by, $sort_direction): \Pipedrive\versions\v2\Model\DealsProductsResponse +``` + +List products attached to a deal + +Lists products 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\DealProductsApi( + // 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 = 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. +$sort_by = 'id'; // string | The field to sort by. Supported fields: `id`, `add_time`, `update_time`, `order_nr`. +$sort_direction = 'asc'; // string | The sorting direction. Supported values: `asc`, `desc`. + +try { + $result = $apiInstance->getDealProducts($id, $cursor, $limit, $sort_by, $sort_direction); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DealProductsApi->getDealProducts: ', $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**| 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] + **sort_by** | **string**| The field to sort by. Supported fields: `id`, `add_time`, `update_time`, `order_nr`. | [optional] [default to 'id'] + **sort_direction** | **string**| The sorting direction. Supported values: `asc`, `desc`. | [optional] [default to 'asc'] + +### Return type + +[**\Pipedrive\versions\v2\Model\DealsProductsResponse**](../Model/DealsProductsResponse.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) + +## `getDealsProducts()` + +```php +getDealsProducts($deal_ids, $cursor, $limit, $sort_by, $sort_direction): \Pipedrive\versions\v2\Model\DealsProductsResponse +``` + +Get deal products of several deals + +Returns data about products attached to 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\DealProductsApi( + // 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 +); +$deal_ids = array(56); // int[] | An array of integers with the IDs of the deals for which the attached products will be returned. A maximum of 100 deal IDs can be provided. +$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. +$sort_by = 'id'; // string | The field to sort by. Supported fields: `id`, `deal_id`, `add_time`, `update_time`, `order_nr`. +$sort_direction = 'asc'; // string | The sorting direction. Supported values: `asc`, `desc`. + +try { + $result = $apiInstance->getDealsProducts($deal_ids, $cursor, $limit, $sort_by, $sort_direction); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DealProductsApi->getDealsProducts: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **deal_ids** | [**int[]**](../Model/int.md)| An array of integers with the IDs of the deals for which the attached products will be returned. A maximum of 100 deal IDs can be provided. | + **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] + **sort_by** | **string**| The field to sort by. Supported fields: `id`, `deal_id`, `add_time`, `update_time`, `order_nr`. | [optional] [default to 'id'] + **sort_direction** | **string**| The sorting direction. Supported values: `asc`, `desc`. | [optional] [default to 'asc'] + +### Return type + +[**\Pipedrive\versions\v2\Model\DealsProductsResponse**](../Model/DealsProductsResponse.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) + +## `updateDealProduct()` + +```php +updateDealProduct($id, $product_attachment_id, $update_deal_product_request_body): \Pipedrive\versions\v2\Model\AddDealProductResponse +``` + +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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\DealProductsApi( + // 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_request_body = new \Pipedrive\versions\v2\Model\UpdateDealProductRequestBody(); // \Pipedrive\versions\v2\Model\UpdateDealProductRequestBody + +try { + $result = $apiInstance->updateDealProduct($id, $product_attachment_id, $update_deal_product_request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DealProductsApi->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_request_body** | [**\Pipedrive\versions\v2\Model\UpdateDealProductRequestBody**](../Model/UpdateDealProductRequestBody.md)| | [optional] + +### Return type + +[**\Pipedrive\versions\v2\Model\AddDealProductResponse**](../Model/AddDealProductResponse.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/v2/Api/DealsApi.md b/docs/versions/v2/Api/DealsApi.md index f88e5682..5a998fe5 100644 --- a/docs/versions/v2/Api/DealsApi.md +++ b/docs/versions/v2/Api/DealsApi.md @@ -6,32 +6,21 @@ Method | HTTP request | Description ------------- | ------------- | ------------- [**addDeal()**](DealsApi.md#addDeal) | **POST** /deals | Add a new deal [**addDealFollower()**](DealsApi.md#addDealFollower) | **POST** /deals/{id}/followers | Add a follower to a deal -[**addDealProduct()**](DealsApi.md#addDealProduct) | **POST** /deals/{id}/products | Add a product to a deal -[**addManyDealProducts()**](DealsApi.md#addManyDealProducts) | **POST** /deals/{id}/products/bulk | Add multiple products to a deal [**convertDealToLead()**](DealsApi.md#convertDealToLead) | **POST** /deals/{id}/convert/lead | Convert a deal to a lead [**deleteAdditionalDiscount()**](DealsApi.md#deleteAdditionalDiscount) | **DELETE** /deals/{id}/discounts/{discount_id} | Delete a discount from 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 -[**deleteDealProduct()**](DealsApi.md#deleteDealProduct) | **DELETE** /deals/{id}/products/{product_attachment_id} | Delete an attached product from a deal -[**deleteInstallment()**](DealsApi.md#deleteInstallment) | **DELETE** /deals/{id}/installments/{installment_id} | Delete an installment from a deal -[**deleteManyDealProducts()**](DealsApi.md#deleteManyDealProducts) | **DELETE** /deals/{id}/products | Delete many products from a deal [**getAdditionalDiscounts()**](DealsApi.md#getAdditionalDiscounts) | **GET** /deals/{id}/discounts | List discounts added to a deal [**getArchivedDeals()**](DealsApi.md#getArchivedDeals) | **GET** /deals/archived | Get all archived deals [**getDeal()**](DealsApi.md#getDeal) | **GET** /deals/{id} | Get details of a deal [**getDealConversionStatus()**](DealsApi.md#getDealConversionStatus) | **GET** /deals/{id}/convert/status/{conversion_id} | Get Deal conversion status [**getDealFollowers()**](DealsApi.md#getDealFollowers) | **GET** /deals/{id}/followers | List followers of a deal [**getDealFollowersChangelog()**](DealsApi.md#getDealFollowersChangelog) | **GET** /deals/{id}/followers/changelog | List followers changelog of a deal -[**getDealProducts()**](DealsApi.md#getDealProducts) | **GET** /deals/{id}/products | List products attached to a deal [**getDeals()**](DealsApi.md#getDeals) | **GET** /deals | Get all deals -[**getDealsProducts()**](DealsApi.md#getDealsProducts) | **GET** /deals/products | Get deal products of several deals -[**getInstallments()**](DealsApi.md#getInstallments) | **GET** /deals/installments | List installments added to a list of deals [**postAdditionalDiscount()**](DealsApi.md#postAdditionalDiscount) | **POST** /deals/{id}/discounts | Add a discount to a deal -[**postInstallment()**](DealsApi.md#postInstallment) | **POST** /deals/{id}/installments | Add an installment to a deal [**searchDeals()**](DealsApi.md#searchDeals) | **GET** /deals/search | Search deals [**updateAdditionalDiscount()**](DealsApi.md#updateAdditionalDiscount) | **PATCH** /deals/{id}/discounts/{discount_id} | Update a discount added to a deal [**updateDeal()**](DealsApi.md#updateDeal) | **PATCH** /deals/{id} | Update a deal -[**updateDealProduct()**](DealsApi.md#updateDealProduct) | **PATCH** /deals/{id}/products/{product_attachment_id} | Update the product attached to a deal -[**updateInstallment()**](DealsApi.md#updateInstallment) | **PATCH** /deals/{id}/installments/{installment_id} | Update an installment added to a deal ## `addDeal()` @@ -166,15 +155,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `addDealProduct()` +## `convertDealToLead()` ```php -addDealProduct($id, $new_deal_product_request_body): \Pipedrive\versions\v2\Model\AddDealProductResponse +convertDealToLead($id): \Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse ``` -Add a product to a deal +Convert a deal to a lead -Adds a product to a deal, creating a new item called a deal-product. +Initiates a conversion of a deal to a lead. The return value is an ID of a job that was assigned to perform the conversion. Related entities (notes, files, emails, activities, ...) are transferred during the process to the target entity. There are exceptions for entities like invoices or history that are not transferred and remain linked to the original deal. If the conversion is successful, the deal is marked as deleted. To retrieve the created entity ID and the result of the conversion, call the /api/v2/deals/{deal_id}/convert/status/{conversion_id} endpoint. ### Example @@ -198,14 +187,13 @@ $apiInstance = new Pipedrive\versions\v2\Api\DealsApi( new GuzzleHttp\Client(), $config ); -$id = 56; // int | The ID of the deal -$new_deal_product_request_body = new \Pipedrive\versions\v2\Model\NewDealProductRequestBody(); // \Pipedrive\versions\v2\Model\NewDealProductRequestBody +$id = 56; // int | The ID of the deal to convert try { - $result = $apiInstance->addDealProduct($id, $new_deal_product_request_body); + $result = $apiInstance->convertDealToLead($id); print_r($result); } catch (Exception $e) { - echo 'Exception when calling DealsApi->addDealProduct: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling DealsApi->convertDealToLead: ', $e->getMessage(), PHP_EOL; } ``` @@ -213,12 +201,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the deal | - **new_deal_product_request_body** | [**\Pipedrive\versions\v2\Model\NewDealProductRequestBody**](../Model/NewDealProductRequestBody.md)| | [optional] + **id** | **int**| The ID of the deal to convert | ### Return type -[**\Pipedrive\versions\v2\Model\AddDealProductResponse**](../Model/AddDealProductResponse.md) +[**\Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse**](../Model/AddConvertDealToLeadResponse.md) ### Authorization @@ -226,22 +213,22 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: `application/json` +- **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) -## `addManyDealProducts()` +## `deleteAdditionalDiscount()` ```php -addManyDealProducts($id, $create_many_deal_product_request_body): \Pipedrive\versions\v2\Model\CreateManyDealProductResponse +deleteAdditionalDiscount($id, $discount_id): \Pipedrive\versions\v2\Model\DeleteAdditionalDiscountResponse ``` -Add multiple products to a deal +Delete a discount from a deal -Adds multiple products to a deal in a single request. Maximum of 100 products allowed per request. +Removes a discount from a deal, changing the deal value if the deal has one-time products attached. ### Example @@ -266,13 +253,13 @@ $apiInstance = new Pipedrive\versions\v2\Api\DealsApi( $config ); $id = 56; // int | The ID of the deal -$create_many_deal_product_request_body = new \Pipedrive\versions\v2\Model\CreateManyDealProductRequestBody(); // \Pipedrive\versions\v2\Model\CreateManyDealProductRequestBody +$discount_id = 'discount_id_example'; // string | The ID of the discount try { - $result = $apiInstance->addManyDealProducts($id, $create_many_deal_product_request_body); + $result = $apiInstance->deleteAdditionalDiscount($id, $discount_id); print_r($result); } catch (Exception $e) { - echo 'Exception when calling DealsApi->addManyDealProducts: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling DealsApi->deleteAdditionalDiscount: ', $e->getMessage(), PHP_EOL; } ``` @@ -281,11 +268,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| The ID of the deal | - **create_many_deal_product_request_body** | [**\Pipedrive\versions\v2\Model\CreateManyDealProductRequestBody**](../Model/CreateManyDealProductRequestBody.md)| | [optional] + **discount_id** | **string**| The ID of the discount | ### Return type -[**\Pipedrive\versions\v2\Model\CreateManyDealProductResponse**](../Model/CreateManyDealProductResponse.md) +[**\Pipedrive\versions\v2\Model\DeleteAdditionalDiscountResponse**](../Model/DeleteAdditionalDiscountResponse.md) ### Authorization @@ -293,22 +280,22 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: `application/json` +- **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) -## `convertDealToLead()` +## `deleteDeal()` ```php -convertDealToLead($id): \Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse +deleteDeal($id): \Pipedrive\versions\v2\Model\DeleteDealResponse ``` -Convert a deal to a lead +Delete a deal -Initiates a conversion of a deal to a lead. The return value is an ID of a job that was assigned to perform the conversion. Related entities (notes, files, emails, activities, ...) are transferred during the process to the target entity. There are exceptions for entities like invoices or history that are not transferred and remain linked to the original deal. If the conversion is successful, the deal is marked as deleted. To retrieve the created entity ID and the result of the conversion, call the /api/v2/deals/{deal_id}/convert/status/{conversion_id} endpoint. +Marks a deal as deleted. After 30 days, the deal will be permanently deleted. ### Example @@ -332,13 +319,13 @@ $apiInstance = new Pipedrive\versions\v2\Api\DealsApi( new GuzzleHttp\Client(), $config ); -$id = 56; // int | The ID of the deal to convert +$id = 56; // int | The ID of the deal try { - $result = $apiInstance->convertDealToLead($id); + $result = $apiInstance->deleteDeal($id); print_r($result); } catch (Exception $e) { - echo 'Exception when calling DealsApi->convertDealToLead: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling DealsApi->deleteDeal: ', $e->getMessage(), PHP_EOL; } ``` @@ -346,11 +333,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the deal to convert | + **id** | **int**| The ID of the deal | ### Return type -[**\Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse**](../Model/AddConvertDealToLeadResponse.md) +[**\Pipedrive\versions\v2\Model\DeleteDealResponse**](../Model/DeleteDealResponse.md) ### Authorization @@ -365,15 +352,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `deleteAdditionalDiscount()` +## `deleteDealFollower()` ```php -deleteAdditionalDiscount($id, $discount_id): \Pipedrive\versions\v2\Model\DeleteAdditionalDiscountResponse +deleteDealFollower($id, $follower_id): \Pipedrive\versions\v2\Model\DeleteFollowerResponse ``` -Delete a discount from a deal +Delete a follower from a deal -Removes a discount from a deal, changing the deal value if the deal has one-time products attached. +Deletes a user follower from the deal. ### Example @@ -398,13 +385,13 @@ $apiInstance = new Pipedrive\versions\v2\Api\DealsApi( $config ); $id = 56; // int | The ID of the deal -$discount_id = 'discount_id_example'; // string | The ID of the discount +$follower_id = 56; // int | The ID of the following user try { - $result = $apiInstance->deleteAdditionalDiscount($id, $discount_id); + $result = $apiInstance->deleteDealFollower($id, $follower_id); print_r($result); } catch (Exception $e) { - echo 'Exception when calling DealsApi->deleteAdditionalDiscount: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling DealsApi->deleteDealFollower: ', $e->getMessage(), PHP_EOL; } ``` @@ -413,11 +400,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| The ID of the deal | - **discount_id** | **string**| The ID of the discount | + **follower_id** | **int**| The ID of the following user | ### Return type -[**\Pipedrive\versions\v2\Model\DeleteAdditionalDiscountResponse**](../Model/DeleteAdditionalDiscountResponse.md) +[**\Pipedrive\versions\v2\Model\DeleteFollowerResponse**](../Model/DeleteFollowerResponse.md) ### Authorization @@ -432,15 +419,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `deleteDeal()` +## `getAdditionalDiscounts()` ```php -deleteDeal($id): \Pipedrive\versions\v2\Model\DeleteDealResponse +getAdditionalDiscounts($id): \Pipedrive\versions\v2\Model\AdditionalDiscountsResponse ``` -Delete a deal +List discounts added to a deal -Marks a deal as deleted. After 30 days, the deal will be permanently deleted. +Lists discounts attached to a deal. ### Example @@ -467,10 +454,10 @@ $apiInstance = new Pipedrive\versions\v2\Api\DealsApi( $id = 56; // int | The ID of the deal try { - $result = $apiInstance->deleteDeal($id); + $result = $apiInstance->getAdditionalDiscounts($id); print_r($result); } catch (Exception $e) { - echo 'Exception when calling DealsApi->deleteDeal: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling DealsApi->getAdditionalDiscounts: ', $e->getMessage(), PHP_EOL; } ``` @@ -482,7 +469,7 @@ Name | Type | Description | Notes ### Return type -[**\Pipedrive\versions\v2\Model\DeleteDealResponse**](../Model/DeleteDealResponse.md) +[**\Pipedrive\versions\v2\Model\AdditionalDiscountsResponse**](../Model/AdditionalDiscountsResponse.md) ### Authorization @@ -497,15 +484,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `deleteDealFollower()` +## `getArchivedDeals()` ```php -deleteDealFollower($id, $follower_id): \Pipedrive\versions\v2\Model\DeleteFollowerResponse +getArchivedDeals($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor): \Pipedrive\versions\v2\Model\GetDeals ``` -Delete a follower from a deal +Get all archived deals -Deletes a user follower from the deal. +Returns data about all archived deals. ### Example @@ -529,14 +516,28 @@ $apiInstance = new Pipedrive\versions\v2\Api\DealsApi( new GuzzleHttp\Client(), $config ); -$id = 56; // int | The ID of the deal -$follower_id = 56; // int | The ID of the following user +$filter_id = 56; // int | If supplied, only deals matching the specified filter are returned +$ids = 'ids_example'; // string | Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. +$owner_id = 56; // int | If supplied, only deals owned by the specified user are returned. If filter_id is provided, this is ignored. +$person_id = 56; // int | If supplied, only deals linked to the specified person are returned. If filter_id is provided, this is ignored. +$org_id = 56; // int | If supplied, only deals linked to the specified organization are returned. If filter_id is provided, this is ignored. +$pipeline_id = 56; // int | If supplied, only deals in the specified pipeline are returned. If filter_id is provided, this is ignored. +$stage_id = 56; // int | If supplied, only deals in the specified stage are returned. If filter_id is provided, this is ignored. +$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. Multiple statuses can be included as a comma separated array. If filter_id is provided, this is ignored. +$updated_since = 'updated_since_example'; // string | If set, only deals with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. +$updated_until = 'updated_until_example'; // string | If set, only deals with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. +$sort_by = 'id'; // string | The field to sort by. Supported fields: `id`, `update_time`, `add_time`. +$sort_direction = 'asc'; // string | The sorting direction. Supported values: `asc`, `desc`. +$include_fields = 'include_fields_example'; // string | Optional comma separated string array of additional fields to include +$custom_fields = 'custom_fields_example'; // string | Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.
A maximum of 15 keys is allowed. +$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. +$cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page try { - $result = $apiInstance->deleteDealFollower($id, $follower_id); + $result = $apiInstance->getArchivedDeals($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor); print_r($result); } catch (Exception $e) { - echo 'Exception when calling DealsApi->deleteDealFollower: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling DealsApi->getArchivedDeals: ', $e->getMessage(), PHP_EOL; } ``` @@ -544,12 +545,26 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the deal | - **follower_id** | **int**| The ID of the following user | + **filter_id** | **int**| If supplied, only deals matching the specified filter are returned | [optional] + **ids** | **string**| Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. | [optional] + **owner_id** | **int**| If supplied, only deals owned by the specified user are returned. If filter_id is provided, this is ignored. | [optional] + **person_id** | **int**| If supplied, only deals linked to the specified person are returned. If filter_id is provided, this is ignored. | [optional] + **org_id** | **int**| If supplied, only deals linked to the specified organization are returned. If filter_id is provided, this is ignored. | [optional] + **pipeline_id** | **int**| If supplied, only deals in the specified pipeline are returned. If filter_id is provided, this is ignored. | [optional] + **stage_id** | **int**| If supplied, only deals in the specified stage are returned. If filter_id is provided, this is ignored. | [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. Multiple statuses can be included as a comma separated array. If filter_id is provided, this is ignored. | [optional] + **updated_since** | **string**| If set, only deals with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. | [optional] + **updated_until** | **string**| If set, only deals with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. | [optional] + **sort_by** | **string**| The field to sort by. Supported fields: `id`, `update_time`, `add_time`. | [optional] [default to 'id'] + **sort_direction** | **string**| The sorting direction. Supported values: `asc`, `desc`. | [optional] [default to 'asc'] + **include_fields** | **string**| Optional comma separated string array of additional fields to include | [optional] + **custom_fields** | **string**| Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. | [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] + **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] ### Return type -[**\Pipedrive\versions\v2\Model\DeleteFollowerResponse**](../Model/DeleteFollowerResponse.md) +[**\Pipedrive\versions\v2\Model\GetDeals**](../Model/GetDeals.md) ### Authorization @@ -564,15 +579,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `deleteDealProduct()` +## `getDeal()` ```php -deleteDealProduct($id, $product_attachment_id): \Pipedrive\versions\v2\Model\DeleteDealProduct +getDeal($id, $include_fields, $custom_fields, $include_option_labels, $include_labels): \Pipedrive\versions\v2\Model\PostPatchGetDeal ``` -Delete an attached product from a deal +Get details of a deal -Deletes a product attachment from a deal, using the `product_attachment_id`. +Returns the details of a specific deal. ### Example @@ -597,13 +612,16 @@ $apiInstance = new Pipedrive\versions\v2\Api\DealsApi( $config ); $id = 56; // int | The ID of the deal -$product_attachment_id = 56; // int | The product attachment ID +$include_fields = 'include_fields_example'; // string | Optional comma separated string array of additional fields to include +$custom_fields = 'custom_fields_example'; // string | Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.
A maximum of 15 keys is allowed. +$include_option_labels = True; // bool | When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id +$include_labels = True; // bool | When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' try { - $result = $apiInstance->deleteDealProduct($id, $product_attachment_id); + $result = $apiInstance->getDeal($id, $include_fields, $custom_fields, $include_option_labels, $include_labels); print_r($result); } catch (Exception $e) { - echo 'Exception when calling DealsApi->deleteDealProduct: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling DealsApi->getDeal: ', $e->getMessage(), PHP_EOL; } ``` @@ -612,11 +630,14 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| The ID of the deal | - **product_attachment_id** | **int**| The product attachment ID | + **include_fields** | **string**| Optional comma separated string array of additional fields to include | [optional] + **custom_fields** | **string**| Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. | [optional] + **include_option_labels** | **bool**| When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id | [optional] + **include_labels** | **bool**| When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' | [optional] ### Return type -[**\Pipedrive\versions\v2\Model\DeleteDealProduct**](../Model/DeleteDealProduct.md) +[**\Pipedrive\versions\v2\Model\PostPatchGetDeal**](../Model/PostPatchGetDeal.md) ### Authorization @@ -631,15 +652,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `deleteInstallment()` +## `getDealConversionStatus()` ```php -deleteInstallment($id, $installment_id): \Pipedrive\versions\v2\Model\DeleteInstallmentResponse +getDealConversionStatus($id, $conversion_id) ``` -Delete an installment from a deal +Get Deal conversion status -Removes an installment from a deal. Only available in Growth and above plans. +Returns information about the conversion. Status is always present and its value (not_started, running, completed, failed, rejected) represents the current state of the conversion. Lead ID is only present if the conversion was successfully finished. This data is only temporary and removed after a few days. ### Example @@ -663,14 +684,13 @@ $apiInstance = new Pipedrive\versions\v2\Api\DealsApi( new GuzzleHttp\Client(), $config ); -$id = 56; // int | The ID of the deal -$installment_id = 56; // int | The ID of the installment +$id = 56; // int | The ID of a deal +$conversion_id = 'conversion_id_example'; // string | The ID of the conversion try { - $result = $apiInstance->deleteInstallment($id, $installment_id); - print_r($result); + $apiInstance->getDealConversionStatus($id, $conversion_id); } catch (Exception $e) { - echo 'Exception when calling DealsApi->deleteInstallment: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling DealsApi->getDealConversionStatus: ', $e->getMessage(), PHP_EOL; } ``` @@ -678,12 +698,12 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the deal | - **installment_id** | **int**| The ID of the installment | + **id** | **int**| The ID of a deal | + **conversion_id** | **string**| The ID of the conversion | ### Return type -[**\Pipedrive\versions\v2\Model\DeleteInstallmentResponse**](../Model/DeleteInstallmentResponse.md) +void (empty response body) ### Authorization @@ -698,15 +718,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `deleteManyDealProducts()` +## `getDealFollowers()` ```php -deleteManyDealProducts($id, $ids): \Pipedrive\versions\v2\Model\DeleteManyDealProductResponse +getDealFollowers($id, $limit, $cursor): \Pipedrive\versions\v2\Model\GetFollowers ``` -Delete many products from a deal +List followers of a deal -Deletes multiple products from a deal. If no product IDs are specified, up to 100 products will be removed from the deal. A maximum of 100 product IDs can be provided per request. +Lists users who are following the deal. ### Example @@ -731,13 +751,14 @@ $apiInstance = new Pipedrive\versions\v2\Api\DealsApi( $config ); $id = 56; // int | The ID of the deal -$ids = 1,2,3; // string | Comma-separated list of deal product IDs to delete. If not provided, all deal products will be deleted up to 100 items. Maximum 100 IDs allowed. +$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. +$cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page try { - $result = $apiInstance->deleteManyDealProducts($id, $ids); + $result = $apiInstance->getDealFollowers($id, $limit, $cursor); print_r($result); } catch (Exception $e) { - echo 'Exception when calling DealsApi->deleteManyDealProducts: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling DealsApi->getDealFollowers: ', $e->getMessage(), PHP_EOL; } ``` @@ -746,11 +767,12 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| The ID of the deal | - **ids** | **string**| Comma-separated list of deal product IDs to delete. If not provided, all deal products will be deleted up to 100 items. Maximum 100 IDs allowed. | [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] + **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] ### Return type -[**\Pipedrive\versions\v2\Model\DeleteManyDealProductResponse**](../Model/DeleteManyDealProductResponse.md) +[**\Pipedrive\versions\v2\Model\GetFollowers**](../Model/GetFollowers.md) ### Authorization @@ -765,15 +787,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getAdditionalDiscounts()` +## `getDealFollowersChangelog()` ```php -getAdditionalDiscounts($id): \Pipedrive\versions\v2\Model\AdditionalDiscountsResponse +getDealFollowersChangelog($id, $limit, $cursor): \Pipedrive\versions\v2\Model\GetFollowerChangelogs ``` -List discounts added to a deal +List followers changelog of a deal -Lists discounts attached to a deal. +Lists changelogs about users have followed the deal. ### Example @@ -798,12 +820,14 @@ $apiInstance = new Pipedrive\versions\v2\Api\DealsApi( $config ); $id = 56; // int | The ID of the deal +$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. +$cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page try { - $result = $apiInstance->getAdditionalDiscounts($id); + $result = $apiInstance->getDealFollowersChangelog($id, $limit, $cursor); print_r($result); } catch (Exception $e) { - echo 'Exception when calling DealsApi->getAdditionalDiscounts: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling DealsApi->getDealFollowersChangelog: ', $e->getMessage(), PHP_EOL; } ``` @@ -812,10 +836,12 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| The ID of the deal | + **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] + **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] ### Return type -[**\Pipedrive\versions\v2\Model\AdditionalDiscountsResponse**](../Model/AdditionalDiscountsResponse.md) +[**\Pipedrive\versions\v2\Model\GetFollowerChangelogs**](../Model/GetFollowerChangelogs.md) ### Authorization @@ -830,15 +856,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getArchivedDeals()` +## `getDeals()` ```php -getArchivedDeals($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor): \Pipedrive\versions\v2\Model\GetDeals +getDeals($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $include_option_labels, $include_labels, $limit, $cursor): \Pipedrive\versions\v2\Model\GetDeals ``` -Get all archived deals +Get all deals -Returns data about all archived deals. +Returns data about all not archived deals. ### Example @@ -876,14 +902,16 @@ $sort_by = 'id'; // string | The field to sort by. Supported fields: `id`, `upda $sort_direction = 'asc'; // string | The sorting direction. Supported values: `asc`, `desc`. $include_fields = 'include_fields_example'; // string | Optional comma separated string array of additional fields to include $custom_fields = 'custom_fields_example'; // string | Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.
A maximum of 15 keys is allowed. +$include_option_labels = True; // bool | When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id +$include_labels = True; // bool | When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' $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. $cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page try { - $result = $apiInstance->getArchivedDeals($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor); + $result = $apiInstance->getDeals($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $include_option_labels, $include_labels, $limit, $cursor); print_r($result); } catch (Exception $e) { - echo 'Exception when calling DealsApi->getArchivedDeals: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling DealsApi->getDeals: ', $e->getMessage(), PHP_EOL; } ``` @@ -905,6 +933,8 @@ Name | Type | Description | Notes **sort_direction** | **string**| The sorting direction. Supported values: `asc`, `desc`. | [optional] [default to 'asc'] **include_fields** | **string**| Optional comma separated string array of additional fields to include | [optional] **custom_fields** | **string**| Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. | [optional] + **include_option_labels** | **bool**| When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id | [optional] + **include_labels** | **bool**| When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' | [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] **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] @@ -925,15 +955,15 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getDeal()` +## `postAdditionalDiscount()` ```php -getDeal($id, $include_fields, $custom_fields): \Pipedrive\versions\v2\Model\PostPatchGetDeal +postAdditionalDiscount($id, $body): \Pipedrive\versions\v2\Model\AddAdditionalDiscountResponse ``` -Get details of a deal +Add a discount to a deal -Returns the details of a specific deal. +Adds a discount to a deal, changing the deal value if the deal has one-time products attached. ### Example @@ -958,14 +988,13 @@ $apiInstance = new Pipedrive\versions\v2\Api\DealsApi( $config ); $id = 56; // int | The ID of the deal -$include_fields = 'include_fields_example'; // string | Optional comma separated string array of additional fields to include -$custom_fields = 'custom_fields_example'; // string | Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.
A maximum of 15 keys is allowed. +$body = new \stdClass; // object try { - $result = $apiInstance->getDeal($id, $include_fields, $custom_fields); + $result = $apiInstance->postAdditionalDiscount($id, $body); print_r($result); } catch (Exception $e) { - echo 'Exception when calling DealsApi->getDeal: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling DealsApi->postAdditionalDiscount: ', $e->getMessage(), PHP_EOL; } ``` @@ -974,12 +1003,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| The ID of the deal | - **include_fields** | **string**| Optional comma separated string array of additional fields to include | [optional] - **custom_fields** | **string**| Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. | [optional] + **body** | **object**| | [optional] ### Return type -[**\Pipedrive\versions\v2\Model\PostPatchGetDeal**](../Model/PostPatchGetDeal.md) +[**\Pipedrive\versions\v2\Model\AddAdditionalDiscountResponse**](../Model/AddAdditionalDiscountResponse.md) ### Authorization @@ -987,22 +1015,22 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: Not defined +- **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) -## `getDealConversionStatus()` +## `searchDeals()` ```php -getDealConversionStatus($id, $conversion_id) +searchDeals($term, $fields, $exact_match, $person_id, $organization_id, $status, $include_fields, $limit, $cursor): \Pipedrive\versions\v2\Model\GetDealSearchResponse ``` -Get Deal conversion status +Search deals -Returns information about the conversion. Status is always present and its value (not_started, running, completed, failed, rejected) represents the current state of the conversion. Lead ID is only present if the conversion was successfully finished. This data is only temporary and removed after a few days. +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 @@ -1026,13 +1054,21 @@ $apiInstance = new Pipedrive\versions\v2\Api\DealsApi( new GuzzleHttp\Client(), $config ); -$id = 56; // int | The ID of a deal -$conversion_id = 'conversion_id_example'; // string | The ID of the conversion +$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 +$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. +$cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page try { - $apiInstance->getDealConversionStatus($id, $conversion_id); + $result = $apiInstance->searchDeals($term, $fields, $exact_match, $person_id, $organization_id, $status, $include_fields, $limit, $cursor); + print_r($result); } catch (Exception $e) { - echo 'Exception when calling DealsApi->getDealConversionStatus: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling DealsApi->searchDeals: ', $e->getMessage(), PHP_EOL; } ``` @@ -1040,12 +1076,19 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of a deal | - **conversion_id** | **string**| The ID of the conversion | + **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] + **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] + **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] ### Return type -void (empty response body) +[**\Pipedrive\versions\v2\Model\GetDealSearchResponse**](../Model/GetDealSearchResponse.md) ### Authorization @@ -1060,15 +1103,15 @@ void (empty response body) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## `getDealFollowers()` +## `updateAdditionalDiscount()` ```php -getDealFollowers($id, $limit, $cursor): \Pipedrive\versions\v2\Model\GetFollowers +updateAdditionalDiscount($id, $discount_id, $body): \Pipedrive\versions\v2\Model\UpdateAdditionalDiscountResponse ``` -List followers of a deal +Update a discount added to a deal -Lists users who are following the deal. +Edits a discount added to a deal, changing the deal value if the deal has one-time products attached. ### Example @@ -1093,675 +1136,8 @@ $apiInstance = new Pipedrive\versions\v2\Api\DealsApi( $config ); $id = 56; // int | The ID of the deal -$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. -$cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page - -try { - $result = $apiInstance->getDealFollowers($id, $limit, $cursor); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling DealsApi->getDealFollowers: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the deal | - **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] - **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] - -### Return type - -[**\Pipedrive\versions\v2\Model\GetFollowers**](../Model/GetFollowers.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) - -## `getDealFollowersChangelog()` - -```php -getDealFollowersChangelog($id, $limit, $cursor): \Pipedrive\versions\v2\Model\GetFollowerChangelogs -``` - -List followers changelog of a deal - -Lists changelogs about users have followed the 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v2\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 -$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. -$cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page - -try { - $result = $apiInstance->getDealFollowersChangelog($id, $limit, $cursor); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling DealsApi->getDealFollowersChangelog: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the deal | - **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] - **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] - -### Return type - -[**\Pipedrive\versions\v2\Model\GetFollowerChangelogs**](../Model/GetFollowerChangelogs.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) - -## `getDealProducts()` - -```php -getDealProducts($id, $cursor, $limit, $sort_by, $sort_direction): \Pipedrive\versions\v2\Model\DealsProductsResponse -``` - -List products attached to a deal - -Lists products 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v2\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 = 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. -$sort_by = 'id'; // string | The field to sort by. Supported fields: `id`, `add_time`, `update_time`, `order_nr`. -$sort_direction = 'asc'; // string | The sorting direction. Supported values: `asc`, `desc`. - -try { - $result = $apiInstance->getDealProducts($id, $cursor, $limit, $sort_by, $sort_direction); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling DealsApi->getDealProducts: ', $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**| 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] - **sort_by** | **string**| The field to sort by. Supported fields: `id`, `add_time`, `update_time`, `order_nr`. | [optional] [default to 'id'] - **sort_direction** | **string**| The sorting direction. Supported values: `asc`, `desc`. | [optional] [default to 'asc'] - -### Return type - -[**\Pipedrive\versions\v2\Model\DealsProductsResponse**](../Model/DealsProductsResponse.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) - -## `getDeals()` - -```php -getDeals($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor): \Pipedrive\versions\v2\Model\GetDeals -``` - -Get all deals - -Returns data about 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v2\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 -); -$filter_id = 56; // int | If supplied, only deals matching the specified filter are returned -$ids = 'ids_example'; // string | Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. -$owner_id = 56; // int | If supplied, only deals owned by the specified user are returned. If filter_id is provided, this is ignored. -$person_id = 56; // int | If supplied, only deals linked to the specified person are returned. If filter_id is provided, this is ignored. -$org_id = 56; // int | If supplied, only deals linked to the specified organization are returned. If filter_id is provided, this is ignored. -$pipeline_id = 56; // int | If supplied, only deals in the specified pipeline are returned. If filter_id is provided, this is ignored. -$stage_id = 56; // int | If supplied, only deals in the specified stage are returned. If filter_id is provided, this is ignored. -$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. Multiple statuses can be included as a comma separated array. If filter_id is provided, this is ignored. -$updated_since = 'updated_since_example'; // string | If set, only deals with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. -$updated_until = 'updated_until_example'; // string | If set, only deals with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. -$sort_by = 'id'; // string | The field to sort by. Supported fields: `id`, `update_time`, `add_time`. -$sort_direction = 'asc'; // string | The sorting direction. Supported values: `asc`, `desc`. -$include_fields = 'include_fields_example'; // string | Optional comma separated string array of additional fields to include -$custom_fields = 'custom_fields_example'; // string | Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.
A maximum of 15 keys is allowed. -$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. -$cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page - -try { - $result = $apiInstance->getDeals($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling DealsApi->getDeals: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **filter_id** | **int**| If supplied, only deals matching the specified filter are returned | [optional] - **ids** | **string**| Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. | [optional] - **owner_id** | **int**| If supplied, only deals owned by the specified user are returned. If filter_id is provided, this is ignored. | [optional] - **person_id** | **int**| If supplied, only deals linked to the specified person are returned. If filter_id is provided, this is ignored. | [optional] - **org_id** | **int**| If supplied, only deals linked to the specified organization are returned. If filter_id is provided, this is ignored. | [optional] - **pipeline_id** | **int**| If supplied, only deals in the specified pipeline are returned. If filter_id is provided, this is ignored. | [optional] - **stage_id** | **int**| If supplied, only deals in the specified stage are returned. If filter_id is provided, this is ignored. | [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. Multiple statuses can be included as a comma separated array. If filter_id is provided, this is ignored. | [optional] - **updated_since** | **string**| If set, only deals with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. | [optional] - **updated_until** | **string**| If set, only deals with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. | [optional] - **sort_by** | **string**| The field to sort by. Supported fields: `id`, `update_time`, `add_time`. | [optional] [default to 'id'] - **sort_direction** | **string**| The sorting direction. Supported values: `asc`, `desc`. | [optional] [default to 'asc'] - **include_fields** | **string**| Optional comma separated string array of additional fields to include | [optional] - **custom_fields** | **string**| Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. | [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] - **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] - -### Return type - -[**\Pipedrive\versions\v2\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) - -## `getDealsProducts()` - -```php -getDealsProducts($deal_ids, $cursor, $limit, $sort_by, $sort_direction): \Pipedrive\versions\v2\Model\DealsProductsResponse -``` - -Get deal products of several deals - -Returns data about products attached to 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v2\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 -); -$deal_ids = array(56); // int[] | An array of integers with the IDs of the deals for which the attached products will be returned. A maximum of 100 deal IDs can be provided. -$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. -$sort_by = 'id'; // string | The field to sort by. Supported fields: `id`, `deal_id`, `add_time`, `update_time`, `order_nr`. -$sort_direction = 'asc'; // string | The sorting direction. Supported values: `asc`, `desc`. - -try { - $result = $apiInstance->getDealsProducts($deal_ids, $cursor, $limit, $sort_by, $sort_direction); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling DealsApi->getDealsProducts: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **deal_ids** | [**int[]**](../Model/int.md)| An array of integers with the IDs of the deals for which the attached products will be returned. A maximum of 100 deal IDs can be provided. | - **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] - **sort_by** | **string**| The field to sort by. Supported fields: `id`, `deal_id`, `add_time`, `update_time`, `order_nr`. | [optional] [default to 'id'] - **sort_direction** | **string**| The sorting direction. Supported values: `asc`, `desc`. | [optional] [default to 'asc'] - -### Return type - -[**\Pipedrive\versions\v2\Model\DealsProductsResponse**](../Model/DealsProductsResponse.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) - -## `getInstallments()` - -```php -getInstallments($deal_ids, $cursor, $limit, $sort_by, $sort_direction): \Pipedrive\versions\v2\Model\InstallmentsResponse -``` - -List installments added to a list of deals - -Lists installments attached to a list of deals. Only available in Growth and above plans. - -### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v2\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 -); -$deal_ids = array(56); // int[] | An array of integers with the IDs of the deals for which the attached installments will be returned. A maximum of 100 deal IDs can be provided. -$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. -$sort_by = 'id'; // string | The field to sort by. Supported fields: `id`, `billing_date`, `deal_id`. -$sort_direction = 'asc'; // string | The sorting direction. Supported values: `asc`, `desc`. - -try { - $result = $apiInstance->getInstallments($deal_ids, $cursor, $limit, $sort_by, $sort_direction); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling DealsApi->getInstallments: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **deal_ids** | [**int[]**](../Model/int.md)| An array of integers with the IDs of the deals for which the attached installments will be returned. A maximum of 100 deal IDs can be provided. | - **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] - **sort_by** | **string**| The field to sort by. Supported fields: `id`, `billing_date`, `deal_id`. | [optional] [default to 'id'] - **sort_direction** | **string**| The sorting direction. Supported values: `asc`, `desc`. | [optional] [default to 'asc'] - -### Return type - -[**\Pipedrive\versions\v2\Model\InstallmentsResponse**](../Model/InstallmentsResponse.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) - -## `postAdditionalDiscount()` - -```php -postAdditionalDiscount($id, $body): \Pipedrive\versions\v2\Model\AddAdditionalDiscountResponse -``` - -Add a discount to a deal - -Adds a discount to a deal, changing the deal value if the deal has one-time products attached. - -### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v2\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 -$body = new \stdClass; // object - -try { - $result = $apiInstance->postAdditionalDiscount($id, $body); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling DealsApi->postAdditionalDiscount: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the deal | - **body** | **object**| | [optional] - -### Return type - -[**\Pipedrive\versions\v2\Model\AddAdditionalDiscountResponse**](../Model/AddAdditionalDiscountResponse.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) - -## `postInstallment()` - -```php -postInstallment($id, $body): \Pipedrive\versions\v2\Model\AddInstallmentResponse -``` - -Add an installment to a deal - -Adds an installment to a deal. An installment can only be added if the deal includes at least one one-time product. If the deal contains at least one recurring product, adding installments is not allowed. Only available in Growth and above plans. - -### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v2\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 -$body = new \stdClass; // object - -try { - $result = $apiInstance->postInstallment($id, $body); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling DealsApi->postInstallment: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the deal | - **body** | **object**| | [optional] - -### Return type - -[**\Pipedrive\versions\v2\Model\AddInstallmentResponse**](../Model/AddInstallmentResponse.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) - -## `searchDeals()` - -```php -searchDeals($term, $fields, $exact_match, $person_id, $organization_id, $status, $include_fields, $limit, $cursor): \Pipedrive\versions\v2\Model\GetDealSearchResponse -``` - -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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v2\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 -$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. -$cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page - -try { - $result = $apiInstance->searchDeals($term, $fields, $exact_match, $person_id, $organization_id, $status, $include_fields, $limit, $cursor); - 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] - **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] - **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] - -### Return type - -[**\Pipedrive\versions\v2\Model\GetDealSearchResponse**](../Model/GetDealSearchResponse.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) - -## `updateAdditionalDiscount()` - -```php -updateAdditionalDiscount($id, $discount_id, $body): \Pipedrive\versions\v2\Model\UpdateAdditionalDiscountResponse -``` - -Update a discount added to a deal - -Edits a discount added to a deal, changing the deal value if the deal has one-time products attached. - -### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v2\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 -$discount_id = 'discount_id_example'; // string | The ID of the discount -$body = new \stdClass; // object +$discount_id = 'discount_id_example'; // string | The ID of the discount +$body = new \stdClass; // object try { $result = $apiInstance->updateAdditionalDiscount($id, $discount_id, $body); @@ -1862,141 +1238,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) - -## `updateDealProduct()` - -```php -updateDealProduct($id, $product_attachment_id, $update_deal_product_request_body): \Pipedrive\versions\v2\Model\AddDealProductResponse -``` - -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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v2\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_request_body = new \Pipedrive\versions\v2\Model\UpdateDealProductRequestBody(); // \Pipedrive\versions\v2\Model\UpdateDealProductRequestBody - -try { - $result = $apiInstance->updateDealProduct($id, $product_attachment_id, $update_deal_product_request_body); - 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_request_body** | [**\Pipedrive\versions\v2\Model\UpdateDealProductRequestBody**](../Model/UpdateDealProductRequestBody.md)| | [optional] - -### Return type - -[**\Pipedrive\versions\v2\Model\AddDealProductResponse**](../Model/AddDealProductResponse.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) - -## `updateInstallment()` - -```php -updateInstallment($id, $installment_id, $body): \Pipedrive\versions\v2\Model\UpdateInstallmentResponse -``` - -Update an installment added to a deal - -Edits an installment added to a deal. Only available in Growth and above plans. - -### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); - -// Configure OAuth2 access token for authorization: oauth2 -$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Pipedrive\versions\v2\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 -$installment_id = 56; // int | The ID of the installment -$body = new \stdClass; // object - -try { - $result = $apiInstance->updateInstallment($id, $installment_id, $body); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling DealsApi->updateInstallment: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **int**| The ID of the deal | - **installment_id** | **int**| The ID of the installment | - **body** | **object**| | [optional] - -### Return type - -[**\Pipedrive\versions\v2\Model\UpdateInstallmentResponse**](../Model/UpdateInstallmentResponse.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/v2/Api/OrganizationsApi.md b/docs/versions/v2/Api/OrganizationsApi.md index b67f8d54..a6ae7071 100644 --- a/docs/versions/v2/Api/OrganizationsApi.md +++ b/docs/versions/v2/Api/OrganizationsApi.md @@ -283,7 +283,7 @@ Name | Type | Description | Notes ## `getOrganization()` ```php -getOrganization($id, $include_fields, $custom_fields): \Pipedrive\versions\v2\Model\PostPatchGetOrganization +getOrganization($id, $include_fields, $custom_fields, $include_option_labels, $include_labels): \Pipedrive\versions\v2\Model\PostPatchGetOrganization ``` Get details of a organization @@ -315,9 +315,11 @@ $apiInstance = new Pipedrive\versions\v2\Api\OrganizationsApi( $id = 56; // int | The ID of the organization $include_fields = 'include_fields_example'; // string | Optional comma separated string array of additional fields to include $custom_fields = 'custom_fields_example'; // string | Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.
A maximum of 15 keys is allowed. +$include_option_labels = True; // bool | When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id +$include_labels = True; // bool | When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' try { - $result = $apiInstance->getOrganization($id, $include_fields, $custom_fields); + $result = $apiInstance->getOrganization($id, $include_fields, $custom_fields, $include_option_labels, $include_labels); print_r($result); } catch (Exception $e) { echo 'Exception when calling OrganizationsApi->getOrganization: ', $e->getMessage(), PHP_EOL; @@ -331,6 +333,8 @@ Name | Type | Description | Notes **id** | **int**| The ID of the organization | **include_fields** | **string**| Optional comma separated string array of additional fields to include | [optional] **custom_fields** | **string**| Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. | [optional] + **include_option_labels** | **bool**| When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id | [optional] + **include_labels** | **bool**| When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' | [optional] ### Return type @@ -490,7 +494,7 @@ Name | Type | Description | Notes ## `getOrganizations()` ```php -getOrganizations($filter_id, $ids, $owner_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor): \Pipedrive\versions\v2\Model\GetOrganizations +getOrganizations($filter_id, $ids, $owner_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $include_option_labels, $include_labels, $limit, $cursor): \Pipedrive\versions\v2\Model\GetOrganizations ``` Get all organizations @@ -528,11 +532,13 @@ $sort_by = 'id'; // string | The field to sort by. Supported fields: `id`, `upda $sort_direction = 'asc'; // string | The sorting direction. Supported values: `asc`, `desc`. $include_fields = 'include_fields_example'; // string | Optional comma separated string array of additional fields to include $custom_fields = 'custom_fields_example'; // string | Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.
A maximum of 15 keys is allowed. +$include_option_labels = True; // bool | When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id +$include_labels = True; // bool | When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' $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. $cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page try { - $result = $apiInstance->getOrganizations($filter_id, $ids, $owner_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor); + $result = $apiInstance->getOrganizations($filter_id, $ids, $owner_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $include_option_labels, $include_labels, $limit, $cursor); print_r($result); } catch (Exception $e) { echo 'Exception when calling OrganizationsApi->getOrganizations: ', $e->getMessage(), PHP_EOL; @@ -552,6 +558,8 @@ Name | Type | Description | Notes **sort_direction** | **string**| The sorting direction. Supported values: `asc`, `desc`. | [optional] [default to 'asc'] **include_fields** | **string**| Optional comma separated string array of additional fields to include | [optional] **custom_fields** | **string**| Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. | [optional] + **include_option_labels** | **bool**| When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id | [optional] + **include_labels** | **bool**| When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' | [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] **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] diff --git a/docs/versions/v2/Api/PersonsApi.md b/docs/versions/v2/Api/PersonsApi.md index 056f637a..8ffe983f 100644 --- a/docs/versions/v2/Api/PersonsApi.md +++ b/docs/versions/v2/Api/PersonsApi.md @@ -284,7 +284,7 @@ Name | Type | Description | Notes ## `getPerson()` ```php -getPerson($id, $include_fields, $custom_fields): \Pipedrive\versions\v2\Model\PostPatchGetPerson +getPerson($id, $include_fields, $custom_fields, $include_option_labels, $include_labels): \Pipedrive\versions\v2\Model\PostPatchGetPerson ``` Get details of a person @@ -316,9 +316,11 @@ $apiInstance = new Pipedrive\versions\v2\Api\PersonsApi( $id = 56; // int | The ID of the person $include_fields = 'include_fields_example'; // string | Optional comma separated string array of additional fields to include. `marketing_status` and `doi_status` can only be included if the company has marketing app enabled. $custom_fields = 'custom_fields_example'; // string | Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.
A maximum of 15 keys is allowed. +$include_option_labels = True; // bool | When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id +$include_labels = True; // bool | When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' try { - $result = $apiInstance->getPerson($id, $include_fields, $custom_fields); + $result = $apiInstance->getPerson($id, $include_fields, $custom_fields, $include_option_labels, $include_labels); print_r($result); } catch (Exception $e) { echo 'Exception when calling PersonsApi->getPerson: ', $e->getMessage(), PHP_EOL; @@ -332,6 +334,8 @@ Name | Type | Description | Notes **id** | **int**| The ID of the person | **include_fields** | **string**| Optional comma separated string array of additional fields to include. `marketing_status` and `doi_status` can only be included if the company has marketing app enabled. | [optional] **custom_fields** | **string**| Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. | [optional] + **include_option_labels** | **bool**| When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id | [optional] + **include_labels** | **bool**| When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' | [optional] ### Return type @@ -556,7 +560,7 @@ Name | Type | Description | Notes ## `getPersons()` ```php -getPersons($filter_id, $ids, $owner_id, $org_id, $deal_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor): \Pipedrive\versions\v2\Model\GetPersons +getPersons($filter_id, $ids, $owner_id, $org_id, $deal_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $include_option_labels, $include_labels, $limit, $cursor): \Pipedrive\versions\v2\Model\GetPersons ``` Get all persons @@ -596,11 +600,13 @@ $sort_by = 'id'; // string | The field to sort by. Supported fields: `id`, `upda $sort_direction = 'asc'; // string | The sorting direction. Supported values: `asc`, `desc`. $include_fields = 'include_fields_example'; // string | Optional comma separated string array of additional fields to include. `marketing_status` and `doi_status` can only be included if the company has marketing app enabled. $custom_fields = 'custom_fields_example'; // string | Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.
A maximum of 15 keys is allowed. +$include_option_labels = True; // bool | When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id +$include_labels = True; // bool | When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' $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. $cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page try { - $result = $apiInstance->getPersons($filter_id, $ids, $owner_id, $org_id, $deal_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor); + $result = $apiInstance->getPersons($filter_id, $ids, $owner_id, $org_id, $deal_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $include_option_labels, $include_labels, $limit, $cursor); print_r($result); } catch (Exception $e) { echo 'Exception when calling PersonsApi->getPersons: ', $e->getMessage(), PHP_EOL; @@ -622,6 +628,8 @@ Name | Type | Description | Notes **sort_direction** | **string**| The sorting direction. Supported values: `asc`, `desc`. | [optional] [default to 'asc'] **include_fields** | **string**| Optional comma separated string array of additional fields to include. `marketing_status` and `doi_status` can only be included if the company has marketing app enabled. | [optional] **custom_fields** | **string**| Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. | [optional] + **include_option_labels** | **bool**| When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id | [optional] + **include_labels** | **bool**| When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' | [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] **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] diff --git a/docs/versions/v2/Api/ProjectBoardsApi.md b/docs/versions/v2/Api/ProjectBoardsApi.md new file mode 100644 index 00000000..49e4d0f4 --- /dev/null +++ b/docs/versions/v2/Api/ProjectBoardsApi.md @@ -0,0 +1,336 @@ +# Pipedrive\versions\v2\ProjectBoardsApi + +All URIs are relative to https://api.pipedrive.com/api/v2. + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addProjectBoard()**](ProjectBoardsApi.md#addProjectBoard) | **POST** /boards | Add a project board +[**deleteProjectBoard()**](ProjectBoardsApi.md#deleteProjectBoard) | **DELETE** /boards/{id} | Delete a project board +[**getProjectsBoard()**](ProjectBoardsApi.md#getProjectsBoard) | **GET** /boards/{id} | Get details of a project board +[**getProjectsBoards()**](ProjectBoardsApi.md#getProjectsBoards) | **GET** /boards | Get all project boards +[**updateProjectBoard()**](ProjectBoardsApi.md#updateProjectBoard) | **PATCH** /boards/{id} | Update a project board + + +## `addProjectBoard()` + +```php +addProjectBoard($board_request_body): \Pipedrive\versions\v2\Model\PostPatchGetBoard +``` + +Add a project board + +Adds a new project board. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectBoardsApi( + // 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 +); +$board_request_body = new \Pipedrive\versions\v2\Model\BoardRequestBody(); // \Pipedrive\versions\v2\Model\BoardRequestBody + +try { + $result = $apiInstance->addProjectBoard($board_request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectBoardsApi->addProjectBoard: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **board_request_body** | [**\Pipedrive\versions\v2\Model\BoardRequestBody**](../Model/BoardRequestBody.md)| | + +### Return type + +[**\Pipedrive\versions\v2\Model\PostPatchGetBoard**](../Model/PostPatchGetBoard.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) + +## `deleteProjectBoard()` + +```php +deleteProjectBoard($id): \Pipedrive\versions\v2\Model\DeleteProjectBoardResponse +``` + +Delete a project board + +Marks a project board 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectBoardsApi( + // 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 project board + +try { + $result = $apiInstance->deleteProjectBoard($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectBoardsApi->deleteProjectBoard: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| The ID of the project board | + +### Return type + +[**\Pipedrive\versions\v2\Model\DeleteProjectBoardResponse**](../Model/DeleteProjectBoardResponse.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) + +## `getProjectsBoard()` + +```php +getProjectsBoard($id): \Pipedrive\versions\v2\Model\PostPatchGetBoard +``` + +Get details of a project board + +Returns the details of a specific project board. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectBoardsApi( + // 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 project board + +try { + $result = $apiInstance->getProjectsBoard($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectBoardsApi->getProjectsBoard: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| The ID of the project board | + +### Return type + +[**\Pipedrive\versions\v2\Model\PostPatchGetBoard**](../Model/PostPatchGetBoard.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) + +## `getProjectsBoards()` + +```php +getProjectsBoards(): \Pipedrive\versions\v2\Model\GetBoards +``` + +Get all project boards + +Returns all active project boards. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectBoardsApi( + // 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->getProjectsBoards(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectBoardsApi->getProjectsBoards: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Pipedrive\versions\v2\Model\GetBoards**](../Model/GetBoards.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) + +## `updateProjectBoard()` + +```php +updateProjectBoard($id, $board_request_body): \Pipedrive\versions\v2\Model\PostPatchGetBoard +``` + +Update a project board + +Updates the properties of a project board. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectBoardsApi( + // 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 project board +$board_request_body = new \Pipedrive\versions\v2\Model\BoardRequestBody(); // \Pipedrive\versions\v2\Model\BoardRequestBody + +try { + $result = $apiInstance->updateProjectBoard($id, $board_request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectBoardsApi->updateProjectBoard: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| The ID of the project board | + **board_request_body** | [**\Pipedrive\versions\v2\Model\BoardRequestBody**](../Model/BoardRequestBody.md)| | [optional] + +### Return type + +[**\Pipedrive\versions\v2\Model\PostPatchGetBoard**](../Model/PostPatchGetBoard.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/v2/Api/ProjectFieldsApi.md b/docs/versions/v2/Api/ProjectFieldsApi.md new file mode 100644 index 00000000..97a72b64 --- /dev/null +++ b/docs/versions/v2/Api/ProjectFieldsApi.md @@ -0,0 +1,545 @@ +# Pipedrive\versions\v2\ProjectFieldsApi + +All URIs are relative to https://api.pipedrive.com/api/v2. + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addProjectField()**](ProjectFieldsApi.md#addProjectField) | **POST** /projectFields | Create one project field +[**addProjectFieldOptions()**](ProjectFieldsApi.md#addProjectFieldOptions) | **POST** /projectFields/{field_code}/options | Add project field options in bulk +[**deleteProjectField()**](ProjectFieldsApi.md#deleteProjectField) | **DELETE** /projectFields/{field_code} | Delete one project field +[**deleteProjectFieldOptions()**](ProjectFieldsApi.md#deleteProjectFieldOptions) | **DELETE** /projectFields/{field_code}/options | Delete project field options in bulk +[**getProjectField()**](ProjectFieldsApi.md#getProjectField) | **GET** /projectFields/{field_code} | Get one project field +[**getProjectFields()**](ProjectFieldsApi.md#getProjectFields) | **GET** /projectFields | Get all project fields +[**updateProjectField()**](ProjectFieldsApi.md#updateProjectField) | **PATCH** /projectFields/{field_code} | Update one project field +[**updateProjectFieldOptions()**](ProjectFieldsApi.md#updateProjectFieldOptions) | **PATCH** /projectFields/{field_code}/options | Update project field options in bulk + + +## `addProjectField()` + +```php +addProjectField($create_project_field_request): \Pipedrive\versions\v2\Model\CreateProjectField +``` + +Create one project field + +Creates a new project custom 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectFieldsApi( + // 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 +); +$create_project_field_request = new \Pipedrive\versions\v2\Model\CreateProjectFieldRequest(); // \Pipedrive\versions\v2\Model\CreateProjectFieldRequest + +try { + $result = $apiInstance->addProjectField($create_project_field_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectFieldsApi->addProjectField: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **create_project_field_request** | [**\Pipedrive\versions\v2\Model\CreateProjectFieldRequest**](../Model/CreateProjectFieldRequest.md)| | + +### Return type + +[**\Pipedrive\versions\v2\Model\CreateProjectField**](../Model/CreateProjectField.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) + +## `addProjectFieldOptions()` + +```php +addProjectFieldOptions($field_code, $request_body): \Pipedrive\versions\v2\Model\InlineResponse200 +``` + +Add project field options in bulk + +Adds new options to a project custom field that supports options (enum or set field types). This operation is atomic - all options are added or none are added. Returns only the newly added options. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectFieldsApi( + // 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 +); +$field_code = 'field_code_example'; // string | The unique code identifying the field +$request_body = array(new \stdClass); // object[] + +try { + $result = $apiInstance->addProjectFieldOptions($field_code, $request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectFieldsApi->addProjectFieldOptions: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **field_code** | **string**| The unique code identifying the field | + **request_body** | [**object[]**](../Model/object.md)| | + +### Return type + +[**\Pipedrive\versions\v2\Model\InlineResponse200**](../Model/InlineResponse200.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) + +## `deleteProjectField()` + +```php +deleteProjectField($field_code): \Pipedrive\versions\v2\Model\DeleteProjectField +``` + +Delete one project field + +Marks a custom field 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectFieldsApi( + // 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 +); +$field_code = 'field_code_example'; // string | The unique code identifying the field + +try { + $result = $apiInstance->deleteProjectField($field_code); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectFieldsApi->deleteProjectField: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **field_code** | **string**| The unique code identifying the field | + +### Return type + +[**\Pipedrive\versions\v2\Model\DeleteProjectField**](../Model/DeleteProjectField.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) + +## `deleteProjectFieldOptions()` + +```php +deleteProjectFieldOptions($field_code, $request_body): \Pipedrive\versions\v2\Model\InlineResponse200 +``` + +Delete project field options in bulk + +Removes existing options from a project custom field. This operation is atomic and fails if any of the specified option IDs do not exist. Returns only the deleted options. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectFieldsApi( + // 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 +); +$field_code = 'field_code_example'; // string | The unique code identifying the field +$request_body = array(new \stdClass); // object[] + +try { + $result = $apiInstance->deleteProjectFieldOptions($field_code, $request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectFieldsApi->deleteProjectFieldOptions: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **field_code** | **string**| The unique code identifying the field | + **request_body** | [**object[]**](../Model/object.md)| | + +### Return type + +[**\Pipedrive\versions\v2\Model\InlineResponse200**](../Model/InlineResponse200.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) + +## `getProjectField()` + +```php +getProjectField($field_code): \Pipedrive\versions\v2\Model\GetProjectField +``` + +Get one project field + +Returns metadata about a specific project 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectFieldsApi( + // 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 +); +$field_code = 'field_code_example'; // string | The unique code identifying the field + +try { + $result = $apiInstance->getProjectField($field_code); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectFieldsApi->getProjectField: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **field_code** | **string**| The unique code identifying the field | + +### Return type + +[**\Pipedrive\versions\v2\Model\GetProjectField**](../Model/GetProjectField.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) + +## `getProjectFields()` + +```php +getProjectFields($limit, $cursor): \Pipedrive\versions\v2\Model\GetProjectFields +``` + +Get all project fields + +Returns metadata about all project fields in the company. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectFieldsApi( + // 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 +); +$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. +$cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page + +try { + $result = $apiInstance->getProjectFields($limit, $cursor); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectFieldsApi->getProjectFields: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **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] + **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] + +### Return type + +[**\Pipedrive\versions\v2\Model\GetProjectFields**](../Model/GetProjectFields.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) + +## `updateProjectField()` + +```php +updateProjectField($field_code, $update_project_field_request): \Pipedrive\versions\v2\Model\GetProjectField +``` + +Update one project field + +Updates a project custom field. The field_code and field_type cannot be changed. At least one field must be provided in the request body. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectFieldsApi( + // 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 +); +$field_code = 'field_code_example'; // string | The unique code identifying the field +$update_project_field_request = new \Pipedrive\versions\v2\Model\UpdateProjectFieldRequest(); // \Pipedrive\versions\v2\Model\UpdateProjectFieldRequest + +try { + $result = $apiInstance->updateProjectField($field_code, $update_project_field_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectFieldsApi->updateProjectField: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **field_code** | **string**| The unique code identifying the field | + **update_project_field_request** | [**\Pipedrive\versions\v2\Model\UpdateProjectFieldRequest**](../Model/UpdateProjectFieldRequest.md)| | + +### Return type + +[**\Pipedrive\versions\v2\Model\GetProjectField**](../Model/GetProjectField.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) + +## `updateProjectFieldOptions()` + +```php +updateProjectFieldOptions($field_code, $request_body): \Pipedrive\versions\v2\Model\InlineResponse200 +``` + +Update project field options in bulk + +Updates existing options for a project custom field. This operation is atomic and fails if any of the specified option IDs do not exist. Returns only the updated options. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectFieldsApi( + // 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 +); +$field_code = 'field_code_example'; // string | The unique code identifying the field +$request_body = array(new \stdClass); // object[] + +try { + $result = $apiInstance->updateProjectFieldOptions($field_code, $request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectFieldsApi->updateProjectFieldOptions: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **field_code** | **string**| The unique code identifying the field | + **request_body** | [**object[]**](../Model/object.md)| | + +### Return type + +[**\Pipedrive\versions\v2\Model\InlineResponse200**](../Model/InlineResponse200.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/v2/Api/ProjectPhasesApi.md b/docs/versions/v2/Api/ProjectPhasesApi.md new file mode 100644 index 00000000..47c5b7f8 --- /dev/null +++ b/docs/versions/v2/Api/ProjectPhasesApi.md @@ -0,0 +1,339 @@ +# Pipedrive\versions\v2\ProjectPhasesApi + +All URIs are relative to https://api.pipedrive.com/api/v2. + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addProjectPhase()**](ProjectPhasesApi.md#addProjectPhase) | **POST** /phases | Add a project phase +[**deleteProjectPhase()**](ProjectPhasesApi.md#deleteProjectPhase) | **DELETE** /phases/{id} | Delete a project phase +[**getProjectsPhase()**](ProjectPhasesApi.md#getProjectsPhase) | **GET** /phases/{id} | Get details of a project phase +[**getProjectsPhases()**](ProjectPhasesApi.md#getProjectsPhases) | **GET** /phases | Get project phases +[**updateProjectPhase()**](ProjectPhasesApi.md#updateProjectPhase) | **PATCH** /phases/{id} | Update a project phase + + +## `addProjectPhase()` + +```php +addProjectPhase($phase_request_body): \Pipedrive\versions\v2\Model\PostPatchGetPhase +``` + +Add a project phase + +Adds a new project phase to a board. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectPhasesApi( + // 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 +); +$phase_request_body = new \Pipedrive\versions\v2\Model\PhaseRequestBody(); // \Pipedrive\versions\v2\Model\PhaseRequestBody + +try { + $result = $apiInstance->addProjectPhase($phase_request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectPhasesApi->addProjectPhase: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **phase_request_body** | [**\Pipedrive\versions\v2\Model\PhaseRequestBody**](../Model/PhaseRequestBody.md)| | + +### Return type + +[**\Pipedrive\versions\v2\Model\PostPatchGetPhase**](../Model/PostPatchGetPhase.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) + +## `deleteProjectPhase()` + +```php +deleteProjectPhase($id): \Pipedrive\versions\v2\Model\DeleteProjectPhaseResponse +``` + +Delete a project phase + +Marks a project phase 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectPhasesApi( + // 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 project phase + +try { + $result = $apiInstance->deleteProjectPhase($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectPhasesApi->deleteProjectPhase: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| The ID of the project phase | + +### Return type + +[**\Pipedrive\versions\v2\Model\DeleteProjectPhaseResponse**](../Model/DeleteProjectPhaseResponse.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) + +## `getProjectsPhase()` + +```php +getProjectsPhase($id): \Pipedrive\versions\v2\Model\PostPatchGetPhase +``` + +Get details of a project phase + +Returns the details of a specific project phase. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectPhasesApi( + // 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 project phase + +try { + $result = $apiInstance->getProjectsPhase($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectPhasesApi->getProjectsPhase: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| The ID of the project phase | + +### Return type + +[**\Pipedrive\versions\v2\Model\PostPatchGetPhase**](../Model/PostPatchGetPhase.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) + +## `getProjectsPhases()` + +```php +getProjectsPhases($board_id): \Pipedrive\versions\v2\Model\GetPhases +``` + +Get project phases + +Returns all active project phases under a specific board. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectPhasesApi( + // 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 +); +$board_id = 1; // int | The ID of the board for which phases are requested + +try { + $result = $apiInstance->getProjectsPhases($board_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectPhasesApi->getProjectsPhases: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **board_id** | **int**| The ID of the board for which phases are requested | + +### Return type + +[**\Pipedrive\versions\v2\Model\GetPhases**](../Model/GetPhases.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) + +## `updateProjectPhase()` + +```php +updateProjectPhase($id, $phase_request_body): \Pipedrive\versions\v2\Model\PostPatchGetPhase +``` + +Update a project phase + +Updates the properties of a project phase. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectPhasesApi( + // 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 project phase +$phase_request_body = new \Pipedrive\versions\v2\Model\PhaseRequestBody(); // \Pipedrive\versions\v2\Model\PhaseRequestBody + +try { + $result = $apiInstance->updateProjectPhase($id, $phase_request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectPhasesApi->updateProjectPhase: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| The ID of the project phase | + **phase_request_body** | [**\Pipedrive\versions\v2\Model\PhaseRequestBody**](../Model/PhaseRequestBody.md)| | [optional] + +### Return type + +[**\Pipedrive\versions\v2\Model\PostPatchGetPhase**](../Model/PostPatchGetPhase.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/v2/Api/ProjectTemplatesApi.md b/docs/versions/v2/Api/ProjectTemplatesApi.md new file mode 100644 index 00000000..499d744f --- /dev/null +++ b/docs/versions/v2/Api/ProjectTemplatesApi.md @@ -0,0 +1,141 @@ +# Pipedrive\versions\v2\ProjectTemplatesApi + +All URIs are relative to https://api.pipedrive.com/api/v2. + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**getProjectTemplate()**](ProjectTemplatesApi.md#getProjectTemplate) | **GET** /projectTemplates/{id} | Get details of a template +[**getProjectTemplates()**](ProjectTemplatesApi.md#getProjectTemplates) | **GET** /projectTemplates | Get all project templates + + +## `getProjectTemplate()` + +```php +getProjectTemplate($id): \Pipedrive\versions\v2\Model\GetProjectTemplateResponse +``` + +Get details of a template + +Returns the details of a specific project template. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectTemplatesApi( + // 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 project template + +try { + $result = $apiInstance->getProjectTemplate($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectTemplatesApi->getProjectTemplate: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| The ID of the project template | + +### Return type + +[**\Pipedrive\versions\v2\Model\GetProjectTemplateResponse**](../Model/GetProjectTemplateResponse.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) + +## `getProjectTemplates()` + +```php +getProjectTemplates($cursor, $limit): \Pipedrive\versions\v2\Model\GetProjectTemplatesResponse +``` + +Get all project templates + +Returns all not deleted project templates. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectTemplatesApi( + // 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. + +try { + $result = $apiInstance->getProjectTemplates($cursor, $limit); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectTemplatesApi->getProjectTemplates: ', $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] + +### Return type + +[**\Pipedrive\versions\v2\Model\GetProjectTemplatesResponse**](../Model/GetProjectTemplatesResponse.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) diff --git a/docs/versions/v2/Api/ProjectsApi.md b/docs/versions/v2/Api/ProjectsApi.md new file mode 100644 index 00000000..47b0e917 --- /dev/null +++ b/docs/versions/v2/Api/ProjectsApi.md @@ -0,0 +1,701 @@ +# Pipedrive\versions\v2\ProjectsApi + +All URIs are relative to https://api.pipedrive.com/api/v2. + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addProject()**](ProjectsApi.md#addProject) | **POST** /projects | Add a project +[**archiveProject()**](ProjectsApi.md#archiveProject) | **POST** /projects/{id}/archive | Archive a project +[**deleteProject()**](ProjectsApi.md#deleteProject) | **DELETE** /projects/{id} | Delete a project +[**getArchivedProjects()**](ProjectsApi.md#getArchivedProjects) | **GET** /projects/archived | Get all archived projects +[**getProject()**](ProjectsApi.md#getProject) | **GET** /projects/{id} | Get details of a project +[**getProjectChangelog()**](ProjectsApi.md#getProjectChangelog) | **GET** /projects/{id}/changelog | List updates about project field values +[**getProjectUsers()**](ProjectsApi.md#getProjectUsers) | **GET** /projects/{id}/permittedUsers | List permitted users +[**getProjects()**](ProjectsApi.md#getProjects) | **GET** /projects | Get all projects +[**searchProjects()**](ProjectsApi.md#searchProjects) | **GET** /projects/search | Search projects +[**updateProject()**](ProjectsApi.md#updateProject) | **PATCH** /projects/{id} | Update a project + + +## `addProject()` + +```php +addProject($project_request_body): \Pipedrive\versions\v2\Model\PostPatchGetProject +``` + +Add a project + +Adds a new project. Custom fields should be wrapped in the `custom_fields` object. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectsApi( + // 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 +); +$project_request_body = new \Pipedrive\versions\v2\Model\ProjectRequestBody(); // \Pipedrive\versions\v2\Model\ProjectRequestBody + +try { + $result = $apiInstance->addProject($project_request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectsApi->addProject: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_request_body** | [**\Pipedrive\versions\v2\Model\ProjectRequestBody**](../Model/ProjectRequestBody.md)| | + +### Return type + +[**\Pipedrive\versions\v2\Model\PostPatchGetProject**](../Model/PostPatchGetProject.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) + +## `archiveProject()` + +```php +archiveProject($id): \Pipedrive\versions\v2\Model\PostPatchGetProject +``` + +Archive a project + +Archives a project. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectsApi( + // 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 project + +try { + $result = $apiInstance->archiveProject($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectsApi->archiveProject: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| The ID of the project | + +### Return type + +[**\Pipedrive\versions\v2\Model\PostPatchGetProject**](../Model/PostPatchGetProject.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) + +## `deleteProject()` + +```php +deleteProject($id): \Pipedrive\versions\v2\Model\DeleteProjectResponse +``` + +Delete a project + +Marks a project 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectsApi( + // 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 project + +try { + $result = $apiInstance->deleteProject($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectsApi->deleteProject: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| The ID of the project | + +### Return type + +[**\Pipedrive\versions\v2\Model\DeleteProjectResponse**](../Model/DeleteProjectResponse.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) + +## `getArchivedProjects()` + +```php +getArchivedProjects($filter_id, $status, $phase_id, $limit, $cursor): \Pipedrive\versions\v2\Model\GetProjects +``` + +Get all archived projects + +Returns all archived projects. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectsApi( + // 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 +); +$filter_id = 56; // int | If supplied, only projects matching the specified filter are returned +$status = open,completed; // string | If supplied, includes only projects with the specified statuses. Possible values are `open`, `completed`, `canceled` and `deleted`. By default `deleted` projects are not returned. +$phase_id = 56; // int | If supplied, only projects in the specified phase are returned +$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. +$cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page + +try { + $result = $apiInstance->getArchivedProjects($filter_id, $status, $phase_id, $limit, $cursor); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectsApi->getArchivedProjects: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **filter_id** | **int**| If supplied, only projects matching the specified filter are returned | [optional] + **status** | **string**| If supplied, includes only projects with the specified statuses. Possible values are `open`, `completed`, `canceled` and `deleted`. By default `deleted` projects are not returned. | [optional] + **phase_id** | **int**| If supplied, only projects in the specified phase are returned | [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] + **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] + +### Return type + +[**\Pipedrive\versions\v2\Model\GetProjects**](../Model/GetProjects.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) + +## `getProject()` + +```php +getProject($id): \Pipedrive\versions\v2\Model\PostPatchGetProject +``` + +Get details of a project + +Returns the details of a specific project. Custom fields appear as keys inside the `custom_fields` object. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectsApi( + // 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 project + +try { + $result = $apiInstance->getProject($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectsApi->getProject: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| The ID of the project | + +### Return type + +[**\Pipedrive\versions\v2\Model\PostPatchGetProject**](../Model/PostPatchGetProject.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) + +## `getProjectChangelog()` + +```php +getProjectChangelog($id, $limit, $cursor): \Pipedrive\versions\v2\Model\ProjectChangelogResponse +``` + +List updates about project field values + +Lists updates about field values of a project. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectsApi( + // 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 project +$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. +$cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page + +try { + $result = $apiInstance->getProjectChangelog($id, $limit, $cursor); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectsApi->getProjectChangelog: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| The ID of the project | + **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] + **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] + +### Return type + +[**\Pipedrive\versions\v2\Model\ProjectChangelogResponse**](../Model/ProjectChangelogResponse.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) + +## `getProjectUsers()` + +```php +getProjectUsers($id): \Pipedrive\versions\v2\Model\GetProjectPermittedUsersResponse +``` + +List permitted users + +Lists the users permitted to access a project. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectsApi( + // 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 project + +try { + $result = $apiInstance->getProjectUsers($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectsApi->getProjectUsers: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| The ID of the project | + +### Return type + +[**\Pipedrive\versions\v2\Model\GetProjectPermittedUsersResponse**](../Model/GetProjectPermittedUsersResponse.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) + +## `getProjects()` + +```php +getProjects($filter_id, $status, $phase_id, $limit, $cursor): \Pipedrive\versions\v2\Model\GetProjects +``` + +Get all projects + +Returns all non-archived projects. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectsApi( + // 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 +); +$filter_id = 56; // int | If supplied, only projects matching the specified filter are returned +$status = open,completed; // string | If supplied, includes only projects with the specified statuses. Possible values are `open`, `completed`, `canceled` and `deleted`. By default `deleted` projects are not returned. +$phase_id = 56; // int | If supplied, only projects in the specified phase are returned +$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. +$cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page + +try { + $result = $apiInstance->getProjects($filter_id, $status, $phase_id, $limit, $cursor); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectsApi->getProjects: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **filter_id** | **int**| If supplied, only projects matching the specified filter are returned | [optional] + **status** | **string**| If supplied, includes only projects with the specified statuses. Possible values are `open`, `completed`, `canceled` and `deleted`. By default `deleted` projects are not returned. | [optional] + **phase_id** | **int**| If supplied, only projects in the specified phase are returned | [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] + **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] + +### Return type + +[**\Pipedrive\versions\v2\Model\GetProjects**](../Model/GetProjects.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) + +## `searchProjects()` + +```php +searchProjects($term, $fields, $exact_match, $person_id, $organization_id, $limit, $cursor): \Pipedrive\versions\v2\Model\ProjectSearchResponse +``` + +Search projects + +Searches all projects by title, description, notes and/or custom fields. This endpoint is a wrapper of /v1/itemSearch with a narrower OAuth scope. Found projects can be filtered by person ID or 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectsApi( + // 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 projects by the provided person ID +$organization_id = 56; // int | Will filter projects by the provided organization ID +$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. +$cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page + +try { + $result = $apiInstance->searchProjects($term, $fields, $exact_match, $person_id, $organization_id, $limit, $cursor); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectsApi->searchProjects: ', $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 projects by the provided person ID | [optional] + **organization_id** | **int**| Will filter projects by the provided organization ID | [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] + **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] + +### Return type + +[**\Pipedrive\versions\v2\Model\ProjectSearchResponse**](../Model/ProjectSearchResponse.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) + +## `updateProject()` + +```php +updateProject($id, $project_request_body): \Pipedrive\versions\v2\Model\PostPatchGetProject +``` + +Update a project + +Updates the properties of a project. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\ProjectsApi( + // 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 project +$project_request_body = new \Pipedrive\versions\v2\Model\ProjectRequestBody(); // \Pipedrive\versions\v2\Model\ProjectRequestBody + +try { + $result = $apiInstance->updateProject($id, $project_request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProjectsApi->updateProject: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| The ID of the project | + **project_request_body** | [**\Pipedrive\versions\v2\Model\ProjectRequestBody**](../Model/ProjectRequestBody.md)| | [optional] + +### Return type + +[**\Pipedrive\versions\v2\Model\PostPatchGetProject**](../Model/PostPatchGetProject.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/v2/Api/TasksApi.md b/docs/versions/v2/Api/TasksApi.md new file mode 100644 index 00000000..5175c095 --- /dev/null +++ b/docs/versions/v2/Api/TasksApi.md @@ -0,0 +1,351 @@ +# Pipedrive\versions\v2\TasksApi + +All URIs are relative to https://api.pipedrive.com/api/v2. + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addTask()**](TasksApi.md#addTask) | **POST** /tasks | Add a task +[**deleteTask()**](TasksApi.md#deleteTask) | **DELETE** /tasks/{id} | Delete a task +[**getTask()**](TasksApi.md#getTask) | **GET** /tasks/{id} | Get details of a task +[**getTasks()**](TasksApi.md#getTasks) | **GET** /tasks | Get all tasks +[**updateTask()**](TasksApi.md#updateTask) | **PATCH** /tasks/{id} | Update a task + + +## `addTask()` + +```php +addTask($task_post_request): \Pipedrive\versions\v2\Model\AddTaskResponse +``` + +Add a task + +Adds a new task. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\TasksApi( + // 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 +); +$task_post_request = new \Pipedrive\versions\v2\Model\TaskPostRequest(); // \Pipedrive\versions\v2\Model\TaskPostRequest + +try { + $result = $apiInstance->addTask($task_post_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TasksApi->addTask: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **task_post_request** | [**\Pipedrive\versions\v2\Model\TaskPostRequest**](../Model/TaskPostRequest.md)| | + +### Return type + +[**\Pipedrive\versions\v2\Model\AddTaskResponse**](../Model/AddTaskResponse.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) + +## `deleteTask()` + +```php +deleteTask($id): \Pipedrive\versions\v2\Model\DeleteTaskResponse +``` + +Delete a task + +Marks a task as deleted. If the task has subtasks, those will also be 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\TasksApi( + // 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 task + +try { + $result = $apiInstance->deleteTask($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TasksApi->deleteTask: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| The ID of the task | + +### Return type + +[**\Pipedrive\versions\v2\Model\DeleteTaskResponse**](../Model/DeleteTaskResponse.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) + +## `getTask()` + +```php +getTask($id): \Pipedrive\versions\v2\Model\GetTaskResponse +``` + +Get details of a task + +Returns the details of a specific task. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\TasksApi( + // 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 task + +try { + $result = $apiInstance->getTask($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TasksApi->getTask: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| The ID of the task | + +### Return type + +[**\Pipedrive\versions\v2\Model\GetTaskResponse**](../Model/GetTaskResponse.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) + +## `getTasks()` + +```php +getTasks($cursor, $limit, $is_done, $is_milestone, $assignee_id, $project_id, $parent_task_id): \Pipedrive\versions\v2\Model\GetTasksResponse +``` + +Get all tasks + +Returns all tasks. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\TasksApi( + // 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. +$is_done = True; // bool | Whether the task is done or not. If omitted, both done and not done tasks are returned. +$is_milestone = True; // bool | Whether the task is a milestone or not. If omitted, both milestone and non-milestone tasks are returned. +$assignee_id = 56; // int | If supplied, only tasks assigned to this user are returned +$project_id = 56; // int | If supplied, only tasks belonging to this project are returned +$parent_task_id = 'parent_task_id_example'; // string | If `null` is supplied, only root-level tasks (without a parent) are returned. If an integer is supplied, only subtasks of that specific task are returned. By default all tasks are returned. + +try { + $result = $apiInstance->getTasks($cursor, $limit, $is_done, $is_milestone, $assignee_id, $project_id, $parent_task_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TasksApi->getTasks: ', $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] + **is_done** | **bool**| Whether the task is done or not. If omitted, both done and not done tasks are returned. | [optional] + **is_milestone** | **bool**| Whether the task is a milestone or not. If omitted, both milestone and non-milestone tasks are returned. | [optional] + **assignee_id** | **int**| If supplied, only tasks assigned to this user are returned | [optional] + **project_id** | **int**| If supplied, only tasks belonging to this project are returned | [optional] + **parent_task_id** | **string**| If `null` is supplied, only root-level tasks (without a parent) are returned. If an integer is supplied, only subtasks of that specific task are returned. By default all tasks are returned. | [optional] + +### Return type + +[**\Pipedrive\versions\v2\Model\GetTasksResponse**](../Model/GetTasksResponse.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) + +## `updateTask()` + +```php +updateTask($id, $task_patch_request): \Pipedrive\versions\v2\Model\UpdateTaskResponse +``` + +Update a task + +Updates a task. + +### 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\v2\Configuration())->setApiKeyPrefix('x-api-token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\versions\v2\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\versions\v2\Api\TasksApi( + // 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 task +$task_patch_request = new \Pipedrive\versions\v2\Model\TaskPatchRequest(); // \Pipedrive\versions\v2\Model\TaskPatchRequest + +try { + $result = $apiInstance->updateTask($id, $task_patch_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TasksApi->updateTask: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| The ID of the task | + **task_patch_request** | [**\Pipedrive\versions\v2\Model\TaskPatchRequest**](../Model/TaskPatchRequest.md)| | [optional] + +### Return type + +[**\Pipedrive\versions\v2\Model\UpdateTaskResponse**](../Model/UpdateTaskResponse.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/v2/Model/AddProductRequestBody.md b/docs/versions/v2/Model/AddProductRequestBody.md index ffa422b1..85b8801d 100644 --- a/docs/versions/v2/Model/AddProductRequestBody.md +++ b/docs/versions/v2/Model/AddProductRequestBody.md @@ -14,7 +14,7 @@ Name | Type | Description | Notes **is_linkable** | **bool** | Whether this product can be added to a deal or not | [optional] [default to true] **visible_to** | [**VisibleTo**](VisibleTo.md) | The visibility of the product. If omitted, the visibility will be set to the default visibility setting of this item type for the authorized user. Read more about visibility groups <a href=\"https://support.pipedrive.com/en/article/visibility-groups\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>.<h4>Light / Growth and Professional plans</h4><table><tr><th style=\"width: 40px\">Value</th><th>Description</th></tr><tr><td>`1`</td><td>Owner &amp; followers</td><tr><td>`3`</td><td>Entire company</td></tr></table><h4>Premium / Ultimate plan</h4><table><tr><th style=\"width: 40px\">Value</th><th>Description</th></tr><tr><td>`1`</td><td>Owner only</td><tr><td>`3`</td><td>Owner's visibility group</td></tr><tr><td>`5`</td><td>Owner's visibility group and sub-groups</td></tr><tr><td>`7`</td><td>Entire company</td></tr></table> | [optional] **prices** | **object[]** | An array of objects, each containing: `currency` (string), `price` (number), `cost` (number, optional), `direct_cost` (number, optional). Note that there can only be one price per product per currency. When `prices` is omitted altogether, a default price of 0 and the user's default currency will be assigned. | [optional] -**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes | [optional] +**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. | [optional] **billing_frequency** | [**\Pipedrive\versions\v2\Model\BillingFrequency1**](BillingFrequency1.md) | | [optional] **billing_frequency_cycles** | **int** | Only available in Growth and above plans The number of times the billing frequency repeats for a product in a deal When `billing_frequency` is set to `one-time`, this field must be `null` When `billing_frequency` is set to `weekly`, this field cannot be `null` For all the other values of `billing_frequency`, `null` represents a product billed indefinitely Must be a positive integer less or equal to 208 | [optional] diff --git a/docs/versions/v2/Model/AddTaskResponse.md b/docs/versions/v2/Model/AddTaskResponse.md new file mode 100644 index 00000000..3048aab0 --- /dev/null +++ b/docs/versions/v2/Model/AddTaskResponse.md @@ -0,0 +1,11 @@ +# # AddTaskResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | If the response is successful or not | [optional] +**data** | [**\Pipedrive\versions\v2\Model\TaskItem**](TaskItem.md) | | [optional] +**additional_data** | **object** | | [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/v2/Model/BaseProduct.md b/docs/versions/v2/Model/BaseProduct.md index c46c279a..5bf91a04 100644 --- a/docs/versions/v2/Model/BaseProduct.md +++ b/docs/versions/v2/Model/BaseProduct.md @@ -13,7 +13,7 @@ Name | Type | Description | Notes **is_linkable** | **bool** | Whether this product can be added to a deal or not | [optional] [default to true] **visible_to** | [**VisibleTo**](VisibleTo.md) | Visibility of the product | [optional] **owner_id** | **int** | Information about the Pipedrive user who owns the product | [optional] -**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes | [optional] +**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. | [optional] **billing_frequency** | [**\Pipedrive\versions\v2\Model\BillingFrequency1**](BillingFrequency1.md) | | [optional] **billing_frequency_cycles** | **int** | Only available in Growth and above plans The number of times the billing frequency repeats for a product in a deal When `billing_frequency` is set to `one-time`, this field must be `null` When `billing_frequency` is set to `weekly`, this field cannot be `null` For all the other values of `billing_frequency`, `null` represents a product billed indefinitely Must be a positive integer less or equal to 208 | [optional] diff --git a/docs/versions/v2/Model/BaseProductAllOf.md b/docs/versions/v2/Model/BaseProductAllOf.md index dbce82f4..e13bc721 100644 --- a/docs/versions/v2/Model/BaseProductAllOf.md +++ b/docs/versions/v2/Model/BaseProductAllOf.md @@ -13,6 +13,6 @@ Name | Type | Description | Notes **is_linkable** | **bool** | Whether this product can be added to a deal or not | [optional] [default to true] **visible_to** | [**VisibleTo**](VisibleTo.md) | Visibility of the product | [optional] **owner_id** | **int** | Information about the Pipedrive user who owns the product | [optional] -**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes | [optional] +**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. | [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/v2/Model/BoardItem.md b/docs/versions/v2/Model/BoardItem.md new file mode 100644 index 00000000..60c80e08 --- /dev/null +++ b/docs/versions/v2/Model/BoardItem.md @@ -0,0 +1,13 @@ +# # BoardItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The ID of the project board | [optional] +**name** | **string** | The name of the project board | [optional] +**order_nr** | **int** | The order of the board | [optional] +**add_time** | **string** | The creation date and time of the board in ISO 8601 format | [optional] +**update_time** | **string** | The update date and time of the board in ISO 8601 format | [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/v2/Model/BoardRequestBody.md b/docs/versions/v2/Model/BoardRequestBody.md new file mode 100644 index 00000000..c580ab7d --- /dev/null +++ b/docs/versions/v2/Model/BoardRequestBody.md @@ -0,0 +1,10 @@ +# # BoardRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | The name of the project board | [optional] +**order_nr** | **int** | The order of the board. Must be between 1 and the total number of boards + 1. | [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/v2/Model/CreateProjectField.md b/docs/versions/v2/Model/CreateProjectField.md new file mode 100644 index 00000000..902189c2 --- /dev/null +++ b/docs/versions/v2/Model/CreateProjectField.md @@ -0,0 +1,10 @@ +# # CreateProjectField + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | Whether the request was successful | [optional] +**data** | [**\Pipedrive\versions\v2\Model\ProjectFieldItem**](ProjectFieldItem.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/v2/Model/CreateProjectFieldRequest.md b/docs/versions/v2/Model/CreateProjectFieldRequest.md new file mode 100644 index 00000000..6501933f --- /dev/null +++ b/docs/versions/v2/Model/CreateProjectFieldRequest.md @@ -0,0 +1,14 @@ +# # CreateProjectFieldRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**field_name** | **string** | Field name | +**field_type** | **string** | The type of the field<table><tr><th>Value</th><th>Description</th></tr><tr><td>`varchar`</td><td>Text (up to 255 characters)</td><tr><td>`varchar_auto`</td><td>Autocomplete text (up to 255 characters)</td><tr><td>`text`</td><td>Long text (up to 65k characters)</td><tr><td>`double`</td><td>Numeric value</td><tr><td>`monetary`</td><td>Monetary field (has a numeric value and a currency value)</td><tr><td>`date`</td><td>Date (format YYYY-MM-DD)</td><tr><td>`set`</td><td>Options field with a possibility of having multiple chosen options</td><tr><td>`enum`</td><td>Options field with a single possible chosen option</td><tr><td>`user`</td><td>User field (contains a user ID of another Pipedrive user)</td><tr><td>`org`</td><td>Organization field (contains an organization ID which is stored on the same account)</td><tr><td>`people`</td><td>Person field (contains a person ID which is stored on the same account)</td><tr><td>`phone`</td><td>Phone field (up to 255 numbers and/or characters)</td><tr><td>`time`</td><td>Time field (format HH:MM:SS)</td><tr><td>`timerange`</td><td>Time-range field (has a start time and end time value, both HH:MM:SS)</td><tr><td>`daterange`</td><td>Date-range field (has a start date and end date value, both YYYY-MM-DD)</td><tr><td>`address`</td><td>Address field</dd></table> | +**options** | [**\Pipedrive\versions\v2\Model\CreateDealFieldRequestOptions[]**](CreateDealFieldRequestOptions.md) | Field options (required for enum and set field types) | [optional] +**ui_visibility** | **array** | UI visibility settings for the field. Controls where the field appears in the Pipedrive web UI. | [optional] +**important_fields** | **array** | Configuration for highlighting the field at specific stages. | [optional] +**required_fields** | **array** | Required fields configuration for marking the field as mandatory when interacted with in the Pipedrive web UI. | [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/v2/Model/Deal.md b/docs/versions/v2/Model/Deal.md index 80b3aea0..51966b39 100644 --- a/docs/versions/v2/Model/Deal.md +++ b/docs/versions/v2/Model/Deal.md @@ -35,6 +35,6 @@ Name | Type | Description | Notes **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] -**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes | [optional] +**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. | [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/v2/Model/DealItem.md b/docs/versions/v2/Model/DealItem.md index ea025fc0..283bf6e4 100644 --- a/docs/versions/v2/Model/DealItem.md +++ b/docs/versions/v2/Model/DealItem.md @@ -35,6 +35,6 @@ Name | Type | Description | Notes **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] -**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes | [optional] +**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. | [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/v2/Model/DealRequestBody.md b/docs/versions/v2/Model/DealRequestBody.md index 2cd5bbf3..10778b9f 100644 --- a/docs/versions/v2/Model/DealRequestBody.md +++ b/docs/versions/v2/Model/DealRequestBody.md @@ -24,6 +24,6 @@ Name | Type | Description | Notes **lost_time** | **string** | The date and time of changing the deal status as lost. Can only be set if deal status is lost. | [optional] **expected_close_date** | **\DateTime** | The expected close date of the deal | [optional] **label_ids** | **int[]** | The IDs of labels assigned to the deal | [optional] -**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes | [optional] +**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. | [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/v2/Model/DeleteProjectBoardResponse.md b/docs/versions/v2/Model/DeleteProjectBoardResponse.md new file mode 100644 index 00000000..285fa305 --- /dev/null +++ b/docs/versions/v2/Model/DeleteProjectBoardResponse.md @@ -0,0 +1,10 @@ +# # DeleteProjectBoardResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | If the response is successful or not | [optional] +**data** | [**\Pipedrive\versions\v2\Model\DeleteProjectBoardResponseData**](DeleteProjectBoardResponseData.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/v2/Model/DeleteProjectBoardResponseData.md b/docs/versions/v2/Model/DeleteProjectBoardResponseData.md new file mode 100644 index 00000000..b62a805c --- /dev/null +++ b/docs/versions/v2/Model/DeleteProjectBoardResponseData.md @@ -0,0 +1,9 @@ +# # DeleteProjectBoardResponseData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The ID of the deleted project board | [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/v2/Model/DeleteProjectField.md b/docs/versions/v2/Model/DeleteProjectField.md new file mode 100644 index 00000000..895aab9c --- /dev/null +++ b/docs/versions/v2/Model/DeleteProjectField.md @@ -0,0 +1,10 @@ +# # DeleteProjectField + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | Whether the request was successful | [optional] +**data** | [**\Pipedrive\versions\v2\Model\DeleteProjectFieldData**](DeleteProjectFieldData.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/v2/Model/DeleteProjectFieldData.md b/docs/versions/v2/Model/DeleteProjectFieldData.md new file mode 100644 index 00000000..ef60bd95 --- /dev/null +++ b/docs/versions/v2/Model/DeleteProjectFieldData.md @@ -0,0 +1,15 @@ +# # DeleteProjectFieldData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**field_name** | **string** | The display name/label of the field | +**field_code** | **string** | The unique identifier for the field (40-character hash for custom fields) | +**field_type** | **string** | The type of the field | +**options** | **object[]** | Array of available options for enum/set fields, null for other field types | [optional] +**subfields** | **object[]** | Array of subfields for complex field types, null for simple field types | [optional] +**is_custom_field** | **bool** | Whether this is a user-created custom field | +**is_optional_response_field** | **bool** | Whether this field is not returned by default in entity responses | + +[[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/v2/Model/DeleteProjectPhaseResponse.md b/docs/versions/v2/Model/DeleteProjectPhaseResponse.md new file mode 100644 index 00000000..b1b058c8 --- /dev/null +++ b/docs/versions/v2/Model/DeleteProjectPhaseResponse.md @@ -0,0 +1,10 @@ +# # DeleteProjectPhaseResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | If the response is successful or not | [optional] +**data** | [**\Pipedrive\versions\v2\Model\DeleteProjectPhaseResponseData**](DeleteProjectPhaseResponseData.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/v2/Model/DeleteProjectPhaseResponseData.md b/docs/versions/v2/Model/DeleteProjectPhaseResponseData.md new file mode 100644 index 00000000..2da67b22 --- /dev/null +++ b/docs/versions/v2/Model/DeleteProjectPhaseResponseData.md @@ -0,0 +1,9 @@ +# # DeleteProjectPhaseResponseData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The ID of the deleted project phase | [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/v2/Model/DeleteProjectResponse.md b/docs/versions/v2/Model/DeleteProjectResponse.md new file mode 100644 index 00000000..138a009d --- /dev/null +++ b/docs/versions/v2/Model/DeleteProjectResponse.md @@ -0,0 +1,10 @@ +# # DeleteProjectResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | If the response is successful or not | [optional] +**data** | [**\Pipedrive\versions\v2\Model\DeleteProjectResponseData**](DeleteProjectResponseData.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/v2/Model/DeleteProjectResponseData.md b/docs/versions/v2/Model/DeleteProjectResponseData.md new file mode 100644 index 00000000..2e4e01e6 --- /dev/null +++ b/docs/versions/v2/Model/DeleteProjectResponseData.md @@ -0,0 +1,9 @@ +# # DeleteProjectResponseData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The ID of the deleted project | [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/v2/Model/DeleteTaskResponse.md b/docs/versions/v2/Model/DeleteTaskResponse.md new file mode 100644 index 00000000..e406ea99 --- /dev/null +++ b/docs/versions/v2/Model/DeleteTaskResponse.md @@ -0,0 +1,11 @@ +# # DeleteTaskResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | If the response is successful or not | [optional] +**data** | [**\Pipedrive\versions\v2\Model\DeleteTaskResponseData**](DeleteTaskResponseData.md) | | [optional] +**additional_data** | **object** | | [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/v2/Model/DeleteTaskResponseData.md b/docs/versions/v2/Model/DeleteTaskResponseData.md new file mode 100644 index 00000000..1592a881 --- /dev/null +++ b/docs/versions/v2/Model/DeleteTaskResponseData.md @@ -0,0 +1,9 @@ +# # DeleteTaskResponseData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The ID of the deleted task | [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/v2/Model/GetBoards.md b/docs/versions/v2/Model/GetBoards.md new file mode 100644 index 00000000..8546446a --- /dev/null +++ b/docs/versions/v2/Model/GetBoards.md @@ -0,0 +1,11 @@ +# # GetBoards + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | If the response is successful or not | [optional] +**data** | [**\Pipedrive\versions\v2\Model\BoardItem[]**](BoardItem.md) | The array of project boards | [optional] +**additional_data** | **object** | | [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/v2/Model/GetPhases.md b/docs/versions/v2/Model/GetPhases.md new file mode 100644 index 00000000..5548d6a9 --- /dev/null +++ b/docs/versions/v2/Model/GetPhases.md @@ -0,0 +1,11 @@ +# # GetPhases + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | If the response is successful or not | [optional] +**data** | [**\Pipedrive\versions\v2\Model\PhaseItem[]**](PhaseItem.md) | The array of project phases | [optional] +**additional_data** | **object** | | [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/v2/Model/GetProjectField.md b/docs/versions/v2/Model/GetProjectField.md new file mode 100644 index 00000000..6fad1489 --- /dev/null +++ b/docs/versions/v2/Model/GetProjectField.md @@ -0,0 +1,10 @@ +# # GetProjectField + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | Whether the request was successful | [optional] +**data** | [**\Pipedrive\versions\v2\Model\ProjectFieldItem**](ProjectFieldItem.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/v2/Model/GetProjectFields.md b/docs/versions/v2/Model/GetProjectFields.md new file mode 100644 index 00000000..33c6a9db --- /dev/null +++ b/docs/versions/v2/Model/GetProjectFields.md @@ -0,0 +1,11 @@ +# # GetProjectFields + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | Whether the request was successful | [optional] +**data** | [**\Pipedrive\versions\v2\Model\ProjectFieldItem[]**](ProjectFieldItem.md) | | [optional] +**additional_data** | [**\Pipedrive\versions\v2\Model\GetActivityFieldsAdditionalData**](GetActivityFieldsAdditionalData.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/v2/Model/GetProjectPermittedUsersResponse.md b/docs/versions/v2/Model/GetProjectPermittedUsersResponse.md new file mode 100644 index 00000000..820a6c09 --- /dev/null +++ b/docs/versions/v2/Model/GetProjectPermittedUsersResponse.md @@ -0,0 +1,10 @@ +# # GetProjectPermittedUsersResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | If the response is successful or not | [optional] +**data** | **int[]** | The list of permitted user IDs | [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/v2/Model/GetProjectTemplateResponse.md b/docs/versions/v2/Model/GetProjectTemplateResponse.md new file mode 100644 index 00000000..12d68a49 --- /dev/null +++ b/docs/versions/v2/Model/GetProjectTemplateResponse.md @@ -0,0 +1,11 @@ +# # GetProjectTemplateResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | If the response is successful or not | [optional] +**data** | [**\Pipedrive\versions\v2\Model\ProjectTemplateItem**](ProjectTemplateItem.md) | | [optional] +**additional_data** | **object** | | [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/v2/Model/GetProjectTemplatesResponse.md b/docs/versions/v2/Model/GetProjectTemplatesResponse.md new file mode 100644 index 00000000..67fe8553 --- /dev/null +++ b/docs/versions/v2/Model/GetProjectTemplatesResponse.md @@ -0,0 +1,11 @@ +# # GetProjectTemplatesResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | If the response is successful or not | [optional] +**data** | [**\Pipedrive\versions\v2\Model\ProjectTemplateItem[]**](ProjectTemplateItem.md) | | [optional] +**additional_data** | [**\Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination**](AdditionalDataWithCursorPagination.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/v2/Model/GetProjects.md b/docs/versions/v2/Model/GetProjects.md new file mode 100644 index 00000000..0cbca789 --- /dev/null +++ b/docs/versions/v2/Model/GetProjects.md @@ -0,0 +1,11 @@ +# # GetProjects + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | If the response is successful or not | [optional] +**data** | [**\Pipedrive\versions\v2\Model\ProjectItem[]**](ProjectItem.md) | Projects array | [optional] +**additional_data** | [**\Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination**](.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/v2/Model/GetProjectsAllOf.md b/docs/versions/v2/Model/GetProjectsAllOf.md new file mode 100644 index 00000000..2f40500a --- /dev/null +++ b/docs/versions/v2/Model/GetProjectsAllOf.md @@ -0,0 +1,10 @@ +# # GetProjectsAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**\Pipedrive\versions\v2\Model\ProjectItem[]**](ProjectItem.md) | Projects array | [optional] +**additional_data** | [**\Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination**](.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/v2/Model/GetTaskResponse.md b/docs/versions/v2/Model/GetTaskResponse.md new file mode 100644 index 00000000..a293ef15 --- /dev/null +++ b/docs/versions/v2/Model/GetTaskResponse.md @@ -0,0 +1,11 @@ +# # GetTaskResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | If the response is successful or not | [optional] +**data** | [**\Pipedrive\versions\v2\Model\TaskItem**](TaskItem.md) | | [optional] +**additional_data** | **object** | | [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/v2/Model/GetTasksResponse.md b/docs/versions/v2/Model/GetTasksResponse.md new file mode 100644 index 00000000..860b2071 --- /dev/null +++ b/docs/versions/v2/Model/GetTasksResponse.md @@ -0,0 +1,11 @@ +# # GetTasksResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | If the response is successful or not | [optional] +**data** | [**\Pipedrive\versions\v2\Model\TaskItem[]**](TaskItem.md) | | [optional] +**additional_data** | [**\Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination**](AdditionalDataWithCursorPagination.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/v2/Model/OrganizationItem.md b/docs/versions/v2/Model/OrganizationItem.md index d6980dd5..ed521379 100644 --- a/docs/versions/v2/Model/OrganizationItem.md +++ b/docs/versions/v2/Model/OrganizationItem.md @@ -13,6 +13,6 @@ Name | Type | Description | Notes **visible_to** | **int** | The visibility of the organization | [optional] **address** | [**\Pipedrive\versions\v2\Model\OrganizationItemAddress**](OrganizationItemAddress.md) | | [optional] **label_ids** | **int[]** | The IDs of labels assigned to the organization | [optional] -**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes | [optional] +**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. | [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/v2/Model/OrganizationRequestBody.md b/docs/versions/v2/Model/OrganizationRequestBody.md index 9c1e3c8f..3f9623e2 100644 --- a/docs/versions/v2/Model/OrganizationRequestBody.md +++ b/docs/versions/v2/Model/OrganizationRequestBody.md @@ -11,6 +11,6 @@ Name | Type | Description | Notes **visible_to** | **int** | The visibility of the organization | [optional] **label_ids** | **int[]** | The IDs of labels assigned to the organization | [optional] **address** | [**\Pipedrive\versions\v2\Model\OrganizationItemAddress**](OrganizationItemAddress.md) | | [optional] -**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes | [optional] +**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. | [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/v2/Model/Person.md b/docs/versions/v2/Model/Person.md index d8b178ce..fc01b575 100644 --- a/docs/versions/v2/Model/Person.md +++ b/docs/versions/v2/Model/Person.md @@ -23,6 +23,6 @@ Name | Type | Description | Notes **im** | [**\Pipedrive\versions\v2\Model\PersonIm[]**](PersonIm.md) | The instant messaging accounts of the person, included if contact sync is enabled for the company | [optional] **birthday** | **string** | The birthday of the person, included if contact sync is enabled for the company | [optional] **job_title** | **string** | The job title of the person, included if contact sync is enabled for the company | [optional] -**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes | [optional] +**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. | [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/v2/Model/PersonItem.md b/docs/versions/v2/Model/PersonItem.md index 8ef3ee44..d3c3c56b 100644 --- a/docs/versions/v2/Model/PersonItem.md +++ b/docs/versions/v2/Model/PersonItem.md @@ -23,6 +23,6 @@ Name | Type | Description | Notes **im** | [**\Pipedrive\versions\v2\Model\PersonIm[]**](PersonIm.md) | The instant messaging accounts of the person, included if contact sync is enabled for the company | [optional] **birthday** | **string** | The birthday of the person, included if contact sync is enabled for the company | [optional] **job_title** | **string** | The job title of the person, included if contact sync is enabled for the company | [optional] -**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes | [optional] +**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. | [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/v2/Model/PersonRequestBody.md b/docs/versions/v2/Model/PersonRequestBody.md index 4cfa8849..5b9c0c38 100644 --- a/docs/versions/v2/Model/PersonRequestBody.md +++ b/docs/versions/v2/Model/PersonRequestBody.md @@ -14,6 +14,6 @@ Name | Type | Description | Notes **visible_to** | **int** | The visibility of the person | [optional] **label_ids** | **int[]** | The IDs of labels assigned to the person | [optional] **marketing_status** | **string** | If the person does not have a valid email address, then the marketing status is **not set** and `no_consent` is returned for the `marketing_status` value when the new person is created. If the change is forbidden, the status will remain unchanged for every call that tries to modify the marketing status. Please be aware that it is only allowed **once** to change the marketing status from an old status to a new one.<table><tr><th>Value</th><th>Description</th></tr><tr><td>`no_consent`</td><td>The customer has not given consent to receive any marketing communications</td></tr><tr><td>`unsubscribed`</td><td>The customers have unsubscribed from ALL marketing communications</td></tr><tr><td>`subscribed`</td><td>The customers are subscribed and are counted towards marketing caps</td></tr><tr><td>`archived`</td><td>The customers with `subscribed` status can be moved to `archived` to save consent, but they are not paid for</td></tr></table> | [optional] -**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes | [optional] +**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. | [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/v2/Model/PhaseItem.md b/docs/versions/v2/Model/PhaseItem.md new file mode 100644 index 00000000..ee5df7c8 --- /dev/null +++ b/docs/versions/v2/Model/PhaseItem.md @@ -0,0 +1,14 @@ +# # PhaseItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The ID of the project phase | [optional] +**name** | **string** | The name of the project phase | [optional] +**board_id** | **int** | The ID of the project board this phase belongs to | [optional] +**order_nr** | **int** | The order of the phase within its board | [optional] +**add_time** | **string** | The creation date and time of the phase in ISO 8601 format | [optional] +**update_time** | **string** | The update date and time of the phase in ISO 8601 format | [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/v2/Model/PhaseRequestBody.md b/docs/versions/v2/Model/PhaseRequestBody.md new file mode 100644 index 00000000..59055297 --- /dev/null +++ b/docs/versions/v2/Model/PhaseRequestBody.md @@ -0,0 +1,11 @@ +# # PhaseRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | The name of the project phase | [optional] +**board_id** | **int** | The ID of the project board to add the phase to | [optional] +**order_nr** | **int** | The order of the phase within its board. Must be between 1 and the total number of phases on the board + 1. | [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/v2/Model/PostPatchGetBoard.md b/docs/versions/v2/Model/PostPatchGetBoard.md new file mode 100644 index 00000000..38fbe402 --- /dev/null +++ b/docs/versions/v2/Model/PostPatchGetBoard.md @@ -0,0 +1,10 @@ +# # PostPatchGetBoard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | If the response is successful or not | [optional] +**data** | [**\Pipedrive\versions\v2\Model\BoardItem**](BoardItem.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/v2/Model/PostPatchGetPhase.md b/docs/versions/v2/Model/PostPatchGetPhase.md new file mode 100644 index 00000000..48b53394 --- /dev/null +++ b/docs/versions/v2/Model/PostPatchGetPhase.md @@ -0,0 +1,10 @@ +# # PostPatchGetPhase + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | If the response is successful or not | [optional] +**data** | [**\Pipedrive\versions\v2\Model\PhaseItem**](PhaseItem.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/v2/Model/PostPatchGetProject.md b/docs/versions/v2/Model/PostPatchGetProject.md new file mode 100644 index 00000000..0e1bf99b --- /dev/null +++ b/docs/versions/v2/Model/PostPatchGetProject.md @@ -0,0 +1,10 @@ +# # PostPatchGetProject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | If the response is successful or not | [optional] +**data** | [**\Pipedrive\versions\v2\Model\ProjectItem**](ProjectItem.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/v2/Model/PostPatchGetProjectAllOf.md b/docs/versions/v2/Model/PostPatchGetProjectAllOf.md new file mode 100644 index 00000000..3f103689 --- /dev/null +++ b/docs/versions/v2/Model/PostPatchGetProjectAllOf.md @@ -0,0 +1,9 @@ +# # PostPatchGetProjectAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**\Pipedrive\versions\v2\Model\ProjectItem**](ProjectItem.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/v2/Model/ProductRequest.md b/docs/versions/v2/Model/ProductRequest.md index c1e4541c..98acd183 100644 --- a/docs/versions/v2/Model/ProductRequest.md +++ b/docs/versions/v2/Model/ProductRequest.md @@ -13,6 +13,6 @@ Name | Type | Description | Notes **is_linkable** | **bool** | Whether this product can be added to a deal or not | [optional] [default to true] **visible_to** | [**VisibleTo**](VisibleTo.md) | The visibility of the product. If omitted, the visibility will be set to the default visibility setting of this item type for the authorized user. Read more about visibility groups <a href=\"https://support.pipedrive.com/en/article/visibility-groups\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>.<h4>Light / Growth and Professional plans</h4><table><tr><th style=\"width: 40px\">Value</th><th>Description</th></tr><tr><td>`1`</td><td>Owner &amp; followers</td><tr><td>`3`</td><td>Entire company</td></tr></table><h4>Premium / Ultimate plan</h4><table><tr><th style=\"width: 40px\">Value</th><th>Description</th></tr><tr><td>`1`</td><td>Owner only</td><tr><td>`3`</td><td>Owner's visibility group</td></tr><tr><td>`5`</td><td>Owner's visibility group and sub-groups</td></tr><tr><td>`7`</td><td>Entire company</td></tr></table> | [optional] **prices** | **object[]** | An array of objects, each containing: `currency` (string), `price` (number), `cost` (number, optional), `direct_cost` (number, optional). Note that there can only be one price per product per currency. When `prices` is omitted altogether, a default price of 0 and the user's default currency will be assigned. | [optional] -**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes | [optional] +**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. | [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/v2/Model/ProductWithArrayPrices.md b/docs/versions/v2/Model/ProductWithArrayPrices.md index a30a7491..98376741 100644 --- a/docs/versions/v2/Model/ProductWithArrayPrices.md +++ b/docs/versions/v2/Model/ProductWithArrayPrices.md @@ -13,7 +13,7 @@ Name | Type | Description | Notes **is_linkable** | **bool** | Whether this product can be added to a deal or not | [optional] [default to true] **visible_to** | [**VisibleTo**](VisibleTo.md) | Visibility of the product | [optional] **owner_id** | **int** | Information about the Pipedrive user who owns the product | [optional] -**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes | [optional] +**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. | [optional] **billing_frequency** | [**\Pipedrive\versions\v2\Model\BillingFrequency1**](BillingFrequency1.md) | | [optional] **billing_frequency_cycles** | **int** | Only available in Growth and above plans The number of times the billing frequency repeats for a product in a deal When `billing_frequency` is set to `one-time`, this field must be `null` When `billing_frequency` is set to `weekly`, this field cannot be `null` For all the other values of `billing_frequency`, `null` represents a product billed indefinitely Must be a positive integer less or equal to 208 | [optional] **prices** | **object[]** | Array of objects, each containing: product_id (number), currency (string), price (number), cost (number), direct_cost (number | null), notes (string) | [optional] diff --git a/docs/versions/v2/Model/ProjectChangelogResponse.md b/docs/versions/v2/Model/ProjectChangelogResponse.md new file mode 100644 index 00000000..1b10429d --- /dev/null +++ b/docs/versions/v2/Model/ProjectChangelogResponse.md @@ -0,0 +1,11 @@ +# # ProjectChangelogResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | | [optional] +**data** | [**\Pipedrive\versions\v2\Model\ProjectChangelogResponseData[]**](ProjectChangelogResponseData.md) | | [optional] +**additional_data** | [**\Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination**](AdditionalDataWithCursorPagination.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/v2/Model/ProjectChangelogResponseData.md b/docs/versions/v2/Model/ProjectChangelogResponseData.md new file mode 100644 index 00000000..5de8ab8b --- /dev/null +++ b/docs/versions/v2/Model/ProjectChangelogResponseData.md @@ -0,0 +1,14 @@ +# # ProjectChangelogResponseData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**change_source** | **string** | The source of change, for example 'app', 'mobile', 'api', etc. | [optional] +**change_source_user_agent** | **string** | The user agent from which the change was made | [optional] +**time** | **string** | The date and time of the change in ISO 8601 format | [optional] +**new_values** | **array** | A map of field keys to their new values after the change | [optional] +**old_values** | **array** | A map of field keys to their previous values before the change | [optional] +**actor_user_id** | **int** | The ID of the user who made the change | [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/v2/Model/ProjectFieldItem.md b/docs/versions/v2/Model/ProjectFieldItem.md new file mode 100644 index 00000000..93069743 --- /dev/null +++ b/docs/versions/v2/Model/ProjectFieldItem.md @@ -0,0 +1,18 @@ +# # ProjectFieldItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**field_name** | **string** | The display name/label of the field | +**field_code** | **string** | The unique identifier for the field (40-character hash for custom fields) | +**field_type** | **string** | The type of the field | +**options** | [**\Pipedrive\versions\v2\Model\ActivityFieldItemOptions[]**](ActivityFieldItemOptions.md) | Array of available options for enum/set fields, null for other field types | [optional] +**subfields** | [**\Pipedrive\versions\v2\Model\ActivityFieldItemSubfields[]**](ActivityFieldItemSubfields.md) | Array of subfields for complex field types (address, monetary), null for simple field types | [optional] +**is_custom_field** | **bool** | Whether this is a user-created custom field | +**is_optional_response_field** | **bool** | Whether this field is not returned by default in entity responses | +**ui_visibility** | [**\Pipedrive\versions\v2\Model\ProjectFieldItemUiVisibility**](ProjectFieldItemUiVisibility.md) | | [optional] +**important_fields** | [**\Pipedrive\versions\v2\Model\PersonFieldItemImportantFields**](PersonFieldItemImportantFields.md) | | [optional] +**required_fields** | [**\Pipedrive\versions\v2\Model\PersonFieldItemRequiredFields**](PersonFieldItemRequiredFields.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/v2/Model/ProjectFieldItemUiVisibility.md b/docs/versions/v2/Model/ProjectFieldItemUiVisibility.md new file mode 100644 index 00000000..e8c3831a --- /dev/null +++ b/docs/versions/v2/Model/ProjectFieldItemUiVisibility.md @@ -0,0 +1,10 @@ +# # ProjectFieldItemUiVisibility + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**add_visible_flag** | **bool** | Whether the field is shown in the add modal | [optional] +**details_visible_flag** | **bool** | Whether the field is shown in the details view | [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/v2/Model/ProjectItem.md b/docs/versions/v2/Model/ProjectItem.md new file mode 100644 index 00000000..f5050fee --- /dev/null +++ b/docs/versions/v2/Model/ProjectItem.md @@ -0,0 +1,27 @@ +# # ProjectItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The ID of the project | [optional] +**title** | **string** | The title of the project | [optional] +**description** | **string** | The description of the project | [optional] +**status** | **string** | The status of the project | [optional] +**board_id** | **int** | The ID of the board this project is associated with | [optional] +**phase_id** | **int** | The ID of the phase this project is associated with | [optional] +**owner_id** | **int** | The ID of the user who owns the project | [optional] +**start_date** | **\DateTime** | The start date of the project. Format: YYYY-MM-DD | [optional] +**end_date** | **\DateTime** | The end date of the project. Format: YYYY-MM-DD | [optional] +**deal_ids** | **int[]** | An array of IDs of the deals this project is associated with | [optional] +**person_ids** | **int[]** | An array of IDs of the persons this project is associated with | [optional] +**org_ids** | **int[]** | An array of IDs of the organizations this project is associated with | [optional] +**label_ids** | **int[]** | An array of IDs of the labels this project has | [optional] +**health_status** | **string** | The health status of the project | [optional] +**add_time** | **string** | The creation date and time of the project in ISO 8601 format | [optional] +**update_time** | **string** | The last updated date and time of the project in ISO 8601 format | [optional] +**status_change_time** | **string** | The date and time of the last status change of the project in ISO 8601 format | [optional] +**archive_time** | **string** | The date and time the project was archived in ISO 8601 format. If not archived, this field is null. | [optional] +**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. | [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/v2/Model/ProjectRequestBody.md b/docs/versions/v2/Model/ProjectRequestBody.md new file mode 100644 index 00000000..5892a1fe --- /dev/null +++ b/docs/versions/v2/Model/ProjectRequestBody.md @@ -0,0 +1,22 @@ +# # ProjectRequestBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | The title of the project | [optional] +**description** | **string** | The description of the project | [optional] +**status** | **string** | The status of the project | [optional] +**board_id** | **int** | The ID of the board this project is associated with | [optional] +**phase_id** | **int** | The ID of the phase this project is associated with | [optional] +**owner_id** | **int** | The ID of the user who owns the project | [optional] +**start_date** | **\DateTime** | The start date of the project. Format: YYYY-MM-DD | [optional] +**end_date** | **\DateTime** | The end date of the project. Format: YYYY-MM-DD | [optional] +**deal_ids** | **int[]** | An array of IDs of the deals this project is associated with | [optional] +**person_ids** | **int[]** | An array of IDs of the persons this project is associated with | [optional] +**org_ids** | **int[]** | An array of IDs of the organizations this project is associated with | [optional] +**label_ids** | **int[]** | An array of IDs of the labels this project has | [optional] +**template_id** | **int** | The ID of the template the project will be based on. Only used when creating a new project. | [optional] +**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. | [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/v2/Model/ProjectSearchItem.md b/docs/versions/v2/Model/ProjectSearchItem.md new file mode 100644 index 00000000..17e6057b --- /dev/null +++ b/docs/versions/v2/Model/ProjectSearchItem.md @@ -0,0 +1,10 @@ +# # ProjectSearchItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**result_score** | **float** | Search result relevancy | [optional] +**item** | [**\Pipedrive\versions\v2\Model\ProjectSearchItemItem**](ProjectSearchItemItem.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/v2/Model/ProjectSearchItemItem.md b/docs/versions/v2/Model/ProjectSearchItemItem.md new file mode 100644 index 00000000..cb4ef238 --- /dev/null +++ b/docs/versions/v2/Model/ProjectSearchItemItem.md @@ -0,0 +1,23 @@ +# # ProjectSearchItemItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The ID of the project | [optional] +**type** | **string** | The type of the item | [optional] +**title** | **string** | The title of the project | [optional] +**status** | **string** | The status of the project | [optional] +**owner** | [**\Pipedrive\versions\v2\Model\ProjectSearchItemItemOwner**](ProjectSearchItemItemOwner.md) | | [optional] +**board_id** | **int** | The ID of the board the project belongs to | [optional] +**phase** | [**\Pipedrive\versions\v2\Model\ProjectSearchItemItemPhase**](ProjectSearchItemItemPhase.md) | | [optional] +**person** | [**\Pipedrive\versions\v2\Model\ProjectSearchItemItemPerson**](ProjectSearchItemItemPerson.md) | | [optional] +**organization** | [**\Pipedrive\versions\v2\Model\ProjectSearchItemItemOrganization**](ProjectSearchItemItemOrganization.md) | | [optional] +**deal** | [**\Pipedrive\versions\v2\Model\ProjectSearchItemItemDeal**](ProjectSearchItemItemDeal.md) | | [optional] +**deal_count** | **int** | The number of deals associated with the project | [optional] +**description** | **string** | The description of the project | [optional] +**end_date** | **string** | The end date of the project | [optional] +**custom_fields** | **string[]** | Custom fields | [optional] +**notes** | **string[]** | An array of notes | [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/v2/Model/ProjectSearchItemItemDeal.md b/docs/versions/v2/Model/ProjectSearchItemItemDeal.md new file mode 100644 index 00000000..7c9ffbaa --- /dev/null +++ b/docs/versions/v2/Model/ProjectSearchItemItemDeal.md @@ -0,0 +1,10 @@ +# # ProjectSearchItemItemDeal + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The ID of the deal the project is associated with | [optional] +**title** | **string** | The title of the deal the 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/v2/Model/ProjectSearchItemItemOrganization.md b/docs/versions/v2/Model/ProjectSearchItemItemOrganization.md new file mode 100644 index 00000000..a8fd0dea --- /dev/null +++ b/docs/versions/v2/Model/ProjectSearchItemItemOrganization.md @@ -0,0 +1,11 @@ +# # ProjectSearchItemItemOrganization + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The ID of the organization the project is associated with | [optional] +**name** | **string** | The name of the organization the project is associated with | [optional] +**address** | **string** | The address of the organization the 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/v2/Model/ProjectSearchItemItemOwner.md b/docs/versions/v2/Model/ProjectSearchItemItemOwner.md new file mode 100644 index 00000000..10ca0de2 --- /dev/null +++ b/docs/versions/v2/Model/ProjectSearchItemItemOwner.md @@ -0,0 +1,9 @@ +# # ProjectSearchItemItemOwner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The ID of the owner of the project | [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/v2/Model/ProjectSearchItemItemPerson.md b/docs/versions/v2/Model/ProjectSearchItemItemPerson.md new file mode 100644 index 00000000..ab037db3 --- /dev/null +++ b/docs/versions/v2/Model/ProjectSearchItemItemPerson.md @@ -0,0 +1,10 @@ +# # ProjectSearchItemItemPerson + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The ID of the person the project is associated with | [optional] +**name** | **string** | The name of the person the 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/v2/Model/ProjectSearchItemItemPhase.md b/docs/versions/v2/Model/ProjectSearchItemItemPhase.md new file mode 100644 index 00000000..f748c3bb --- /dev/null +++ b/docs/versions/v2/Model/ProjectSearchItemItemPhase.md @@ -0,0 +1,10 @@ +# # ProjectSearchItemItemPhase + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The ID of the phase | [optional] +**name** | **string** | The name of the phase | [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/v2/Model/ProjectSearchResponse.md b/docs/versions/v2/Model/ProjectSearchResponse.md new file mode 100644 index 00000000..f851deb8 --- /dev/null +++ b/docs/versions/v2/Model/ProjectSearchResponse.md @@ -0,0 +1,11 @@ +# # ProjectSearchResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | If the response is successful or not | [optional] +**data** | [**\Pipedrive\versions\v2\Model\ProjectSearchResponseAllOfData**](ProjectSearchResponseAllOfData.md) | | [optional] +**additional_data** | [**\Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination**](.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/v2/Model/ProjectSearchResponseAllOf.md b/docs/versions/v2/Model/ProjectSearchResponseAllOf.md new file mode 100644 index 00000000..d8f2637e --- /dev/null +++ b/docs/versions/v2/Model/ProjectSearchResponseAllOf.md @@ -0,0 +1,10 @@ +# # ProjectSearchResponseAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**\Pipedrive\versions\v2\Model\ProjectSearchResponseAllOfData**](ProjectSearchResponseAllOfData.md) | | [optional] +**additional_data** | [**\Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination**](.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/v2/Model/ProjectSearchResponseAllOfData.md b/docs/versions/v2/Model/ProjectSearchResponseAllOfData.md new file mode 100644 index 00000000..b09212e4 --- /dev/null +++ b/docs/versions/v2/Model/ProjectSearchResponseAllOfData.md @@ -0,0 +1,9 @@ +# # ProjectSearchResponseAllOfData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**items** | [**\Pipedrive\versions\v2\Model\ProjectSearchItem[]**](ProjectSearchItem.md) | The array of found projects | [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/v2/Model/ProjectTemplateItem.md b/docs/versions/v2/Model/ProjectTemplateItem.md new file mode 100644 index 00000000..71ca0ce8 --- /dev/null +++ b/docs/versions/v2/Model/ProjectTemplateItem.md @@ -0,0 +1,15 @@ +# # ProjectTemplateItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The ID of the project template | [optional] +**title** | **string** | The title of the project template | [optional] +**description** | **string** | The description of the project template | [optional] +**projects_board_id** | **int** | The ID of the project board this template is associated with | [optional] +**owner_id** | **int** | The ID of the owner of the project template | [optional] +**add_time** | **string** | The creation date and time of the project template in ISO 8601 format | [optional] +**update_time** | **string** | The update date and time of the project template in ISO 8601 format | [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/v2/Model/TaskItem.md b/docs/versions/v2/Model/TaskItem.md new file mode 100644 index 00000000..03660bba --- /dev/null +++ b/docs/versions/v2/Model/TaskItem.md @@ -0,0 +1,23 @@ +# # TaskItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The ID of the task | [optional] +**title** | **string** | The title of the task | [optional] +**creator_id** | **int** | The ID of the user who created the task | [optional] +**description** | **string** | The description of the task | [optional] +**project_id** | **int** | The ID of the project this task is associated with | [optional] +**is_done** | **bool** | Whether the task is done or not. | [optional] +**is_milestone** | **bool** | Whether the task is a milestone or not. | [optional] +**due_date** | **\DateTime** | The due date of the task. Format: YYYY-MM-DD. | [optional] +**start_date** | **\DateTime** | The start date of the task. Format: YYYY-MM-DD. | [optional] +**parent_task_id** | **int** | The ID of the parent task. If `null`, the task is a root-level task. | [optional] +**assignee_ids** | **int[]** | The IDs of users assigned to the task | [optional] +**priority** | **int** | The priority of the task | [optional] +**add_time** | **string** | The creation date and time of the task in ISO 8601 format | [optional] +**update_time** | **string** | The update date and time of the task in ISO 8601 format | [optional] +**marked_as_done_time** | **string** | The date and time the task was marked as done in ISO 8601 format | [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/v2/Model/TaskPatchRequest.md b/docs/versions/v2/Model/TaskPatchRequest.md new file mode 100644 index 00000000..ddc2e1ed --- /dev/null +++ b/docs/versions/v2/Model/TaskPatchRequest.md @@ -0,0 +1,19 @@ +# # TaskPatchRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | The title of the task | [optional] +**project_id** | **int** | The ID of the project this task is associated with | [optional] +**parent_task_id** | **int** | The ID of the parent task. Cannot be the ID of a task that is already a subtask. | [optional] +**description** | **string** | The description of the task | [optional] +**done** | **int** | Whether the task is done or not. `0` = Not done, `1` = Done. | [optional] +**milestone** | **int** | Whether the task is a milestone or not. `0` = Not a milestone, `1` = Milestone. | [optional] +**due_date** | **\DateTime** | The due date of the task. Format: YYYY-MM-DD. | [optional] +**start_date** | **\DateTime** | The start date of the task. Format: YYYY-MM-DD. | [optional] +**assignee_id** | **int** | The ID of the user assigned to the task. When set, the `assignee_ids` field will be overwritten with this value. | [optional] +**assignee_ids** | **int[]** | The IDs of users assigned to the task. When set, the `assignee_id` field will be set to the first value in this array, or `null` if empty. | [optional] +**priority** | **int** | The priority of the task | [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/v2/Model/TaskPostRequest.md b/docs/versions/v2/Model/TaskPostRequest.md new file mode 100644 index 00000000..f707d384 --- /dev/null +++ b/docs/versions/v2/Model/TaskPostRequest.md @@ -0,0 +1,19 @@ +# # TaskPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | The title of the task | +**project_id** | **int** | The ID of the project this task is associated with | +**parent_task_id** | **int** | The ID of the parent task. Cannot be the ID of a task that is already a subtask. | [optional] +**description** | **string** | The description of the task | [optional] +**done** | **int** | Whether the task is done or not. `0` = Not done, `1` = Done. | [optional] +**milestone** | **int** | Whether the task is a milestone or not. `0` = Not a milestone, `1` = Milestone. | [optional] +**due_date** | **\DateTime** | The due date of the task. Format: YYYY-MM-DD. | [optional] +**start_date** | **\DateTime** | The start date of the task. Format: YYYY-MM-DD. | [optional] +**assignee_id** | **int** | The ID of the user assigned to the task. When set, the `assignee_ids` field will be overwritten with this value. | [optional] +**assignee_ids** | **int[]** | The IDs of users assigned to the task. When set, the `assignee_id` field will be set to the first value in this array, or `null` if empty. | [optional] +**priority** | **int** | The priority of the task | [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/v2/Model/UpdateOrganizationFieldRequest.md b/docs/versions/v2/Model/UpdateOrganizationFieldRequest.md index c117d796..67c03e1b 100644 --- a/docs/versions/v2/Model/UpdateOrganizationFieldRequest.md +++ b/docs/versions/v2/Model/UpdateOrganizationFieldRequest.md @@ -8,6 +8,5 @@ Name | Type | Description | Notes **ui_visibility** | **array** | UI visibility settings for the field. Controls where the field appears in the Pipedrive web UI. | [optional] **important_fields** | **array** | Configuration for highlighting the field at specific stages. | [optional] **required_fields** | **array** | Required fields configuration for marking the field as mandatory when interacted with in the Pipedrive web UI. | [optional] -**description** | **string** | Field description | [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/v2/Model/UpdateProductRequestBody.md b/docs/versions/v2/Model/UpdateProductRequestBody.md index a7ae010f..efbc02d7 100644 --- a/docs/versions/v2/Model/UpdateProductRequestBody.md +++ b/docs/versions/v2/Model/UpdateProductRequestBody.md @@ -14,7 +14,7 @@ Name | Type | Description | Notes **is_linkable** | **bool** | Whether this product can be added to a deal or not | [optional] [default to true] **visible_to** | [**VisibleTo**](VisibleTo.md) | The visibility of the product. If omitted, the visibility will be set to the default visibility setting of this item type for the authorized user. Read more about visibility groups <a href=\"https://support.pipedrive.com/en/article/visibility-groups\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>.<h4>Light / Growth and Professional plans</h4><table><tr><th style=\"width: 40px\">Value</th><th>Description</th></tr><tr><td>`1`</td><td>Owner &amp; followers</td><tr><td>`3`</td><td>Entire company</td></tr></table><h4>Premium / Ultimate plan</h4><table><tr><th style=\"width: 40px\">Value</th><th>Description</th></tr><tr><td>`1`</td><td>Owner only</td><tr><td>`3`</td><td>Owner's visibility group</td></tr><tr><td>`5`</td><td>Owner's visibility group and sub-groups</td></tr><tr><td>`7`</td><td>Entire company</td></tr></table> | [optional] **prices** | **object[]** | An array of objects, each containing: `currency` (string), `price` (number), `cost` (number, optional), `direct_cost` (number, optional). Note that there can only be one price per product per currency. When `prices` is omitted altogether, a default price of 0 and the user's default currency will be assigned. | [optional] -**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes | [optional] +**custom_fields** | **array** | An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. | [optional] **billing_frequency** | [**\Pipedrive\versions\v2\Model\BillingFrequency1**](BillingFrequency1.md) | | [optional] **billing_frequency_cycles** | **int** | Only available in Growth and above plans The number of times the billing frequency repeats for a product in a deal When `billing_frequency` is set to `one-time`, this field must be `null` When `billing_frequency` is set to `weekly`, this field cannot be `null` For all the other values of `billing_frequency`, `null` represents a product billed indefinitely Must be a positive integer less or equal to 208 | [optional] diff --git a/docs/versions/v2/Model/UpdateProjectFieldRequest.md b/docs/versions/v2/Model/UpdateProjectFieldRequest.md new file mode 100644 index 00000000..ec095835 --- /dev/null +++ b/docs/versions/v2/Model/UpdateProjectFieldRequest.md @@ -0,0 +1,12 @@ +# # UpdateProjectFieldRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**field_name** | **string** | Field name | [optional] +**ui_visibility** | **array** | UI visibility settings for the field. Controls where the field appears in the Pipedrive web UI. | [optional] +**important_fields** | **array** | Configuration for highlighting the field at specific stages. | [optional] +**required_fields** | **array** | Required fields configuration for marking the field as mandatory when interacted with in the Pipedrive web UI. | [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/v2/Model/UpdateTaskResponse.md b/docs/versions/v2/Model/UpdateTaskResponse.md new file mode 100644 index 00000000..5426f79d --- /dev/null +++ b/docs/versions/v2/Model/UpdateTaskResponse.md @@ -0,0 +1,11 @@ +# # UpdateTaskResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | If the response is successful or not | [optional] +**data** | [**\Pipedrive\versions\v2\Model\TaskItem**](TaskItem.md) | | [optional] +**additional_data** | **object** | | [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/v2/README.md b/docs/versions/v2/README.md index 352c51c0..9aa73825 100644 --- a/docs/versions/v2/README.md +++ b/docs/versions/v2/README.md @@ -272,6 +272,30 @@ Class | Method | HTTP request | Description *ActivitiesApi* | [**updateActivity**](Api/ActivitiesApi.md#updateactivity) | **PATCH** /activities/{id} | Update an activity *ActivityFieldsApi* | [**getActivityField**](Api/ActivityFieldsApi.md#getactivityfield) | **GET** /activityFields/{field_code} | Get one activity field *ActivityFieldsApi* | [**getActivityFields**](Api/ActivityFieldsApi.md#getactivityfields) | **GET** /activityFields | Get all activity fields +*BetaApi* | [**addProjectBoard**](Api/BetaApi.md#addprojectboard) | **POST** /boards | Add a project board +*BetaApi* | [**addProjectField**](Api/BetaApi.md#addprojectfield) | **POST** /projectFields | Create one project field +*BetaApi* | [**addProjectFieldOptions**](Api/BetaApi.md#addprojectfieldoptions) | **POST** /projectFields/{field_code}/options | Add project field options in bulk +*BetaApi* | [**addProjectPhase**](Api/BetaApi.md#addprojectphase) | **POST** /phases | Add a project phase +*BetaApi* | [**addTask**](Api/BetaApi.md#addtask) | **POST** /tasks | Add a task +*BetaApi* | [**deleteProjectBoard**](Api/BetaApi.md#deleteprojectboard) | **DELETE** /boards/{id} | Delete a project board +*BetaApi* | [**deleteProjectField**](Api/BetaApi.md#deleteprojectfield) | **DELETE** /projectFields/{field_code} | Delete one project field +*BetaApi* | [**deleteProjectFieldOptions**](Api/BetaApi.md#deleteprojectfieldoptions) | **DELETE** /projectFields/{field_code}/options | Delete project field options in bulk +*BetaApi* | [**deleteProjectPhase**](Api/BetaApi.md#deleteprojectphase) | **DELETE** /phases/{id} | Delete a project phase +*BetaApi* | [**deleteTask**](Api/BetaApi.md#deletetask) | **DELETE** /tasks/{id} | Delete a task +*BetaApi* | [**getProjectField**](Api/BetaApi.md#getprojectfield) | **GET** /projectFields/{field_code} | Get one project field +*BetaApi* | [**getProjectFields**](Api/BetaApi.md#getprojectfields) | **GET** /projectFields | Get all project fields +*BetaApi* | [**getProjectsBoard**](Api/BetaApi.md#getprojectsboard) | **GET** /boards/{id} | Get details of a project board +*BetaApi* | [**getProjectsBoards**](Api/BetaApi.md#getprojectsboards) | **GET** /boards | Get all project boards +*BetaApi* | [**getProjectsPhase**](Api/BetaApi.md#getprojectsphase) | **GET** /phases/{id} | Get details of a project phase +*BetaApi* | [**getProjectsPhases**](Api/BetaApi.md#getprojectsphases) | **GET** /phases | Get project phases +*BetaApi* | [**getTask**](Api/BetaApi.md#gettask) | **GET** /tasks/{id} | Get details of a task +*BetaApi* | [**getTasks**](Api/BetaApi.md#gettasks) | **GET** /tasks | Get all tasks +*BetaApi* | [**searchProjects**](Api/BetaApi.md#searchprojects) | **GET** /projects/search | Search projects +*BetaApi* | [**updateProjectBoard**](Api/BetaApi.md#updateprojectboard) | **PATCH** /boards/{id} | Update a project board +*BetaApi* | [**updateProjectField**](Api/BetaApi.md#updateprojectfield) | **PATCH** /projectFields/{field_code} | Update one project field +*BetaApi* | [**updateProjectFieldOptions**](Api/BetaApi.md#updateprojectfieldoptions) | **PATCH** /projectFields/{field_code}/options | Update project field options in bulk +*BetaApi* | [**updateProjectPhase**](Api/BetaApi.md#updateprojectphase) | **PATCH** /phases/{id} | Update a project phase +*BetaApi* | [**updateTask**](Api/BetaApi.md#updatetask) | **PATCH** /tasks/{id} | Update a task *DealFieldsApi* | [**addDealField**](Api/DealFieldsApi.md#adddealfield) | **POST** /dealFields | Create one deal field *DealFieldsApi* | [**addDealFieldOptions**](Api/DealFieldsApi.md#adddealfieldoptions) | **POST** /dealFields/{field_code}/options | Add deal field options in bulk *DealFieldsApi* | [**deleteDealField**](Api/DealFieldsApi.md#deletedealfield) | **DELETE** /dealFields/{field_code} | Delete one deal field @@ -280,34 +304,34 @@ Class | Method | HTTP request | Description *DealFieldsApi* | [**getDealFields**](Api/DealFieldsApi.md#getdealfields) | **GET** /dealFields | Get all deal fields *DealFieldsApi* | [**updateDealField**](Api/DealFieldsApi.md#updatedealfield) | **PATCH** /dealFields/{field_code} | Update one deal field *DealFieldsApi* | [**updateDealFieldOptions**](Api/DealFieldsApi.md#updatedealfieldoptions) | **PATCH** /dealFields/{field_code}/options | Update deal field options in bulk +*DealInstallmentsApi* | [**deleteInstallment**](Api/DealInstallmentsApi.md#deleteinstallment) | **DELETE** /deals/{id}/installments/{installment_id} | Delete an installment from a deal +*DealInstallmentsApi* | [**getInstallments**](Api/DealInstallmentsApi.md#getinstallments) | **GET** /deals/installments | List installments added to a list of deals +*DealInstallmentsApi* | [**postInstallment**](Api/DealInstallmentsApi.md#postinstallment) | **POST** /deals/{id}/installments | Add an installment to a deal +*DealInstallmentsApi* | [**updateInstallment**](Api/DealInstallmentsApi.md#updateinstallment) | **PATCH** /deals/{id}/installments/{installment_id} | Update an installment added to a deal +*DealProductsApi* | [**addDealProduct**](Api/DealProductsApi.md#adddealproduct) | **POST** /deals/{id}/products | Add a product to a deal +*DealProductsApi* | [**addManyDealProducts**](Api/DealProductsApi.md#addmanydealproducts) | **POST** /deals/{id}/products/bulk | Add multiple products to a deal +*DealProductsApi* | [**deleteDealProduct**](Api/DealProductsApi.md#deletedealproduct) | **DELETE** /deals/{id}/products/{product_attachment_id} | Delete an attached product from a deal +*DealProductsApi* | [**deleteManyDealProducts**](Api/DealProductsApi.md#deletemanydealproducts) | **DELETE** /deals/{id}/products | Delete many products from a deal +*DealProductsApi* | [**getDealProducts**](Api/DealProductsApi.md#getdealproducts) | **GET** /deals/{id}/products | List products attached to a deal +*DealProductsApi* | [**getDealsProducts**](Api/DealProductsApi.md#getdealsproducts) | **GET** /deals/products | Get deal products of several deals +*DealProductsApi* | [**updateDealProduct**](Api/DealProductsApi.md#updatedealproduct) | **PATCH** /deals/{id}/products/{product_attachment_id} | Update the product attached to a deal *DealsApi* | [**addDeal**](Api/DealsApi.md#adddeal) | **POST** /deals | Add a new deal *DealsApi* | [**addDealFollower**](Api/DealsApi.md#adddealfollower) | **POST** /deals/{id}/followers | Add a follower to a deal -*DealsApi* | [**addDealProduct**](Api/DealsApi.md#adddealproduct) | **POST** /deals/{id}/products | Add a product to a deal -*DealsApi* | [**addManyDealProducts**](Api/DealsApi.md#addmanydealproducts) | **POST** /deals/{id}/products/bulk | Add multiple products to a deal *DealsApi* | [**convertDealToLead**](Api/DealsApi.md#convertdealtolead) | **POST** /deals/{id}/convert/lead | Convert a deal to a lead *DealsApi* | [**deleteAdditionalDiscount**](Api/DealsApi.md#deleteadditionaldiscount) | **DELETE** /deals/{id}/discounts/{discount_id} | Delete a discount from 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* | [**deleteDealProduct**](Api/DealsApi.md#deletedealproduct) | **DELETE** /deals/{id}/products/{product_attachment_id} | Delete an attached product from a deal -*DealsApi* | [**deleteInstallment**](Api/DealsApi.md#deleteinstallment) | **DELETE** /deals/{id}/installments/{installment_id} | Delete an installment from a deal -*DealsApi* | [**deleteManyDealProducts**](Api/DealsApi.md#deletemanydealproducts) | **DELETE** /deals/{id}/products | Delete many products from a deal *DealsApi* | [**getAdditionalDiscounts**](Api/DealsApi.md#getadditionaldiscounts) | **GET** /deals/{id}/discounts | List discounts added to a deal *DealsApi* | [**getArchivedDeals**](Api/DealsApi.md#getarchiveddeals) | **GET** /deals/archived | Get all archived deals *DealsApi* | [**getDeal**](Api/DealsApi.md#getdeal) | **GET** /deals/{id} | Get details of a deal *DealsApi* | [**getDealConversionStatus**](Api/DealsApi.md#getdealconversionstatus) | **GET** /deals/{id}/convert/status/{conversion_id} | Get Deal conversion status *DealsApi* | [**getDealFollowers**](Api/DealsApi.md#getdealfollowers) | **GET** /deals/{id}/followers | List followers of a deal *DealsApi* | [**getDealFollowersChangelog**](Api/DealsApi.md#getdealfollowerschangelog) | **GET** /deals/{id}/followers/changelog | List followers changelog of a deal -*DealsApi* | [**getDealProducts**](Api/DealsApi.md#getdealproducts) | **GET** /deals/{id}/products | List products attached to a deal *DealsApi* | [**getDeals**](Api/DealsApi.md#getdeals) | **GET** /deals | Get all deals -*DealsApi* | [**getDealsProducts**](Api/DealsApi.md#getdealsproducts) | **GET** /deals/products | Get deal products of several deals -*DealsApi* | [**getInstallments**](Api/DealsApi.md#getinstallments) | **GET** /deals/installments | List installments added to a list of deals *DealsApi* | [**postAdditionalDiscount**](Api/DealsApi.md#postadditionaldiscount) | **POST** /deals/{id}/discounts | Add a discount to a deal -*DealsApi* | [**postInstallment**](Api/DealsApi.md#postinstallment) | **POST** /deals/{id}/installments | Add an installment to a deal *DealsApi* | [**searchDeals**](Api/DealsApi.md#searchdeals) | **GET** /deals/search | Search deals *DealsApi* | [**updateAdditionalDiscount**](Api/DealsApi.md#updateadditionaldiscount) | **PATCH** /deals/{id}/discounts/{discount_id} | Update a discount added to a deal *DealsApi* | [**updateDeal**](Api/DealsApi.md#updatedeal) | **PATCH** /deals/{id} | Update a deal -*DealsApi* | [**updateDealProduct**](Api/DealsApi.md#updatedealproduct) | **PATCH** /deals/{id}/products/{product_attachment_id} | Update the product attached to a deal -*DealsApi* | [**updateInstallment**](Api/DealsApi.md#updateinstallment) | **PATCH** /deals/{id}/installments/{installment_id} | Update an installment added to a deal *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 *LeadsApi* | [**convertLeadToDeal**](Api/LeadsApi.md#convertleadtodeal) | **POST** /leads/{id}/convert/deal | Convert a lead to a deal @@ -382,11 +406,46 @@ Class | Method | HTTP request | Description *ProductsApi* | [**updateProductImage**](Api/ProductsApi.md#updateproductimage) | **PUT** /products/{id}/images | Update an image for a product *ProductsApi* | [**updateProductVariation**](Api/ProductsApi.md#updateproductvariation) | **PATCH** /products/{id}/variations/{product_variation_id} | Update a product variation *ProductsApi* | [**uploadProductImage**](Api/ProductsApi.md#uploadproductimage) | **POST** /products/{id}/images | Upload an image for a product +*ProjectBoardsApi* | [**addProjectBoard**](Api/ProjectBoardsApi.md#addprojectboard) | **POST** /boards | Add a project board +*ProjectBoardsApi* | [**deleteProjectBoard**](Api/ProjectBoardsApi.md#deleteprojectboard) | **DELETE** /boards/{id} | Delete a project board +*ProjectBoardsApi* | [**getProjectsBoard**](Api/ProjectBoardsApi.md#getprojectsboard) | **GET** /boards/{id} | Get details of a project board +*ProjectBoardsApi* | [**getProjectsBoards**](Api/ProjectBoardsApi.md#getprojectsboards) | **GET** /boards | Get all project boards +*ProjectBoardsApi* | [**updateProjectBoard**](Api/ProjectBoardsApi.md#updateprojectboard) | **PATCH** /boards/{id} | Update a project board +*ProjectFieldsApi* | [**addProjectField**](Api/ProjectFieldsApi.md#addprojectfield) | **POST** /projectFields | Create one project field +*ProjectFieldsApi* | [**addProjectFieldOptions**](Api/ProjectFieldsApi.md#addprojectfieldoptions) | **POST** /projectFields/{field_code}/options | Add project field options in bulk +*ProjectFieldsApi* | [**deleteProjectField**](Api/ProjectFieldsApi.md#deleteprojectfield) | **DELETE** /projectFields/{field_code} | Delete one project field +*ProjectFieldsApi* | [**deleteProjectFieldOptions**](Api/ProjectFieldsApi.md#deleteprojectfieldoptions) | **DELETE** /projectFields/{field_code}/options | Delete project field options in bulk +*ProjectFieldsApi* | [**getProjectField**](Api/ProjectFieldsApi.md#getprojectfield) | **GET** /projectFields/{field_code} | Get one project field +*ProjectFieldsApi* | [**getProjectFields**](Api/ProjectFieldsApi.md#getprojectfields) | **GET** /projectFields | Get all project fields +*ProjectFieldsApi* | [**updateProjectField**](Api/ProjectFieldsApi.md#updateprojectfield) | **PATCH** /projectFields/{field_code} | Update one project field +*ProjectFieldsApi* | [**updateProjectFieldOptions**](Api/ProjectFieldsApi.md#updateprojectfieldoptions) | **PATCH** /projectFields/{field_code}/options | Update project field options in bulk +*ProjectPhasesApi* | [**addProjectPhase**](Api/ProjectPhasesApi.md#addprojectphase) | **POST** /phases | Add a project phase +*ProjectPhasesApi* | [**deleteProjectPhase**](Api/ProjectPhasesApi.md#deleteprojectphase) | **DELETE** /phases/{id} | Delete a project phase +*ProjectPhasesApi* | [**getProjectsPhase**](Api/ProjectPhasesApi.md#getprojectsphase) | **GET** /phases/{id} | Get details of a project phase +*ProjectPhasesApi* | [**getProjectsPhases**](Api/ProjectPhasesApi.md#getprojectsphases) | **GET** /phases | Get project phases +*ProjectPhasesApi* | [**updateProjectPhase**](Api/ProjectPhasesApi.md#updateprojectphase) | **PATCH** /phases/{id} | Update a project phase +*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 +*ProjectsApi* | [**addProject**](Api/ProjectsApi.md#addproject) | **POST** /projects | Add a project +*ProjectsApi* | [**archiveProject**](Api/ProjectsApi.md#archiveproject) | **POST** /projects/{id}/archive | Archive a project +*ProjectsApi* | [**deleteProject**](Api/ProjectsApi.md#deleteproject) | **DELETE** /projects/{id} | Delete a project +*ProjectsApi* | [**getArchivedProjects**](Api/ProjectsApi.md#getarchivedprojects) | **GET** /projects/archived | Get all archived projects +*ProjectsApi* | [**getProject**](Api/ProjectsApi.md#getproject) | **GET** /projects/{id} | Get details of a project +*ProjectsApi* | [**getProjectChangelog**](Api/ProjectsApi.md#getprojectchangelog) | **GET** /projects/{id}/changelog | List updates about project field values +*ProjectsApi* | [**getProjectUsers**](Api/ProjectsApi.md#getprojectusers) | **GET** /projects/{id}/permittedUsers | List permitted users +*ProjectsApi* | [**getProjects**](Api/ProjectsApi.md#getprojects) | **GET** /projects | Get all projects +*ProjectsApi* | [**searchProjects**](Api/ProjectsApi.md#searchprojects) | **GET** /projects/search | Search projects +*ProjectsApi* | [**updateProject**](Api/ProjectsApi.md#updateproject) | **PATCH** /projects/{id} | Update a project *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* | [**getStages**](Api/StagesApi.md#getstages) | **GET** /stages | Get all stages *StagesApi* | [**updateStage**](Api/StagesApi.md#updatestage) | **PATCH** /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 +*TasksApi* | [**getTasks**](Api/TasksApi.md#gettasks) | **GET** /tasks | Get all tasks +*TasksApi* | [**updateTask**](Api/TasksApi.md#updatetask) | **PATCH** /tasks/{id} | Update a task *UsersApi* | [**getUserFollowers**](Api/UsersApi.md#getuserfollowers) | **GET** /users/{id}/followers | List followers of a user @@ -408,6 +467,7 @@ Class | Method | HTTP request | Description - [AddInstallmentResponse](Model/AddInstallmentResponse.md) - [AddProductImageResponse](Model/AddProductImageResponse.md) - [AddProductRequestBody](Model/AddProductRequestBody.md) + - [AddTaskResponse](Model/AddTaskResponse.md) - [AdditionalDataWithCursorPagination](Model/AdditionalDataWithCursorPagination.md) - [AdditionalDiscountRequestBody](Model/AdditionalDiscountRequestBody.md) - [AdditionalDiscountsResponse](Model/AdditionalDiscountsResponse.md) @@ -426,6 +486,8 @@ Class | Method | HTTP request | Description - [BaseResponse](Model/BaseResponse.md) - [BillingFrequency](Model/BillingFrequency.md) - [BillingFrequency1](Model/BillingFrequency1.md) + - [BoardItem](Model/BoardItem.md) + - [BoardRequestBody](Model/BoardRequestBody.md) - [ConvertEntityResponse](Model/ConvertEntityResponse.md) - [CreateDealField](Model/CreateDealField.md) - [CreateDealFieldRequest](Model/CreateDealFieldRequest.md) @@ -438,6 +500,8 @@ Class | Method | HTTP request | Description - [CreatePersonFieldRequest](Model/CreatePersonFieldRequest.md) - [CreateProductField](Model/CreateProductField.md) - [CreateProductFieldRequest](Model/CreateProductFieldRequest.md) + - [CreateProjectField](Model/CreateProjectField.md) + - [CreateProjectFieldRequest](Model/CreateProjectFieldRequest.md) - [Deal](Model/Deal.md) - [DealFieldItem](Model/DealFieldItem.md) - [DealFieldItemImportantFields](Model/DealFieldItemImportantFields.md) @@ -487,8 +551,18 @@ Class | Method | HTTP request | Description - [DeleteProductResponseData](Model/DeleteProductResponseData.md) - [DeleteProductVariation](Model/DeleteProductVariation.md) - [DeleteProductVariationData](Model/DeleteProductVariationData.md) + - [DeleteProjectBoardResponse](Model/DeleteProjectBoardResponse.md) + - [DeleteProjectBoardResponseData](Model/DeleteProjectBoardResponseData.md) + - [DeleteProjectField](Model/DeleteProjectField.md) + - [DeleteProjectFieldData](Model/DeleteProjectFieldData.md) + - [DeleteProjectPhaseResponse](Model/DeleteProjectPhaseResponse.md) + - [DeleteProjectPhaseResponseData](Model/DeleteProjectPhaseResponseData.md) + - [DeleteProjectResponse](Model/DeleteProjectResponse.md) + - [DeleteProjectResponseData](Model/DeleteProjectResponseData.md) - [DeleteStageResponse](Model/DeleteStageResponse.md) - [DeleteStageResponseData](Model/DeleteStageResponseData.md) + - [DeleteTaskResponse](Model/DeleteTaskResponse.md) + - [DeleteTaskResponseData](Model/DeleteTaskResponseData.md) - [FieldOption](Model/FieldOption.md) - [FollowerChangelogItem](Model/FollowerChangelogItem.md) - [FollowerItem](Model/FollowerItem.md) @@ -498,6 +572,7 @@ Class | Method | HTTP request | Description - [GetActivityField](Model/GetActivityField.md) - [GetActivityFields](Model/GetActivityFields.md) - [GetActivityFieldsAdditionalData](Model/GetActivityFieldsAdditionalData.md) + - [GetBoards](Model/GetBoards.md) - [GetConvertResponse](Model/GetConvertResponse.md) - [GetDealField](Model/GetDealField.md) - [GetDealFields](Model/GetDealFields.md) @@ -525,11 +600,21 @@ Class | Method | HTTP request | Description - [GetPersonFields](Model/GetPersonFields.md) - [GetPersons](Model/GetPersons.md) - [GetPersonsAllOf](Model/GetPersonsAllOf.md) + - [GetPhases](Model/GetPhases.md) - [GetPipelines](Model/GetPipelines.md) - [GetPipelinesAllOf](Model/GetPipelinesAllOf.md) - [GetProductField](Model/GetProductField.md) - [GetProductFields](Model/GetProductFields.md) + - [GetProjectField](Model/GetProjectField.md) + - [GetProjectFields](Model/GetProjectFields.md) + - [GetProjectPermittedUsersResponse](Model/GetProjectPermittedUsersResponse.md) + - [GetProjectTemplateResponse](Model/GetProjectTemplateResponse.md) + - [GetProjectTemplatesResponse](Model/GetProjectTemplatesResponse.md) + - [GetProjects](Model/GetProjects.md) + - [GetProjectsAllOf](Model/GetProjectsAllOf.md) - [GetStages](Model/GetStages.md) + - [GetTaskResponse](Model/GetTaskResponse.md) + - [GetTasksResponse](Model/GetTasksResponse.md) - [InlineObject](Model/InlineObject.md) - [InlineResponse200](Model/InlineResponse200.md) - [InstallmentRequestBody](Model/InstallmentRequestBody.md) @@ -576,15 +661,21 @@ Class | Method | HTTP request | Description - [PersonSearchResponse](Model/PersonSearchResponse.md) - [PersonSearchResponseAllOf](Model/PersonSearchResponseAllOf.md) - [PersonSearchResponseAllOfData](Model/PersonSearchResponseAllOfData.md) + - [PhaseItem](Model/PhaseItem.md) + - [PhaseRequestBody](Model/PhaseRequestBody.md) - [PipelineItem](Model/PipelineItem.md) - [PipelineRequestBody](Model/PipelineRequestBody.md) - [PostFollower](Model/PostFollower.md) - [PostFollowerAllOf](Model/PostFollowerAllOf.md) - [PostPatchGetActivity](Model/PostPatchGetActivity.md) + - [PostPatchGetBoard](Model/PostPatchGetBoard.md) - [PostPatchGetDeal](Model/PostPatchGetDeal.md) - [PostPatchGetOrganization](Model/PostPatchGetOrganization.md) - [PostPatchGetPerson](Model/PostPatchGetPerson.md) + - [PostPatchGetPhase](Model/PostPatchGetPhase.md) - [PostPatchGetPipeline](Model/PostPatchGetPipeline.md) + - [PostPatchGetProject](Model/PostPatchGetProject.md) + - [PostPatchGetProjectAllOf](Model/PostPatchGetProjectAllOf.md) - [PostPatchGetStage](Model/PostPatchGetStage.md) - [ProductFieldItem](Model/ProductFieldItem.md) - [ProductImageResponse](Model/ProductImageResponse.md) @@ -603,8 +694,28 @@ Class | Method | HTTP request | Description - [ProductVariationsResponse](Model/ProductVariationsResponse.md) - [ProductWithArrayPrices](Model/ProductWithArrayPrices.md) - [ProductsResponse](Model/ProductsResponse.md) + - [ProjectChangelogResponse](Model/ProjectChangelogResponse.md) + - [ProjectChangelogResponseData](Model/ProjectChangelogResponseData.md) + - [ProjectFieldItem](Model/ProjectFieldItem.md) + - [ProjectFieldItemUiVisibility](Model/ProjectFieldItemUiVisibility.md) + - [ProjectItem](Model/ProjectItem.md) + - [ProjectRequestBody](Model/ProjectRequestBody.md) + - [ProjectSearchItem](Model/ProjectSearchItem.md) + - [ProjectSearchItemItem](Model/ProjectSearchItemItem.md) + - [ProjectSearchItemItemDeal](Model/ProjectSearchItemItemDeal.md) + - [ProjectSearchItemItemOrganization](Model/ProjectSearchItemItemOrganization.md) + - [ProjectSearchItemItemOwner](Model/ProjectSearchItemItemOwner.md) + - [ProjectSearchItemItemPerson](Model/ProjectSearchItemItemPerson.md) + - [ProjectSearchItemItemPhase](Model/ProjectSearchItemItemPhase.md) + - [ProjectSearchResponse](Model/ProjectSearchResponse.md) + - [ProjectSearchResponseAllOf](Model/ProjectSearchResponseAllOf.md) + - [ProjectSearchResponseAllOfData](Model/ProjectSearchResponseAllOfData.md) + - [ProjectTemplateItem](Model/ProjectTemplateItem.md) - [StageItem](Model/StageItem.md) - [StageRequestBody](Model/StageRequestBody.md) + - [TaskItem](Model/TaskItem.md) + - [TaskPatchRequest](Model/TaskPatchRequest.md) + - [TaskPostRequest](Model/TaskPostRequest.md) - [UpdateAdditionalDiscountResponse](Model/UpdateAdditionalDiscountResponse.md) - [UpdateDealFieldRequest](Model/UpdateDealFieldRequest.md) - [UpdateDealProductRequestBody](Model/UpdateDealProductRequestBody.md) @@ -615,6 +726,8 @@ Class | Method | HTTP request | Description - [UpdateProductImageResponse](Model/UpdateProductImageResponse.md) - [UpdateProductRequestBody](Model/UpdateProductRequestBody.md) - [UpdateProductResponse](Model/UpdateProductResponse.md) + - [UpdateProjectFieldRequest](Model/UpdateProjectFieldRequest.md) + - [UpdateTaskResponse](Model/UpdateTaskResponse.md) - [UpsertActivityResponseData](Model/UpsertActivityResponseData.md) - [UpsertDealResponseData](Model/UpsertDealResponseData.md) - [UpsertOrganizationResponseData](Model/UpsertOrganizationResponseData.md) @@ -678,4 +791,5 @@ Class | Method | HTTP request | Description - **deal-fields:full**: Create, read, update and delete deal fields - **product-fields:full**: Create, read, update and delete product fields - **contact-fields:full**: Create, read, update and delete person and organization fields +- **project-fields:full**: Create, read, update and delete project fields diff --git a/lib/versions/v1/Api/NotesApi.php b/lib/versions/v1/Api/NotesApi.php index 7deeed61..e786a266 100644 --- a/lib/versions/v1/Api/NotesApi.php +++ b/lib/versions/v1/Api/NotesApi.php @@ -2273,6 +2273,7 @@ public function getNoteCommentsRequest($id, $start = 0, $limit = null): Request * @param int|null $person_id The ID of the person whose notes to fetch. If omitted, notes about all persons will be returned. (optional) * @param int|null $org_id The ID of the organization which notes to fetch. If omitted, notes about all organizations will be returned. (optional) * @param int|null $project_id The ID of the project which notes to fetch. If omitted, notes about all projects will be returned. (optional) + * @param int|null $task_id The ID of the task which notes to fetch. If omitted, notes about all tasks will be returned. (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). Supported fields: `id`, `user_id`, `deal_id`, `person_id`, `org_id`, `content`, `add_time`, `update_time`. (optional) @@ -2284,14 +2285,15 @@ public function getNoteCommentsRequest($id, $start = 0, $limit = null): Request * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $pinned_to_organization_flag If set, the results are filtered by note to organization pinning state (optional) * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $pinned_to_person_flag If set, the results are filtered by note to person pinning state (optional) * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $pinned_to_project_flag If set, the results are filtered by note to project pinning state (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $pinned_to_task_flag If set, the results are filtered by note to task pinning state (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException * @return \Pipedrive\versions\v1\Model\GetNotes */ - public function getNotes($user_id = null, $lead_id = null, $deal_id = null, $person_id = null, $org_id = null, $project_id = null, $start = 0, $limit = null, $sort = null, $start_date = null, $end_date = null, $updated_since = null, $pinned_to_lead_flag = null, $pinned_to_deal_flag = null, $pinned_to_organization_flag = null, $pinned_to_person_flag = null, $pinned_to_project_flag = null) + public function getNotes($user_id = null, $lead_id = null, $deal_id = null, $person_id = null, $org_id = null, $project_id = null, $task_id = null, $start = 0, $limit = null, $sort = null, $start_date = null, $end_date = null, $updated_since = null, $pinned_to_lead_flag = null, $pinned_to_deal_flag = null, $pinned_to_organization_flag = null, $pinned_to_person_flag = null, $pinned_to_project_flag = null, $pinned_to_task_flag = null) { - list($response) = $this->getNotesWithHttpInfo($user_id, $lead_id, $deal_id, $person_id, $org_id, $project_id, $start, $limit, $sort, $start_date, $end_date, $updated_since, $pinned_to_lead_flag, $pinned_to_deal_flag, $pinned_to_organization_flag, $pinned_to_person_flag, $pinned_to_project_flag); + list($response) = $this->getNotesWithHttpInfo($user_id, $lead_id, $deal_id, $person_id, $org_id, $project_id, $task_id, $start, $limit, $sort, $start_date, $end_date, $updated_since, $pinned_to_lead_flag, $pinned_to_deal_flag, $pinned_to_organization_flag, $pinned_to_person_flag, $pinned_to_project_flag, $pinned_to_task_flag); return $response; } @@ -2306,6 +2308,7 @@ public function getNotes($user_id = null, $lead_id = null, $deal_id = null, $per * @param int|null $person_id The ID of the person whose notes to fetch. If omitted, notes about all persons will be returned. (optional) * @param int|null $org_id The ID of the organization which notes to fetch. If omitted, notes about all organizations will be returned. (optional) * @param int|null $project_id The ID of the project which notes to fetch. If omitted, notes about all projects will be returned. (optional) + * @param int|null $task_id The ID of the task which notes to fetch. If omitted, notes about all tasks will be returned. (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). Supported fields: `id`, `user_id`, `deal_id`, `person_id`, `org_id`, `content`, `add_time`, `update_time`. (optional) @@ -2317,14 +2320,15 @@ public function getNotes($user_id = null, $lead_id = null, $deal_id = null, $per * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $pinned_to_organization_flag If set, the results are filtered by note to organization pinning state (optional) * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $pinned_to_person_flag If set, the results are filtered by note to person pinning state (optional) * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $pinned_to_project_flag If set, the results are filtered by note to project pinning state (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $pinned_to_task_flag If set, the results are filtered by note to task pinning state (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException * @return array of \Pipedrive\versions\v1\Model\GetNotes, HTTP status code, HTTP response headers (array of strings) */ - public function getNotesWithHttpInfo($user_id = null, $lead_id = null, $deal_id = null, $person_id = null, $org_id = null, $project_id = null, $start = 0, $limit = null, $sort = null, $start_date = null, $end_date = null, $updated_since = null, $pinned_to_lead_flag = null, $pinned_to_deal_flag = null, $pinned_to_organization_flag = null, $pinned_to_person_flag = null, $pinned_to_project_flag = null) + public function getNotesWithHttpInfo($user_id = null, $lead_id = null, $deal_id = null, $person_id = null, $org_id = null, $project_id = null, $task_id = null, $start = 0, $limit = null, $sort = null, $start_date = null, $end_date = null, $updated_since = null, $pinned_to_lead_flag = null, $pinned_to_deal_flag = null, $pinned_to_organization_flag = null, $pinned_to_person_flag = null, $pinned_to_project_flag = null, $pinned_to_task_flag = null) { - $request = $this->getNotesRequest($user_id, $lead_id, $deal_id, $person_id, $org_id, $project_id, $start, $limit, $sort, $start_date, $end_date, $updated_since, $pinned_to_lead_flag, $pinned_to_deal_flag, $pinned_to_organization_flag, $pinned_to_person_flag, $pinned_to_project_flag); + $request = $this->getNotesRequest($user_id, $lead_id, $deal_id, $person_id, $org_id, $project_id, $task_id, $start, $limit, $sort, $start_date, $end_date, $updated_since, $pinned_to_lead_flag, $pinned_to_deal_flag, $pinned_to_organization_flag, $pinned_to_person_flag, $pinned_to_project_flag, $pinned_to_task_flag); try { $options = $this->createHttpClientOption(); @@ -2333,7 +2337,7 @@ public function getNotesWithHttpInfo($user_id = null, $lead_id = null, $deal_id } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getNotesRequest($user_id, $lead_id, $deal_id, $person_id, $org_id, $project_id, $start, $limit, $sort, $start_date, $end_date, $updated_since, $pinned_to_lead_flag, $pinned_to_deal_flag, $pinned_to_organization_flag, $pinned_to_person_flag, $pinned_to_project_flag); + $request = $this->getNotesRequest($user_id, $lead_id, $deal_id, $person_id, $org_id, $project_id, $task_id, $start, $limit, $sort, $start_date, $end_date, $updated_since, $pinned_to_lead_flag, $pinned_to_deal_flag, $pinned_to_organization_flag, $pinned_to_person_flag, $pinned_to_project_flag, $pinned_to_task_flag); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -2423,6 +2427,7 @@ public function getNotesWithHttpInfo($user_id = null, $lead_id = null, $deal_id * @param int|null $person_id The ID of the person whose notes to fetch. If omitted, notes about all persons will be returned. (optional) * @param int|null $org_id The ID of the organization which notes to fetch. If omitted, notes about all organizations will be returned. (optional) * @param int|null $project_id The ID of the project which notes to fetch. If omitted, notes about all projects will be returned. (optional) + * @param int|null $task_id The ID of the task which notes to fetch. If omitted, notes about all tasks will be returned. (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). Supported fields: `id`, `user_id`, `deal_id`, `person_id`, `org_id`, `content`, `add_time`, `update_time`. (optional) @@ -2434,13 +2439,14 @@ public function getNotesWithHttpInfo($user_id = null, $lead_id = null, $deal_id * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $pinned_to_organization_flag If set, the results are filtered by note to organization pinning state (optional) * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $pinned_to_person_flag If set, the results are filtered by note to person pinning state (optional) * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $pinned_to_project_flag If set, the results are filtered by note to project pinning state (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $pinned_to_task_flag If set, the results are filtered by note to task pinning state (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getNotesAsync($user_id = null, $lead_id = null, $deal_id = null, $person_id = null, $org_id = null, $project_id = null, $start = 0, $limit = null, $sort = null, $start_date = null, $end_date = null, $updated_since = null, $pinned_to_lead_flag = null, $pinned_to_deal_flag = null, $pinned_to_organization_flag = null, $pinned_to_person_flag = null, $pinned_to_project_flag = null): PromiseInterface + public function getNotesAsync($user_id = null, $lead_id = null, $deal_id = null, $person_id = null, $org_id = null, $project_id = null, $task_id = null, $start = 0, $limit = null, $sort = null, $start_date = null, $end_date = null, $updated_since = null, $pinned_to_lead_flag = null, $pinned_to_deal_flag = null, $pinned_to_organization_flag = null, $pinned_to_person_flag = null, $pinned_to_project_flag = null, $pinned_to_task_flag = null): PromiseInterface { - return $this->getNotesAsyncWithHttpInfo($user_id, $lead_id, $deal_id, $person_id, $org_id, $project_id, $start, $limit, $sort, $start_date, $end_date, $updated_since, $pinned_to_lead_flag, $pinned_to_deal_flag, $pinned_to_organization_flag, $pinned_to_person_flag, $pinned_to_project_flag) + return $this->getNotesAsyncWithHttpInfo($user_id, $lead_id, $deal_id, $person_id, $org_id, $project_id, $task_id, $start, $limit, $sort, $start_date, $end_date, $updated_since, $pinned_to_lead_flag, $pinned_to_deal_flag, $pinned_to_organization_flag, $pinned_to_person_flag, $pinned_to_project_flag, $pinned_to_task_flag) ->then( function ($response) { return $response[0]; @@ -2459,6 +2465,7 @@ function ($response) { * @param int|null $person_id The ID of the person whose notes to fetch. If omitted, notes about all persons will be returned. (optional) * @param int|null $org_id The ID of the organization which notes to fetch. If omitted, notes about all organizations will be returned. (optional) * @param int|null $project_id The ID of the project which notes to fetch. If omitted, notes about all projects will be returned. (optional) + * @param int|null $task_id The ID of the task which notes to fetch. If omitted, notes about all tasks will be returned. (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). Supported fields: `id`, `user_id`, `deal_id`, `person_id`, `org_id`, `content`, `add_time`, `update_time`. (optional) @@ -2470,14 +2477,15 @@ function ($response) { * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $pinned_to_organization_flag If set, the results are filtered by note to organization pinning state (optional) * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $pinned_to_person_flag If set, the results are filtered by note to person pinning state (optional) * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $pinned_to_project_flag If set, the results are filtered by note to project pinning state (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $pinned_to_task_flag If set, the results are filtered by note to task pinning state (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getNotesAsyncWithHttpInfo($user_id = null, $lead_id = null, $deal_id = null, $person_id = null, $org_id = null, $project_id = null, $start = 0, $limit = null, $sort = null, $start_date = null, $end_date = null, $updated_since = null, $pinned_to_lead_flag = null, $pinned_to_deal_flag = null, $pinned_to_organization_flag = null, $pinned_to_person_flag = null, $pinned_to_project_flag = null): PromiseInterface + public function getNotesAsyncWithHttpInfo($user_id = null, $lead_id = null, $deal_id = null, $person_id = null, $org_id = null, $project_id = null, $task_id = null, $start = 0, $limit = null, $sort = null, $start_date = null, $end_date = null, $updated_since = null, $pinned_to_lead_flag = null, $pinned_to_deal_flag = null, $pinned_to_organization_flag = null, $pinned_to_person_flag = null, $pinned_to_project_flag = null, $pinned_to_task_flag = null): PromiseInterface { $returnType = '\Pipedrive\versions\v1\Model\GetNotes'; - $request = $this->getNotesRequest($user_id, $lead_id, $deal_id, $person_id, $org_id, $project_id, $start, $limit, $sort, $start_date, $end_date, $updated_since, $pinned_to_lead_flag, $pinned_to_deal_flag, $pinned_to_organization_flag, $pinned_to_person_flag, $pinned_to_project_flag); + $request = $this->getNotesRequest($user_id, $lead_id, $deal_id, $person_id, $org_id, $project_id, $task_id, $start, $limit, $sort, $start_date, $end_date, $updated_since, $pinned_to_lead_flag, $pinned_to_deal_flag, $pinned_to_organization_flag, $pinned_to_person_flag, $pinned_to_project_flag, $pinned_to_task_flag); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2522,6 +2530,7 @@ function ($exception) { * @param int|null $person_id The ID of the person whose notes to fetch. If omitted, notes about all persons will be returned. (optional) * @param int|null $org_id The ID of the organization which notes to fetch. If omitted, notes about all organizations will be returned. (optional) * @param int|null $project_id The ID of the project which notes to fetch. If omitted, notes about all projects will be returned. (optional) + * @param int|null $task_id The ID of the task which notes to fetch. If omitted, notes about all tasks will be returned. (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). Supported fields: `id`, `user_id`, `deal_id`, `person_id`, `org_id`, `content`, `add_time`, `update_time`. (optional) @@ -2533,11 +2542,12 @@ function ($exception) { * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $pinned_to_organization_flag If set, the results are filtered by note to organization pinning state (optional) * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $pinned_to_person_flag If set, the results are filtered by note to person pinning state (optional) * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $pinned_to_project_flag If set, the results are filtered by note to project pinning state (optional) + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $pinned_to_task_flag If set, the results are filtered by note to task pinning state (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function getNotesRequest($user_id = null, $lead_id = null, $deal_id = null, $person_id = null, $org_id = null, $project_id = null, $start = 0, $limit = null, $sort = null, $start_date = null, $end_date = null, $updated_since = null, $pinned_to_lead_flag = null, $pinned_to_deal_flag = null, $pinned_to_organization_flag = null, $pinned_to_person_flag = null, $pinned_to_project_flag = null): Request + public function getNotesRequest($user_id = null, $lead_id = null, $deal_id = null, $person_id = null, $org_id = null, $project_id = null, $task_id = null, $start = 0, $limit = null, $sort = null, $start_date = null, $end_date = null, $updated_since = null, $pinned_to_lead_flag = null, $pinned_to_deal_flag = null, $pinned_to_organization_flag = null, $pinned_to_person_flag = null, $pinned_to_project_flag = null, $pinned_to_task_flag = null): Request { $resourcePath = '/notes'; @@ -2597,6 +2607,14 @@ public function getNotesRequest($user_id = null, $lead_id = null, $deal_id = nul } // query params /* @phpstan-ignore-next-line */ + if (is_array($task_id)) { + $task_id = ObjectSerializer::serializeCollection($task_id, '', true); + } + if ($task_id !== null) { + $queryParams['task_id'] = $task_id; + } + // query params + /* @phpstan-ignore-next-line */ if (is_array($start)) { $start = ObjectSerializer::serializeCollection($start, '', true); } @@ -2683,6 +2701,14 @@ public function getNotesRequest($user_id = null, $lead_id = null, $deal_id = nul if ($pinned_to_project_flag !== null) { $queryParams['pinned_to_project_flag'] = $pinned_to_project_flag; } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($pinned_to_task_flag)) { + $pinned_to_task_flag = ObjectSerializer::serializeCollection($pinned_to_task_flag, '', true); + } + if ($pinned_to_task_flag !== null) { + $queryParams['pinned_to_task_flag'] = $pinned_to_task_flag; + } diff --git a/lib/versions/v1/Api/ProjectBoardsApi.php b/lib/versions/v1/Api/ProjectBoardsApi.php new file mode 100644 index 00000000..65c89a95 --- /dev/null +++ b/lib/versions/v1/Api/ProjectBoardsApi.php @@ -0,0 +1,715 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation getProjectsBoard + * + * Get details of a board + * + * @param int $id The ID of the project board (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v1\Model\GetProjectBoardResponse + */ + public function getProjectsBoard($id) + { + list($response) = $this->getProjectsBoardWithHttpInfo($id); + return $response; + } + + /** + * Operation getProjectsBoardWithHttpInfo + * + * Get details of a board + * + * @param int $id The ID of the project board (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v1\Model\GetProjectBoardResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getProjectsBoardWithHttpInfo($id) + { + $request = $this->getProjectsBoardRequest($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->getProjectsBoardRequest($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\GetProjectBoardResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetProjectBoardResponse', []), + $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\GetProjectBoardResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetProjectBoardResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v1\Model\GetProjectBoardResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getProjectsBoardAsync + * + * Get details of a board + * + * @param int $id The ID of the project board (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectsBoardAsync($id): PromiseInterface + { + return $this->getProjectsBoardAsyncWithHttpInfo($id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProjectsBoardAsyncWithHttpInfo + * + * Get details of a board + * + * @param int $id The ID of the project board (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectsBoardAsyncWithHttpInfo($id): PromiseInterface + { + $returnType = '\Pipedrive\versions\v1\Model\GetProjectBoardResponse'; + $request = $this->getProjectsBoardRequest($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 'getProjectsBoard' + * + * @param int $id The ID of the project board (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function getProjectsBoardRequest($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 getProjectsBoard' + ); + } + + $resourcePath = '/projects/boards/{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 getProjectsBoards + * + * Get all project boards + * + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v1\Model\GetProjectBoardsResponse + */ + public function getProjectsBoards() + { + list($response) = $this->getProjectsBoardsWithHttpInfo(); + return $response; + } + + /** + * Operation getProjectsBoardsWithHttpInfo + * + * Get all project boards + * + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v1\Model\GetProjectBoardsResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getProjectsBoardsWithHttpInfo() + { + $request = $this->getProjectsBoardsRequest(); + + 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->getProjectsBoardsRequest(); + $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\GetProjectBoardsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetProjectBoardsResponse', []), + $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\GetProjectBoardsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetProjectBoardsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v1\Model\GetProjectBoardsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getProjectsBoardsAsync + * + * Get all project boards + * + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectsBoardsAsync(): PromiseInterface + { + return $this->getProjectsBoardsAsyncWithHttpInfo() + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProjectsBoardsAsyncWithHttpInfo + * + * Get all project boards + * + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectsBoardsAsyncWithHttpInfo(): PromiseInterface + { + $returnType = '\Pipedrive\versions\v1\Model\GetProjectBoardsResponse'; + $request = $this->getProjectsBoardsRequest(); + + 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 'getProjectsBoards' + * + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function getProjectsBoardsRequest(): Request + { + + $resourcePath = '/projects/boards'; + $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'], + [] + ); + } + + // 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 + ); + } + + /** + * Create http client option + * + * @throws RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/versions/v1/Api/ProjectPhasesApi.php b/lib/versions/v1/Api/ProjectPhasesApi.php new file mode 100644 index 00000000..0c82644b --- /dev/null +++ b/lib/versions/v1/Api/ProjectPhasesApi.php @@ -0,0 +1,735 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation getProjectsPhase + * + * Get details of a phase + * + * @param int $id The ID of the project phase (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v1\Model\GetProjectPhaseResponse + */ + public function getProjectsPhase($id) + { + list($response) = $this->getProjectsPhaseWithHttpInfo($id); + return $response; + } + + /** + * Operation getProjectsPhaseWithHttpInfo + * + * Get details of a phase + * + * @param int $id The ID of the project phase (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v1\Model\GetProjectPhaseResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getProjectsPhaseWithHttpInfo($id) + { + $request = $this->getProjectsPhaseRequest($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->getProjectsPhaseRequest($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\GetProjectPhaseResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetProjectPhaseResponse', []), + $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\GetProjectPhaseResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetProjectPhaseResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v1\Model\GetProjectPhaseResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getProjectsPhaseAsync + * + * Get details of a phase + * + * @param int $id The ID of the project phase (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectsPhaseAsync($id): PromiseInterface + { + return $this->getProjectsPhaseAsyncWithHttpInfo($id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProjectsPhaseAsyncWithHttpInfo + * + * Get details of a phase + * + * @param int $id The ID of the project phase (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectsPhaseAsyncWithHttpInfo($id): PromiseInterface + { + $returnType = '\Pipedrive\versions\v1\Model\GetProjectPhaseResponse'; + $request = $this->getProjectsPhaseRequest($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 'getProjectsPhase' + * + * @param int $id The ID of the project phase (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function getProjectsPhaseRequest($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 getProjectsPhase' + ); + } + + $resourcePath = '/projects/phases/{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 getProjectsPhases + * + * Get project phases + * + * @param int $board_id ID of the board for which phases are requested (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v1\Model\GetProjectPhasesResponse + */ + public function getProjectsPhases($board_id) + { + list($response) = $this->getProjectsPhasesWithHttpInfo($board_id); + return $response; + } + + /** + * Operation getProjectsPhasesWithHttpInfo + * + * Get project phases + * + * @param int $board_id ID of the board for which phases are requested (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v1\Model\GetProjectPhasesResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getProjectsPhasesWithHttpInfo($board_id) + { + $request = $this->getProjectsPhasesRequest($board_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->getProjectsPhasesRequest($board_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\GetProjectPhasesResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetProjectPhasesResponse', []), + $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\GetProjectPhasesResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetProjectPhasesResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v1\Model\GetProjectPhasesResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getProjectsPhasesAsync + * + * Get project phases + * + * @param int $board_id ID of the board for which phases are requested (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectsPhasesAsync($board_id): PromiseInterface + { + return $this->getProjectsPhasesAsyncWithHttpInfo($board_id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProjectsPhasesAsyncWithHttpInfo + * + * Get project phases + * + * @param int $board_id ID of the board for which phases are requested (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectsPhasesAsyncWithHttpInfo($board_id): PromiseInterface + { + $returnType = '\Pipedrive\versions\v1\Model\GetProjectPhasesResponse'; + $request = $this->getProjectsPhasesRequest($board_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 'getProjectsPhases' + * + * @param int $board_id ID of the board for which phases are requested (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function getProjectsPhasesRequest($board_id): Request + { + // verify the required parameter 'board_id' is set + /* @phpstan-ignore-next-line */ + if ($board_id === null || (is_array($board_id) && count($board_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $board_id when calling getProjectsPhases' + ); + } + + $resourcePath = '/projects/phases'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + /* @phpstan-ignore-next-line */ + if (is_array($board_id)) { + $board_id = ObjectSerializer::serializeCollection($board_id, '', true); + } + if ($board_id !== null) { + $queryParams['board_id'] = $board_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 + ); + } + + /** + * Create http client option + * + * @throws RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/versions/v1/Api/ProjectTemplatesApi.php b/lib/versions/v1/Api/ProjectTemplatesApi.php index e0ee7fe9..d779745f 100644 --- a/lib/versions/v1/Api/ProjectTemplatesApi.php +++ b/lib/versions/v1/Api/ProjectTemplatesApi.php @@ -648,598 +648,6 @@ public function getProjectTemplatesRequest($cursor = null, $limit = null): Reque - /* @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 getProjectsBoard - * - * Get details of a board - * - * @param int $id The ID of the project board (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetProjectBoardResponse - */ - public function getProjectsBoard($id) - { - list($response) = $this->getProjectsBoardWithHttpInfo($id); - return $response; - } - - /** - * Operation getProjectsBoardWithHttpInfo - * - * Get details of a board - * - * @param int $id The ID of the project board (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetProjectBoardResponse, HTTP status code, HTTP response headers (array of strings) - */ - public function getProjectsBoardWithHttpInfo($id) - { - $request = $this->getProjectsBoardRequest($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->getProjectsBoardRequest($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\GetProjectBoardResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetProjectBoardResponse', []), - $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\GetProjectBoardResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetProjectBoardResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetProjectBoardResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getProjectsBoardAsync - * - * Get details of a board - * - * @param int $id The ID of the project board (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getProjectsBoardAsync($id): PromiseInterface - { - return $this->getProjectsBoardAsyncWithHttpInfo($id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getProjectsBoardAsyncWithHttpInfo - * - * Get details of a board - * - * @param int $id The ID of the project board (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getProjectsBoardAsyncWithHttpInfo($id): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\GetProjectBoardResponse'; - $request = $this->getProjectsBoardRequest($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 'getProjectsBoard' - * - * @param int $id The ID of the project board (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function getProjectsBoardRequest($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 getProjectsBoard' - ); - } - - $resourcePath = '/projects/boards/{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 getProjectsPhase - * - * Get details of a phase - * - * @param int $id The ID of the project phase (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetProjectPhaseResponse - */ - public function getProjectsPhase($id) - { - list($response) = $this->getProjectsPhaseWithHttpInfo($id); - return $response; - } - - /** - * Operation getProjectsPhaseWithHttpInfo - * - * Get details of a phase - * - * @param int $id The ID of the project phase (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetProjectPhaseResponse, HTTP status code, HTTP response headers (array of strings) - */ - public function getProjectsPhaseWithHttpInfo($id) - { - $request = $this->getProjectsPhaseRequest($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->getProjectsPhaseRequest($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\GetProjectPhaseResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetProjectPhaseResponse', []), - $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\GetProjectPhaseResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetProjectPhaseResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetProjectPhaseResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getProjectsPhaseAsync - * - * Get details of a phase - * - * @param int $id The ID of the project phase (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getProjectsPhaseAsync($id): PromiseInterface - { - return $this->getProjectsPhaseAsyncWithHttpInfo($id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getProjectsPhaseAsyncWithHttpInfo - * - * Get details of a phase - * - * @param int $id The ID of the project phase (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getProjectsPhaseAsyncWithHttpInfo($id): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\GetProjectPhaseResponse'; - $request = $this->getProjectsPhaseRequest($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 'getProjectsPhase' - * - * @param int $id The ID of the project phase (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function getProjectsPhaseRequest($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 getProjectsPhase' - ); - } - - $resourcePath = '/projects/phases/{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( diff --git a/lib/versions/v1/Api/ProjectsApi.php b/lib/versions/v1/Api/ProjectsApi.php index 18da14c2..f43d2bcd 100644 --- a/lib/versions/v1/Api/ProjectsApi.php +++ b/lib/versions/v1/Api/ProjectsApi.php @@ -2763,578 +2763,6 @@ public function getProjectsRequest($cursor = null, $limit = null, $filter_id = n - /* @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 getProjectsBoards - * - * Get all project boards - * - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetProjectBoardsResponse - */ - public function getProjectsBoards() - { - list($response) = $this->getProjectsBoardsWithHttpInfo(); - return $response; - } - - /** - * Operation getProjectsBoardsWithHttpInfo - * - * Get all project boards - * - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetProjectBoardsResponse, HTTP status code, HTTP response headers (array of strings) - */ - public function getProjectsBoardsWithHttpInfo() - { - $request = $this->getProjectsBoardsRequest(); - - 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->getProjectsBoardsRequest(); - $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\GetProjectBoardsResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetProjectBoardsResponse', []), - $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\GetProjectBoardsResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetProjectBoardsResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetProjectBoardsResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getProjectsBoardsAsync - * - * Get all project boards - * - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getProjectsBoardsAsync(): PromiseInterface - { - return $this->getProjectsBoardsAsyncWithHttpInfo() - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getProjectsBoardsAsyncWithHttpInfo - * - * Get all project boards - * - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getProjectsBoardsAsyncWithHttpInfo(): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\GetProjectBoardsResponse'; - $request = $this->getProjectsBoardsRequest(); - - 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 'getProjectsBoards' - * - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function getProjectsBoardsRequest(): Request - { - - $resourcePath = '/projects/boards'; - $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'], - [] - ); - } - - // 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 getProjectsPhases - * - * Get project phases - * - * @param int $board_id ID of the board for which phases are requested (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v1\Model\GetProjectPhasesResponse - */ - public function getProjectsPhases($board_id) - { - list($response) = $this->getProjectsPhasesWithHttpInfo($board_id); - return $response; - } - - /** - * Operation getProjectsPhasesWithHttpInfo - * - * Get project phases - * - * @param int $board_id ID of the board for which phases are requested (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v1\Model\GetProjectPhasesResponse, HTTP status code, HTTP response headers (array of strings) - */ - public function getProjectsPhasesWithHttpInfo($board_id) - { - $request = $this->getProjectsPhasesRequest($board_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->getProjectsPhasesRequest($board_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\GetProjectPhasesResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetProjectPhasesResponse', []), - $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\GetProjectPhasesResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v1\Model\GetProjectPhasesResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v1\Model\GetProjectPhasesResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getProjectsPhasesAsync - * - * Get project phases - * - * @param int $board_id ID of the board for which phases are requested (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getProjectsPhasesAsync($board_id): PromiseInterface - { - return $this->getProjectsPhasesAsyncWithHttpInfo($board_id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getProjectsPhasesAsyncWithHttpInfo - * - * Get project phases - * - * @param int $board_id ID of the board for which phases are requested (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getProjectsPhasesAsyncWithHttpInfo($board_id): PromiseInterface - { - $returnType = '\Pipedrive\versions\v1\Model\GetProjectPhasesResponse'; - $request = $this->getProjectsPhasesRequest($board_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 'getProjectsPhases' - * - * @param int $board_id ID of the board for which phases are requested (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function getProjectsPhasesRequest($board_id): Request - { - // verify the required parameter 'board_id' is set - /* @phpstan-ignore-next-line */ - if ($board_id === null || (is_array($board_id) && count($board_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $board_id when calling getProjectsPhases' - ); - } - - $resourcePath = '/projects/phases'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - /* @phpstan-ignore-next-line */ - if (is_array($board_id)) { - $board_id = ObjectSerializer::serializeCollection($board_id, '', true); - } - if ($board_id !== null) { - $queryParams['board_id'] = $board_id; - } - - - - /* @phpstan-ignore-next-line */ if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( diff --git a/lib/versions/v1/Model/AddNoteRequest.php b/lib/versions/v1/Model/AddNoteRequest.php index f917e997..26977919 100644 --- a/lib/versions/v1/Model/AddNoteRequest.php +++ b/lib/versions/v1/Model/AddNoteRequest.php @@ -72,13 +72,15 @@ class AddNoteRequest implements ModelInterface, ArrayAccess, JsonSerializable 'person_id' => 'int', 'org_id' => 'int', 'project_id' => 'int', + 'task_id' => 'int', 'user_id' => 'int', 'add_time' => 'string', 'pinned_to_lead_flag' => '\Pipedrive\versions\v1\Model\NumberBoolean', 'pinned_to_deal_flag' => '\Pipedrive\versions\v1\Model\NumberBoolean', 'pinned_to_organization_flag' => '\Pipedrive\versions\v1\Model\NumberBoolean', 'pinned_to_person_flag' => '\Pipedrive\versions\v1\Model\NumberBoolean', - 'pinned_to_project_flag' => '\Pipedrive\versions\v1\Model\NumberBoolean' + 'pinned_to_project_flag' => '\Pipedrive\versions\v1\Model\NumberBoolean', + 'pinned_to_task_flag' => '\Pipedrive\versions\v1\Model\NumberBoolean' ]; /** @@ -95,13 +97,15 @@ class AddNoteRequest implements ModelInterface, ArrayAccess, JsonSerializable 'person_id' => null, 'org_id' => null, 'project_id' => null, + 'task_id' => null, 'user_id' => null, 'add_time' => null, 'pinned_to_lead_flag' => null, 'pinned_to_deal_flag' => null, 'pinned_to_organization_flag' => null, 'pinned_to_person_flag' => null, - 'pinned_to_project_flag' => null + 'pinned_to_project_flag' => null, + 'pinned_to_task_flag' => null ]; /** @@ -141,13 +145,15 @@ public static function openAPIFormats(): array 'person_id' => 'person_id', 'org_id' => 'org_id', 'project_id' => 'project_id', + 'task_id' => 'task_id', 'user_id' => 'user_id', 'add_time' => 'add_time', 'pinned_to_lead_flag' => 'pinned_to_lead_flag', 'pinned_to_deal_flag' => 'pinned_to_deal_flag', 'pinned_to_organization_flag' => 'pinned_to_organization_flag', 'pinned_to_person_flag' => 'pinned_to_person_flag', - 'pinned_to_project_flag' => 'pinned_to_project_flag' + 'pinned_to_project_flag' => 'pinned_to_project_flag', + 'pinned_to_task_flag' => 'pinned_to_task_flag' ]; /** @@ -162,13 +168,15 @@ public static function openAPIFormats(): array 'person_id' => 'setPersonId', 'org_id' => 'setOrgId', 'project_id' => 'setProjectId', + 'task_id' => 'setTaskId', 'user_id' => 'setUserId', 'add_time' => 'setAddTime', 'pinned_to_lead_flag' => 'setPinnedToLeadFlag', 'pinned_to_deal_flag' => 'setPinnedToDealFlag', 'pinned_to_organization_flag' => 'setPinnedToOrganizationFlag', 'pinned_to_person_flag' => 'setPinnedToPersonFlag', - 'pinned_to_project_flag' => 'setPinnedToProjectFlag' + 'pinned_to_project_flag' => 'setPinnedToProjectFlag', + 'pinned_to_task_flag' => 'setPinnedToTaskFlag' ]; /** @@ -183,13 +191,15 @@ public static function openAPIFormats(): array 'person_id' => 'getPersonId', 'org_id' => 'getOrgId', 'project_id' => 'getProjectId', + 'task_id' => 'getTaskId', 'user_id' => 'getUserId', 'add_time' => 'getAddTime', 'pinned_to_lead_flag' => 'getPinnedToLeadFlag', 'pinned_to_deal_flag' => 'getPinnedToDealFlag', 'pinned_to_organization_flag' => 'getPinnedToOrganizationFlag', 'pinned_to_person_flag' => 'getPinnedToPersonFlag', - 'pinned_to_project_flag' => 'getPinnedToProjectFlag' + 'pinned_to_project_flag' => 'getPinnedToProjectFlag', + 'pinned_to_task_flag' => 'getPinnedToTaskFlag' ]; /** @@ -265,6 +275,7 @@ public function __construct(array $data = null) $this->container['person_id'] = $data['person_id'] ?? null; $this->container['org_id'] = $data['org_id'] ?? null; $this->container['project_id'] = $data['project_id'] ?? null; + $this->container['task_id'] = $data['task_id'] ?? null; $this->container['user_id'] = $data['user_id'] ?? null; $this->container['add_time'] = $data['add_time'] ?? null; $this->container['pinned_to_lead_flag'] = $data['pinned_to_lead_flag'] ?? null; @@ -272,6 +283,7 @@ public function __construct(array $data = null) $this->container['pinned_to_organization_flag'] = $data['pinned_to_organization_flag'] ?? null; $this->container['pinned_to_person_flag'] = $data['pinned_to_person_flag'] ?? null; $this->container['pinned_to_project_flag'] = $data['pinned_to_project_flag'] ?? null; + $this->container['pinned_to_task_flag'] = $data['pinned_to_task_flag'] ?? null; } /** @@ -340,7 +352,7 @@ public function getLeadId() /** * Sets lead_id * - * @param string|null $lead_id The ID of the lead the note will be attached to. This property is required unless one of (`deal_id/person_id/org_id/project_id`) is specified. + * @param string|null $lead_id The ID of the lead the note will be attached to. This property is required unless one of (`deal_id/person_id/org_id/project_id/task_id`) is specified. * * @return self */ @@ -364,7 +376,7 @@ public function getDealId() /** * Sets deal_id * - * @param int|null $deal_id The ID of the deal the note will be attached to. This property is required unless one of (`lead_id/person_id/org_id/project_id`) is specified. + * @param int|null $deal_id The ID of the deal the note will be attached to. This property is required unless one of (`lead_id/person_id/org_id/project_id/task_id`) is specified. * * @return self */ @@ -388,7 +400,7 @@ public function getPersonId() /** * Sets person_id * - * @param int|null $person_id The ID of the person this note will be attached to. This property is required unless one of (`deal_id/lead_id/org_id/project_id`) is specified. + * @param int|null $person_id The ID of the person this note will be attached to. This property is required unless one of (`deal_id/lead_id/org_id/project_id/task_id`) is specified. * * @return self */ @@ -412,7 +424,7 @@ public function getOrgId() /** * Sets org_id * - * @param int|null $org_id The ID of the organization this note will be attached to. This property is required unless one of (`deal_id/lead_id/person_id/project_id`) is specified. + * @param int|null $org_id The ID of the organization this note will be attached to. This property is required unless one of (`deal_id/lead_id/person_id/project_id/task_id`) is specified. * * @return self */ @@ -436,7 +448,7 @@ public function getProjectId() /** * Sets project_id * - * @param int|null $project_id The ID of the project the note will be attached to. This property is required unless one of (`deal_id/lead_id/person_id/org_id`) is specified. + * @param int|null $project_id The ID of the project the note will be attached to. This property is required unless one of (`deal_id/lead_id/person_id/org_id/task_id`) is specified. * * @return self */ @@ -447,6 +459,30 @@ public function setProjectId($project_id): self return $this; } + /** + * Gets task_id + * + * @return int|null + */ + public function getTaskId() + { + return $this->container['task_id']; + } + + /** + * Sets task_id + * + * @param int|null $task_id The ID of the task the note will be attached to. This property is required unless one of (`deal_id/lead_id/person_id/org_id/project_id`) is specified. + * + * @return self + */ + public function setTaskId($task_id): self + { + $this->container['task_id'] = $task_id; + + return $this; + } + /** * Gets user_id * @@ -614,6 +650,30 @@ public function setPinnedToProjectFlag($pinned_to_project_flag): self return $this; } + + /** + * Gets pinned_to_task_flag + * + * @return \Pipedrive\versions\v1\Model\NumberBoolean|null + */ + public function getPinnedToTaskFlag() + { + return $this->container['pinned_to_task_flag']; + } + + /** + * Sets pinned_to_task_flag + * + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $pinned_to_task_flag If set, the results are filtered by note to task pinning state (`task_id` is also required) + * + * @return self + */ + public function setPinnedToTaskFlag($pinned_to_task_flag): self + { + $this->container['pinned_to_task_flag'] = $pinned_to_task_flag; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/lib/versions/v1/Model/AddNoteRequestAllOf.php b/lib/versions/v1/Model/AddNoteRequestAllOf.php index c1f591f5..5209c3ef 100644 --- a/lib/versions/v1/Model/AddNoteRequestAllOf.php +++ b/lib/versions/v1/Model/AddNoteRequestAllOf.php @@ -71,7 +71,8 @@ class AddNoteRequestAllOf implements ModelInterface, ArrayAccess, JsonSerializab 'deal_id' => 'int', 'person_id' => 'int', 'org_id' => 'int', - 'project_id' => 'int' + 'project_id' => 'int', + 'task_id' => 'int' ]; /** @@ -87,7 +88,8 @@ class AddNoteRequestAllOf implements ModelInterface, ArrayAccess, JsonSerializab 'deal_id' => null, 'person_id' => null, 'org_id' => null, - 'project_id' => null + 'project_id' => null, + 'task_id' => null ]; /** @@ -126,7 +128,8 @@ public static function openAPIFormats(): array 'deal_id' => 'deal_id', 'person_id' => 'person_id', 'org_id' => 'org_id', - 'project_id' => 'project_id' + 'project_id' => 'project_id', + 'task_id' => 'task_id' ]; /** @@ -140,7 +143,8 @@ public static function openAPIFormats(): array 'deal_id' => 'setDealId', 'person_id' => 'setPersonId', 'org_id' => 'setOrgId', - 'project_id' => 'setProjectId' + 'project_id' => 'setProjectId', + 'task_id' => 'setTaskId' ]; /** @@ -154,7 +158,8 @@ public static function openAPIFormats(): array 'deal_id' => 'getDealId', 'person_id' => 'getPersonId', 'org_id' => 'getOrgId', - 'project_id' => 'getProjectId' + 'project_id' => 'getProjectId', + 'task_id' => 'getTaskId' ]; /** @@ -230,6 +235,7 @@ public function __construct(array $data = null) $this->container['person_id'] = $data['person_id'] ?? null; $this->container['org_id'] = $data['org_id'] ?? null; $this->container['project_id'] = $data['project_id'] ?? null; + $this->container['task_id'] = $data['task_id'] ?? null; } /** @@ -298,7 +304,7 @@ public function getLeadId() /** * Sets lead_id * - * @param string|null $lead_id The ID of the lead the note will be attached to. This property is required unless one of (`deal_id/person_id/org_id/project_id`) is specified. + * @param string|null $lead_id The ID of the lead the note will be attached to. This property is required unless one of (`deal_id/person_id/org_id/project_id/task_id`) is specified. * * @return self */ @@ -322,7 +328,7 @@ public function getDealId() /** * Sets deal_id * - * @param int|null $deal_id The ID of the deal the note will be attached to. This property is required unless one of (`lead_id/person_id/org_id/project_id`) is specified. + * @param int|null $deal_id The ID of the deal the note will be attached to. This property is required unless one of (`lead_id/person_id/org_id/project_id/task_id`) is specified. * * @return self */ @@ -346,7 +352,7 @@ public function getPersonId() /** * Sets person_id * - * @param int|null $person_id The ID of the person this note will be attached to. This property is required unless one of (`deal_id/lead_id/org_id/project_id`) is specified. + * @param int|null $person_id The ID of the person this note will be attached to. This property is required unless one of (`deal_id/lead_id/org_id/project_id/task_id`) is specified. * * @return self */ @@ -370,7 +376,7 @@ public function getOrgId() /** * Sets org_id * - * @param int|null $org_id The ID of the organization this note will be attached to. This property is required unless one of (`deal_id/lead_id/person_id/project_id`) is specified. + * @param int|null $org_id The ID of the organization this note will be attached to. This property is required unless one of (`deal_id/lead_id/person_id/project_id/task_id`) is specified. * * @return self */ @@ -394,7 +400,7 @@ public function getProjectId() /** * Sets project_id * - * @param int|null $project_id The ID of the project the note will be attached to. This property is required unless one of (`deal_id/lead_id/person_id/org_id`) is specified. + * @param int|null $project_id The ID of the project the note will be attached to. This property is required unless one of (`deal_id/lead_id/person_id/org_id/task_id`) is specified. * * @return self */ @@ -404,6 +410,30 @@ public function setProjectId($project_id): self return $this; } + + /** + * Gets task_id + * + * @return int|null + */ + public function getTaskId() + { + return $this->container['task_id']; + } + + /** + * Sets task_id + * + * @param int|null $task_id The ID of the task the note will be attached to. This property is required unless one of (`deal_id/lead_id/person_id/org_id/project_id`) is specified. + * + * @return self + */ + public function setTaskId($task_id): self + { + $this->container['task_id'] = $task_id; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/lib/versions/v1/Model/BaseNote.php b/lib/versions/v1/Model/BaseNote.php index a5267d92..fd72f509 100644 --- a/lib/versions/v1/Model/BaseNote.php +++ b/lib/versions/v1/Model/BaseNote.php @@ -80,10 +80,13 @@ class BaseNote implements ModelInterface, ArrayAccess, JsonSerializable 'person_id' => 'int', 'project_id' => 'int', 'project' => '\Pipedrive\versions\v1\Model\BaseNoteProject', + 'task_id' => 'int', + 'task' => '\Pipedrive\versions\v1\Model\BaseNoteTask', 'pinned_to_deal_flag' => 'bool', 'pinned_to_organization_flag' => 'bool', 'pinned_to_person_flag' => 'bool', 'pinned_to_project_flag' => 'bool', + 'pinned_to_task_flag' => 'bool', 'update_time' => 'string', 'user' => '\Pipedrive\versions\v1\Model\NoteCreatorUser', 'user_id' => 'int' @@ -111,10 +114,13 @@ class BaseNote implements ModelInterface, ArrayAccess, JsonSerializable 'person_id' => null, 'project_id' => null, 'project' => null, + 'task_id' => null, + 'task' => null, 'pinned_to_deal_flag' => null, 'pinned_to_organization_flag' => null, 'pinned_to_person_flag' => null, 'pinned_to_project_flag' => null, + 'pinned_to_task_flag' => null, 'update_time' => null, 'user' => null, 'user_id' => null @@ -165,10 +171,13 @@ public static function openAPIFormats(): array 'person_id' => 'person_id', 'project_id' => 'project_id', 'project' => 'project', + 'task_id' => 'task_id', + 'task' => 'task', 'pinned_to_deal_flag' => 'pinned_to_deal_flag', 'pinned_to_organization_flag' => 'pinned_to_organization_flag', 'pinned_to_person_flag' => 'pinned_to_person_flag', 'pinned_to_project_flag' => 'pinned_to_project_flag', + 'pinned_to_task_flag' => 'pinned_to_task_flag', 'update_time' => 'update_time', 'user' => 'user', 'user_id' => 'user_id' @@ -194,10 +203,13 @@ public static function openAPIFormats(): array 'person_id' => 'setPersonId', 'project_id' => 'setProjectId', 'project' => 'setProject', + 'task_id' => 'setTaskId', + 'task' => 'setTask', 'pinned_to_deal_flag' => 'setPinnedToDealFlag', 'pinned_to_organization_flag' => 'setPinnedToOrganizationFlag', 'pinned_to_person_flag' => 'setPinnedToPersonFlag', 'pinned_to_project_flag' => 'setPinnedToProjectFlag', + 'pinned_to_task_flag' => 'setPinnedToTaskFlag', 'update_time' => 'setUpdateTime', 'user' => 'setUser', 'user_id' => 'setUserId' @@ -223,10 +235,13 @@ public static function openAPIFormats(): array 'person_id' => 'getPersonId', 'project_id' => 'getProjectId', 'project' => 'getProject', + 'task_id' => 'getTaskId', + 'task' => 'getTask', 'pinned_to_deal_flag' => 'getPinnedToDealFlag', 'pinned_to_organization_flag' => 'getPinnedToOrganizationFlag', 'pinned_to_person_flag' => 'getPinnedToPersonFlag', 'pinned_to_project_flag' => 'getPinnedToProjectFlag', + 'pinned_to_task_flag' => 'getPinnedToTaskFlag', 'update_time' => 'getUpdateTime', 'user' => 'getUser', 'user_id' => 'getUserId' @@ -313,10 +328,13 @@ public function __construct(array $data = null) $this->container['person_id'] = $data['person_id'] ?? null; $this->container['project_id'] = $data['project_id'] ?? null; $this->container['project'] = $data['project'] ?? null; + $this->container['task_id'] = $data['task_id'] ?? null; + $this->container['task'] = $data['task'] ?? null; $this->container['pinned_to_deal_flag'] = $data['pinned_to_deal_flag'] ?? null; $this->container['pinned_to_organization_flag'] = $data['pinned_to_organization_flag'] ?? null; $this->container['pinned_to_person_flag'] = $data['pinned_to_person_flag'] ?? null; $this->container['pinned_to_project_flag'] = $data['pinned_to_project_flag'] ?? null; + $this->container['pinned_to_task_flag'] = $data['pinned_to_task_flag'] ?? null; $this->container['update_time'] = $data['update_time'] ?? null; $this->container['user'] = $data['user'] ?? null; $this->container['user_id'] = $data['user_id'] ?? null; @@ -684,6 +702,54 @@ public function setProject($project): self return $this; } + /** + * Gets task_id + * + * @return int|null + */ + public function getTaskId() + { + return $this->container['task_id']; + } + + /** + * Sets task_id + * + * @param int|null $task_id The ID of the task the note is attached to + * + * @return self + */ + public function setTaskId($task_id): self + { + $this->container['task_id'] = $task_id; + + return $this; + } + + /** + * Gets task + * + * @return \Pipedrive\versions\v1\Model\BaseNoteTask|null + */ + public function getTask() + { + return $this->container['task']; + } + + /** + * Sets task + * + * @param \Pipedrive\versions\v1\Model\BaseNoteTask|null $task task + * + * @return self + */ + public function setTask($task): self + { + $this->container['task'] = $task; + + return $this; + } + /** * Gets pinned_to_deal_flag * @@ -780,6 +846,30 @@ public function setPinnedToProjectFlag($pinned_to_project_flag): self return $this; } + /** + * Gets pinned_to_task_flag + * + * @return bool|null + */ + public function getPinnedToTaskFlag() + { + return $this->container['pinned_to_task_flag']; + } + + /** + * Sets pinned_to_task_flag + * + * @param bool|null $pinned_to_task_flag If true, the results are filtered by note to task pinning state + * + * @return self + */ + public function setPinnedToTaskFlag($pinned_to_task_flag): self + { + $this->container['pinned_to_task_flag'] = $pinned_to_task_flag; + + return $this; + } + /** * Gets update_time * diff --git a/lib/versions/v1/Model/BaseNoteTask.php b/lib/versions/v1/Model/BaseNoteTask.php new file mode 100644 index 00000000..cf8242c1 --- /dev/null +++ b/lib/versions/v1/Model/BaseNoteTask.php @@ -0,0 +1,346 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class BaseNoteTask implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'BaseNote_task'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'title' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'title' => 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 = [ + 'title' => 'title' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'title' => 'setTitle' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'title' => 'getTitle' + ]; + + /** + * 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['title'] = $data['title'] ?? 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 title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the task the note is attached to + * + * @return self + */ + public function setTitle($title): self + { + $this->container['title'] = $title; + + 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/Note.php b/lib/versions/v1/Model/Note.php index 4e13c11e..cf335e6c 100644 --- a/lib/versions/v1/Model/Note.php +++ b/lib/versions/v1/Model/Note.php @@ -72,13 +72,15 @@ class Note implements ModelInterface, ArrayAccess, JsonSerializable 'person_id' => 'int', 'org_id' => 'int', 'project_id' => 'int', + 'task_id' => 'int', 'user_id' => 'int', 'add_time' => 'string', 'pinned_to_lead_flag' => '\Pipedrive\versions\v1\Model\NumberBoolean', 'pinned_to_deal_flag' => '\Pipedrive\versions\v1\Model\NumberBoolean', 'pinned_to_organization_flag' => '\Pipedrive\versions\v1\Model\NumberBoolean', 'pinned_to_person_flag' => '\Pipedrive\versions\v1\Model\NumberBoolean', - 'pinned_to_project_flag' => '\Pipedrive\versions\v1\Model\NumberBoolean' + 'pinned_to_project_flag' => '\Pipedrive\versions\v1\Model\NumberBoolean', + 'pinned_to_task_flag' => '\Pipedrive\versions\v1\Model\NumberBoolean' ]; /** @@ -95,13 +97,15 @@ class Note implements ModelInterface, ArrayAccess, JsonSerializable 'person_id' => null, 'org_id' => null, 'project_id' => null, + 'task_id' => null, 'user_id' => null, 'add_time' => null, 'pinned_to_lead_flag' => null, 'pinned_to_deal_flag' => null, 'pinned_to_organization_flag' => null, 'pinned_to_person_flag' => null, - 'pinned_to_project_flag' => null + 'pinned_to_project_flag' => null, + 'pinned_to_task_flag' => null ]; /** @@ -141,13 +145,15 @@ public static function openAPIFormats(): array 'person_id' => 'person_id', 'org_id' => 'org_id', 'project_id' => 'project_id', + 'task_id' => 'task_id', 'user_id' => 'user_id', 'add_time' => 'add_time', 'pinned_to_lead_flag' => 'pinned_to_lead_flag', 'pinned_to_deal_flag' => 'pinned_to_deal_flag', 'pinned_to_organization_flag' => 'pinned_to_organization_flag', 'pinned_to_person_flag' => 'pinned_to_person_flag', - 'pinned_to_project_flag' => 'pinned_to_project_flag' + 'pinned_to_project_flag' => 'pinned_to_project_flag', + 'pinned_to_task_flag' => 'pinned_to_task_flag' ]; /** @@ -162,13 +168,15 @@ public static function openAPIFormats(): array 'person_id' => 'setPersonId', 'org_id' => 'setOrgId', 'project_id' => 'setProjectId', + 'task_id' => 'setTaskId', 'user_id' => 'setUserId', 'add_time' => 'setAddTime', 'pinned_to_lead_flag' => 'setPinnedToLeadFlag', 'pinned_to_deal_flag' => 'setPinnedToDealFlag', 'pinned_to_organization_flag' => 'setPinnedToOrganizationFlag', 'pinned_to_person_flag' => 'setPinnedToPersonFlag', - 'pinned_to_project_flag' => 'setPinnedToProjectFlag' + 'pinned_to_project_flag' => 'setPinnedToProjectFlag', + 'pinned_to_task_flag' => 'setPinnedToTaskFlag' ]; /** @@ -183,13 +191,15 @@ public static function openAPIFormats(): array 'person_id' => 'getPersonId', 'org_id' => 'getOrgId', 'project_id' => 'getProjectId', + 'task_id' => 'getTaskId', 'user_id' => 'getUserId', 'add_time' => 'getAddTime', 'pinned_to_lead_flag' => 'getPinnedToLeadFlag', 'pinned_to_deal_flag' => 'getPinnedToDealFlag', 'pinned_to_organization_flag' => 'getPinnedToOrganizationFlag', 'pinned_to_person_flag' => 'getPinnedToPersonFlag', - 'pinned_to_project_flag' => 'getPinnedToProjectFlag' + 'pinned_to_project_flag' => 'getPinnedToProjectFlag', + 'pinned_to_task_flag' => 'getPinnedToTaskFlag' ]; /** @@ -265,6 +275,7 @@ public function __construct(array $data = null) $this->container['person_id'] = $data['person_id'] ?? null; $this->container['org_id'] = $data['org_id'] ?? null; $this->container['project_id'] = $data['project_id'] ?? null; + $this->container['task_id'] = $data['task_id'] ?? null; $this->container['user_id'] = $data['user_id'] ?? null; $this->container['add_time'] = $data['add_time'] ?? null; $this->container['pinned_to_lead_flag'] = $data['pinned_to_lead_flag'] ?? null; @@ -272,6 +283,7 @@ public function __construct(array $data = null) $this->container['pinned_to_organization_flag'] = $data['pinned_to_organization_flag'] ?? null; $this->container['pinned_to_person_flag'] = $data['pinned_to_person_flag'] ?? null; $this->container['pinned_to_project_flag'] = $data['pinned_to_project_flag'] ?? null; + $this->container['pinned_to_task_flag'] = $data['pinned_to_task_flag'] ?? null; } /** @@ -444,6 +456,30 @@ public function setProjectId($project_id): self return $this; } + /** + * Gets task_id + * + * @return int|null + */ + public function getTaskId() + { + return $this->container['task_id']; + } + + /** + * Sets task_id + * + * @param int|null $task_id The ID of the task the note will be attached to + * + * @return self + */ + public function setTaskId($task_id): self + { + $this->container['task_id'] = $task_id; + + return $this; + } + /** * Gets user_id * @@ -611,6 +647,30 @@ public function setPinnedToProjectFlag($pinned_to_project_flag): self return $this; } + + /** + * Gets pinned_to_task_flag + * + * @return \Pipedrive\versions\v1\Model\NumberBoolean|null + */ + public function getPinnedToTaskFlag() + { + return $this->container['pinned_to_task_flag']; + } + + /** + * Sets pinned_to_task_flag + * + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $pinned_to_task_flag If set, the results are filtered by note to task pinning state (`task_id` is also required) + * + * @return self + */ + public function setPinnedToTaskFlag($pinned_to_task_flag): self + { + $this->container['pinned_to_task_flag'] = $pinned_to_task_flag; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/lib/versions/v1/Model/NoteConnectToParams.php b/lib/versions/v1/Model/NoteConnectToParams.php index 5becc541..5ae8cfc7 100644 --- a/lib/versions/v1/Model/NoteConnectToParams.php +++ b/lib/versions/v1/Model/NoteConnectToParams.php @@ -70,7 +70,8 @@ class NoteConnectToParams implements ModelInterface, ArrayAccess, JsonSerializab 'deal_id' => 'int', 'person_id' => 'int', 'org_id' => 'int', - 'project_id' => 'int' + 'project_id' => 'int', + 'task_id' => 'int' ]; /** @@ -85,7 +86,8 @@ class NoteConnectToParams implements ModelInterface, ArrayAccess, JsonSerializab 'deal_id' => null, 'person_id' => null, 'org_id' => null, - 'project_id' => null + 'project_id' => null, + 'task_id' => null ]; /** @@ -123,7 +125,8 @@ public static function openAPIFormats(): array 'deal_id' => 'deal_id', 'person_id' => 'person_id', 'org_id' => 'org_id', - 'project_id' => 'project_id' + 'project_id' => 'project_id', + 'task_id' => 'task_id' ]; /** @@ -136,7 +139,8 @@ public static function openAPIFormats(): array 'deal_id' => 'setDealId', 'person_id' => 'setPersonId', 'org_id' => 'setOrgId', - 'project_id' => 'setProjectId' + 'project_id' => 'setProjectId', + 'task_id' => 'setTaskId' ]; /** @@ -149,7 +153,8 @@ public static function openAPIFormats(): array 'deal_id' => 'getDealId', 'person_id' => 'getPersonId', 'org_id' => 'getOrgId', - 'project_id' => 'getProjectId' + 'project_id' => 'getProjectId', + 'task_id' => 'getTaskId' ]; /** @@ -224,6 +229,7 @@ public function __construct(array $data = null) $this->container['person_id'] = $data['person_id'] ?? null; $this->container['org_id'] = $data['org_id'] ?? null; $this->container['project_id'] = $data['project_id'] ?? null; + $this->container['task_id'] = $data['task_id'] ?? null; } /** @@ -371,6 +377,30 @@ public function setProjectId($project_id): self return $this; } + + /** + * Gets task_id + * + * @return int|null + */ + public function getTaskId() + { + return $this->container['task_id']; + } + + /** + * Sets task_id + * + * @param int|null $task_id The ID of the task the note will be attached to + * + * @return self + */ + public function setTaskId($task_id): self + { + $this->container['task_id'] = $task_id; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/lib/versions/v1/Model/NoteParams.php b/lib/versions/v1/Model/NoteParams.php index 928b5bea..87c2128f 100644 --- a/lib/versions/v1/Model/NoteParams.php +++ b/lib/versions/v1/Model/NoteParams.php @@ -72,7 +72,8 @@ class NoteParams implements ModelInterface, ArrayAccess, JsonSerializable 'pinned_to_deal_flag' => '\Pipedrive\versions\v1\Model\NumberBoolean', 'pinned_to_organization_flag' => '\Pipedrive\versions\v1\Model\NumberBoolean', 'pinned_to_person_flag' => '\Pipedrive\versions\v1\Model\NumberBoolean', - 'pinned_to_project_flag' => '\Pipedrive\versions\v1\Model\NumberBoolean' + 'pinned_to_project_flag' => '\Pipedrive\versions\v1\Model\NumberBoolean', + 'pinned_to_task_flag' => '\Pipedrive\versions\v1\Model\NumberBoolean' ]; /** @@ -89,7 +90,8 @@ class NoteParams implements ModelInterface, ArrayAccess, JsonSerializable 'pinned_to_deal_flag' => null, 'pinned_to_organization_flag' => null, 'pinned_to_person_flag' => null, - 'pinned_to_project_flag' => null + 'pinned_to_project_flag' => null, + 'pinned_to_task_flag' => null ]; /** @@ -129,7 +131,8 @@ public static function openAPIFormats(): array 'pinned_to_deal_flag' => 'pinned_to_deal_flag', 'pinned_to_organization_flag' => 'pinned_to_organization_flag', 'pinned_to_person_flag' => 'pinned_to_person_flag', - 'pinned_to_project_flag' => 'pinned_to_project_flag' + 'pinned_to_project_flag' => 'pinned_to_project_flag', + 'pinned_to_task_flag' => 'pinned_to_task_flag' ]; /** @@ -144,7 +147,8 @@ public static function openAPIFormats(): array 'pinned_to_deal_flag' => 'setPinnedToDealFlag', 'pinned_to_organization_flag' => 'setPinnedToOrganizationFlag', 'pinned_to_person_flag' => 'setPinnedToPersonFlag', - 'pinned_to_project_flag' => 'setPinnedToProjectFlag' + 'pinned_to_project_flag' => 'setPinnedToProjectFlag', + 'pinned_to_task_flag' => 'setPinnedToTaskFlag' ]; /** @@ -159,7 +163,8 @@ public static function openAPIFormats(): array 'pinned_to_deal_flag' => 'getPinnedToDealFlag', 'pinned_to_organization_flag' => 'getPinnedToOrganizationFlag', 'pinned_to_person_flag' => 'getPinnedToPersonFlag', - 'pinned_to_project_flag' => 'getPinnedToProjectFlag' + 'pinned_to_project_flag' => 'getPinnedToProjectFlag', + 'pinned_to_task_flag' => 'getPinnedToTaskFlag' ]; /** @@ -236,6 +241,7 @@ public function __construct(array $data = null) $this->container['pinned_to_organization_flag'] = $data['pinned_to_organization_flag'] ?? null; $this->container['pinned_to_person_flag'] = $data['pinned_to_person_flag'] ?? null; $this->container['pinned_to_project_flag'] = $data['pinned_to_project_flag'] ?? null; + $this->container['pinned_to_task_flag'] = $data['pinned_to_task_flag'] ?? null; } /** @@ -431,6 +437,30 @@ public function setPinnedToProjectFlag($pinned_to_project_flag): self return $this; } + + /** + * Gets pinned_to_task_flag + * + * @return \Pipedrive\versions\v1\Model\NumberBoolean|null + */ + public function getPinnedToTaskFlag() + { + return $this->container['pinned_to_task_flag']; + } + + /** + * Sets pinned_to_task_flag + * + * @param \Pipedrive\versions\v1\Model\NumberBoolean|null $pinned_to_task_flag If set, the results are filtered by note to task pinning state (`task_id` is also required) + * + * @return self + */ + public function setPinnedToTaskFlag($pinned_to_task_flag): self + { + $this->container['pinned_to_task_flag'] = $pinned_to_task_flag; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/lib/versions/v2/Api/BetaApi.php b/lib/versions/v2/Api/BetaApi.php index 6b6d043f..8d199c81 100644 --- a/lib/versions/v2/Api/BetaApi.php +++ b/lib/versions/v2/Api/BetaApi.php @@ -123,36 +123,36 @@ public function getConfig(): Configuration } /** - * Operation convertDealToLead + * Operation addProjectBoard * - * Convert a deal to a lead (BETA) + * Add a project board * - * @param int $id The ID of the deal to convert (required) + * @param \Pipedrive\versions\v2\Model\BoardRequestBody $board_request_body board_request_body (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse|\Pipedrive\versions\v2\Model\GetConvertResponse + * @return \Pipedrive\versions\v2\Model\PostPatchGetBoard */ - public function convertDealToLead($id) + public function addProjectBoard($board_request_body) { - list($response) = $this->convertDealToLeadWithHttpInfo($id); + list($response) = $this->addProjectBoardWithHttpInfo($board_request_body); return $response; } /** - * Operation convertDealToLeadWithHttpInfo + * Operation addProjectBoardWithHttpInfo * - * Convert a deal to a lead (BETA) + * Add a project board * - * @param int $id The ID of the deal to convert (required) + * @param \Pipedrive\versions\v2\Model\BoardRequestBody $board_request_body (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse|\Pipedrive\versions\v2\Model\GetConvertResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v2\Model\PostPatchGetBoard, HTTP status code, HTTP response headers (array of strings) */ - public function convertDealToLeadWithHttpInfo($id) + public function addProjectBoardWithHttpInfo($board_request_body) { - $request = $this->convertDealToLeadRequest($id); + $request = $this->addProjectBoardRequest($board_request_body); try { $options = $this->createHttpClientOption(); @@ -161,7 +161,7 @@ public function convertDealToLeadWithHttpInfo($id) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->convertDealToLeadRequest($id); + $request = $this->addProjectBoardRequest($board_request_body); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -186,27 +186,3600 @@ public function convertDealToLeadWithHttpInfo($id) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\PostPatchGetBoard' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetBoard', []), $response->getStatusCode(), $response->getHeaders() ]; - case 404: + } + + 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\v2\Model\PostPatchGetBoard' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetBoard', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\PostPatchGetBoard', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation addProjectBoardAsync + * + * Add a project board + * + * @param \Pipedrive\versions\v2\Model\BoardRequestBody $board_request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addProjectBoardAsync($board_request_body): PromiseInterface + { + return $this->addProjectBoardAsyncWithHttpInfo($board_request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addProjectBoardAsyncWithHttpInfo + * + * Add a project board + * + * @param \Pipedrive\versions\v2\Model\BoardRequestBody $board_request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addProjectBoardAsyncWithHttpInfo($board_request_body): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\PostPatchGetBoard'; + $request = $this->addProjectBoardRequest($board_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 'addProjectBoard' + * + * @param \Pipedrive\versions\v2\Model\BoardRequestBody $board_request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function addProjectBoardRequest($board_request_body): Request + { + // verify the required parameter 'board_request_body' is set + /* @phpstan-ignore-next-line */ + if ($board_request_body === null || (is_array($board_request_body) && count($board_request_body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $board_request_body when calling addProjectBoard' + ); + } + + $resourcePath = '/boards'; + $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($board_request_body)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($board_request_body)); + } else { + $httpBody = $board_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 addProjectField + * + * Create one project field + * + * @param \Pipedrive\versions\v2\Model\CreateProjectFieldRequest $create_project_field_request create_project_field_request (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\CreateProjectField + */ + public function addProjectField($create_project_field_request) + { + list($response) = $this->addProjectFieldWithHttpInfo($create_project_field_request); + return $response; + } + + /** + * Operation addProjectFieldWithHttpInfo + * + * Create one project field + * + * @param \Pipedrive\versions\v2\Model\CreateProjectFieldRequest $create_project_field_request (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\CreateProjectField, HTTP status code, HTTP response headers (array of strings) + */ + public function addProjectFieldWithHttpInfo($create_project_field_request) + { + $request = $this->addProjectFieldRequest($create_project_field_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->addProjectFieldRequest($create_project_field_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\v2\Model\CreateProjectField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\CreateProjectField', []), + $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\v2\Model\CreateProjectField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\CreateProjectField', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\CreateProjectField', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation addProjectFieldAsync + * + * Create one project field + * + * @param \Pipedrive\versions\v2\Model\CreateProjectFieldRequest $create_project_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addProjectFieldAsync($create_project_field_request): PromiseInterface + { + return $this->addProjectFieldAsyncWithHttpInfo($create_project_field_request) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addProjectFieldAsyncWithHttpInfo + * + * Create one project field + * + * @param \Pipedrive\versions\v2\Model\CreateProjectFieldRequest $create_project_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addProjectFieldAsyncWithHttpInfo($create_project_field_request): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\CreateProjectField'; + $request = $this->addProjectFieldRequest($create_project_field_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 'addProjectField' + * + * @param \Pipedrive\versions\v2\Model\CreateProjectFieldRequest $create_project_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function addProjectFieldRequest($create_project_field_request): Request + { + // verify the required parameter 'create_project_field_request' is set + /* @phpstan-ignore-next-line */ + if ($create_project_field_request === null || (is_array($create_project_field_request) && count($create_project_field_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $create_project_field_request when calling addProjectField' + ); + } + + $resourcePath = '/projectFields'; + $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($create_project_field_request)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($create_project_field_request)); + } else { + $httpBody = $create_project_field_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 addProjectFieldOptions + * + * Add project field options in bulk + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body request_body (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\InlineResponse200 + */ + public function addProjectFieldOptions($field_code, $request_body) + { + list($response) = $this->addProjectFieldOptionsWithHttpInfo($field_code, $request_body); + return $response; + } + + /** + * Operation addProjectFieldOptionsWithHttpInfo + * + * Add project field options in bulk + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\InlineResponse200, HTTP status code, HTTP response headers (array of strings) + */ + public function addProjectFieldOptionsWithHttpInfo($field_code, $request_body) + { + $request = $this->addProjectFieldOptionsRequest($field_code, $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->addProjectFieldOptionsRequest($field_code, $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 200: + /* @phpstan-ignore-next-line */ + if ('\Pipedrive\versions\v2\Model\InlineResponse200' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\InlineResponse200', []), + $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\v2\Model\InlineResponse200' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\InlineResponse200', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\InlineResponse200', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation addProjectFieldOptionsAsync + * + * Add project field options in bulk + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addProjectFieldOptionsAsync($field_code, $request_body): PromiseInterface + { + return $this->addProjectFieldOptionsAsyncWithHttpInfo($field_code, $request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addProjectFieldOptionsAsyncWithHttpInfo + * + * Add project field options in bulk + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addProjectFieldOptionsAsyncWithHttpInfo($field_code, $request_body): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\InlineResponse200'; + $request = $this->addProjectFieldOptionsRequest($field_code, $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 'addProjectFieldOptions' + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function addProjectFieldOptionsRequest($field_code, $request_body): Request + { + // verify the required parameter 'field_code' is set + /* @phpstan-ignore-next-line */ + if ($field_code === null || (is_array($field_code) && count($field_code) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $field_code when calling addProjectFieldOptions' + ); + } + // verify the required parameter 'request_body' is set + /* @phpstan-ignore-next-line */ + if ($request_body === null || (is_array($request_body) && count($request_body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request_body when calling addProjectFieldOptions' + ); + } + + $resourcePath = '/projectFields/{field_code}/options'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($field_code !== null) { + $resourcePath = str_replace( + '{' . 'field_code' . '}', + ObjectSerializer::toPathValue($field_code), + $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($request_body)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request_body)); + } else { + $httpBody = $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 addProjectPhase + * + * Add a project phase + * + * @param \Pipedrive\versions\v2\Model\PhaseRequestBody $phase_request_body phase_request_body (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\PostPatchGetPhase + */ + public function addProjectPhase($phase_request_body) + { + list($response) = $this->addProjectPhaseWithHttpInfo($phase_request_body); + return $response; + } + + /** + * Operation addProjectPhaseWithHttpInfo + * + * Add a project phase + * + * @param \Pipedrive\versions\v2\Model\PhaseRequestBody $phase_request_body (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\PostPatchGetPhase, HTTP status code, HTTP response headers (array of strings) + */ + public function addProjectPhaseWithHttpInfo($phase_request_body) + { + $request = $this->addProjectPhaseRequest($phase_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->addProjectPhaseRequest($phase_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 200: + /* @phpstan-ignore-next-line */ + if ('\Pipedrive\versions\v2\Model\PostPatchGetPhase' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetPhase', []), + $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\v2\Model\PostPatchGetPhase' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetPhase', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\PostPatchGetPhase', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation addProjectPhaseAsync + * + * Add a project phase + * + * @param \Pipedrive\versions\v2\Model\PhaseRequestBody $phase_request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addProjectPhaseAsync($phase_request_body): PromiseInterface + { + return $this->addProjectPhaseAsyncWithHttpInfo($phase_request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addProjectPhaseAsyncWithHttpInfo + * + * Add a project phase + * + * @param \Pipedrive\versions\v2\Model\PhaseRequestBody $phase_request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addProjectPhaseAsyncWithHttpInfo($phase_request_body): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\PostPatchGetPhase'; + $request = $this->addProjectPhaseRequest($phase_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 'addProjectPhase' + * + * @param \Pipedrive\versions\v2\Model\PhaseRequestBody $phase_request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function addProjectPhaseRequest($phase_request_body): Request + { + // verify the required parameter 'phase_request_body' is set + /* @phpstan-ignore-next-line */ + if ($phase_request_body === null || (is_array($phase_request_body) && count($phase_request_body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $phase_request_body when calling addProjectPhase' + ); + } + + $resourcePath = '/phases'; + $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($phase_request_body)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($phase_request_body)); + } else { + $httpBody = $phase_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 addTask + * + * Add a task + * + * @param \Pipedrive\versions\v2\Model\TaskPostRequest $task_post_request task_post_request (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\AddTaskResponse + */ + public function addTask($task_post_request) + { + list($response) = $this->addTaskWithHttpInfo($task_post_request); + return $response; + } + + /** + * Operation addTaskWithHttpInfo + * + * Add a task + * + * @param \Pipedrive\versions\v2\Model\TaskPostRequest $task_post_request (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\AddTaskResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function addTaskWithHttpInfo($task_post_request) + { + $request = $this->addTaskRequest($task_post_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->addTaskRequest($task_post_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\v2\Model\AddTaskResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddTaskResponse', []), + $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\v2\Model\AddTaskResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddTaskResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\AddTaskResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation addTaskAsync + * + * Add a task + * + * @param \Pipedrive\versions\v2\Model\TaskPostRequest $task_post_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addTaskAsync($task_post_request): PromiseInterface + { + return $this->addTaskAsyncWithHttpInfo($task_post_request) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addTaskAsyncWithHttpInfo + * + * Add a task + * + * @param \Pipedrive\versions\v2\Model\TaskPostRequest $task_post_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addTaskAsyncWithHttpInfo($task_post_request): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\AddTaskResponse'; + $request = $this->addTaskRequest($task_post_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 'addTask' + * + * @param \Pipedrive\versions\v2\Model\TaskPostRequest $task_post_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function addTaskRequest($task_post_request): Request + { + // verify the required parameter 'task_post_request' is set + /* @phpstan-ignore-next-line */ + if ($task_post_request === null || (is_array($task_post_request) && count($task_post_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $task_post_request when calling addTask' + ); + } + + $resourcePath = '/tasks'; + $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($task_post_request)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($task_post_request)); + } else { + $httpBody = $task_post_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 deleteProjectBoard + * + * Delete a project board + * + * @param int $id The ID of the project board (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\DeleteProjectBoardResponse + */ + public function deleteProjectBoard($id) + { + list($response) = $this->deleteProjectBoardWithHttpInfo($id); + return $response; + } + + /** + * Operation deleteProjectBoardWithHttpInfo + * + * Delete a project board + * + * @param int $id The ID of the project board (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\DeleteProjectBoardResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteProjectBoardWithHttpInfo($id) + { + $request = $this->deleteProjectBoardRequest($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->deleteProjectBoardRequest($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\v2\Model\DeleteProjectBoardResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteProjectBoardResponse', []), + $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\v2\Model\DeleteProjectBoardResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteProjectBoardResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\DeleteProjectBoardResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteProjectBoardAsync + * + * Delete a project board + * + * @param int $id The ID of the project board (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteProjectBoardAsync($id): PromiseInterface + { + return $this->deleteProjectBoardAsyncWithHttpInfo($id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteProjectBoardAsyncWithHttpInfo + * + * Delete a project board + * + * @param int $id The ID of the project board (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteProjectBoardAsyncWithHttpInfo($id): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\DeleteProjectBoardResponse'; + $request = $this->deleteProjectBoardRequest($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 'deleteProjectBoard' + * + * @param int $id The ID of the project board (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function deleteProjectBoardRequest($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 deleteProjectBoard' + ); + } + + $resourcePath = '/boards/{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 deleteProjectField + * + * Delete one project field + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\DeleteProjectField + */ + public function deleteProjectField($field_code) + { + list($response) = $this->deleteProjectFieldWithHttpInfo($field_code); + return $response; + } + + /** + * Operation deleteProjectFieldWithHttpInfo + * + * Delete one project field + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\DeleteProjectField, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteProjectFieldWithHttpInfo($field_code) + { + $request = $this->deleteProjectFieldRequest($field_code); + + 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->deleteProjectFieldRequest($field_code); + $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\v2\Model\DeleteProjectField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteProjectField', []), + $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\v2\Model\DeleteProjectField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteProjectField', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\DeleteProjectField', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteProjectFieldAsync + * + * Delete one project field + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteProjectFieldAsync($field_code): PromiseInterface + { + return $this->deleteProjectFieldAsyncWithHttpInfo($field_code) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteProjectFieldAsyncWithHttpInfo + * + * Delete one project field + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteProjectFieldAsyncWithHttpInfo($field_code): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\DeleteProjectField'; + $request = $this->deleteProjectFieldRequest($field_code); + + 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 'deleteProjectField' + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function deleteProjectFieldRequest($field_code): Request + { + // verify the required parameter 'field_code' is set + /* @phpstan-ignore-next-line */ + if ($field_code === null || (is_array($field_code) && count($field_code) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $field_code when calling deleteProjectField' + ); + } + + $resourcePath = '/projectFields/{field_code}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($field_code !== null) { + $resourcePath = str_replace( + '{' . 'field_code' . '}', + ObjectSerializer::toPathValue($field_code), + $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 deleteProjectFieldOptions + * + * Delete project field options in bulk + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body request_body (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\InlineResponse200 + */ + public function deleteProjectFieldOptions($field_code, $request_body) + { + list($response) = $this->deleteProjectFieldOptionsWithHttpInfo($field_code, $request_body); + return $response; + } + + /** + * Operation deleteProjectFieldOptionsWithHttpInfo + * + * Delete project field options in bulk + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\InlineResponse200, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteProjectFieldOptionsWithHttpInfo($field_code, $request_body) + { + $request = $this->deleteProjectFieldOptionsRequest($field_code, $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->deleteProjectFieldOptionsRequest($field_code, $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 200: + /* @phpstan-ignore-next-line */ + if ('\Pipedrive\versions\v2\Model\InlineResponse200' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\InlineResponse200', []), + $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\v2\Model\InlineResponse200' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\InlineResponse200', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\InlineResponse200', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteProjectFieldOptionsAsync + * + * Delete project field options in bulk + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteProjectFieldOptionsAsync($field_code, $request_body): PromiseInterface + { + return $this->deleteProjectFieldOptionsAsyncWithHttpInfo($field_code, $request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteProjectFieldOptionsAsyncWithHttpInfo + * + * Delete project field options in bulk + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteProjectFieldOptionsAsyncWithHttpInfo($field_code, $request_body): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\InlineResponse200'; + $request = $this->deleteProjectFieldOptionsRequest($field_code, $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 'deleteProjectFieldOptions' + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function deleteProjectFieldOptionsRequest($field_code, $request_body): Request + { + // verify the required parameter 'field_code' is set + /* @phpstan-ignore-next-line */ + if ($field_code === null || (is_array($field_code) && count($field_code) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $field_code when calling deleteProjectFieldOptions' + ); + } + // verify the required parameter 'request_body' is set + /* @phpstan-ignore-next-line */ + if ($request_body === null || (is_array($request_body) && count($request_body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request_body when calling deleteProjectFieldOptions' + ); + } + + $resourcePath = '/projectFields/{field_code}/options'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($field_code !== null) { + $resourcePath = str_replace( + '{' . 'field_code' . '}', + ObjectSerializer::toPathValue($field_code), + $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($request_body)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request_body)); + } else { + $httpBody = $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( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteProjectPhase + * + * Delete a project phase + * + * @param int $id The ID of the project phase (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\DeleteProjectPhaseResponse + */ + public function deleteProjectPhase($id) + { + list($response) = $this->deleteProjectPhaseWithHttpInfo($id); + return $response; + } + + /** + * Operation deleteProjectPhaseWithHttpInfo + * + * Delete a project phase + * + * @param int $id The ID of the project phase (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\DeleteProjectPhaseResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteProjectPhaseWithHttpInfo($id) + { + $request = $this->deleteProjectPhaseRequest($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->deleteProjectPhaseRequest($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\v2\Model\DeleteProjectPhaseResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteProjectPhaseResponse', []), + $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\v2\Model\DeleteProjectPhaseResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteProjectPhaseResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\DeleteProjectPhaseResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteProjectPhaseAsync + * + * Delete a project phase + * + * @param int $id The ID of the project phase (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteProjectPhaseAsync($id): PromiseInterface + { + return $this->deleteProjectPhaseAsyncWithHttpInfo($id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteProjectPhaseAsyncWithHttpInfo + * + * Delete a project phase + * + * @param int $id The ID of the project phase (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteProjectPhaseAsyncWithHttpInfo($id): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\DeleteProjectPhaseResponse'; + $request = $this->deleteProjectPhaseRequest($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 'deleteProjectPhase' + * + * @param int $id The ID of the project phase (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function deleteProjectPhaseRequest($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 deleteProjectPhase' + ); + } + + $resourcePath = '/phases/{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 deleteTask + * + * Delete a task + * + * @param int $id The ID of the task (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\DeleteTaskResponse + */ + public function deleteTask($id) + { + list($response) = $this->deleteTaskWithHttpInfo($id); + return $response; + } + + /** + * Operation deleteTaskWithHttpInfo + * + * Delete a task + * + * @param int $id The ID of the task (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\DeleteTaskResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteTaskWithHttpInfo($id) + { + $request = $this->deleteTaskRequest($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->deleteTaskRequest($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\v2\Model\DeleteTaskResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteTaskResponse', []), + $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\v2\Model\DeleteTaskResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteTaskResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\DeleteTaskResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteTaskAsync + * + * Delete a task + * + * @param int $id The ID of the task (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteTaskAsync($id): PromiseInterface + { + return $this->deleteTaskAsyncWithHttpInfo($id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteTaskAsyncWithHttpInfo + * + * Delete a task + * + * @param int $id The ID of the task (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteTaskAsyncWithHttpInfo($id): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\DeleteTaskResponse'; + $request = $this->deleteTaskRequest($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 'deleteTask' + * + * @param int $id The ID of the task (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function deleteTaskRequest($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 deleteTask' + ); + } + + $resourcePath = '/tasks/{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 getProjectField + * + * Get one project field + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\GetProjectField + */ + public function getProjectField($field_code) + { + list($response) = $this->getProjectFieldWithHttpInfo($field_code); + return $response; + } + + /** + * Operation getProjectFieldWithHttpInfo + * + * Get one project field + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\GetProjectField, HTTP status code, HTTP response headers (array of strings) + */ + public function getProjectFieldWithHttpInfo($field_code) + { + $request = $this->getProjectFieldRequest($field_code); + + 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->getProjectFieldRequest($field_code); + $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\v2\Model\GetProjectField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProjectField', []), + $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\v2\Model\GetProjectField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProjectField', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetProjectField', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getProjectFieldAsync + * + * Get one project field + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectFieldAsync($field_code): PromiseInterface + { + return $this->getProjectFieldAsyncWithHttpInfo($field_code) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProjectFieldAsyncWithHttpInfo + * + * Get one project field + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectFieldAsyncWithHttpInfo($field_code): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetProjectField'; + $request = $this->getProjectFieldRequest($field_code); + + 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 'getProjectField' + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function getProjectFieldRequest($field_code): Request + { + // verify the required parameter 'field_code' is set + /* @phpstan-ignore-next-line */ + if ($field_code === null || (is_array($field_code) && count($field_code) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $field_code when calling getProjectField' + ); + } + + $resourcePath = '/projectFields/{field_code}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($field_code !== null) { + $resourcePath = str_replace( + '{' . 'field_code' . '}', + ObjectSerializer::toPathValue($field_code), + $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 getProjectFields + * + * Get all project fields + * + * @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 $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\v2\Model\GetProjectFields + */ + public function getProjectFields($limit = null, $cursor = null) + { + list($response) = $this->getProjectFieldsWithHttpInfo($limit, $cursor); + return $response; + } + + /** + * Operation getProjectFieldsWithHttpInfo + * + * Get all project fields + * + * @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 $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\v2\Model\GetProjectFields, HTTP status code, HTTP response headers (array of strings) + */ + public function getProjectFieldsWithHttpInfo($limit = null, $cursor = null) + { + $request = $this->getProjectFieldsRequest($limit, $cursor); + + 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->getProjectFieldsRequest($limit, $cursor); + $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\v2\Model\GetProjectFields' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProjectFields', []), + $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\v2\Model\GetProjectFields' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProjectFields', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetProjectFields', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getProjectFieldsAsync + * + * Get all project fields + * + * @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 $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 getProjectFieldsAsync($limit = null, $cursor = null): PromiseInterface + { + return $this->getProjectFieldsAsyncWithHttpInfo($limit, $cursor) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProjectFieldsAsyncWithHttpInfo + * + * Get all project fields + * + * @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 $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 getProjectFieldsAsyncWithHttpInfo($limit = null, $cursor = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetProjectFields'; + $request = $this->getProjectFieldsRequest($limit, $cursor); + + 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 'getProjectFields' + * + * @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 $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 getProjectFieldsRequest($limit = null, $cursor = null): Request + { + + $resourcePath = '/projectFields'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // 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($cursor)) { + $cursor = ObjectSerializer::serializeCollection($cursor, '', true); + } + if ($cursor !== null) { + $queryParams['cursor'] = $cursor; + } + + + + + /* @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 getProjectsBoard + * + * Get details of a project board + * + * @param int $id The ID of the project board (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\PostPatchGetBoard + */ + public function getProjectsBoard($id) + { + list($response) = $this->getProjectsBoardWithHttpInfo($id); + return $response; + } + + /** + * Operation getProjectsBoardWithHttpInfo + * + * Get details of a project board + * + * @param int $id The ID of the project board (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\PostPatchGetBoard, HTTP status code, HTTP response headers (array of strings) + */ + public function getProjectsBoardWithHttpInfo($id) + { + $request = $this->getProjectsBoardRequest($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->getProjectsBoardRequest($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\v2\Model\GetConvertResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\PostPatchGetBoard' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetConvertResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetBoard', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -226,14 +3799,14 @@ public function convertDealToLeadWithHttpInfo($id) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\PostPatchGetBoard' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetBoard', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -243,15 +3816,7 @@ public function convertDealToLeadWithHttpInfo($id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\GetConvertResponse', + '\Pipedrive\versions\v2\Model\PostPatchGetBoard', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -262,18 +3827,18 @@ public function convertDealToLeadWithHttpInfo($id) } /** - * Operation convertDealToLeadAsync + * Operation getProjectsBoardAsync * - * Convert a deal to a lead (BETA) + * Get details of a project board * - * @param int $id The ID of the deal to convert (required) + * @param int $id The ID of the project board (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function convertDealToLeadAsync($id): PromiseInterface + public function getProjectsBoardAsync($id): PromiseInterface { - return $this->convertDealToLeadAsyncWithHttpInfo($id) + return $this->getProjectsBoardAsyncWithHttpInfo($id) ->then( function ($response) { return $response[0]; @@ -282,19 +3847,19 @@ function ($response) { } /** - * Operation convertDealToLeadAsyncWithHttpInfo + * Operation getProjectsBoardAsyncWithHttpInfo * - * Convert a deal to a lead (BETA) + * Get details of a project board * - * @param int $id The ID of the deal to convert (required) + * @param int $id The ID of the project board (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function convertDealToLeadAsyncWithHttpInfo($id): PromiseInterface + public function getProjectsBoardAsyncWithHttpInfo($id): PromiseInterface { - $returnType = '\Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse'; - $request = $this->convertDealToLeadRequest($id); + $returnType = '\Pipedrive\versions\v2\Model\PostPatchGetBoard'; + $request = $this->getProjectsBoardRequest($id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -331,24 +3896,24 @@ function ($exception) { } /** - * Create request for operation 'convertDealToLead' + * Create request for operation 'getProjectsBoard' * - * @param int $id The ID of the deal to convert (required) + * @param int $id The ID of the project board (required) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function convertDealToLeadRequest($id): Request + public function getProjectsBoardRequest($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 convertDealToLead' + 'Missing the required parameter $id when calling getProjectsBoard' ); } - $resourcePath = '/deals/{id}/convert/lead'; + $resourcePath = '/boards/{id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -432,7 +3997,7 @@ public function convertDealToLeadRequest($id): Request $query = Query::build($queryParams); return new Request( - 'POST', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -440,38 +4005,34 @@ public function convertDealToLeadRequest($id): Request } /** - * Operation convertLeadToDeal + * Operation getProjectsBoards * - * Convert a lead to a deal (BETA) + * Get all project boards * - * @param string $id The ID of the lead to convert (required) - * @param \Pipedrive\versions\v2\Model\InlineObject|null $inline_object inline_object (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v2\Model\AddConvertLeadToDealResponse|\Pipedrive\versions\v2\Model\GetConvertResponse + * @return \Pipedrive\versions\v2\Model\GetBoards */ - public function convertLeadToDeal($id, $inline_object = null) + public function getProjectsBoards() { - list($response) = $this->convertLeadToDealWithHttpInfo($id, $inline_object); + list($response) = $this->getProjectsBoardsWithHttpInfo(); return $response; } /** - * Operation convertLeadToDealWithHttpInfo + * Operation getProjectsBoardsWithHttpInfo * - * Convert a lead to a deal (BETA) + * Get all project boards * - * @param string $id The ID of the lead to convert (required) - * @param \Pipedrive\versions\v2\Model\InlineObject|null $inline_object (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v2\Model\AddConvertLeadToDealResponse|\Pipedrive\versions\v2\Model\GetConvertResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v2\Model\GetBoards, HTTP status code, HTTP response headers (array of strings) */ - public function convertLeadToDealWithHttpInfo($id, $inline_object = null) + public function getProjectsBoardsWithHttpInfo() { - $request = $this->convertLeadToDealRequest($id, $inline_object); + $request = $this->getProjectsBoardsRequest(); try { $options = $this->createHttpClientOption(); @@ -480,7 +4041,7 @@ public function convertLeadToDealWithHttpInfo($id, $inline_object = null) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->convertLeadToDealRequest($id, $inline_object); + $request = $this->getProjectsBoardsRequest(); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -505,27 +4066,14 @@ public function convertLeadToDealWithHttpInfo($id, $inline_object = null) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\AddConvertLeadToDealResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddConvertLeadToDealResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 404: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\GetConvertResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\GetBoards' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetConvertResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetBoards', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -545,14 +4093,14 @@ public function convertLeadToDealWithHttpInfo($id, $inline_object = null) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\AddConvertLeadToDealResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\GetBoards' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddConvertLeadToDealResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetBoards', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -562,15 +4110,7 @@ public function convertLeadToDealWithHttpInfo($id, $inline_object = null) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\AddConvertLeadToDealResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\GetConvertResponse', + '\Pipedrive\versions\v2\Model\GetBoards', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -581,19 +4121,17 @@ public function convertLeadToDealWithHttpInfo($id, $inline_object = null) } /** - * Operation convertLeadToDealAsync + * Operation getProjectsBoardsAsync * - * Convert a lead to a deal (BETA) + * Get all project boards * - * @param string $id The ID of the lead to convert (required) - * @param \Pipedrive\versions\v2\Model\InlineObject|null $inline_object (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function convertLeadToDealAsync($id, $inline_object = null): PromiseInterface + public function getProjectsBoardsAsync(): PromiseInterface { - return $this->convertLeadToDealAsyncWithHttpInfo($id, $inline_object) + return $this->getProjectsBoardsAsyncWithHttpInfo() ->then( function ($response) { return $response[0]; @@ -602,20 +4140,18 @@ function ($response) { } /** - * Operation convertLeadToDealAsyncWithHttpInfo + * Operation getProjectsBoardsAsyncWithHttpInfo * - * Convert a lead to a deal (BETA) + * Get all project boards * - * @param string $id The ID of the lead to convert (required) - * @param \Pipedrive\versions\v2\Model\InlineObject|null $inline_object (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function convertLeadToDealAsyncWithHttpInfo($id, $inline_object = null): PromiseInterface + public function getProjectsBoardsAsyncWithHttpInfo(): PromiseInterface { - $returnType = '\Pipedrive\versions\v2\Model\AddConvertLeadToDealResponse'; - $request = $this->convertLeadToDealRequest($id, $inline_object); + $returnType = '\Pipedrive\versions\v2\Model\GetBoards'; + $request = $this->getProjectsBoardsRequest(); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -652,25 +4188,16 @@ function ($exception) { } /** - * Create request for operation 'convertLeadToDeal' + * Create request for operation 'getProjectsBoards' * - * @param string $id The ID of the lead to convert (required) - * @param \Pipedrive\versions\v2\Model\InlineObject|null $inline_object (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function convertLeadToDealRequest($id, $inline_object = null): Request + public function getProjectsBoardsRequest(): 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 convertLeadToDeal' - ); - } - $resourcePath = '/leads/{id}/convert/deal'; + $resourcePath = '/boards'; $formParams = []; $queryParams = []; $headerParams = []; @@ -679,14 +4206,6 @@ public function convertLeadToDealRequest($id, $inline_object = null): Request - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } /* @phpstan-ignore-next-line */ @@ -697,18 +4216,12 @@ public function convertLeadToDealRequest($id, $inline_object = null): Request } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - ['application/json'] + [] ); } // for model (json/xml) - if (isset($inline_object)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($inline_object)); - } else { - $httpBody = $inline_object; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { /* @phpstan-ignore-next-line */ if ($multipart) { $multipartContents = []; @@ -760,7 +4273,7 @@ public function convertLeadToDealRequest($id, $inline_object = null): Request $query = Query::build($queryParams); return new Request( - 'POST', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -768,38 +4281,36 @@ public function convertLeadToDealRequest($id, $inline_object = null): Request } /** - * Operation deleteInstallment + * Operation getProjectsPhase * - * Delete an installment from a deal + * Get details of a project phase * - * @param int $id The ID of the deal (required) - * @param int $installment_id The ID of the installment (required) + * @param int $id The ID of the project phase (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v2\Model\DeleteInstallmentResponse + * @return \Pipedrive\versions\v2\Model\PostPatchGetPhase */ - public function deleteInstallment($id, $installment_id) + public function getProjectsPhase($id) { - list($response) = $this->deleteInstallmentWithHttpInfo($id, $installment_id); + list($response) = $this->getProjectsPhaseWithHttpInfo($id); return $response; } /** - * Operation deleteInstallmentWithHttpInfo + * Operation getProjectsPhaseWithHttpInfo * - * Delete an installment from a deal + * Get details of a project phase * - * @param int $id The ID of the deal (required) - * @param int $installment_id The ID of the installment (required) + * @param int $id The ID of the project phase (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v2\Model\DeleteInstallmentResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v2\Model\PostPatchGetPhase, HTTP status code, HTTP response headers (array of strings) */ - public function deleteInstallmentWithHttpInfo($id, $installment_id) + public function getProjectsPhaseWithHttpInfo($id) { - $request = $this->deleteInstallmentRequest($id, $installment_id); + $request = $this->getProjectsPhaseRequest($id); try { $options = $this->createHttpClientOption(); @@ -808,7 +4319,7 @@ public function deleteInstallmentWithHttpInfo($id, $installment_id) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->deleteInstallmentRequest($id, $installment_id); + $request = $this->getProjectsPhaseRequest($id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -833,14 +4344,14 @@ public function deleteInstallmentWithHttpInfo($id, $installment_id) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\DeleteInstallmentResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\PostPatchGetPhase' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteInstallmentResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetPhase', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -860,14 +4371,14 @@ public function deleteInstallmentWithHttpInfo($id, $installment_id) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\DeleteInstallmentResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\PostPatchGetPhase' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteInstallmentResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetPhase', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -877,7 +4388,7 @@ public function deleteInstallmentWithHttpInfo($id, $installment_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\DeleteInstallmentResponse', + '\Pipedrive\versions\v2\Model\PostPatchGetPhase', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -888,19 +4399,18 @@ public function deleteInstallmentWithHttpInfo($id, $installment_id) } /** - * Operation deleteInstallmentAsync + * Operation getProjectsPhaseAsync * - * Delete an installment from a deal + * Get details of a project phase * - * @param int $id The ID of the deal (required) - * @param int $installment_id The ID of the installment (required) + * @param int $id The ID of the project phase (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function deleteInstallmentAsync($id, $installment_id): PromiseInterface + public function getProjectsPhaseAsync($id): PromiseInterface { - return $this->deleteInstallmentAsyncWithHttpInfo($id, $installment_id) + return $this->getProjectsPhaseAsyncWithHttpInfo($id) ->then( function ($response) { return $response[0]; @@ -909,20 +4419,19 @@ function ($response) { } /** - * Operation deleteInstallmentAsyncWithHttpInfo + * Operation getProjectsPhaseAsyncWithHttpInfo * - * Delete an installment from a deal + * Get details of a project phase * - * @param int $id The ID of the deal (required) - * @param int $installment_id The ID of the installment (required) + * @param int $id The ID of the project phase (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function deleteInstallmentAsyncWithHttpInfo($id, $installment_id): PromiseInterface + public function getProjectsPhaseAsyncWithHttpInfo($id): PromiseInterface { - $returnType = '\Pipedrive\versions\v2\Model\DeleteInstallmentResponse'; - $request = $this->deleteInstallmentRequest($id, $installment_id); + $returnType = '\Pipedrive\versions\v2\Model\PostPatchGetPhase'; + $request = $this->getProjectsPhaseRequest($id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -959,32 +4468,24 @@ function ($exception) { } /** - * Create request for operation 'deleteInstallment' + * Create request for operation 'getProjectsPhase' * - * @param int $id The ID of the deal (required) - * @param int $installment_id The ID of the installment (required) + * @param int $id The ID of the project phase (required) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function deleteInstallmentRequest($id, $installment_id): Request + public function getProjectsPhaseRequest($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 deleteInstallment' - ); - } - // verify the required parameter 'installment_id' is set - /* @phpstan-ignore-next-line */ - if ($installment_id === null || (is_array($installment_id) && count($installment_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $installment_id when calling deleteInstallment' + 'Missing the required parameter $id when calling getProjectsPhase' ); } - $resourcePath = '/deals/{id}/installments/{installment_id}'; + $resourcePath = '/phases/{id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -1001,14 +4502,6 @@ public function deleteInstallmentRequest($id, $installment_id): Request $resourcePath ); } - // path params - if ($installment_id !== null) { - $resourcePath = str_replace( - '{' . 'installment_id' . '}', - ObjectSerializer::toPathValue($installment_id), - $resourcePath - ); - } /* @phpstan-ignore-next-line */ @@ -1076,7 +4569,7 @@ public function deleteInstallmentRequest($id, $installment_id): Request $query = Query::build($queryParams); return new Request( - 'DELETE', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -1084,36 +4577,36 @@ public function deleteInstallmentRequest($id, $installment_id): Request } /** - * Operation deleteProductImage + * Operation getProjectsPhases * - * Delete an image of a product + * Get project phases * - * @param int $id The ID of the product (required) + * @param int $board_id The ID of the board for which phases are requested (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v2\Model\DeleteProductImageResponse + * @return \Pipedrive\versions\v2\Model\GetPhases */ - public function deleteProductImage($id) + public function getProjectsPhases($board_id) { - list($response) = $this->deleteProductImageWithHttpInfo($id); + list($response) = $this->getProjectsPhasesWithHttpInfo($board_id); return $response; } /** - * Operation deleteProductImageWithHttpInfo + * Operation getProjectsPhasesWithHttpInfo * - * Delete an image of a product + * Get project phases * - * @param int $id The ID of the product (required) + * @param int $board_id The ID of the board for which phases are requested (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v2\Model\DeleteProductImageResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v2\Model\GetPhases, HTTP status code, HTTP response headers (array of strings) */ - public function deleteProductImageWithHttpInfo($id) + public function getProjectsPhasesWithHttpInfo($board_id) { - $request = $this->deleteProductImageRequest($id); + $request = $this->getProjectsPhasesRequest($board_id); try { $options = $this->createHttpClientOption(); @@ -1122,7 +4615,7 @@ public function deleteProductImageWithHttpInfo($id) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->deleteProductImageRequest($id); + $request = $this->getProjectsPhasesRequest($board_id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -1147,14 +4640,14 @@ public function deleteProductImageWithHttpInfo($id) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\DeleteProductImageResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\GetPhases' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteProductImageResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetPhases', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1174,14 +4667,14 @@ public function deleteProductImageWithHttpInfo($id) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\DeleteProductImageResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\GetPhases' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteProductImageResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetPhases', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1191,7 +4684,7 @@ public function deleteProductImageWithHttpInfo($id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\DeleteProductImageResponse', + '\Pipedrive\versions\v2\Model\GetPhases', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1202,18 +4695,18 @@ public function deleteProductImageWithHttpInfo($id) } /** - * Operation deleteProductImageAsync + * Operation getProjectsPhasesAsync * - * Delete an image of a product + * Get project phases * - * @param int $id The ID of the product (required) + * @param int $board_id The ID of the board for which phases are requested (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function deleteProductImageAsync($id): PromiseInterface + public function getProjectsPhasesAsync($board_id): PromiseInterface { - return $this->deleteProductImageAsyncWithHttpInfo($id) + return $this->getProjectsPhasesAsyncWithHttpInfo($board_id) ->then( function ($response) { return $response[0]; @@ -1222,19 +4715,19 @@ function ($response) { } /** - * Operation deleteProductImageAsyncWithHttpInfo + * Operation getProjectsPhasesAsyncWithHttpInfo * - * Delete an image of a product + * Get project phases * - * @param int $id The ID of the product (required) + * @param int $board_id The ID of the board for which phases are requested (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function deleteProductImageAsyncWithHttpInfo($id): PromiseInterface + public function getProjectsPhasesAsyncWithHttpInfo($board_id): PromiseInterface { - $returnType = '\Pipedrive\versions\v2\Model\DeleteProductImageResponse'; - $request = $this->deleteProductImageRequest($id); + $returnType = '\Pipedrive\versions\v2\Model\GetPhases'; + $request = $this->getProjectsPhasesRequest($board_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1271,40 +4764,40 @@ function ($exception) { } /** - * Create request for operation 'deleteProductImage' + * Create request for operation 'getProjectsPhases' * - * @param int $id The ID of the product (required) + * @param int $board_id The ID of the board for which phases are requested (required) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function deleteProductImageRequest($id): Request + public function getProjectsPhasesRequest($board_id): Request { - // verify the required parameter 'id' is set + // verify the required parameter 'board_id' is set /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { + if ($board_id === null || (is_array($board_id) && count($board_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling deleteProductImage' + 'Missing the required parameter $board_id when calling getProjectsPhases' ); } - $resourcePath = '/products/{id}/images'; + $resourcePath = '/phases'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + /* @phpstan-ignore-next-line */ + if (is_array($board_id)) { + $board_id = ObjectSerializer::serializeCollection($board_id, '', true); + } + if ($board_id !== null) { + $queryParams['board_id'] = $board_id; + } - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } /* @phpstan-ignore-next-line */ @@ -1372,7 +4865,7 @@ public function deleteProductImageRequest($id): Request $query = Query::build($queryParams); return new Request( - 'DELETE', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -1380,37 +4873,36 @@ public function deleteProductImageRequest($id): Request } /** - * Operation getDealConversionStatus + * Operation getTask * - * Get Deal conversion status (BETA) + * Get details of a task * - * @param int $id The ID of a deal (required) - * @param string $conversion_id The ID of the conversion (required) + * @param int $id The ID of the task (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return void + * @return \Pipedrive\versions\v2\Model\GetTaskResponse */ - public function getDealConversionStatus($id, $conversion_id) + public function getTask($id) { - $this->getDealConversionStatusWithHttpInfo($id, $conversion_id); + list($response) = $this->getTaskWithHttpInfo($id); + return $response; } /** - * Operation getDealConversionStatusWithHttpInfo + * Operation getTaskWithHttpInfo * - * Get Deal conversion status (BETA) + * Get details of a task * - * @param int $id The ID of a deal (required) - * @param string $conversion_id The ID of the conversion (required) + * @param int $id The ID of the task (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v2\Model\GetTaskResponse, HTTP status code, HTTP response headers (array of strings) */ - public function getDealConversionStatusWithHttpInfo($id, $conversion_id) + public function getTaskWithHttpInfo($id) { - $request = $this->getDealConversionStatusRequest($id, $conversion_id); + $request = $this->getTaskRequest($id); try { $options = $this->createHttpClientOption(); @@ -1419,7 +4911,7 @@ public function getDealConversionStatusWithHttpInfo($id, $conversion_id) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getDealConversionStatusRequest($id, $conversion_id); + $request = $this->getTaskRequest($id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -1431,24 +4923,64 @@ public function getDealConversionStatusWithHttpInfo($id, $conversion_id) } } catch (ConnectException $e) { throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + /* @phpstan-ignore-next-line */ + if ('\Pipedrive\versions\v2\Model\GetTaskResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetTaskResponse', []), + $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() ); } - $statusCode = $response->getStatusCode(); - + /* @phpstan-ignore-next-line */ + if ('\Pipedrive\versions\v2\Model\GetTaskResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } - return [null, $statusCode, $response->getHeaders()]; + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetTaskResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; } catch (ApiException $e) { switch ($e->getCode()) { - case 404: + case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\GetConvertResponse', + '\Pipedrive\versions\v2\Model\GetTaskResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1459,19 +4991,18 @@ public function getDealConversionStatusWithHttpInfo($id, $conversion_id) } /** - * Operation getDealConversionStatusAsync + * Operation getTaskAsync * - * Get Deal conversion status (BETA) + * Get details of a task * - * @param int $id The ID of a deal (required) - * @param string $conversion_id The ID of the conversion (required) + * @param int $id The ID of the task (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getDealConversionStatusAsync($id, $conversion_id): PromiseInterface + public function getTaskAsync($id): PromiseInterface { - return $this->getDealConversionStatusAsyncWithHttpInfo($id, $conversion_id) + return $this->getTaskAsyncWithHttpInfo($id) ->then( function ($response) { return $response[0]; @@ -1480,26 +5011,36 @@ function ($response) { } /** - * Operation getDealConversionStatusAsyncWithHttpInfo + * Operation getTaskAsyncWithHttpInfo * - * Get Deal conversion status (BETA) + * Get details of a task * - * @param int $id The ID of a deal (required) - * @param string $conversion_id The ID of the conversion (required) + * @param int $id The ID of the task (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getDealConversionStatusAsyncWithHttpInfo($id, $conversion_id): PromiseInterface + public function getTaskAsyncWithHttpInfo($id): PromiseInterface { - $returnType = ''; - $request = $this->getDealConversionStatusRequest($id, $conversion_id); + $returnType = '\Pipedrive\versions\v2\Model\GetTaskResponse'; + $request = $this->getTaskRequest($id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + /* @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(); @@ -1519,32 +5060,24 @@ function ($exception) { } /** - * Create request for operation 'getDealConversionStatus' + * Create request for operation 'getTask' * - * @param int $id The ID of a deal (required) - * @param string $conversion_id The ID of the conversion (required) + * @param int $id The ID of the task (required) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function getDealConversionStatusRequest($id, $conversion_id): Request + public function getTaskRequest($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 getDealConversionStatus' - ); - } - // verify the required parameter 'conversion_id' is set - /* @phpstan-ignore-next-line */ - if ($conversion_id === null || (is_array($conversion_id) && count($conversion_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $conversion_id when calling getDealConversionStatus' + 'Missing the required parameter $id when calling getTask' ); } - $resourcePath = '/deals/{id}/convert/status/{conversion_id}'; + $resourcePath = '/tasks/{id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -1561,14 +5094,6 @@ public function getDealConversionStatusRequest($id, $conversion_id): Request $resourcePath ); } - // path params - if ($conversion_id !== null) { - $resourcePath = str_replace( - '{' . 'conversion_id' . '}', - ObjectSerializer::toPathValue($conversion_id), - $resourcePath - ); - } /* @phpstan-ignore-next-line */ @@ -1644,44 +5169,48 @@ public function getDealConversionStatusRequest($id, $conversion_id): Request } /** - * Operation getInstallments + * Operation getTasks * - * List installments added to a list of deals + * Get all tasks * - * @param int[] $deal_ids An array of integers with the IDs of the deals for which the attached installments will be returned. A maximum of 100 deal IDs can be provided. (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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `billing_date`, `deal_id`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * @param bool|null $is_done Whether the task is done or not. If omitted, both done and not done tasks are returned. (optional) + * @param bool|null $is_milestone Whether the task is a milestone or not. If omitted, both milestone and non-milestone tasks are returned. (optional) + * @param int|null $assignee_id If supplied, only tasks assigned to this user are returned (optional) + * @param int|null $project_id If supplied, only tasks belonging to this project are returned (optional) + * @param string|null $parent_task_id If `null` is supplied, only root-level tasks (without a parent) are returned. If an integer is supplied, only subtasks of that specific task are returned. By default all tasks are returned. (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v2\Model\InstallmentsResponse + * @return \Pipedrive\versions\v2\Model\GetTasksResponse */ - public function getInstallments($deal_ids, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc') + public function getTasks($cursor = null, $limit = null, $is_done = null, $is_milestone = null, $assignee_id = null, $project_id = null, $parent_task_id = null) { - list($response) = $this->getInstallmentsWithHttpInfo($deal_ids, $cursor, $limit, $sort_by, $sort_direction); + list($response) = $this->getTasksWithHttpInfo($cursor, $limit, $is_done, $is_milestone, $assignee_id, $project_id, $parent_task_id); return $response; } /** - * Operation getInstallmentsWithHttpInfo + * Operation getTasksWithHttpInfo * - * List installments added to a list of deals + * Get all tasks * - * @param int[] $deal_ids An array of integers with the IDs of the deals for which the attached installments will be returned. A maximum of 100 deal IDs can be provided. (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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `billing_date`, `deal_id`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * @param bool|null $is_done Whether the task is done or not. If omitted, both done and not done tasks are returned. (optional) + * @param bool|null $is_milestone Whether the task is a milestone or not. If omitted, both milestone and non-milestone tasks are returned. (optional) + * @param int|null $assignee_id If supplied, only tasks assigned to this user are returned (optional) + * @param int|null $project_id If supplied, only tasks belonging to this project are returned (optional) + * @param string|null $parent_task_id If `null` is supplied, only root-level tasks (without a parent) are returned. If an integer is supplied, only subtasks of that specific task are returned. By default all tasks are returned. (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v2\Model\InstallmentsResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v2\Model\GetTasksResponse, HTTP status code, HTTP response headers (array of strings) */ - public function getInstallmentsWithHttpInfo($deal_ids, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc') + public function getTasksWithHttpInfo($cursor = null, $limit = null, $is_done = null, $is_milestone = null, $assignee_id = null, $project_id = null, $parent_task_id = null) { - $request = $this->getInstallmentsRequest($deal_ids, $cursor, $limit, $sort_by, $sort_direction); + $request = $this->getTasksRequest($cursor, $limit, $is_done, $is_milestone, $assignee_id, $project_id, $parent_task_id); try { $options = $this->createHttpClientOption(); @@ -1690,7 +5219,7 @@ public function getInstallmentsWithHttpInfo($deal_ids, $cursor = null, $limit = } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getInstallmentsRequest($deal_ids, $cursor, $limit, $sort_by, $sort_direction); + $request = $this->getTasksRequest($cursor, $limit, $is_done, $is_milestone, $assignee_id, $project_id, $parent_task_id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -1715,14 +5244,14 @@ public function getInstallmentsWithHttpInfo($deal_ids, $cursor = null, $limit = switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\InstallmentsResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\GetTasksResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\InstallmentsResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetTasksResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1742,14 +5271,14 @@ public function getInstallmentsWithHttpInfo($deal_ids, $cursor = null, $limit = } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\InstallmentsResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\GetTasksResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\InstallmentsResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetTasksResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1759,7 +5288,7 @@ public function getInstallmentsWithHttpInfo($deal_ids, $cursor = null, $limit = case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\InstallmentsResponse', + '\Pipedrive\versions\v2\Model\GetTasksResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1770,22 +5299,24 @@ public function getInstallmentsWithHttpInfo($deal_ids, $cursor = null, $limit = } /** - * Operation getInstallmentsAsync + * Operation getTasksAsync * - * List installments added to a list of deals + * Get all tasks * - * @param int[] $deal_ids An array of integers with the IDs of the deals for which the attached installments will be returned. A maximum of 100 deal IDs can be provided. (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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `billing_date`, `deal_id`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * @param bool|null $is_done Whether the task is done or not. If omitted, both done and not done tasks are returned. (optional) + * @param bool|null $is_milestone Whether the task is a milestone or not. If omitted, both milestone and non-milestone tasks are returned. (optional) + * @param int|null $assignee_id If supplied, only tasks assigned to this user are returned (optional) + * @param int|null $project_id If supplied, only tasks belonging to this project are returned (optional) + * @param string|null $parent_task_id If `null` is supplied, only root-level tasks (without a parent) are returned. If an integer is supplied, only subtasks of that specific task are returned. By default all tasks are returned. (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getInstallmentsAsync($deal_ids, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc'): PromiseInterface + public function getTasksAsync($cursor = null, $limit = null, $is_done = null, $is_milestone = null, $assignee_id = null, $project_id = null, $parent_task_id = null): PromiseInterface { - return $this->getInstallmentsAsyncWithHttpInfo($deal_ids, $cursor, $limit, $sort_by, $sort_direction) + return $this->getTasksAsyncWithHttpInfo($cursor, $limit, $is_done, $is_milestone, $assignee_id, $project_id, $parent_task_id) ->then( function ($response) { return $response[0]; @@ -1794,23 +5325,25 @@ function ($response) { } /** - * Operation getInstallmentsAsyncWithHttpInfo + * Operation getTasksAsyncWithHttpInfo * - * List installments added to a list of deals + * Get all tasks * - * @param int[] $deal_ids An array of integers with the IDs of the deals for which the attached installments will be returned. A maximum of 100 deal IDs can be provided. (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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `billing_date`, `deal_id`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * @param bool|null $is_done Whether the task is done or not. If omitted, both done and not done tasks are returned. (optional) + * @param bool|null $is_milestone Whether the task is a milestone or not. If omitted, both milestone and non-milestone tasks are returned. (optional) + * @param int|null $assignee_id If supplied, only tasks assigned to this user are returned (optional) + * @param int|null $project_id If supplied, only tasks belonging to this project are returned (optional) + * @param string|null $parent_task_id If `null` is supplied, only root-level tasks (without a parent) are returned. If an integer is supplied, only subtasks of that specific task are returned. By default all tasks are returned. (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getInstallmentsAsyncWithHttpInfo($deal_ids, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc'): PromiseInterface + public function getTasksAsyncWithHttpInfo($cursor = null, $limit = null, $is_done = null, $is_milestone = null, $assignee_id = null, $project_id = null, $parent_task_id = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v2\Model\InstallmentsResponse'; - $request = $this->getInstallmentsRequest($deal_ids, $cursor, $limit, $sort_by, $sort_direction); + $returnType = '\Pipedrive\versions\v2\Model\GetTasksResponse'; + $request = $this->getTasksRequest($cursor, $limit, $is_done, $is_milestone, $assignee_id, $project_id, $parent_task_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1847,42 +5380,29 @@ function ($exception) { } /** - * Create request for operation 'getInstallments' + * Create request for operation 'getTasks' * - * @param int[] $deal_ids An array of integers with the IDs of the deals for which the attached installments will be returned. A maximum of 100 deal IDs can be provided. (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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `billing_date`, `deal_id`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * @param bool|null $is_done Whether the task is done or not. If omitted, both done and not done tasks are returned. (optional) + * @param bool|null $is_milestone Whether the task is a milestone or not. If omitted, both milestone and non-milestone tasks are returned. (optional) + * @param int|null $assignee_id If supplied, only tasks assigned to this user are returned (optional) + * @param int|null $project_id If supplied, only tasks belonging to this project are returned (optional) + * @param string|null $parent_task_id If `null` is supplied, only root-level tasks (without a parent) are returned. If an integer is supplied, only subtasks of that specific task are returned. By default all tasks are returned. (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function getInstallmentsRequest($deal_ids, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc'): Request + public function getTasksRequest($cursor = null, $limit = null, $is_done = null, $is_milestone = null, $assignee_id = null, $project_id = null, $parent_task_id = null): Request { - // verify the required parameter 'deal_ids' is set - /* @phpstan-ignore-next-line */ - if ($deal_ids === null || (is_array($deal_ids) && count($deal_ids) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $deal_ids when calling getInstallments' - ); - } - $resourcePath = '/deals/installments'; + $resourcePath = '/tasks'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - /* @phpstan-ignore-next-line */ - if (is_array($deal_ids)) { - $deal_ids = ObjectSerializer::serializeCollection($deal_ids, 'csv', true); - } - if ($deal_ids !== null) { - $queryParams['deal_ids'] = $deal_ids; - } // query params /* @phpstan-ignore-next-line */ if (is_array($cursor)) { @@ -1901,19 +5421,43 @@ public function getInstallmentsRequest($deal_ids, $cursor = null, $limit = null, } // query params /* @phpstan-ignore-next-line */ - if (is_array($sort_by)) { - $sort_by = ObjectSerializer::serializeCollection($sort_by, '', true); + if (is_array($is_done)) { + $is_done = ObjectSerializer::serializeCollection($is_done, '', true); + } + if ($is_done !== null) { + $queryParams['is_done'] = $is_done; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($is_milestone)) { + $is_milestone = ObjectSerializer::serializeCollection($is_milestone, '', true); + } + if ($is_milestone !== null) { + $queryParams['is_milestone'] = $is_milestone; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($assignee_id)) { + $assignee_id = ObjectSerializer::serializeCollection($assignee_id, '', true); + } + if ($assignee_id !== null) { + $queryParams['assignee_id'] = $assignee_id; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($project_id)) { + $project_id = ObjectSerializer::serializeCollection($project_id, '', true); } - if ($sort_by !== null) { - $queryParams['sort_by'] = $sort_by; + if ($project_id !== null) { + $queryParams['project_id'] = $project_id; } // query params /* @phpstan-ignore-next-line */ - if (is_array($sort_direction)) { - $sort_direction = ObjectSerializer::serializeCollection($sort_direction, '', true); + if (is_array($parent_task_id)) { + $parent_task_id = ObjectSerializer::serializeCollection($parent_task_id, '', true); } - if ($sort_direction !== null) { - $queryParams['sort_direction'] = $sort_direction; + if ($parent_task_id !== null) { + $queryParams['parent_task_id'] = $parent_task_id; } @@ -1992,37 +5536,48 @@ public function getInstallmentsRequest($deal_ids, $cursor = null, $limit = null, } /** - * Operation getLeadConversionStatus + * Operation searchProjects * - * Get Lead conversion status (BETA) + * Search projects * - * @param string $id The ID of a lead (required) - * @param string $conversion_id The ID of the conversion (required) + * @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 projects by the provided person ID (optional) + * @param int|null $organization_id Will filter projects by the provided organization ID (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 $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 void + * @return \Pipedrive\versions\v2\Model\ProjectSearchResponse */ - public function getLeadConversionStatus($id, $conversion_id) + public function searchProjects($term, $fields = null, $exact_match = null, $person_id = null, $organization_id = null, $limit = null, $cursor = null) { - $this->getLeadConversionStatusWithHttpInfo($id, $conversion_id); + list($response) = $this->searchProjectsWithHttpInfo($term, $fields, $exact_match, $person_id, $organization_id, $limit, $cursor); + return $response; } /** - * Operation getLeadConversionStatusWithHttpInfo + * Operation searchProjectsWithHttpInfo * - * Get Lead conversion status (BETA) + * Search projects * - * @param string $id The ID of a lead (required) - * @param string $conversion_id The ID of the conversion (required) + * @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 projects by the provided person ID (optional) + * @param int|null $organization_id Will filter projects by the provided organization ID (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 $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 null, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v2\Model\ProjectSearchResponse, HTTP status code, HTTP response headers (array of strings) */ - public function getLeadConversionStatusWithHttpInfo($id, $conversion_id) + public function searchProjectsWithHttpInfo($term, $fields = null, $exact_match = null, $person_id = null, $organization_id = null, $limit = null, $cursor = null) { - $request = $this->getLeadConversionStatusRequest($id, $conversion_id); + $request = $this->searchProjectsRequest($term, $fields, $exact_match, $person_id, $organization_id, $limit, $cursor); try { $options = $this->createHttpClientOption(); @@ -2031,7 +5586,7 @@ public function getLeadConversionStatusWithHttpInfo($id, $conversion_id) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getLeadConversionStatusRequest($id, $conversion_id); + $request = $this->searchProjectsRequest($term, $fields, $exact_match, $person_id, $organization_id, $limit, $cursor); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -2053,14 +5608,54 @@ public function getLeadConversionStatusWithHttpInfo($id, $conversion_id) $statusCode = $response->getStatusCode(); - return [null, $statusCode, $response->getHeaders()]; + switch($statusCode) { + case 200: + /* @phpstan-ignore-next-line */ + if ('\Pipedrive\versions\v2\Model\ProjectSearchResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\ProjectSearchResponse', []), + $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\v2\Model\ProjectSearchResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\ProjectSearchResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; } catch (ApiException $e) { switch ($e->getCode()) { - case 404: + case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\GetConvertResponse', + '\Pipedrive\versions\v2\Model\ProjectSearchResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2071,19 +5666,24 @@ public function getLeadConversionStatusWithHttpInfo($id, $conversion_id) } /** - * Operation getLeadConversionStatusAsync + * Operation searchProjectsAsync * - * Get Lead conversion status (BETA) + * Search projects * - * @param string $id The ID of a lead (required) - * @param string $conversion_id The ID of the conversion (required) + * @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 projects by the provided person ID (optional) + * @param int|null $organization_id Will filter projects by the provided organization ID (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 $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 getLeadConversionStatusAsync($id, $conversion_id): PromiseInterface + public function searchProjectsAsync($term, $fields = null, $exact_match = null, $person_id = null, $organization_id = null, $limit = null, $cursor = null): PromiseInterface { - return $this->getLeadConversionStatusAsyncWithHttpInfo($id, $conversion_id) + return $this->searchProjectsAsyncWithHttpInfo($term, $fields, $exact_match, $person_id, $organization_id, $limit, $cursor) ->then( function ($response) { return $response[0]; @@ -2092,26 +5692,42 @@ function ($response) { } /** - * Operation getLeadConversionStatusAsyncWithHttpInfo + * Operation searchProjectsAsyncWithHttpInfo * - * Get Lead conversion status (BETA) + * Search projects * - * @param string $id The ID of a lead (required) - * @param string $conversion_id The ID of the conversion (required) + * @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 projects by the provided person ID (optional) + * @param int|null $organization_id Will filter projects by the provided organization ID (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 $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 getLeadConversionStatusAsyncWithHttpInfo($id, $conversion_id): PromiseInterface + public function searchProjectsAsyncWithHttpInfo($term, $fields = null, $exact_match = null, $person_id = null, $organization_id = null, $limit = null, $cursor = null): PromiseInterface { - $returnType = ''; - $request = $this->getLeadConversionStatusRequest($id, $conversion_id); + $returnType = '\Pipedrive\versions\v2\Model\ProjectSearchResponse'; + $request = $this->searchProjectsRequest($term, $fields, $exact_match, $person_id, $organization_id, $limit, $cursor); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + /* @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(); @@ -2131,56 +5747,94 @@ function ($exception) { } /** - * Create request for operation 'getLeadConversionStatus' + * Create request for operation 'searchProjects' * - * @param string $id The ID of a lead (required) - * @param string $conversion_id The ID of the conversion (required) + * @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 projects by the provided person ID (optional) + * @param int|null $organization_id Will filter projects by the provided organization ID (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 $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 getLeadConversionStatusRequest($id, $conversion_id): Request + public function searchProjectsRequest($term, $fields = null, $exact_match = null, $person_id = null, $organization_id = null, $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 getLeadConversionStatus' - ); - } - // verify the required parameter 'conversion_id' is set + // verify the required parameter 'term' is set /* @phpstan-ignore-next-line */ - if ($conversion_id === null || (is_array($conversion_id) && count($conversion_id) === 0)) { + if ($term === null || (is_array($term) && count($term) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $conversion_id when calling getLeadConversionStatus' + 'Missing the required parameter $term when calling searchProjects' ); } - $resourcePath = '/leads/{id}/convert/status/{conversion_id}'; + $resourcePath = '/projects/search'; $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($term)) { + $term = ObjectSerializer::serializeCollection($term, '', true); } - // path params - if ($conversion_id !== null) { - $resourcePath = str_replace( - '{' . 'conversion_id' . '}', - ObjectSerializer::toPathValue($conversion_id), - $resourcePath - ); + 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($limit)) { + $limit = ObjectSerializer::serializeCollection($limit, '', true); + } + if ($limit !== null) { + $queryParams['limit'] = $limit; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($cursor)) { + $cursor = ObjectSerializer::serializeCollection($cursor, '', true); + } + if ($cursor !== null) { + $queryParams['cursor'] = $cursor; + } + + /* @phpstan-ignore-next-line */ @@ -2256,36 +5910,38 @@ public function getLeadConversionStatusRequest($id, $conversion_id): Request } /** - * Operation getProductImage + * Operation updateProjectBoard * - * Get image of a product + * Update a project board * - * @param int $id The ID of the product (required) + * @param int $id The ID of the project board (required) + * @param \Pipedrive\versions\v2\Model\BoardRequestBody|null $board_request_body board_request_body (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v2\Model\ProductImageResponse + * @return \Pipedrive\versions\v2\Model\PostPatchGetBoard */ - public function getProductImage($id) + public function updateProjectBoard($id, $board_request_body = null) { - list($response) = $this->getProductImageWithHttpInfo($id); + list($response) = $this->updateProjectBoardWithHttpInfo($id, $board_request_body); return $response; } /** - * Operation getProductImageWithHttpInfo + * Operation updateProjectBoardWithHttpInfo * - * Get image of a product + * Update a project board * - * @param int $id The ID of the product (required) + * @param int $id The ID of the project board (required) + * @param \Pipedrive\versions\v2\Model\BoardRequestBody|null $board_request_body (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v2\Model\ProductImageResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v2\Model\PostPatchGetBoard, HTTP status code, HTTP response headers (array of strings) */ - public function getProductImageWithHttpInfo($id) + public function updateProjectBoardWithHttpInfo($id, $board_request_body = null) { - $request = $this->getProductImageRequest($id); + $request = $this->updateProjectBoardRequest($id, $board_request_body); try { $options = $this->createHttpClientOption(); @@ -2294,7 +5950,7 @@ public function getProductImageWithHttpInfo($id) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getProductImageRequest($id); + $request = $this->updateProjectBoardRequest($id, $board_request_body); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -2319,14 +5975,14 @@ public function getProductImageWithHttpInfo($id) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\ProductImageResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\PostPatchGetBoard' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\ProductImageResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetBoard', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2346,14 +6002,14 @@ public function getProductImageWithHttpInfo($id) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\ProductImageResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\PostPatchGetBoard' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\ProductImageResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetBoard', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2363,7 +6019,7 @@ public function getProductImageWithHttpInfo($id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\ProductImageResponse', + '\Pipedrive\versions\v2\Model\PostPatchGetBoard', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2374,18 +6030,19 @@ public function getProductImageWithHttpInfo($id) } /** - * Operation getProductImageAsync + * Operation updateProjectBoardAsync * - * Get image of a product + * Update a project board * - * @param int $id The ID of the product (required) + * @param int $id The ID of the project board (required) + * @param \Pipedrive\versions\v2\Model\BoardRequestBody|null $board_request_body (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getProductImageAsync($id): PromiseInterface + public function updateProjectBoardAsync($id, $board_request_body = null): PromiseInterface { - return $this->getProductImageAsyncWithHttpInfo($id) + return $this->updateProjectBoardAsyncWithHttpInfo($id, $board_request_body) ->then( function ($response) { return $response[0]; @@ -2394,19 +6051,20 @@ function ($response) { } /** - * Operation getProductImageAsyncWithHttpInfo + * Operation updateProjectBoardAsyncWithHttpInfo * - * Get image of a product + * Update a project board * - * @param int $id The ID of the product (required) + * @param int $id The ID of the project board (required) + * @param \Pipedrive\versions\v2\Model\BoardRequestBody|null $board_request_body (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getProductImageAsyncWithHttpInfo($id): PromiseInterface + public function updateProjectBoardAsyncWithHttpInfo($id, $board_request_body = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v2\Model\ProductImageResponse'; - $request = $this->getProductImageRequest($id); + $returnType = '\Pipedrive\versions\v2\Model\PostPatchGetBoard'; + $request = $this->updateProjectBoardRequest($id, $board_request_body); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2443,24 +6101,25 @@ function ($exception) { } /** - * Create request for operation 'getProductImage' + * Create request for operation 'updateProjectBoard' * - * @param int $id The ID of the product (required) + * @param int $id The ID of the project board (required) + * @param \Pipedrive\versions\v2\Model\BoardRequestBody|null $board_request_body (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function getProductImageRequest($id): Request + public function updateProjectBoardRequest($id, $board_request_body = 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 getProductImage' + 'Missing the required parameter $id when calling updateProjectBoard' ); } - $resourcePath = '/products/{id}/images'; + $resourcePath = '/boards/{id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -2487,12 +6146,18 @@ public function getProductImageRequest($id): Request } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - [] + ['application/json'] ); } // for model (json/xml) - if (count($formParams) > 0) { + if (isset($board_request_body)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($board_request_body)); + } else { + $httpBody = $board_request_body; + } + } elseif (count($formParams) > 0) { /* @phpstan-ignore-next-line */ if ($multipart) { $multipartContents = []; @@ -2544,7 +6209,7 @@ public function getProductImageRequest($id): Request $query = Query::build($queryParams); return new Request( - 'GET', + 'PATCH', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -2552,38 +6217,38 @@ public function getProductImageRequest($id): Request } /** - * Operation postInstallment + * Operation updateProjectField * - * Add an installment to a deal + * Update one project field * - * @param int $id The ID of the deal (required) - * @param object|null $body body (optional) + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdateProjectFieldRequest $update_project_field_request update_project_field_request (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v2\Model\AddInstallmentResponse + * @return \Pipedrive\versions\v2\Model\GetProjectField */ - public function postInstallment($id, $body = null) + public function updateProjectField($field_code, $update_project_field_request) { - list($response) = $this->postInstallmentWithHttpInfo($id, $body); + list($response) = $this->updateProjectFieldWithHttpInfo($field_code, $update_project_field_request); return $response; } /** - * Operation postInstallmentWithHttpInfo + * Operation updateProjectFieldWithHttpInfo * - * Add an installment to a deal + * Update one project field * - * @param int $id The ID of the deal (required) - * @param object|null $body (optional) + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdateProjectFieldRequest $update_project_field_request (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v2\Model\AddInstallmentResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v2\Model\GetProjectField, HTTP status code, HTTP response headers (array of strings) */ - public function postInstallmentWithHttpInfo($id, $body = null) + public function updateProjectFieldWithHttpInfo($field_code, $update_project_field_request) { - $request = $this->postInstallmentRequest($id, $body); + $request = $this->updateProjectFieldRequest($field_code, $update_project_field_request); try { $options = $this->createHttpClientOption(); @@ -2592,7 +6257,7 @@ public function postInstallmentWithHttpInfo($id, $body = null) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->postInstallmentRequest($id, $body); + $request = $this->updateProjectFieldRequest($field_code, $update_project_field_request); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -2617,14 +6282,14 @@ public function postInstallmentWithHttpInfo($id, $body = null) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\AddInstallmentResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\GetProjectField' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddInstallmentResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProjectField', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2644,14 +6309,14 @@ public function postInstallmentWithHttpInfo($id, $body = null) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\AddInstallmentResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\GetProjectField' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddInstallmentResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProjectField', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2661,7 +6326,7 @@ public function postInstallmentWithHttpInfo($id, $body = null) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\AddInstallmentResponse', + '\Pipedrive\versions\v2\Model\GetProjectField', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2672,19 +6337,19 @@ public function postInstallmentWithHttpInfo($id, $body = null) } /** - * Operation postInstallmentAsync + * Operation updateProjectFieldAsync * - * Add an installment to a deal + * Update one project field * - * @param int $id The ID of the deal (required) - * @param object|null $body (optional) + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdateProjectFieldRequest $update_project_field_request (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function postInstallmentAsync($id, $body = null): PromiseInterface + public function updateProjectFieldAsync($field_code, $update_project_field_request): PromiseInterface { - return $this->postInstallmentAsyncWithHttpInfo($id, $body) + return $this->updateProjectFieldAsyncWithHttpInfo($field_code, $update_project_field_request) ->then( function ($response) { return $response[0]; @@ -2693,20 +6358,20 @@ function ($response) { } /** - * Operation postInstallmentAsyncWithHttpInfo + * Operation updateProjectFieldAsyncWithHttpInfo * - * Add an installment to a deal + * Update one project field * - * @param int $id The ID of the deal (required) - * @param object|null $body (optional) + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdateProjectFieldRequest $update_project_field_request (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function postInstallmentAsyncWithHttpInfo($id, $body = null): PromiseInterface + public function updateProjectFieldAsyncWithHttpInfo($field_code, $update_project_field_request): PromiseInterface { - $returnType = '\Pipedrive\versions\v2\Model\AddInstallmentResponse'; - $request = $this->postInstallmentRequest($id, $body); + $returnType = '\Pipedrive\versions\v2\Model\GetProjectField'; + $request = $this->updateProjectFieldRequest($field_code, $update_project_field_request); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2743,25 +6408,32 @@ function ($exception) { } /** - * Create request for operation 'postInstallment' + * Create request for operation 'updateProjectField' * - * @param int $id The ID of the deal (required) - * @param object|null $body (optional) + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdateProjectFieldRequest $update_project_field_request (required) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function postInstallmentRequest($id, $body = null): Request + public function updateProjectFieldRequest($field_code, $update_project_field_request): Request { - // verify the required parameter 'id' is set + // verify the required parameter 'field_code' is set /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { + if ($field_code === null || (is_array($field_code) && count($field_code) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $field_code when calling updateProjectField' + ); + } + // verify the required parameter 'update_project_field_request' is set + /* @phpstan-ignore-next-line */ + if ($update_project_field_request === null || (is_array($update_project_field_request) && count($update_project_field_request) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling postInstallment' + 'Missing the required parameter $update_project_field_request when calling updateProjectField' ); } - $resourcePath = '/deals/{id}/installments'; + $resourcePath = '/projectFields/{field_code}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -2771,10 +6443,10 @@ public function postInstallmentRequest($id, $body = null): Request // path params - if ($id !== null) { + if ($field_code !== null) { $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), + '{' . 'field_code' . '}', + ObjectSerializer::toPathValue($field_code), $resourcePath ); } @@ -2793,11 +6465,11 @@ public function postInstallmentRequest($id, $body = null): Request } // for model (json/xml) - if (isset($body)) { + if (isset($update_project_field_request)) { if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_project_field_request)); } else { - $httpBody = $body; + $httpBody = $update_project_field_request; } } elseif (count($formParams) > 0) { /* @phpstan-ignore-next-line */ @@ -2851,7 +6523,7 @@ public function postInstallmentRequest($id, $body = null): Request $query = Query::build($queryParams); return new Request( - 'POST', + 'PATCH', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -2859,40 +6531,38 @@ public function postInstallmentRequest($id, $body = null): Request } /** - * Operation updateInstallment + * Operation updateProjectFieldOptions * - * Update an installment added to a deal + * Update project field options in bulk * - * @param int $id The ID of the deal (required) - * @param int $installment_id The ID of the installment (required) - * @param object|null $body body (optional) + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body request_body (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v2\Model\UpdateInstallmentResponse + * @return \Pipedrive\versions\v2\Model\InlineResponse200 */ - public function updateInstallment($id, $installment_id, $body = null) + public function updateProjectFieldOptions($field_code, $request_body) { - list($response) = $this->updateInstallmentWithHttpInfo($id, $installment_id, $body); + list($response) = $this->updateProjectFieldOptionsWithHttpInfo($field_code, $request_body); return $response; } /** - * Operation updateInstallmentWithHttpInfo + * Operation updateProjectFieldOptionsWithHttpInfo * - * Update an installment added to a deal + * Update project field options in bulk * - * @param int $id The ID of the deal (required) - * @param int $installment_id The ID of the installment (required) - * @param object|null $body (optional) + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v2\Model\UpdateInstallmentResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v2\Model\InlineResponse200, HTTP status code, HTTP response headers (array of strings) */ - public function updateInstallmentWithHttpInfo($id, $installment_id, $body = null) + public function updateProjectFieldOptionsWithHttpInfo($field_code, $request_body) { - $request = $this->updateInstallmentRequest($id, $installment_id, $body); + $request = $this->updateProjectFieldOptionsRequest($field_code, $request_body); try { $options = $this->createHttpClientOption(); @@ -2901,7 +6571,7 @@ public function updateInstallmentWithHttpInfo($id, $installment_id, $body = null } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->updateInstallmentRequest($id, $installment_id, $body); + $request = $this->updateProjectFieldOptionsRequest($field_code, $request_body); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -2926,14 +6596,14 @@ public function updateInstallmentWithHttpInfo($id, $installment_id, $body = null switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\UpdateInstallmentResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\InlineResponse200' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\UpdateInstallmentResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\InlineResponse200', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2953,14 +6623,14 @@ public function updateInstallmentWithHttpInfo($id, $installment_id, $body = null } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\UpdateInstallmentResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\InlineResponse200' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\UpdateInstallmentResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\InlineResponse200', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2970,7 +6640,7 @@ public function updateInstallmentWithHttpInfo($id, $installment_id, $body = null case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\UpdateInstallmentResponse', + '\Pipedrive\versions\v2\Model\InlineResponse200', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2981,20 +6651,19 @@ public function updateInstallmentWithHttpInfo($id, $installment_id, $body = null } /** - * Operation updateInstallmentAsync + * Operation updateProjectFieldOptionsAsync * - * Update an installment added to a deal + * Update project field options in bulk * - * @param int $id The ID of the deal (required) - * @param int $installment_id The ID of the installment (required) - * @param object|null $body (optional) + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function updateInstallmentAsync($id, $installment_id, $body = null): PromiseInterface + public function updateProjectFieldOptionsAsync($field_code, $request_body): PromiseInterface { - return $this->updateInstallmentAsyncWithHttpInfo($id, $installment_id, $body) + return $this->updateProjectFieldOptionsAsyncWithHttpInfo($field_code, $request_body) ->then( function ($response) { return $response[0]; @@ -3003,21 +6672,20 @@ function ($response) { } /** - * Operation updateInstallmentAsyncWithHttpInfo + * Operation updateProjectFieldOptionsAsyncWithHttpInfo * - * Update an installment added to a deal + * Update project field options in bulk * - * @param int $id The ID of the deal (required) - * @param int $installment_id The ID of the installment (required) - * @param object|null $body (optional) + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function updateInstallmentAsyncWithHttpInfo($id, $installment_id, $body = null): PromiseInterface + public function updateProjectFieldOptionsAsyncWithHttpInfo($field_code, $request_body): PromiseInterface { - $returnType = '\Pipedrive\versions\v2\Model\UpdateInstallmentResponse'; - $request = $this->updateInstallmentRequest($id, $installment_id, $body); + $returnType = '\Pipedrive\versions\v2\Model\InlineResponse200'; + $request = $this->updateProjectFieldOptionsRequest($field_code, $request_body); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3054,33 +6722,32 @@ function ($exception) { } /** - * Create request for operation 'updateInstallment' + * Create request for operation 'updateProjectFieldOptions' * - * @param int $id The ID of the deal (required) - * @param int $installment_id The ID of the installment (required) - * @param object|null $body (optional) + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function updateInstallmentRequest($id, $installment_id, $body = null): Request + public function updateProjectFieldOptionsRequest($field_code, $request_body): Request { - // verify the required parameter 'id' is set + // verify the required parameter 'field_code' is set /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { + if ($field_code === null || (is_array($field_code) && count($field_code) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling updateInstallment' + 'Missing the required parameter $field_code when calling updateProjectFieldOptions' ); } - // verify the required parameter 'installment_id' is set + // verify the required parameter 'request_body' is set /* @phpstan-ignore-next-line */ - if ($installment_id === null || (is_array($installment_id) && count($installment_id) === 0)) { + if ($request_body === null || (is_array($request_body) && count($request_body) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $installment_id when calling updateInstallment' + 'Missing the required parameter $request_body when calling updateProjectFieldOptions' ); } - $resourcePath = '/deals/{id}/installments/{installment_id}'; + $resourcePath = '/projectFields/{field_code}/options'; $formParams = []; $queryParams = []; $headerParams = []; @@ -3090,18 +6757,10 @@ public function updateInstallmentRequest($id, $installment_id, $body = null): Re // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - // path params - if ($installment_id !== null) { + if ($field_code !== null) { $resourcePath = str_replace( - '{' . 'installment_id' . '}', - ObjectSerializer::toPathValue($installment_id), + '{' . 'field_code' . '}', + ObjectSerializer::toPathValue($field_code), $resourcePath ); } @@ -3120,11 +6779,11 @@ public function updateInstallmentRequest($id, $installment_id, $body = null): Re } // for model (json/xml) - if (isset($body)) { + if (isset($request_body)) { if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request_body)); } else { - $httpBody = $body; + $httpBody = $request_body; } } elseif (count($formParams) > 0) { /* @phpstan-ignore-next-line */ @@ -3186,38 +6845,38 @@ public function updateInstallmentRequest($id, $installment_id, $body = null): Re } /** - * Operation updateProductImage + * Operation updateProjectPhase * - * Update an image for a product + * Update a project phase * - * @param int $id The ID of the product (required) - * @param \SplFileObject $data One image supplied in the multipart/form-data encoding (required) + * @param int $id The ID of the project phase (required) + * @param \Pipedrive\versions\v2\Model\PhaseRequestBody|null $phase_request_body phase_request_body (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v2\Model\UpdateProductImageResponse + * @return \Pipedrive\versions\v2\Model\PostPatchGetPhase */ - public function updateProductImage($id, $data) + public function updateProjectPhase($id, $phase_request_body = null) { - list($response) = $this->updateProductImageWithHttpInfo($id, $data); + list($response) = $this->updateProjectPhaseWithHttpInfo($id, $phase_request_body); return $response; } /** - * Operation updateProductImageWithHttpInfo + * Operation updateProjectPhaseWithHttpInfo * - * Update an image for a product + * Update a project phase * - * @param int $id The ID of the product (required) - * @param \SplFileObject $data One image supplied in the multipart/form-data encoding (required) + * @param int $id The ID of the project phase (required) + * @param \Pipedrive\versions\v2\Model\PhaseRequestBody|null $phase_request_body (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v2\Model\UpdateProductImageResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v2\Model\PostPatchGetPhase, HTTP status code, HTTP response headers (array of strings) */ - public function updateProductImageWithHttpInfo($id, $data) + public function updateProjectPhaseWithHttpInfo($id, $phase_request_body = null) { - $request = $this->updateProductImageRequest($id, $data); + $request = $this->updateProjectPhaseRequest($id, $phase_request_body); try { $options = $this->createHttpClientOption(); @@ -3226,7 +6885,7 @@ public function updateProductImageWithHttpInfo($id, $data) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->updateProductImageRequest($id, $data); + $request = $this->updateProjectPhaseRequest($id, $phase_request_body); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -3251,14 +6910,14 @@ public function updateProductImageWithHttpInfo($id, $data) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\UpdateProductImageResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\PostPatchGetPhase' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\UpdateProductImageResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetPhase', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -3278,14 +6937,14 @@ public function updateProductImageWithHttpInfo($id, $data) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\UpdateProductImageResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\PostPatchGetPhase' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\UpdateProductImageResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetPhase', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -3295,7 +6954,7 @@ public function updateProductImageWithHttpInfo($id, $data) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\UpdateProductImageResponse', + '\Pipedrive\versions\v2\Model\PostPatchGetPhase', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3306,19 +6965,19 @@ public function updateProductImageWithHttpInfo($id, $data) } /** - * Operation updateProductImageAsync + * Operation updateProjectPhaseAsync * - * Update an image for a product + * Update a project phase * - * @param int $id The ID of the product (required) - * @param \SplFileObject $data One image supplied in the multipart/form-data encoding (required) + * @param int $id The ID of the project phase (required) + * @param \Pipedrive\versions\v2\Model\PhaseRequestBody|null $phase_request_body (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function updateProductImageAsync($id, $data): PromiseInterface + public function updateProjectPhaseAsync($id, $phase_request_body = null): PromiseInterface { - return $this->updateProductImageAsyncWithHttpInfo($id, $data) + return $this->updateProjectPhaseAsyncWithHttpInfo($id, $phase_request_body) ->then( function ($response) { return $response[0]; @@ -3327,20 +6986,20 @@ function ($response) { } /** - * Operation updateProductImageAsyncWithHttpInfo + * Operation updateProjectPhaseAsyncWithHttpInfo * - * Update an image for a product + * Update a project phase * - * @param int $id The ID of the product (required) - * @param \SplFileObject $data One image supplied in the multipart/form-data encoding (required) + * @param int $id The ID of the project phase (required) + * @param \Pipedrive\versions\v2\Model\PhaseRequestBody|null $phase_request_body (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function updateProductImageAsyncWithHttpInfo($id, $data): PromiseInterface + public function updateProjectPhaseAsyncWithHttpInfo($id, $phase_request_body = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v2\Model\UpdateProductImageResponse'; - $request = $this->updateProductImageRequest($id, $data); + $returnType = '\Pipedrive\versions\v2\Model\PostPatchGetPhase'; + $request = $this->updateProjectPhaseRequest($id, $phase_request_body); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3377,32 +7036,25 @@ function ($exception) { } /** - * Create request for operation 'updateProductImage' + * Create request for operation 'updateProjectPhase' * - * @param int $id The ID of the product (required) - * @param \SplFileObject $data One image supplied in the multipart/form-data encoding (required) + * @param int $id The ID of the project phase (required) + * @param \Pipedrive\versions\v2\Model\PhaseRequestBody|null $phase_request_body (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function updateProductImageRequest($id, $data): Request + public function updateProjectPhaseRequest($id, $phase_request_body = 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 updateProductImage' - ); - } - // verify the required parameter 'data' is set - /* @phpstan-ignore-next-line */ - if ($data === null || (is_array($data) && count($data) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $data when calling updateProductImage' + 'Missing the required parameter $id when calling updateProjectPhase' ); } - $resourcePath = '/products/{id}/images'; + $resourcePath = '/phases/{id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -3420,19 +7072,6 @@ public function updateProductImageRequest($id, $data): Request ); } - // form params - if ($data !== null) { - $multipart = true; - $formParams['data'] = []; - /* @phpstan-ignore-next-line */ - $paramFiles = is_array($data) ? $data : [$data]; - foreach ($paramFiles as $paramFile) { - $formParams['data'][] = \GuzzleHttp\Psr7\Utils::tryFopen( - ObjectSerializer::toFormValue($paramFile), - 'rb' - ); - } - } /* @phpstan-ignore-next-line */ if ($multipart) { @@ -3442,12 +7081,18 @@ public function updateProductImageRequest($id, $data): Request } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - ['multipart/form-data'] + ['application/json'] ); } // for model (json/xml) - if (count($formParams) > 0) { + if (isset($phase_request_body)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($phase_request_body)); + } else { + $httpBody = $phase_request_body; + } + } elseif (count($formParams) > 0) { /* @phpstan-ignore-next-line */ if ($multipart) { $multipartContents = []; @@ -3499,7 +7144,7 @@ public function updateProductImageRequest($id, $data): Request $query = Query::build($queryParams); return new Request( - 'PUT', + 'PATCH', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -3507,38 +7152,38 @@ public function updateProductImageRequest($id, $data): Request } /** - * Operation uploadProductImage + * Operation updateTask * - * Upload an image for a product + * Update a task * - * @param int $id The ID of the product (required) - * @param \SplFileObject $data One image supplied in the multipart/form-data encoding (required) + * @param int $id The ID of the task (required) + * @param \Pipedrive\versions\v2\Model\TaskPatchRequest|null $task_patch_request task_patch_request (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v2\Model\AddProductImageResponse + * @return \Pipedrive\versions\v2\Model\UpdateTaskResponse */ - public function uploadProductImage($id, $data) + public function updateTask($id, $task_patch_request = null) { - list($response) = $this->uploadProductImageWithHttpInfo($id, $data); + list($response) = $this->updateTaskWithHttpInfo($id, $task_patch_request); return $response; } /** - * Operation uploadProductImageWithHttpInfo + * Operation updateTaskWithHttpInfo * - * Upload an image for a product + * Update a task * - * @param int $id The ID of the product (required) - * @param \SplFileObject $data One image supplied in the multipart/form-data encoding (required) + * @param int $id The ID of the task (required) + * @param \Pipedrive\versions\v2\Model\TaskPatchRequest|null $task_patch_request (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v2\Model\AddProductImageResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v2\Model\UpdateTaskResponse, HTTP status code, HTTP response headers (array of strings) */ - public function uploadProductImageWithHttpInfo($id, $data) + public function updateTaskWithHttpInfo($id, $task_patch_request = null) { - $request = $this->uploadProductImageRequest($id, $data); + $request = $this->updateTaskRequest($id, $task_patch_request); try { $options = $this->createHttpClientOption(); @@ -3547,7 +7192,7 @@ public function uploadProductImageWithHttpInfo($id, $data) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->uploadProductImageRequest($id, $data); + $request = $this->updateTaskRequest($id, $task_patch_request); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -3570,16 +7215,16 @@ public function uploadProductImageWithHttpInfo($id, $data) switch($statusCode) { - case 201: + case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\AddProductImageResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\UpdateTaskResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddProductImageResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\UpdateTaskResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -3599,24 +7244,24 @@ public function uploadProductImageWithHttpInfo($id, $data) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\AddProductImageResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\UpdateTaskResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddProductImageResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\UpdateTaskResponse', []), $response->getStatusCode(), $response->getHeaders() ]; } catch (ApiException $e) { switch ($e->getCode()) { - case 201: + case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\AddProductImageResponse', + '\Pipedrive\versions\v2\Model\UpdateTaskResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3627,19 +7272,19 @@ public function uploadProductImageWithHttpInfo($id, $data) } /** - * Operation uploadProductImageAsync + * Operation updateTaskAsync * - * Upload an image for a product + * Update a task * - * @param int $id The ID of the product (required) - * @param \SplFileObject $data One image supplied in the multipart/form-data encoding (required) + * @param int $id The ID of the task (required) + * @param \Pipedrive\versions\v2\Model\TaskPatchRequest|null $task_patch_request (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function uploadProductImageAsync($id, $data): PromiseInterface + public function updateTaskAsync($id, $task_patch_request = null): PromiseInterface { - return $this->uploadProductImageAsyncWithHttpInfo($id, $data) + return $this->updateTaskAsyncWithHttpInfo($id, $task_patch_request) ->then( function ($response) { return $response[0]; @@ -3648,20 +7293,20 @@ function ($response) { } /** - * Operation uploadProductImageAsyncWithHttpInfo + * Operation updateTaskAsyncWithHttpInfo * - * Upload an image for a product + * Update a task * - * @param int $id The ID of the product (required) - * @param \SplFileObject $data One image supplied in the multipart/form-data encoding (required) + * @param int $id The ID of the task (required) + * @param \Pipedrive\versions\v2\Model\TaskPatchRequest|null $task_patch_request (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function uploadProductImageAsyncWithHttpInfo($id, $data): PromiseInterface + public function updateTaskAsyncWithHttpInfo($id, $task_patch_request = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v2\Model\AddProductImageResponse'; - $request = $this->uploadProductImageRequest($id, $data); + $returnType = '\Pipedrive\versions\v2\Model\UpdateTaskResponse'; + $request = $this->updateTaskRequest($id, $task_patch_request); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3698,32 +7343,25 @@ function ($exception) { } /** - * Create request for operation 'uploadProductImage' + * Create request for operation 'updateTask' * - * @param int $id The ID of the product (required) - * @param \SplFileObject $data One image supplied in the multipart/form-data encoding (required) + * @param int $id The ID of the task (required) + * @param \Pipedrive\versions\v2\Model\TaskPatchRequest|null $task_patch_request (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function uploadProductImageRequest($id, $data): Request + public function updateTaskRequest($id, $task_patch_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 uploadProductImage' - ); - } - // verify the required parameter 'data' is set - /* @phpstan-ignore-next-line */ - if ($data === null || (is_array($data) && count($data) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $data when calling uploadProductImage' + 'Missing the required parameter $id when calling updateTask' ); } - $resourcePath = '/products/{id}/images'; + $resourcePath = '/tasks/{id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -3741,19 +7379,6 @@ public function uploadProductImageRequest($id, $data): Request ); } - // form params - if ($data !== null) { - $multipart = true; - $formParams['data'] = []; - /* @phpstan-ignore-next-line */ - $paramFiles = is_array($data) ? $data : [$data]; - foreach ($paramFiles as $paramFile) { - $formParams['data'][] = \GuzzleHttp\Psr7\Utils::tryFopen( - ObjectSerializer::toFormValue($paramFile), - 'rb' - ); - } - } /* @phpstan-ignore-next-line */ if ($multipart) { @@ -3763,12 +7388,18 @@ public function uploadProductImageRequest($id, $data): Request } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - ['multipart/form-data'] + ['application/json'] ); } // for model (json/xml) - if (count($formParams) > 0) { + if (isset($task_patch_request)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($task_patch_request)); + } else { + $httpBody = $task_patch_request; + } + } elseif (count($formParams) > 0) { /* @phpstan-ignore-next-line */ if ($multipart) { $multipartContents = []; @@ -3820,7 +7451,7 @@ public function uploadProductImageRequest($id, $data): Request $query = Query::build($queryParams); return new Request( - 'POST', + 'PATCH', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody diff --git a/lib/versions/v2/Api/DealInstallmentsApi.php b/lib/versions/v2/Api/DealInstallmentsApi.php new file mode 100644 index 00000000..ce13f760 --- /dev/null +++ b/lib/versions/v2/Api/DealInstallmentsApi.php @@ -0,0 +1,1441 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation deleteInstallment + * + * Delete an installment from a deal + * + * @param int $id The ID of the deal (required) + * @param int $installment_id The ID of the installment (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\DeleteInstallmentResponse + */ + public function deleteInstallment($id, $installment_id) + { + list($response) = $this->deleteInstallmentWithHttpInfo($id, $installment_id); + return $response; + } + + /** + * Operation deleteInstallmentWithHttpInfo + * + * Delete an installment from a deal + * + * @param int $id The ID of the deal (required) + * @param int $installment_id The ID of the installment (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\DeleteInstallmentResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteInstallmentWithHttpInfo($id, $installment_id) + { + $request = $this->deleteInstallmentRequest($id, $installment_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->deleteInstallmentRequest($id, $installment_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\v2\Model\DeleteInstallmentResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteInstallmentResponse', []), + $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\v2\Model\DeleteInstallmentResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteInstallmentResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\DeleteInstallmentResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteInstallmentAsync + * + * Delete an installment from a deal + * + * @param int $id The ID of the deal (required) + * @param int $installment_id The ID of the installment (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteInstallmentAsync($id, $installment_id): PromiseInterface + { + return $this->deleteInstallmentAsyncWithHttpInfo($id, $installment_id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteInstallmentAsyncWithHttpInfo + * + * Delete an installment from a deal + * + * @param int $id The ID of the deal (required) + * @param int $installment_id The ID of the installment (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteInstallmentAsyncWithHttpInfo($id, $installment_id): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\DeleteInstallmentResponse'; + $request = $this->deleteInstallmentRequest($id, $installment_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 'deleteInstallment' + * + * @param int $id The ID of the deal (required) + * @param int $installment_id The ID of the installment (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function deleteInstallmentRequest($id, $installment_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 deleteInstallment' + ); + } + // verify the required parameter 'installment_id' is set + /* @phpstan-ignore-next-line */ + if ($installment_id === null || (is_array($installment_id) && count($installment_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $installment_id when calling deleteInstallment' + ); + } + + $resourcePath = '/deals/{id}/installments/{installment_id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + // path params + if ($installment_id !== null) { + $resourcePath = str_replace( + '{' . 'installment_id' . '}', + ObjectSerializer::toPathValue($installment_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 getInstallments + * + * List installments added to a list of deals + * + * @param int[] $deal_ids An array of integers with the IDs of the deals for which the attached installments will be returned. A maximum of 100 deal IDs can be provided. (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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `billing_date`, `deal_id`. (optional, default to 'id') + * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\InstallmentsResponse + */ + public function getInstallments($deal_ids, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc') + { + list($response) = $this->getInstallmentsWithHttpInfo($deal_ids, $cursor, $limit, $sort_by, $sort_direction); + return $response; + } + + /** + * Operation getInstallmentsWithHttpInfo + * + * List installments added to a list of deals + * + * @param int[] $deal_ids An array of integers with the IDs of the deals for which the attached installments will be returned. A maximum of 100 deal IDs can be provided. (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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `billing_date`, `deal_id`. (optional, default to 'id') + * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\InstallmentsResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getInstallmentsWithHttpInfo($deal_ids, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc') + { + $request = $this->getInstallmentsRequest($deal_ids, $cursor, $limit, $sort_by, $sort_direction); + + 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->getInstallmentsRequest($deal_ids, $cursor, $limit, $sort_by, $sort_direction); + $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\v2\Model\InstallmentsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\InstallmentsResponse', []), + $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\v2\Model\InstallmentsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\InstallmentsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\InstallmentsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getInstallmentsAsync + * + * List installments added to a list of deals + * + * @param int[] $deal_ids An array of integers with the IDs of the deals for which the attached installments will be returned. A maximum of 100 deal IDs can be provided. (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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `billing_date`, `deal_id`. (optional, default to 'id') + * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getInstallmentsAsync($deal_ids, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc'): PromiseInterface + { + return $this->getInstallmentsAsyncWithHttpInfo($deal_ids, $cursor, $limit, $sort_by, $sort_direction) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getInstallmentsAsyncWithHttpInfo + * + * List installments added to a list of deals + * + * @param int[] $deal_ids An array of integers with the IDs of the deals for which the attached installments will be returned. A maximum of 100 deal IDs can be provided. (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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `billing_date`, `deal_id`. (optional, default to 'id') + * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getInstallmentsAsyncWithHttpInfo($deal_ids, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc'): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\InstallmentsResponse'; + $request = $this->getInstallmentsRequest($deal_ids, $cursor, $limit, $sort_by, $sort_direction); + + 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 'getInstallments' + * + * @param int[] $deal_ids An array of integers with the IDs of the deals for which the attached installments will be returned. A maximum of 100 deal IDs can be provided. (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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `billing_date`, `deal_id`. (optional, default to 'id') + * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function getInstallmentsRequest($deal_ids, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc'): Request + { + // verify the required parameter 'deal_ids' is set + /* @phpstan-ignore-next-line */ + if ($deal_ids === null || (is_array($deal_ids) && count($deal_ids) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $deal_ids when calling getInstallments' + ); + } + + $resourcePath = '/deals/installments'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + /* @phpstan-ignore-next-line */ + if (is_array($deal_ids)) { + $deal_ids = ObjectSerializer::serializeCollection($deal_ids, 'csv', true); + } + if ($deal_ids !== null) { + $queryParams['deal_ids'] = $deal_ids; + } + // 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($sort_by)) { + $sort_by = ObjectSerializer::serializeCollection($sort_by, '', true); + } + if ($sort_by !== null) { + $queryParams['sort_by'] = $sort_by; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($sort_direction)) { + $sort_direction = ObjectSerializer::serializeCollection($sort_direction, '', true); + } + if ($sort_direction !== null) { + $queryParams['sort_direction'] = $sort_direction; + } + + + + + /* @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 postInstallment + * + * Add an installment to a deal + * + * @param int $id The ID of the deal (required) + * @param object|null $body body (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\AddInstallmentResponse + */ + public function postInstallment($id, $body = null) + { + list($response) = $this->postInstallmentWithHttpInfo($id, $body); + return $response; + } + + /** + * Operation postInstallmentWithHttpInfo + * + * Add an installment to a deal + * + * @param int $id The ID of the deal (required) + * @param object|null $body (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\AddInstallmentResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function postInstallmentWithHttpInfo($id, $body = null) + { + $request = $this->postInstallmentRequest($id, $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->postInstallmentRequest($id, $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 200: + /* @phpstan-ignore-next-line */ + if ('\Pipedrive\versions\v2\Model\AddInstallmentResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddInstallmentResponse', []), + $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\v2\Model\AddInstallmentResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddInstallmentResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\AddInstallmentResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation postInstallmentAsync + * + * Add an installment to a deal + * + * @param int $id The ID of the deal (required) + * @param object|null $body (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function postInstallmentAsync($id, $body = null): PromiseInterface + { + return $this->postInstallmentAsyncWithHttpInfo($id, $body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation postInstallmentAsyncWithHttpInfo + * + * Add an installment to a deal + * + * @param int $id The ID of the deal (required) + * @param object|null $body (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function postInstallmentAsyncWithHttpInfo($id, $body = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\AddInstallmentResponse'; + $request = $this->postInstallmentRequest($id, $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 'postInstallment' + * + * @param int $id The ID of the deal (required) + * @param object|null $body (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function postInstallmentRequest($id, $body = 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 postInstallment' + ); + } + + $resourcePath = '/deals/{id}/installments'; + $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($body)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $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 updateInstallment + * + * Update an installment added to a deal + * + * @param int $id The ID of the deal (required) + * @param int $installment_id The ID of the installment (required) + * @param object|null $body body (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\UpdateInstallmentResponse + */ + public function updateInstallment($id, $installment_id, $body = null) + { + list($response) = $this->updateInstallmentWithHttpInfo($id, $installment_id, $body); + return $response; + } + + /** + * Operation updateInstallmentWithHttpInfo + * + * Update an installment added to a deal + * + * @param int $id The ID of the deal (required) + * @param int $installment_id The ID of the installment (required) + * @param object|null $body (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\UpdateInstallmentResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function updateInstallmentWithHttpInfo($id, $installment_id, $body = null) + { + $request = $this->updateInstallmentRequest($id, $installment_id, $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->updateInstallmentRequest($id, $installment_id, $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 200: + /* @phpstan-ignore-next-line */ + if ('\Pipedrive\versions\v2\Model\UpdateInstallmentResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\UpdateInstallmentResponse', []), + $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\v2\Model\UpdateInstallmentResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\UpdateInstallmentResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\UpdateInstallmentResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateInstallmentAsync + * + * Update an installment added to a deal + * + * @param int $id The ID of the deal (required) + * @param int $installment_id The ID of the installment (required) + * @param object|null $body (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function updateInstallmentAsync($id, $installment_id, $body = null): PromiseInterface + { + return $this->updateInstallmentAsyncWithHttpInfo($id, $installment_id, $body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateInstallmentAsyncWithHttpInfo + * + * Update an installment added to a deal + * + * @param int $id The ID of the deal (required) + * @param int $installment_id The ID of the installment (required) + * @param object|null $body (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function updateInstallmentAsyncWithHttpInfo($id, $installment_id, $body = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\UpdateInstallmentResponse'; + $request = $this->updateInstallmentRequest($id, $installment_id, $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 'updateInstallment' + * + * @param int $id The ID of the deal (required) + * @param int $installment_id The ID of the installment (required) + * @param object|null $body (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function updateInstallmentRequest($id, $installment_id, $body = 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 updateInstallment' + ); + } + // verify the required parameter 'installment_id' is set + /* @phpstan-ignore-next-line */ + if ($installment_id === null || (is_array($installment_id) && count($installment_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $installment_id when calling updateInstallment' + ); + } + + $resourcePath = '/deals/{id}/installments/{installment_id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + // path params + if ($installment_id !== null) { + $resourcePath = str_replace( + '{' . 'installment_id' . '}', + ObjectSerializer::toPathValue($installment_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($body)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $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( + 'PATCH', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/versions/v2/Api/DealProductsApi.php b/lib/versions/v2/Api/DealProductsApi.php new file mode 100644 index 00000000..3b854a68 --- /dev/null +++ b/lib/versions/v2/Api/DealProductsApi.php @@ -0,0 +1,2405 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation addDealProduct + * + * Add a product to a deal + * + * @param int $id The ID of the deal (required) + * @param \Pipedrive\versions\v2\Model\NewDealProductRequestBody|null $new_deal_product_request_body new_deal_product_request_body (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\AddDealProductResponse + */ + public function addDealProduct($id, $new_deal_product_request_body = null) + { + list($response) = $this->addDealProductWithHttpInfo($id, $new_deal_product_request_body); + return $response; + } + + /** + * Operation addDealProductWithHttpInfo + * + * Add a product to a deal + * + * @param int $id The ID of the deal (required) + * @param \Pipedrive\versions\v2\Model\NewDealProductRequestBody|null $new_deal_product_request_body (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\AddDealProductResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function addDealProductWithHttpInfo($id, $new_deal_product_request_body = null) + { + $request = $this->addDealProductRequest($id, $new_deal_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->addDealProductRequest($id, $new_deal_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\v2\Model\AddDealProductResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddDealProductResponse', []), + $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\v2\Model\AddDealProductResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddDealProductResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\AddDealProductResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation addDealProductAsync + * + * Add a product to a deal + * + * @param int $id The ID of the deal (required) + * @param \Pipedrive\versions\v2\Model\NewDealProductRequestBody|null $new_deal_product_request_body (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addDealProductAsync($id, $new_deal_product_request_body = null): PromiseInterface + { + return $this->addDealProductAsyncWithHttpInfo($id, $new_deal_product_request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addDealProductAsyncWithHttpInfo + * + * Add a product to a deal + * + * @param int $id The ID of the deal (required) + * @param \Pipedrive\versions\v2\Model\NewDealProductRequestBody|null $new_deal_product_request_body (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addDealProductAsyncWithHttpInfo($id, $new_deal_product_request_body = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\AddDealProductResponse'; + $request = $this->addDealProductRequest($id, $new_deal_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 'addDealProduct' + * + * @param int $id The ID of the deal (required) + * @param \Pipedrive\versions\v2\Model\NewDealProductRequestBody|null $new_deal_product_request_body (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function addDealProductRequest($id, $new_deal_product_request_body = 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 addDealProduct' + ); + } + + $resourcePath = '/deals/{id}/products'; + $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($new_deal_product_request_body)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($new_deal_product_request_body)); + } else { + $httpBody = $new_deal_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 addManyDealProducts + * + * Add multiple products to a deal + * + * @param int $id The ID of the deal (required) + * @param \Pipedrive\versions\v2\Model\CreateManyDealProductRequestBody|null $create_many_deal_product_request_body create_many_deal_product_request_body (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\CreateManyDealProductResponse + */ + public function addManyDealProducts($id, $create_many_deal_product_request_body = null) + { + list($response) = $this->addManyDealProductsWithHttpInfo($id, $create_many_deal_product_request_body); + return $response; + } + + /** + * Operation addManyDealProductsWithHttpInfo + * + * Add multiple products to a deal + * + * @param int $id The ID of the deal (required) + * @param \Pipedrive\versions\v2\Model\CreateManyDealProductRequestBody|null $create_many_deal_product_request_body (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\CreateManyDealProductResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function addManyDealProductsWithHttpInfo($id, $create_many_deal_product_request_body = null) + { + $request = $this->addManyDealProductsRequest($id, $create_many_deal_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->addManyDealProductsRequest($id, $create_many_deal_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\v2\Model\CreateManyDealProductResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\CreateManyDealProductResponse', []), + $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\v2\Model\CreateManyDealProductResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\CreateManyDealProductResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\CreateManyDealProductResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation addManyDealProductsAsync + * + * Add multiple products to a deal + * + * @param int $id The ID of the deal (required) + * @param \Pipedrive\versions\v2\Model\CreateManyDealProductRequestBody|null $create_many_deal_product_request_body (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addManyDealProductsAsync($id, $create_many_deal_product_request_body = null): PromiseInterface + { + return $this->addManyDealProductsAsyncWithHttpInfo($id, $create_many_deal_product_request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addManyDealProductsAsyncWithHttpInfo + * + * Add multiple products to a deal + * + * @param int $id The ID of the deal (required) + * @param \Pipedrive\versions\v2\Model\CreateManyDealProductRequestBody|null $create_many_deal_product_request_body (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addManyDealProductsAsyncWithHttpInfo($id, $create_many_deal_product_request_body = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\CreateManyDealProductResponse'; + $request = $this->addManyDealProductsRequest($id, $create_many_deal_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 'addManyDealProducts' + * + * @param int $id The ID of the deal (required) + * @param \Pipedrive\versions\v2\Model\CreateManyDealProductRequestBody|null $create_many_deal_product_request_body (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function addManyDealProductsRequest($id, $create_many_deal_product_request_body = 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 addManyDealProducts' + ); + } + + $resourcePath = '/deals/{id}/products/bulk'; + $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($create_many_deal_product_request_body)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($create_many_deal_product_request_body)); + } else { + $httpBody = $create_many_deal_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 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\v2\Model\DeleteDealProduct + */ + 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\v2\Model\DeleteDealProduct, HTTP status code, HTTP response headers (array of strings) + */ + 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\v2\Model\DeleteDealProduct' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\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\v2\Model\DeleteDealProduct' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteDealProduct', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\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 + */ + 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 + */ + public function deleteDealProductAsyncWithHttpInfo($id, $product_attachment_id): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\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 + */ + 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 deleteManyDealProducts + * + * Delete many products from a deal + * + * @param int $id The ID of the deal (required) + * @param string|null $ids Comma-separated list of deal product IDs to delete. If not provided, all deal products will be deleted up to 100 items. Maximum 100 IDs allowed. (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\DeleteManyDealProductResponse + */ + public function deleteManyDealProducts($id, $ids = null) + { + list($response) = $this->deleteManyDealProductsWithHttpInfo($id, $ids); + return $response; + } + + /** + * Operation deleteManyDealProductsWithHttpInfo + * + * Delete many products from a deal + * + * @param int $id The ID of the deal (required) + * @param string|null $ids Comma-separated list of deal product IDs to delete. If not provided, all deal products will be deleted up to 100 items. Maximum 100 IDs allowed. (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\DeleteManyDealProductResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteManyDealProductsWithHttpInfo($id, $ids = null) + { + $request = $this->deleteManyDealProductsRequest($id, $ids); + + 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->deleteManyDealProductsRequest($id, $ids); + $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\v2\Model\DeleteManyDealProductResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteManyDealProductResponse', []), + $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\v2\Model\DeleteManyDealProductResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteManyDealProductResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\DeleteManyDealProductResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteManyDealProductsAsync + * + * Delete many products from a deal + * + * @param int $id The ID of the deal (required) + * @param string|null $ids Comma-separated list of deal product IDs to delete. If not provided, all deal products will be deleted up to 100 items. Maximum 100 IDs allowed. (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteManyDealProductsAsync($id, $ids = null): PromiseInterface + { + return $this->deleteManyDealProductsAsyncWithHttpInfo($id, $ids) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteManyDealProductsAsyncWithHttpInfo + * + * Delete many products from a deal + * + * @param int $id The ID of the deal (required) + * @param string|null $ids Comma-separated list of deal product IDs to delete. If not provided, all deal products will be deleted up to 100 items. Maximum 100 IDs allowed. (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteManyDealProductsAsyncWithHttpInfo($id, $ids = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\DeleteManyDealProductResponse'; + $request = $this->deleteManyDealProductsRequest($id, $ids); + + 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 'deleteManyDealProducts' + * + * @param int $id The ID of the deal (required) + * @param string|null $ids Comma-separated list of deal product IDs to delete. If not provided, all deal products will be deleted up to 100 items. Maximum 100 IDs allowed. (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function deleteManyDealProductsRequest($id, $ids = 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 deleteManyDealProducts' + ); + } + + $resourcePath = '/deals/{id}/products'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + /* @phpstan-ignore-next-line */ + if (is_array($ids)) { + $ids = ObjectSerializer::serializeCollection($ids, '', true); + } + if ($ids !== null) { + $queryParams['ids'] = $ids; + } + + + // 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 getDealProducts + * + * List products attached to a deal + * + * @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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `add_time`, `update_time`, `order_nr`. (optional, default to 'id') + * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\DealsProductsResponse + */ + public function getDealProducts($id, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc') + { + list($response) = $this->getDealProductsWithHttpInfo($id, $cursor, $limit, $sort_by, $sort_direction); + return $response; + } + + /** + * Operation getDealProductsWithHttpInfo + * + * List products attached to a deal + * + * @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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `add_time`, `update_time`, `order_nr`. (optional, default to 'id') + * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\DealsProductsResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getDealProductsWithHttpInfo($id, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc') + { + $request = $this->getDealProductsRequest($id, $cursor, $limit, $sort_by, $sort_direction); + + 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->getDealProductsRequest($id, $cursor, $limit, $sort_by, $sort_direction); + $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\v2\Model\DealsProductsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DealsProductsResponse', []), + $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\v2\Model\DealsProductsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DealsProductsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\DealsProductsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getDealProductsAsync + * + * List products attached to a deal + * + * @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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `add_time`, `update_time`, `order_nr`. (optional, default to 'id') + * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getDealProductsAsync($id, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc'): PromiseInterface + { + return $this->getDealProductsAsyncWithHttpInfo($id, $cursor, $limit, $sort_by, $sort_direction) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getDealProductsAsyncWithHttpInfo + * + * List products attached to a deal + * + * @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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `add_time`, `update_time`, `order_nr`. (optional, default to 'id') + * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getDealProductsAsyncWithHttpInfo($id, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc'): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\DealsProductsResponse'; + $request = $this->getDealProductsRequest($id, $cursor, $limit, $sort_by, $sort_direction); + + 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 'getDealProducts' + * + * @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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `add_time`, `update_time`, `order_nr`. (optional, default to 'id') + * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function getDealProductsRequest($id, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc'): 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' + ); + } + + $resourcePath = '/deals/{id}/products'; + $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($sort_by)) { + $sort_by = ObjectSerializer::serializeCollection($sort_by, '', true); + } + if ($sort_by !== null) { + $queryParams['sort_by'] = $sort_by; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($sort_direction)) { + $sort_direction = ObjectSerializer::serializeCollection($sort_direction, '', true); + } + if ($sort_direction !== null) { + $queryParams['sort_direction'] = $sort_direction; + } + + + // 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 getDealsProducts + * + * Get deal products of several deals + * + * @param int[] $deal_ids An array of integers with the IDs of the deals for which the attached products will be returned. A maximum of 100 deal IDs can be provided. (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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `deal_id`, `add_time`, `update_time`, `order_nr`. (optional, default to 'id') + * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\DealsProductsResponse + */ + public function getDealsProducts($deal_ids, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc') + { + list($response) = $this->getDealsProductsWithHttpInfo($deal_ids, $cursor, $limit, $sort_by, $sort_direction); + return $response; + } + + /** + * Operation getDealsProductsWithHttpInfo + * + * Get deal products of several deals + * + * @param int[] $deal_ids An array of integers with the IDs of the deals for which the attached products will be returned. A maximum of 100 deal IDs can be provided. (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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `deal_id`, `add_time`, `update_time`, `order_nr`. (optional, default to 'id') + * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\DealsProductsResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getDealsProductsWithHttpInfo($deal_ids, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc') + { + $request = $this->getDealsProductsRequest($deal_ids, $cursor, $limit, $sort_by, $sort_direction); + + 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->getDealsProductsRequest($deal_ids, $cursor, $limit, $sort_by, $sort_direction); + $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\v2\Model\DealsProductsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DealsProductsResponse', []), + $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\v2\Model\DealsProductsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DealsProductsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\DealsProductsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getDealsProductsAsync + * + * Get deal products of several deals + * + * @param int[] $deal_ids An array of integers with the IDs of the deals for which the attached products will be returned. A maximum of 100 deal IDs can be provided. (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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `deal_id`, `add_time`, `update_time`, `order_nr`. (optional, default to 'id') + * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getDealsProductsAsync($deal_ids, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc'): PromiseInterface + { + return $this->getDealsProductsAsyncWithHttpInfo($deal_ids, $cursor, $limit, $sort_by, $sort_direction) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getDealsProductsAsyncWithHttpInfo + * + * Get deal products of several deals + * + * @param int[] $deal_ids An array of integers with the IDs of the deals for which the attached products will be returned. A maximum of 100 deal IDs can be provided. (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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `deal_id`, `add_time`, `update_time`, `order_nr`. (optional, default to 'id') + * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getDealsProductsAsyncWithHttpInfo($deal_ids, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc'): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\DealsProductsResponse'; + $request = $this->getDealsProductsRequest($deal_ids, $cursor, $limit, $sort_by, $sort_direction); + + 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 'getDealsProducts' + * + * @param int[] $deal_ids An array of integers with the IDs of the deals for which the attached products will be returned. A maximum of 100 deal IDs can be provided. (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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `deal_id`, `add_time`, `update_time`, `order_nr`. (optional, default to 'id') + * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function getDealsProductsRequest($deal_ids, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc'): Request + { + // verify the required parameter 'deal_ids' is set + /* @phpstan-ignore-next-line */ + if ($deal_ids === null || (is_array($deal_ids) && count($deal_ids) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $deal_ids when calling getDealsProducts' + ); + } + + $resourcePath = '/deals/products'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + /* @phpstan-ignore-next-line */ + if (is_array($deal_ids)) { + $deal_ids = ObjectSerializer::serializeCollection($deal_ids, 'csv', true); + } + if ($deal_ids !== null) { + $queryParams['deal_ids'] = $deal_ids; + } + // 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($sort_by)) { + $sort_by = ObjectSerializer::serializeCollection($sort_by, '', true); + } + if ($sort_by !== null) { + $queryParams['sort_by'] = $sort_by; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($sort_direction)) { + $sort_direction = ObjectSerializer::serializeCollection($sort_direction, '', true); + } + if ($sort_direction !== null) { + $queryParams['sort_direction'] = $sort_direction; + } + + + + + /* @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 updateDealProduct + * + * Update the product attached to a deal + * + * @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\v2\Model\UpdateDealProductRequestBody|null $update_deal_product_request_body update_deal_product_request_body (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\AddDealProductResponse + */ + public function updateDealProduct($id, $product_attachment_id, $update_deal_product_request_body = null) + { + list($response) = $this->updateDealProductWithHttpInfo($id, $product_attachment_id, $update_deal_product_request_body); + return $response; + } + + /** + * Operation updateDealProductWithHttpInfo + * + * Update the product attached to a deal + * + * @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\v2\Model\UpdateDealProductRequestBody|null $update_deal_product_request_body (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\AddDealProductResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function updateDealProductWithHttpInfo($id, $product_attachment_id, $update_deal_product_request_body = null) + { + $request = $this->updateDealProductRequest($id, $product_attachment_id, $update_deal_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->updateDealProductRequest($id, $product_attachment_id, $update_deal_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 200: + /* @phpstan-ignore-next-line */ + if ('\Pipedrive\versions\v2\Model\AddDealProductResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddDealProductResponse', []), + $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\v2\Model\AddDealProductResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddDealProductResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\AddDealProductResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateDealProductAsync + * + * Update the product attached to a deal + * + * @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\v2\Model\UpdateDealProductRequestBody|null $update_deal_product_request_body (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function updateDealProductAsync($id, $product_attachment_id, $update_deal_product_request_body = null): PromiseInterface + { + return $this->updateDealProductAsyncWithHttpInfo($id, $product_attachment_id, $update_deal_product_request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateDealProductAsyncWithHttpInfo + * + * Update the product attached to a deal + * + * @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\v2\Model\UpdateDealProductRequestBody|null $update_deal_product_request_body (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function updateDealProductAsyncWithHttpInfo($id, $product_attachment_id, $update_deal_product_request_body = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\AddDealProductResponse'; + $request = $this->updateDealProductRequest($id, $product_attachment_id, $update_deal_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 'updateDealProduct' + * + * @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\v2\Model\UpdateDealProductRequestBody|null $update_deal_product_request_body (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function updateDealProductRequest($id, $product_attachment_id, $update_deal_product_request_body = 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' + ); + } + + $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'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($update_deal_product_request_body)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_deal_product_request_body)); + } else { + $httpBody = $update_deal_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( + 'PATCH', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/versions/v2/Api/DealsApi.php b/lib/versions/v2/Api/DealsApi.php index 67ad71ae..35e8a09f 100644 --- a/lib/versions/v2/Api/DealsApi.php +++ b/lib/versions/v2/Api/DealsApi.php @@ -717,38 +717,36 @@ public function addDealFollowerRequest($id, $follower_request_body = null): Requ } /** - * Operation addDealProduct + * Operation convertDealToLead * - * Add a product to a deal + * Convert a deal to a lead * - * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v2\Model\NewDealProductRequestBody|null $new_deal_product_request_body new_deal_product_request_body (optional) + * @param int $id The ID of the deal to convert (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v2\Model\AddDealProductResponse + * @return \Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse|\Pipedrive\versions\v2\Model\GetConvertResponse */ - public function addDealProduct($id, $new_deal_product_request_body = null) + public function convertDealToLead($id) { - list($response) = $this->addDealProductWithHttpInfo($id, $new_deal_product_request_body); + list($response) = $this->convertDealToLeadWithHttpInfo($id); return $response; } /** - * Operation addDealProductWithHttpInfo + * Operation convertDealToLeadWithHttpInfo * - * Add a product to a deal + * Convert a deal to a lead * - * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v2\Model\NewDealProductRequestBody|null $new_deal_product_request_body (optional) + * @param int $id The ID of the deal to convert (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v2\Model\AddDealProductResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse|\Pipedrive\versions\v2\Model\GetConvertResponse, HTTP status code, HTTP response headers (array of strings) */ - public function addDealProductWithHttpInfo($id, $new_deal_product_request_body = null) + public function convertDealToLeadWithHttpInfo($id) { - $request = $this->addDealProductRequest($id, $new_deal_product_request_body); + $request = $this->convertDealToLeadRequest($id); try { $options = $this->createHttpClientOption(); @@ -757,7 +755,7 @@ public function addDealProductWithHttpInfo($id, $new_deal_product_request_body = } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->addDealProductRequest($id, $new_deal_product_request_body); + $request = $this->convertDealToLeadRequest($id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -780,16 +778,29 @@ public function addDealProductWithHttpInfo($id, $new_deal_product_request_body = switch($statusCode) { - case 201: + case 200: + /* @phpstan-ignore-next-line */ + if ('\Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\AddDealProductResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\GetConvertResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddDealProductResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetConvertResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -809,24 +820,32 @@ public function addDealProductWithHttpInfo($id, $new_deal_product_request_body = } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\AddDealProductResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddDealProductResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse', []), $response->getStatusCode(), $response->getHeaders() ]; } catch (ApiException $e) { switch ($e->getCode()) { - case 201: + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\AddDealProductResponse', + '\Pipedrive\versions\v2\Model\GetConvertResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -837,19 +856,18 @@ public function addDealProductWithHttpInfo($id, $new_deal_product_request_body = } /** - * Operation addDealProductAsync + * Operation convertDealToLeadAsync * - * Add a product to a deal + * Convert a deal to a lead * - * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v2\Model\NewDealProductRequestBody|null $new_deal_product_request_body (optional) + * @param int $id The ID of the deal to convert (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function addDealProductAsync($id, $new_deal_product_request_body = null): PromiseInterface + public function convertDealToLeadAsync($id): PromiseInterface { - return $this->addDealProductAsyncWithHttpInfo($id, $new_deal_product_request_body) + return $this->convertDealToLeadAsyncWithHttpInfo($id) ->then( function ($response) { return $response[0]; @@ -858,20 +876,19 @@ function ($response) { } /** - * Operation addDealProductAsyncWithHttpInfo + * Operation convertDealToLeadAsyncWithHttpInfo * - * Add a product to a deal + * Convert a deal to a lead * - * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v2\Model\NewDealProductRequestBody|null $new_deal_product_request_body (optional) + * @param int $id The ID of the deal to convert (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function addDealProductAsyncWithHttpInfo($id, $new_deal_product_request_body = null): PromiseInterface + public function convertDealToLeadAsyncWithHttpInfo($id): PromiseInterface { - $returnType = '\Pipedrive\versions\v2\Model\AddDealProductResponse'; - $request = $this->addDealProductRequest($id, $new_deal_product_request_body); + $returnType = '\Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse'; + $request = $this->convertDealToLeadRequest($id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -908,25 +925,24 @@ function ($exception) { } /** - * Create request for operation 'addDealProduct' + * Create request for operation 'convertDealToLead' * - * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v2\Model\NewDealProductRequestBody|null $new_deal_product_request_body (optional) + * @param int $id The ID of the deal to convert (required) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function addDealProductRequest($id, $new_deal_product_request_body = null): Request + public function convertDealToLeadRequest($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 convertDealToLead' ); } - $resourcePath = '/deals/{id}/products'; + $resourcePath = '/deals/{id}/convert/lead'; $formParams = []; $queryParams = []; $headerParams = []; @@ -953,18 +969,12 @@ public function addDealProductRequest($id, $new_deal_product_request_body = null } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - ['application/json'] + [] ); } // for model (json/xml) - if (isset($new_deal_product_request_body)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($new_deal_product_request_body)); - } else { - $httpBody = $new_deal_product_request_body; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { /* @phpstan-ignore-next-line */ if ($multipart) { $multipartContents = []; @@ -1024,38 +1034,38 @@ public function addDealProductRequest($id, $new_deal_product_request_body = null } /** - * Operation addManyDealProducts + * Operation deleteAdditionalDiscount * - * Add multiple products to a deal + * Delete a discount from a deal * * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v2\Model\CreateManyDealProductRequestBody|null $create_many_deal_product_request_body create_many_deal_product_request_body (optional) + * @param string $discount_id The ID of the discount (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v2\Model\CreateManyDealProductResponse + * @return \Pipedrive\versions\v2\Model\DeleteAdditionalDiscountResponse */ - public function addManyDealProducts($id, $create_many_deal_product_request_body = null) + public function deleteAdditionalDiscount($id, $discount_id) { - list($response) = $this->addManyDealProductsWithHttpInfo($id, $create_many_deal_product_request_body); + list($response) = $this->deleteAdditionalDiscountWithHttpInfo($id, $discount_id); return $response; } /** - * Operation addManyDealProductsWithHttpInfo + * Operation deleteAdditionalDiscountWithHttpInfo * - * Add multiple products to a deal + * Delete a discount from a deal * * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v2\Model\CreateManyDealProductRequestBody|null $create_many_deal_product_request_body (optional) + * @param string $discount_id The ID of the discount (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v2\Model\CreateManyDealProductResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v2\Model\DeleteAdditionalDiscountResponse, HTTP status code, HTTP response headers (array of strings) */ - public function addManyDealProductsWithHttpInfo($id, $create_many_deal_product_request_body = null) + public function deleteAdditionalDiscountWithHttpInfo($id, $discount_id) { - $request = $this->addManyDealProductsRequest($id, $create_many_deal_product_request_body); + $request = $this->deleteAdditionalDiscountRequest($id, $discount_id); try { $options = $this->createHttpClientOption(); @@ -1064,7 +1074,7 @@ public function addManyDealProductsWithHttpInfo($id, $create_many_deal_product_r } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->addManyDealProductsRequest($id, $create_many_deal_product_request_body); + $request = $this->deleteAdditionalDiscountRequest($id, $discount_id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -1087,16 +1097,16 @@ public function addManyDealProductsWithHttpInfo($id, $create_many_deal_product_r switch($statusCode) { - case 201: + case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\CreateManyDealProductResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\DeleteAdditionalDiscountResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\CreateManyDealProductResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteAdditionalDiscountResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1116,24 +1126,24 @@ public function addManyDealProductsWithHttpInfo($id, $create_many_deal_product_r } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\CreateManyDealProductResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\DeleteAdditionalDiscountResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\CreateManyDealProductResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteAdditionalDiscountResponse', []), $response->getStatusCode(), $response->getHeaders() ]; } catch (ApiException $e) { switch ($e->getCode()) { - case 201: + case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\CreateManyDealProductResponse', + '\Pipedrive\versions\v2\Model\DeleteAdditionalDiscountResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1144,19 +1154,19 @@ public function addManyDealProductsWithHttpInfo($id, $create_many_deal_product_r } /** - * Operation addManyDealProductsAsync + * Operation deleteAdditionalDiscountAsync * - * Add multiple products to a deal + * Delete a discount from a deal * * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v2\Model\CreateManyDealProductRequestBody|null $create_many_deal_product_request_body (optional) + * @param string $discount_id The ID of the discount (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function addManyDealProductsAsync($id, $create_many_deal_product_request_body = null): PromiseInterface + public function deleteAdditionalDiscountAsync($id, $discount_id): PromiseInterface { - return $this->addManyDealProductsAsyncWithHttpInfo($id, $create_many_deal_product_request_body) + return $this->deleteAdditionalDiscountAsyncWithHttpInfo($id, $discount_id) ->then( function ($response) { return $response[0]; @@ -1165,20 +1175,20 @@ function ($response) { } /** - * Operation addManyDealProductsAsyncWithHttpInfo + * Operation deleteAdditionalDiscountAsyncWithHttpInfo * - * Add multiple products to a deal + * Delete a discount from a deal * * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v2\Model\CreateManyDealProductRequestBody|null $create_many_deal_product_request_body (optional) + * @param string $discount_id The ID of the discount (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function addManyDealProductsAsyncWithHttpInfo($id, $create_many_deal_product_request_body = null): PromiseInterface + public function deleteAdditionalDiscountAsyncWithHttpInfo($id, $discount_id): PromiseInterface { - $returnType = '\Pipedrive\versions\v2\Model\CreateManyDealProductResponse'; - $request = $this->addManyDealProductsRequest($id, $create_many_deal_product_request_body); + $returnType = '\Pipedrive\versions\v2\Model\DeleteAdditionalDiscountResponse'; + $request = $this->deleteAdditionalDiscountRequest($id, $discount_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1215,25 +1225,32 @@ function ($exception) { } /** - * Create request for operation 'addManyDealProducts' + * Create request for operation 'deleteAdditionalDiscount' * * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v2\Model\CreateManyDealProductRequestBody|null $create_many_deal_product_request_body (optional) + * @param string $discount_id The ID of the discount (required) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function addManyDealProductsRequest($id, $create_many_deal_product_request_body = null): Request + public function deleteAdditionalDiscountRequest($id, $discount_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 addManyDealProducts' + 'Missing the required parameter $id when calling deleteAdditionalDiscount' + ); + } + // verify the required parameter 'discount_id' is set + /* @phpstan-ignore-next-line */ + if ($discount_id === null || (is_array($discount_id) && count($discount_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $discount_id when calling deleteAdditionalDiscount' ); } - $resourcePath = '/deals/{id}/products/bulk'; + $resourcePath = '/deals/{id}/discounts/{discount_id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -1250,6 +1267,14 @@ public function addManyDealProductsRequest($id, $create_many_deal_product_reques $resourcePath ); } + // path params + if ($discount_id !== null) { + $resourcePath = str_replace( + '{' . 'discount_id' . '}', + ObjectSerializer::toPathValue($discount_id), + $resourcePath + ); + } /* @phpstan-ignore-next-line */ @@ -1260,18 +1285,12 @@ public function addManyDealProductsRequest($id, $create_many_deal_product_reques } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - ['application/json'] + [] ); } // for model (json/xml) - if (isset($create_many_deal_product_request_body)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($create_many_deal_product_request_body)); - } else { - $httpBody = $create_many_deal_product_request_body; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { /* @phpstan-ignore-next-line */ if ($multipart) { $multipartContents = []; @@ -1323,7 +1342,7 @@ public function addManyDealProductsRequest($id, $create_many_deal_product_reques $query = Query::build($queryParams); return new Request( - 'POST', + 'DELETE', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -1331,36 +1350,36 @@ public function addManyDealProductsRequest($id, $create_many_deal_product_reques } /** - * Operation convertDealToLead + * Operation deleteDeal * - * Convert a deal to a lead + * Delete a deal * - * @param int $id The ID of the deal to convert (required) + * @param int $id The ID of the deal (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse|\Pipedrive\versions\v2\Model\GetConvertResponse + * @return \Pipedrive\versions\v2\Model\DeleteDealResponse */ - public function convertDealToLead($id) + public function deleteDeal($id) { - list($response) = $this->convertDealToLeadWithHttpInfo($id); + list($response) = $this->deleteDealWithHttpInfo($id); return $response; } /** - * Operation convertDealToLeadWithHttpInfo + * Operation deleteDealWithHttpInfo * - * Convert a deal to a lead + * Delete a deal * - * @param int $id The ID of the deal to convert (required) + * @param int $id The ID of the deal (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse|\Pipedrive\versions\v2\Model\GetConvertResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v2\Model\DeleteDealResponse, HTTP status code, HTTP response headers (array of strings) */ - public function convertDealToLeadWithHttpInfo($id) + public function deleteDealWithHttpInfo($id) { - $request = $this->convertDealToLeadRequest($id); + $request = $this->deleteDealRequest($id); try { $options = $this->createHttpClientOption(); @@ -1369,7 +1388,7 @@ public function convertDealToLeadWithHttpInfo($id) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->convertDealToLeadRequest($id); + $request = $this->deleteDealRequest($id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -1394,27 +1413,14 @@ public function convertDealToLeadWithHttpInfo($id) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 404: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\GetConvertResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\DeleteDealResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetConvertResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteDealResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1434,14 +1440,14 @@ public function convertDealToLeadWithHttpInfo($id) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\DeleteDealResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteDealResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1451,15 +1457,7 @@ public function convertDealToLeadWithHttpInfo($id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\GetConvertResponse', + '\Pipedrive\versions\v2\Model\DeleteDealResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1470,18 +1468,18 @@ public function convertDealToLeadWithHttpInfo($id) } /** - * Operation convertDealToLeadAsync + * Operation deleteDealAsync * - * Convert a deal to a lead + * Delete a deal * - * @param int $id The ID of the deal to convert (required) + * @param int $id The ID of the deal (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function convertDealToLeadAsync($id): PromiseInterface + public function deleteDealAsync($id): PromiseInterface { - return $this->convertDealToLeadAsyncWithHttpInfo($id) + return $this->deleteDealAsyncWithHttpInfo($id) ->then( function ($response) { return $response[0]; @@ -1490,19 +1488,19 @@ function ($response) { } /** - * Operation convertDealToLeadAsyncWithHttpInfo + * Operation deleteDealAsyncWithHttpInfo * - * Convert a deal to a lead + * Delete a deal * - * @param int $id The ID of the deal to convert (required) + * @param int $id The ID of the deal (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function convertDealToLeadAsyncWithHttpInfo($id): PromiseInterface + public function deleteDealAsyncWithHttpInfo($id): PromiseInterface { - $returnType = '\Pipedrive\versions\v2\Model\AddConvertDealToLeadResponse'; - $request = $this->convertDealToLeadRequest($id); + $returnType = '\Pipedrive\versions\v2\Model\DeleteDealResponse'; + $request = $this->deleteDealRequest($id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1539,24 +1537,24 @@ function ($exception) { } /** - * Create request for operation 'convertDealToLead' + * Create request for operation 'deleteDeal' * - * @param int $id The ID of the deal to convert (required) + * @param int $id The ID of the deal (required) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function convertDealToLeadRequest($id): Request + public function deleteDealRequest($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 convertDealToLead' + 'Missing the required parameter $id when calling deleteDeal' ); } - $resourcePath = '/deals/{id}/convert/lead'; + $resourcePath = '/deals/{id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -1640,7 +1638,7 @@ public function convertDealToLeadRequest($id): Request $query = Query::build($queryParams); return new Request( - 'POST', + 'DELETE', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -1648,38 +1646,38 @@ public function convertDealToLeadRequest($id): Request } /** - * Operation deleteAdditionalDiscount + * Operation deleteDealFollower * - * Delete a discount from a deal + * Delete a follower from a deal * * @param int $id The ID of the deal (required) - * @param string $discount_id The ID of the discount (required) + * @param int $follower_id The ID of the following user (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v2\Model\DeleteAdditionalDiscountResponse + * @return \Pipedrive\versions\v2\Model\DeleteFollowerResponse */ - public function deleteAdditionalDiscount($id, $discount_id) + public function deleteDealFollower($id, $follower_id) { - list($response) = $this->deleteAdditionalDiscountWithHttpInfo($id, $discount_id); + list($response) = $this->deleteDealFollowerWithHttpInfo($id, $follower_id); return $response; } /** - * Operation deleteAdditionalDiscountWithHttpInfo + * Operation deleteDealFollowerWithHttpInfo * - * Delete a discount from a deal + * Delete a follower from a deal * * @param int $id The ID of the deal (required) - * @param string $discount_id The ID of the discount (required) + * @param int $follower_id The ID of the following user (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v2\Model\DeleteAdditionalDiscountResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v2\Model\DeleteFollowerResponse, HTTP status code, HTTP response headers (array of strings) */ - public function deleteAdditionalDiscountWithHttpInfo($id, $discount_id) + public function deleteDealFollowerWithHttpInfo($id, $follower_id) { - $request = $this->deleteAdditionalDiscountRequest($id, $discount_id); + $request = $this->deleteDealFollowerRequest($id, $follower_id); try { $options = $this->createHttpClientOption(); @@ -1688,7 +1686,7 @@ public function deleteAdditionalDiscountWithHttpInfo($id, $discount_id) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->deleteAdditionalDiscountRequest($id, $discount_id); + $request = $this->deleteDealFollowerRequest($id, $follower_id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -1713,14 +1711,14 @@ public function deleteAdditionalDiscountWithHttpInfo($id, $discount_id) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\DeleteAdditionalDiscountResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\DeleteFollowerResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteAdditionalDiscountResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteFollowerResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1740,14 +1738,14 @@ public function deleteAdditionalDiscountWithHttpInfo($id, $discount_id) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\DeleteAdditionalDiscountResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\DeleteFollowerResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteAdditionalDiscountResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteFollowerResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -1757,7 +1755,7 @@ public function deleteAdditionalDiscountWithHttpInfo($id, $discount_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\DeleteAdditionalDiscountResponse', + '\Pipedrive\versions\v2\Model\DeleteFollowerResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1768,19 +1766,19 @@ public function deleteAdditionalDiscountWithHttpInfo($id, $discount_id) } /** - * Operation deleteAdditionalDiscountAsync + * Operation deleteDealFollowerAsync * - * Delete a discount from a deal + * Delete a follower from a deal * * @param int $id The ID of the deal (required) - * @param string $discount_id The ID of the discount (required) + * @param int $follower_id The ID of the following user (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function deleteAdditionalDiscountAsync($id, $discount_id): PromiseInterface + public function deleteDealFollowerAsync($id, $follower_id): PromiseInterface { - return $this->deleteAdditionalDiscountAsyncWithHttpInfo($id, $discount_id) + return $this->deleteDealFollowerAsyncWithHttpInfo($id, $follower_id) ->then( function ($response) { return $response[0]; @@ -1789,20 +1787,20 @@ function ($response) { } /** - * Operation deleteAdditionalDiscountAsyncWithHttpInfo + * Operation deleteDealFollowerAsyncWithHttpInfo * - * Delete a discount from a deal + * Delete a follower from a deal * * @param int $id The ID of the deal (required) - * @param string $discount_id The ID of the discount (required) + * @param int $follower_id The ID of the following user (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function deleteAdditionalDiscountAsyncWithHttpInfo($id, $discount_id): PromiseInterface + public function deleteDealFollowerAsyncWithHttpInfo($id, $follower_id): PromiseInterface { - $returnType = '\Pipedrive\versions\v2\Model\DeleteAdditionalDiscountResponse'; - $request = $this->deleteAdditionalDiscountRequest($id, $discount_id); + $returnType = '\Pipedrive\versions\v2\Model\DeleteFollowerResponse'; + $request = $this->deleteDealFollowerRequest($id, $follower_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1839,32 +1837,32 @@ function ($exception) { } /** - * Create request for operation 'deleteAdditionalDiscount' + * Create request for operation 'deleteDealFollower' * * @param int $id The ID of the deal (required) - * @param string $discount_id The ID of the discount (required) + * @param int $follower_id The ID of the following user (required) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function deleteAdditionalDiscountRequest($id, $discount_id): 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 deleteAdditionalDiscount' + 'Missing the required parameter $id when calling deleteDealFollower' ); } - // verify the required parameter 'discount_id' is set + // verify the required parameter 'follower_id' is set /* @phpstan-ignore-next-line */ - if ($discount_id === null || (is_array($discount_id) && count($discount_id) === 0)) { + if ($follower_id === null || (is_array($follower_id) && count($follower_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $discount_id when calling deleteAdditionalDiscount' + 'Missing the required parameter $follower_id when calling deleteDealFollower' ); } - $resourcePath = '/deals/{id}/discounts/{discount_id}'; + $resourcePath = '/deals/{id}/followers/{follower_id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -1882,10 +1880,10 @@ public function deleteAdditionalDiscountRequest($id, $discount_id): Request ); } // path params - if ($discount_id !== null) { + if ($follower_id !== null) { $resourcePath = str_replace( - '{' . 'discount_id' . '}', - ObjectSerializer::toPathValue($discount_id), + '{' . 'follower_id' . '}', + ObjectSerializer::toPathValue($follower_id), $resourcePath ); } @@ -1964,36 +1962,36 @@ public function deleteAdditionalDiscountRequest($id, $discount_id): Request } /** - * Operation deleteDeal + * Operation getAdditionalDiscounts * - * Delete a deal + * List discounts added to a deal * * @param int $id The ID of the deal (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v2\Model\DeleteDealResponse + * @return \Pipedrive\versions\v2\Model\AdditionalDiscountsResponse */ - public function deleteDeal($id) + public function getAdditionalDiscounts($id) { - list($response) = $this->deleteDealWithHttpInfo($id); + list($response) = $this->getAdditionalDiscountsWithHttpInfo($id); return $response; } /** - * Operation deleteDealWithHttpInfo + * Operation getAdditionalDiscountsWithHttpInfo * - * Delete a deal + * List discounts added to 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\v2\Model\DeleteDealResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v2\Model\AdditionalDiscountsResponse, HTTP status code, HTTP response headers (array of strings) */ - public function deleteDealWithHttpInfo($id) + public function getAdditionalDiscountsWithHttpInfo($id) { - $request = $this->deleteDealRequest($id); + $request = $this->getAdditionalDiscountsRequest($id); try { $options = $this->createHttpClientOption(); @@ -2002,7 +2000,7 @@ public function deleteDealWithHttpInfo($id) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->deleteDealRequest($id); + $request = $this->getAdditionalDiscountsRequest($id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -2027,14 +2025,14 @@ public function deleteDealWithHttpInfo($id) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\DeleteDealResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\AdditionalDiscountsResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteDealResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AdditionalDiscountsResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2054,14 +2052,14 @@ public function deleteDealWithHttpInfo($id) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\DeleteDealResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\AdditionalDiscountsResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteDealResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AdditionalDiscountsResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2071,7 +2069,7 @@ public function deleteDealWithHttpInfo($id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\DeleteDealResponse', + '\Pipedrive\versions\v2\Model\AdditionalDiscountsResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2082,18 +2080,18 @@ public function deleteDealWithHttpInfo($id) } /** - * Operation deleteDealAsync + * Operation getAdditionalDiscountsAsync * - * Delete a deal + * List discounts added to a deal * * @param int $id The ID of the deal (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function deleteDealAsync($id): PromiseInterface + public function getAdditionalDiscountsAsync($id): PromiseInterface { - return $this->deleteDealAsyncWithHttpInfo($id) + return $this->getAdditionalDiscountsAsyncWithHttpInfo($id) ->then( function ($response) { return $response[0]; @@ -2102,19 +2100,19 @@ function ($response) { } /** - * Operation deleteDealAsyncWithHttpInfo + * Operation getAdditionalDiscountsAsyncWithHttpInfo * - * Delete a deal + * List discounts added to a deal * * @param int $id The ID of the deal (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function deleteDealAsyncWithHttpInfo($id): PromiseInterface + public function getAdditionalDiscountsAsyncWithHttpInfo($id): PromiseInterface { - $returnType = '\Pipedrive\versions\v2\Model\DeleteDealResponse'; - $request = $this->deleteDealRequest($id); + $returnType = '\Pipedrive\versions\v2\Model\AdditionalDiscountsResponse'; + $request = $this->getAdditionalDiscountsRequest($id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2151,24 +2149,24 @@ function ($exception) { } /** - * Create request for operation 'deleteDeal' + * Create request for operation 'getAdditionalDiscounts' * * @param int $id The ID of the deal (required) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function deleteDealRequest($id): Request + public function getAdditionalDiscountsRequest($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 getAdditionalDiscounts' ); } - $resourcePath = '/deals/{id}'; + $resourcePath = '/deals/{id}/discounts'; $formParams = []; $queryParams = []; $headerParams = []; @@ -2252,7 +2250,7 @@ public function deleteDealRequest($id): Request $query = Query::build($queryParams); return new Request( - 'DELETE', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -2260,38 +2258,66 @@ 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 following user (required) + * @param int|null $filter_id If supplied, only deals matching the specified filter are returned (optional) + * @param string|null $ids Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. (optional) + * @param int|null $owner_id If supplied, only deals owned by the specified user are returned. If filter_id is provided, this is ignored. (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 $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|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. Multiple statuses can be included as a comma separated array. If filter_id is provided, this is ignored. (optional) + * @param string|null $updated_since If set, only deals with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) + * @param string|null $updated_until If set, only deals with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) + * @param string|'id' $sort_by The field to sort by. Supported fields: `id`, `update_time`, `add_time`. (optional, default to 'id') + * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) + * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (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 $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\v2\Model\DeleteFollowerResponse + * @return \Pipedrive\versions\v2\Model\GetDeals */ - public function deleteDealFollower($id, $follower_id) + public function getArchivedDeals($filter_id = null, $ids = null, $owner_id = null, $person_id = null, $org_id = null, $pipeline_id = null, $stage_id = null, $status = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $limit = null, $cursor = null) { - list($response) = $this->deleteDealFollowerWithHttpInfo($id, $follower_id); + list($response) = $this->getArchivedDealsWithHttpInfo($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor); 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 following user (required) + * @param int|null $filter_id If supplied, only deals matching the specified filter are returned (optional) + * @param string|null $ids Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. (optional) + * @param int|null $owner_id If supplied, only deals owned by the specified user are returned. If filter_id is provided, this is ignored. (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 $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|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. Multiple statuses can be included as a comma separated array. If filter_id is provided, this is ignored. (optional) + * @param string|null $updated_since If set, only deals with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) + * @param string|null $updated_until If set, only deals with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) + * @param string|'id' $sort_by The field to sort by. Supported fields: `id`, `update_time`, `add_time`. (optional, default to 'id') + * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) + * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (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 $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\v2\Model\DeleteFollowerResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v2\Model\GetDeals, HTTP status code, HTTP response headers (array of strings) */ - public function deleteDealFollowerWithHttpInfo($id, $follower_id) + public function getArchivedDealsWithHttpInfo($filter_id = null, $ids = null, $owner_id = null, $person_id = null, $org_id = null, $pipeline_id = null, $stage_id = null, $status = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $limit = null, $cursor = null) { - $request = $this->deleteDealFollowerRequest($id, $follower_id); + $request = $this->getArchivedDealsRequest($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor); try { $options = $this->createHttpClientOption(); @@ -2300,7 +2326,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($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -2325,14 +2351,14 @@ public function deleteDealFollowerWithHttpInfo($id, $follower_id) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\DeleteFollowerResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\GetDeals' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteFollowerResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetDeals', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2352,14 +2378,14 @@ public function deleteDealFollowerWithHttpInfo($id, $follower_id) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\DeleteFollowerResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\GetDeals' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteFollowerResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetDeals', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2369,7 +2395,7 @@ public function deleteDealFollowerWithHttpInfo($id, $follower_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\DeleteFollowerResponse', + '\Pipedrive\versions\v2\Model\GetDeals', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2380,19 +2406,33 @@ 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 following user (required) + * @param int|null $filter_id If supplied, only deals matching the specified filter are returned (optional) + * @param string|null $ids Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. (optional) + * @param int|null $owner_id If supplied, only deals owned by the specified user are returned. If filter_id is provided, this is ignored. (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 $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|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. Multiple statuses can be included as a comma separated array. If filter_id is provided, this is ignored. (optional) + * @param string|null $updated_since If set, only deals with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) + * @param string|null $updated_until If set, only deals with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) + * @param string|'id' $sort_by The field to sort by. Supported fields: `id`, `update_time`, `add_time`. (optional, default to 'id') + * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) + * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (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 $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 deleteDealFollowerAsync($id, $follower_id): PromiseInterface + public function getArchivedDealsAsync($filter_id = null, $ids = null, $owner_id = null, $person_id = null, $org_id = null, $pipeline_id = null, $stage_id = null, $status = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $limit = null, $cursor = null): PromiseInterface { - return $this->deleteDealFollowerAsyncWithHttpInfo($id, $follower_id) + return $this->getArchivedDealsAsyncWithHttpInfo($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor) ->then( function ($response) { return $response[0]; @@ -2401,20 +2441,34 @@ 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 following user (required) + * @param int|null $filter_id If supplied, only deals matching the specified filter are returned (optional) + * @param string|null $ids Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. (optional) + * @param int|null $owner_id If supplied, only deals owned by the specified user are returned. If filter_id is provided, this is ignored. (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 $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|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. Multiple statuses can be included as a comma separated array. If filter_id is provided, this is ignored. (optional) + * @param string|null $updated_since If set, only deals with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) + * @param string|null $updated_until If set, only deals with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) + * @param string|'id' $sort_by The field to sort by. Supported fields: `id`, `update_time`, `add_time`. (optional, default to 'id') + * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) + * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (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 $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 deleteDealFollowerAsyncWithHttpInfo($id, $follower_id): PromiseInterface + public function getArchivedDealsAsyncWithHttpInfo($filter_id = null, $ids = null, $owner_id = null, $person_id = null, $org_id = null, $pipeline_id = null, $stage_id = null, $status = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $limit = null, $cursor = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v2\Model\DeleteFollowerResponse'; - $request = $this->deleteDealFollowerRequest($id, $follower_id); + $returnType = '\Pipedrive\versions\v2\Model\GetDeals'; + $request = $this->getArchivedDealsRequest($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2451,3703 +2505,32 @@ 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 following user (required) + * @param int|null $filter_id If supplied, only deals matching the specified filter are returned (optional) + * @param string|null $ids Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. (optional) + * @param int|null $owner_id If supplied, only deals owned by the specified user are returned. If filter_id is provided, this is ignored. (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 $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|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. Multiple statuses can be included as a comma separated array. If filter_id is provided, this is ignored. (optional) + * @param string|null $updated_since If set, only deals with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) + * @param string|null $updated_until If set, only deals with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) + * @param string|'id' $sort_by The field to sort by. Supported fields: `id`, `update_time`, `add_time`. (optional, default to 'id') + * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) + * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (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 $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 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 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}'; - $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 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\v2\Model\DeleteDealProduct - */ - 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\v2\Model\DeleteDealProduct, HTTP status code, HTTP response headers (array of strings) - */ - 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\v2\Model\DeleteDealProduct' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\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\v2\Model\DeleteDealProduct' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteDealProduct', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v2\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 - */ - 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 - */ - public function deleteDealProductAsyncWithHttpInfo($id, $product_attachment_id): PromiseInterface - { - $returnType = '\Pipedrive\versions\v2\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 - */ - 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 deleteInstallment - * - * Delete an installment from a deal - * - * @param int $id The ID of the deal (required) - * @param int $installment_id The ID of the installment (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v2\Model\DeleteInstallmentResponse - */ - public function deleteInstallment($id, $installment_id) - { - list($response) = $this->deleteInstallmentWithHttpInfo($id, $installment_id); - return $response; - } - - /** - * Operation deleteInstallmentWithHttpInfo - * - * Delete an installment from a deal - * - * @param int $id The ID of the deal (required) - * @param int $installment_id The ID of the installment (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v2\Model\DeleteInstallmentResponse, HTTP status code, HTTP response headers (array of strings) - */ - public function deleteInstallmentWithHttpInfo($id, $installment_id) - { - $request = $this->deleteInstallmentRequest($id, $installment_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->deleteInstallmentRequest($id, $installment_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\v2\Model\DeleteInstallmentResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteInstallmentResponse', []), - $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\v2\Model\DeleteInstallmentResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteInstallmentResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\DeleteInstallmentResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation deleteInstallmentAsync - * - * Delete an installment from a deal - * - * @param int $id The ID of the deal (required) - * @param int $installment_id The ID of the installment (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function deleteInstallmentAsync($id, $installment_id): PromiseInterface - { - return $this->deleteInstallmentAsyncWithHttpInfo($id, $installment_id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation deleteInstallmentAsyncWithHttpInfo - * - * Delete an installment from a deal - * - * @param int $id The ID of the deal (required) - * @param int $installment_id The ID of the installment (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function deleteInstallmentAsyncWithHttpInfo($id, $installment_id): PromiseInterface - { - $returnType = '\Pipedrive\versions\v2\Model\DeleteInstallmentResponse'; - $request = $this->deleteInstallmentRequest($id, $installment_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 'deleteInstallment' - * - * @param int $id The ID of the deal (required) - * @param int $installment_id The ID of the installment (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function deleteInstallmentRequest($id, $installment_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 deleteInstallment' - ); - } - // verify the required parameter 'installment_id' is set - /* @phpstan-ignore-next-line */ - if ($installment_id === null || (is_array($installment_id) && count($installment_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $installment_id when calling deleteInstallment' - ); - } - - $resourcePath = '/deals/{id}/installments/{installment_id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - // path params - if ($installment_id !== null) { - $resourcePath = str_replace( - '{' . 'installment_id' . '}', - ObjectSerializer::toPathValue($installment_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 deleteManyDealProducts - * - * Delete many products from a deal - * - * @param int $id The ID of the deal (required) - * @param string|null $ids Comma-separated list of deal product IDs to delete. If not provided, all deal products will be deleted up to 100 items. Maximum 100 IDs allowed. (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v2\Model\DeleteManyDealProductResponse - */ - public function deleteManyDealProducts($id, $ids = null) - { - list($response) = $this->deleteManyDealProductsWithHttpInfo($id, $ids); - return $response; - } - - /** - * Operation deleteManyDealProductsWithHttpInfo - * - * Delete many products from a deal - * - * @param int $id The ID of the deal (required) - * @param string|null $ids Comma-separated list of deal product IDs to delete. If not provided, all deal products will be deleted up to 100 items. Maximum 100 IDs allowed. (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v2\Model\DeleteManyDealProductResponse, HTTP status code, HTTP response headers (array of strings) - */ - public function deleteManyDealProductsWithHttpInfo($id, $ids = null) - { - $request = $this->deleteManyDealProductsRequest($id, $ids); - - 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->deleteManyDealProductsRequest($id, $ids); - $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\v2\Model\DeleteManyDealProductResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteManyDealProductResponse', []), - $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\v2\Model\DeleteManyDealProductResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteManyDealProductResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\DeleteManyDealProductResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation deleteManyDealProductsAsync - * - * Delete many products from a deal - * - * @param int $id The ID of the deal (required) - * @param string|null $ids Comma-separated list of deal product IDs to delete. If not provided, all deal products will be deleted up to 100 items. Maximum 100 IDs allowed. (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function deleteManyDealProductsAsync($id, $ids = null): PromiseInterface - { - return $this->deleteManyDealProductsAsyncWithHttpInfo($id, $ids) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation deleteManyDealProductsAsyncWithHttpInfo - * - * Delete many products from a deal - * - * @param int $id The ID of the deal (required) - * @param string|null $ids Comma-separated list of deal product IDs to delete. If not provided, all deal products will be deleted up to 100 items. Maximum 100 IDs allowed. (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function deleteManyDealProductsAsyncWithHttpInfo($id, $ids = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v2\Model\DeleteManyDealProductResponse'; - $request = $this->deleteManyDealProductsRequest($id, $ids); - - 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 'deleteManyDealProducts' - * - * @param int $id The ID of the deal (required) - * @param string|null $ids Comma-separated list of deal product IDs to delete. If not provided, all deal products will be deleted up to 100 items. Maximum 100 IDs allowed. (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function deleteManyDealProductsRequest($id, $ids = 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 deleteManyDealProducts' - ); - } - - $resourcePath = '/deals/{id}/products'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - /* @phpstan-ignore-next-line */ - if (is_array($ids)) { - $ids = ObjectSerializer::serializeCollection($ids, '', true); - } - if ($ids !== null) { - $queryParams['ids'] = $ids; - } - - - // 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 getAdditionalDiscounts - * - * List discounts added to a deal - * - * @param int $id The ID of the deal (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v2\Model\AdditionalDiscountsResponse - */ - public function getAdditionalDiscounts($id) - { - list($response) = $this->getAdditionalDiscountsWithHttpInfo($id); - return $response; - } - - /** - * Operation getAdditionalDiscountsWithHttpInfo - * - * List discounts added to 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\v2\Model\AdditionalDiscountsResponse, HTTP status code, HTTP response headers (array of strings) - */ - public function getAdditionalDiscountsWithHttpInfo($id) - { - $request = $this->getAdditionalDiscountsRequest($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->getAdditionalDiscountsRequest($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\v2\Model\AdditionalDiscountsResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AdditionalDiscountsResponse', []), - $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\v2\Model\AdditionalDiscountsResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AdditionalDiscountsResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\AdditionalDiscountsResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getAdditionalDiscountsAsync - * - * List discounts added to a deal - * - * @param int $id The ID of the deal (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getAdditionalDiscountsAsync($id): PromiseInterface - { - return $this->getAdditionalDiscountsAsyncWithHttpInfo($id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getAdditionalDiscountsAsyncWithHttpInfo - * - * List discounts added to a deal - * - * @param int $id The ID of the deal (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getAdditionalDiscountsAsyncWithHttpInfo($id): PromiseInterface - { - $returnType = '\Pipedrive\versions\v2\Model\AdditionalDiscountsResponse'; - $request = $this->getAdditionalDiscountsRequest($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 'getAdditionalDiscounts' - * - * @param int $id The ID of the deal (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function getAdditionalDiscountsRequest($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 getAdditionalDiscounts' - ); - } - - $resourcePath = '/deals/{id}/discounts'; - $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 getArchivedDeals - * - * Get all archived deals - * - * @param int|null $filter_id If supplied, only deals matching the specified filter are returned (optional) - * @param string|null $ids Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. (optional) - * @param int|null $owner_id If supplied, only deals owned by the specified user are returned. If filter_id is provided, this is ignored. (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 $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|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. Multiple statuses can be included as a comma separated array. If filter_id is provided, this is ignored. (optional) - * @param string|null $updated_since If set, only deals with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) - * @param string|null $updated_until If set, only deals with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) - * @param string|'id' $sort_by The field to sort by. Supported fields: `id`, `update_time`, `add_time`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') - * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) - * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (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 $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\v2\Model\GetDeals - */ - public function getArchivedDeals($filter_id = null, $ids = null, $owner_id = null, $person_id = null, $org_id = null, $pipeline_id = null, $stage_id = null, $status = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $limit = null, $cursor = null) - { - list($response) = $this->getArchivedDealsWithHttpInfo($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor); - return $response; - } - - /** - * Operation getArchivedDealsWithHttpInfo - * - * Get all archived deals - * - * @param int|null $filter_id If supplied, only deals matching the specified filter are returned (optional) - * @param string|null $ids Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. (optional) - * @param int|null $owner_id If supplied, only deals owned by the specified user are returned. If filter_id is provided, this is ignored. (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 $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|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. Multiple statuses can be included as a comma separated array. If filter_id is provided, this is ignored. (optional) - * @param string|null $updated_since If set, only deals with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) - * @param string|null $updated_until If set, only deals with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) - * @param string|'id' $sort_by The field to sort by. Supported fields: `id`, `update_time`, `add_time`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') - * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) - * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (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 $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\v2\Model\GetDeals, HTTP status code, HTTP response headers (array of strings) - */ - public function getArchivedDealsWithHttpInfo($filter_id = null, $ids = null, $owner_id = null, $person_id = null, $org_id = null, $pipeline_id = null, $stage_id = null, $status = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $limit = null, $cursor = null) - { - $request = $this->getArchivedDealsRequest($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor); - - 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($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor); - $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\v2\Model\GetDeals' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\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\v2\Model\GetDeals' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetDeals', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\GetDeals', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getArchivedDealsAsync - * - * Get all archived deals - * - * @param int|null $filter_id If supplied, only deals matching the specified filter are returned (optional) - * @param string|null $ids Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. (optional) - * @param int|null $owner_id If supplied, only deals owned by the specified user are returned. If filter_id is provided, this is ignored. (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 $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|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. Multiple statuses can be included as a comma separated array. If filter_id is provided, this is ignored. (optional) - * @param string|null $updated_since If set, only deals with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) - * @param string|null $updated_until If set, only deals with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) - * @param string|'id' $sort_by The field to sort by. Supported fields: `id`, `update_time`, `add_time`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') - * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) - * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (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 $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 getArchivedDealsAsync($filter_id = null, $ids = null, $owner_id = null, $person_id = null, $org_id = null, $pipeline_id = null, $stage_id = null, $status = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $limit = null, $cursor = null): PromiseInterface - { - return $this->getArchivedDealsAsyncWithHttpInfo($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getArchivedDealsAsyncWithHttpInfo - * - * Get all archived deals - * - * @param int|null $filter_id If supplied, only deals matching the specified filter are returned (optional) - * @param string|null $ids Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. (optional) - * @param int|null $owner_id If supplied, only deals owned by the specified user are returned. If filter_id is provided, this is ignored. (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 $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|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. Multiple statuses can be included as a comma separated array. If filter_id is provided, this is ignored. (optional) - * @param string|null $updated_since If set, only deals with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) - * @param string|null $updated_until If set, only deals with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) - * @param string|'id' $sort_by The field to sort by. Supported fields: `id`, `update_time`, `add_time`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') - * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) - * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (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 $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 getArchivedDealsAsyncWithHttpInfo($filter_id = null, $ids = null, $owner_id = null, $person_id = null, $org_id = null, $pipeline_id = null, $stage_id = null, $status = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $limit = null, $cursor = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v2\Model\GetDeals'; - $request = $this->getArchivedDealsRequest($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor); - - 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 $filter_id If supplied, only deals matching the specified filter are returned (optional) - * @param string|null $ids Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. (optional) - * @param int|null $owner_id If supplied, only deals owned by the specified user are returned. If filter_id is provided, this is ignored. (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 $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|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. Multiple statuses can be included as a comma separated array. If filter_id is provided, this is ignored. (optional) - * @param string|null $updated_since If set, only deals with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) - * @param string|null $updated_until If set, only deals with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) - * @param string|'id' $sort_by The field to sort by. Supported fields: `id`, `update_time`, `add_time`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') - * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) - * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (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 $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 getArchivedDealsRequest($filter_id = null, $ids = null, $owner_id = null, $person_id = null, $org_id = null, $pipeline_id = null, $stage_id = null, $status = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $limit = null, $cursor = null): Request - { - - $resourcePath = '/deals/archived'; - $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($ids)) { - $ids = ObjectSerializer::serializeCollection($ids, '', true); - } - if ($ids !== null) { - $queryParams['ids'] = $ids; - } - // 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($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($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($updated_since)) { - $updated_since = ObjectSerializer::serializeCollection($updated_since, '', true); - } - if ($updated_since !== null) { - $queryParams['updated_since'] = $updated_since; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($updated_until)) { - $updated_until = ObjectSerializer::serializeCollection($updated_until, '', true); - } - if ($updated_until !== null) { - $queryParams['updated_until'] = $updated_until; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($sort_by)) { - $sort_by = ObjectSerializer::serializeCollection($sort_by, '', true); - } - if ($sort_by !== null) { - $queryParams['sort_by'] = $sort_by; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($sort_direction)) { - $sort_direction = ObjectSerializer::serializeCollection($sort_direction, '', true); - } - if ($sort_direction !== null) { - $queryParams['sort_direction'] = $sort_direction; - } - // 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($custom_fields)) { - $custom_fields = ObjectSerializer::serializeCollection($custom_fields, '', true); - } - if ($custom_fields !== null) { - $queryParams['custom_fields'] = $custom_fields; - } - // 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($cursor)) { - $cursor = ObjectSerializer::serializeCollection($cursor, '', true); - } - if ($cursor !== null) { - $queryParams['cursor'] = $cursor; - } - - - - - /* @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) - * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) - * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v2\Model\PostPatchGetDeal - */ - public function getDeal($id, $include_fields = null, $custom_fields = null) - { - list($response) = $this->getDealWithHttpInfo($id, $include_fields, $custom_fields); - return $response; - } - - /** - * Operation getDealWithHttpInfo - * - * Get details of a deal - * - * @param int $id The ID of the deal (required) - * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) - * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v2\Model\PostPatchGetDeal, HTTP status code, HTTP response headers (array of strings) - */ - public function getDealWithHttpInfo($id, $include_fields = null, $custom_fields = null) - { - $request = $this->getDealRequest($id, $include_fields, $custom_fields); - - 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, $include_fields, $custom_fields); - $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\v2\Model\PostPatchGetDeal' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetDeal', []), - $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\v2\Model\PostPatchGetDeal' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetDeal', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\PostPatchGetDeal', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getDealAsync - * - * Get details of a deal - * - * @param int $id The ID of the deal (required) - * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) - * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getDealAsync($id, $include_fields = null, $custom_fields = null): PromiseInterface - { - return $this->getDealAsyncWithHttpInfo($id, $include_fields, $custom_fields) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getDealAsyncWithHttpInfo - * - * Get details of a deal - * - * @param int $id The ID of the deal (required) - * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) - * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getDealAsyncWithHttpInfo($id, $include_fields = null, $custom_fields = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v2\Model\PostPatchGetDeal'; - $request = $this->getDealRequest($id, $include_fields, $custom_fields); - - 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) - * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) - * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function getDealRequest($id, $include_fields = null, $custom_fields = 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 getDeal' - ); - } - - $resourcePath = '/deals/{id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // 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($custom_fields)) { - $custom_fields = ObjectSerializer::serializeCollection($custom_fields, '', true); - } - if ($custom_fields !== null) { - $queryParams['custom_fields'] = $custom_fields; - } - - - // 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 getDealConversionStatus - * - * Get Deal conversion status - * - * @param int $id The ID of a deal (required) - * @param string $conversion_id The ID of the conversion (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return void - */ - public function getDealConversionStatus($id, $conversion_id) - { - $this->getDealConversionStatusWithHttpInfo($id, $conversion_id); - } - - /** - * Operation getDealConversionStatusWithHttpInfo - * - * Get Deal conversion status - * - * @param int $id The ID of a deal (required) - * @param string $conversion_id The ID of the conversion (required) - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function getDealConversionStatusWithHttpInfo($id, $conversion_id) - { - $request = $this->getDealConversionStatusRequest($id, $conversion_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->getDealConversionStatusRequest($id, $conversion_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(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\GetConvertResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getDealConversionStatusAsync - * - * Get Deal conversion status - * - * @param int $id The ID of a deal (required) - * @param string $conversion_id The ID of the conversion (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getDealConversionStatusAsync($id, $conversion_id): PromiseInterface - { - return $this->getDealConversionStatusAsyncWithHttpInfo($id, $conversion_id) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getDealConversionStatusAsyncWithHttpInfo - * - * Get Deal conversion status - * - * @param int $id The ID of a deal (required) - * @param string $conversion_id The ID of the conversion (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getDealConversionStatusAsyncWithHttpInfo($id, $conversion_id): PromiseInterface - { - $returnType = ''; - $request = $this->getDealConversionStatusRequest($id, $conversion_id); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $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 'getDealConversionStatus' - * - * @param int $id The ID of a deal (required) - * @param string $conversion_id The ID of the conversion (required) - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function getDealConversionStatusRequest($id, $conversion_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 getDealConversionStatus' - ); - } - // verify the required parameter 'conversion_id' is set - /* @phpstan-ignore-next-line */ - if ($conversion_id === null || (is_array($conversion_id) && count($conversion_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $conversion_id when calling getDealConversionStatus' - ); - } - - $resourcePath = '/deals/{id}/convert/status/{conversion_id}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } - // path params - if ($conversion_id !== null) { - $resourcePath = str_replace( - '{' . 'conversion_id' . '}', - ObjectSerializer::toPathValue($conversion_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) - * @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 $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\v2\Model\GetFollowers - */ - public function getDealFollowers($id, $limit = null, $cursor = null) - { - list($response) = $this->getDealFollowersWithHttpInfo($id, $limit, $cursor); - return $response; - } - - /** - * Operation getDealFollowersWithHttpInfo - * - * List followers of a deal - * - * @param int $id The ID of the deal (required) - * @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 $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\v2\Model\GetFollowers, HTTP status code, HTTP response headers (array of strings) - */ - public function getDealFollowersWithHttpInfo($id, $limit = null, $cursor = null) - { - $request = $this->getDealFollowersRequest($id, $limit, $cursor); - - 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, $limit, $cursor); - $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\v2\Model\GetFollowers' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetFollowers', []), - $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\v2\Model\GetFollowers' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetFollowers', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\GetFollowers', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getDealFollowersAsync - * - * List followers of a deal - * - * @param int $id The ID of the deal (required) - * @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 $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 getDealFollowersAsync($id, $limit = null, $cursor = null): PromiseInterface - { - return $this->getDealFollowersAsyncWithHttpInfo($id, $limit, $cursor) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getDealFollowersAsyncWithHttpInfo - * - * List followers of a deal - * - * @param int $id The ID of the deal (required) - * @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 $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 getDealFollowersAsyncWithHttpInfo($id, $limit = null, $cursor = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v2\Model\GetFollowers'; - $request = $this->getDealFollowersRequest($id, $limit, $cursor); - - 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) - * @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 $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 getDealFollowersRequest($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 getDealFollowers' - ); - } - - $resourcePath = '/deals/{id}/followers'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // 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($cursor)) { - $cursor = ObjectSerializer::serializeCollection($cursor, '', true); - } - if ($cursor !== null) { - $queryParams['cursor'] = $cursor; - } - - - // 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 getDealFollowersChangelog - * - * List followers changelog of a deal - * - * @param int $id The ID of the deal (required) - * @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 $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\v2\Model\GetFollowerChangelogs - */ - public function getDealFollowersChangelog($id, $limit = null, $cursor = null) - { - list($response) = $this->getDealFollowersChangelogWithHttpInfo($id, $limit, $cursor); - return $response; - } - - /** - * Operation getDealFollowersChangelogWithHttpInfo - * - * List followers changelog of a deal - * - * @param int $id The ID of the deal (required) - * @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 $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\v2\Model\GetFollowerChangelogs, HTTP status code, HTTP response headers (array of strings) - */ - public function getDealFollowersChangelogWithHttpInfo($id, $limit = null, $cursor = null) - { - $request = $this->getDealFollowersChangelogRequest($id, $limit, $cursor); - - 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->getDealFollowersChangelogRequest($id, $limit, $cursor); - $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\v2\Model\GetFollowerChangelogs' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetFollowerChangelogs', []), - $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\v2\Model\GetFollowerChangelogs' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetFollowerChangelogs', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\GetFollowerChangelogs', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getDealFollowersChangelogAsync - * - * List followers changelog of a deal - * - * @param int $id The ID of the deal (required) - * @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 $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 getDealFollowersChangelogAsync($id, $limit = null, $cursor = null): PromiseInterface - { - return $this->getDealFollowersChangelogAsyncWithHttpInfo($id, $limit, $cursor) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getDealFollowersChangelogAsyncWithHttpInfo - * - * List followers changelog of a deal - * - * @param int $id The ID of the deal (required) - * @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 $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 getDealFollowersChangelogAsyncWithHttpInfo($id, $limit = null, $cursor = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v2\Model\GetFollowerChangelogs'; - $request = $this->getDealFollowersChangelogRequest($id, $limit, $cursor); - - 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 'getDealFollowersChangelog' - * - * @param int $id The ID of the deal (required) - * @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 $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 getDealFollowersChangelogRequest($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 getDealFollowersChangelog' - ); - } - - $resourcePath = '/deals/{id}/followers/changelog'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // 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($cursor)) { - $cursor = ObjectSerializer::serializeCollection($cursor, '', true); - } - if ($cursor !== null) { - $queryParams['cursor'] = $cursor; - } - - - // 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 getDealProducts - * - * List products attached to a deal - * - * @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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `add_time`, `update_time`, `order_nr`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v2\Model\DealsProductsResponse - */ - public function getDealProducts($id, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc') - { - list($response) = $this->getDealProductsWithHttpInfo($id, $cursor, $limit, $sort_by, $sort_direction); - return $response; - } - - /** - * Operation getDealProductsWithHttpInfo - * - * List products attached to a deal - * - * @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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `add_time`, `update_time`, `order_nr`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') - * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v2\Model\DealsProductsResponse, HTTP status code, HTTP response headers (array of strings) - */ - public function getDealProductsWithHttpInfo($id, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc') - { - $request = $this->getDealProductsRequest($id, $cursor, $limit, $sort_by, $sort_direction); - - 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->getDealProductsRequest($id, $cursor, $limit, $sort_by, $sort_direction); - $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\v2\Model\DealsProductsResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DealsProductsResponse', []), - $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\v2\Model\DealsProductsResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DealsProductsResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\DealsProductsResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getDealProductsAsync - * - * List products attached to a deal - * - * @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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `add_time`, `update_time`, `order_nr`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getDealProductsAsync($id, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc'): PromiseInterface - { - return $this->getDealProductsAsyncWithHttpInfo($id, $cursor, $limit, $sort_by, $sort_direction) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getDealProductsAsyncWithHttpInfo - * - * List products attached to a deal - * - * @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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `add_time`, `update_time`, `order_nr`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') - * - * @throws InvalidArgumentException|OAuthProviderException - * @return PromiseInterface - */ - public function getDealProductsAsyncWithHttpInfo($id, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc'): PromiseInterface - { - $returnType = '\Pipedrive\versions\v2\Model\DealsProductsResponse'; - $request = $this->getDealProductsRequest($id, $cursor, $limit, $sort_by, $sort_direction); - - 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 'getDealProducts' - * - * @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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `add_time`, `update_time`, `order_nr`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') - * - * @throws InvalidArgumentException|OAuthProviderException - * @return Request - */ - public function getDealProductsRequest($id, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc'): 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' - ); - } - - $resourcePath = '/deals/{id}/products'; - $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($sort_by)) { - $sort_by = ObjectSerializer::serializeCollection($sort_by, '', true); - } - if ($sort_by !== null) { - $queryParams['sort_by'] = $sort_by; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($sort_direction)) { - $sort_direction = ObjectSerializer::serializeCollection($sort_direction, '', true); - } - if ($sort_direction !== null) { - $queryParams['sort_direction'] = $sort_direction; - } - - - // 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 getDeals - * - * Get all deals - * - * @param int|null $filter_id If supplied, only deals matching the specified filter are returned (optional) - * @param string|null $ids Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. (optional) - * @param int|null $owner_id If supplied, only deals owned by the specified user are returned. If filter_id is provided, this is ignored. (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 $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|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. Multiple statuses can be included as a comma separated array. If filter_id is provided, this is ignored. (optional) - * @param string|null $updated_since If set, only deals with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) - * @param string|null $updated_until If set, only deals with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) - * @param string|'id' $sort_by The field to sort by. Supported fields: `id`, `update_time`, `add_time`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') - * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) - * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (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 $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\v2\Model\GetDeals - */ - public function getDeals($filter_id = null, $ids = null, $owner_id = null, $person_id = null, $org_id = null, $pipeline_id = null, $stage_id = null, $status = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $limit = null, $cursor = null) - { - list($response) = $this->getDealsWithHttpInfo($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor); - return $response; - } - - /** - * Operation getDealsWithHttpInfo - * - * Get all deals - * - * @param int|null $filter_id If supplied, only deals matching the specified filter are returned (optional) - * @param string|null $ids Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. (optional) - * @param int|null $owner_id If supplied, only deals owned by the specified user are returned. If filter_id is provided, this is ignored. (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 $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|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. Multiple statuses can be included as a comma separated array. If filter_id is provided, this is ignored. (optional) - * @param string|null $updated_since If set, only deals with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) - * @param string|null $updated_until If set, only deals with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) - * @param string|'id' $sort_by The field to sort by. Supported fields: `id`, `update_time`, `add_time`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') - * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) - * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (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 $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\v2\Model\GetDeals, HTTP status code, HTTP response headers (array of strings) - */ - public function getDealsWithHttpInfo($filter_id = null, $ids = null, $owner_id = null, $person_id = null, $org_id = null, $pipeline_id = null, $stage_id = null, $status = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $limit = null, $cursor = null) - { - $request = $this->getDealsRequest($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor); - - 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->getDealsRequest($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor); - $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\v2\Model\GetDeals' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\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\v2\Model\GetDeals' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetDeals', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\GetDeals', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation getDealsAsync - * - * Get all deals - * - * @param int|null $filter_id If supplied, only deals matching the specified filter are returned (optional) - * @param string|null $ids Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. (optional) - * @param int|null $owner_id If supplied, only deals owned by the specified user are returned. If filter_id is provided, this is ignored. (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 $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|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. Multiple statuses can be included as a comma separated array. If filter_id is provided, this is ignored. (optional) - * @param string|null $updated_since If set, only deals with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) - * @param string|null $updated_until If set, only deals with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) - * @param string|'id' $sort_by The field to sort by. Supported fields: `id`, `update_time`, `add_time`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') - * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) - * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (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 $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 getDealsAsync($filter_id = null, $ids = null, $owner_id = null, $person_id = null, $org_id = null, $pipeline_id = null, $stage_id = null, $status = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $limit = null, $cursor = null): PromiseInterface - { - return $this->getDealsAsyncWithHttpInfo($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation getDealsAsyncWithHttpInfo - * - * Get all deals - * - * @param int|null $filter_id If supplied, only deals matching the specified filter are returned (optional) - * @param string|null $ids Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. (optional) - * @param int|null $owner_id If supplied, only deals owned by the specified user are returned. If filter_id is provided, this is ignored. (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 $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|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. Multiple statuses can be included as a comma separated array. If filter_id is provided, this is ignored. (optional) - * @param string|null $updated_since If set, only deals with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) - * @param string|null $updated_until If set, only deals with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) - * @param string|'id' $sort_by The field to sort by. Supported fields: `id`, `update_time`, `add_time`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') - * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) - * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (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 $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 getDealsAsyncWithHttpInfo($filter_id = null, $ids = null, $owner_id = null, $person_id = null, $org_id = null, $pipeline_id = null, $stage_id = null, $status = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $limit = null, $cursor = null): PromiseInterface - { - $returnType = '\Pipedrive\versions\v2\Model\GetDeals'; - $request = $this->getDealsRequest($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor); - - 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 'getDeals' - * - * @param int|null $filter_id If supplied, only deals matching the specified filter are returned (optional) - * @param string|null $ids Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. (optional) - * @param int|null $owner_id If supplied, only deals owned by the specified user are returned. If filter_id is provided, this is ignored. (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 $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|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. Multiple statuses can be included as a comma separated array. If filter_id is provided, this is ignored. (optional) - * @param string|null $updated_since If set, only deals with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) - * @param string|null $updated_until If set, only deals with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) - * @param string|'id' $sort_by The field to sort by. Supported fields: `id`, `update_time`, `add_time`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') - * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) - * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (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 $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 getDealsRequest($filter_id = null, $ids = null, $owner_id = null, $person_id = null, $org_id = null, $pipeline_id = null, $stage_id = null, $status = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $limit = null, $cursor = null): Request + public function getArchivedDealsRequest($filter_id = null, $ids = null, $owner_id = null, $person_id = null, $org_id = null, $pipeline_id = null, $stage_id = null, $status = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $limit = null, $cursor = null): Request { - $resourcePath = '/deals'; + $resourcePath = '/deals/archived'; $formParams = []; $queryParams = []; $headerParams = []; @@ -6359,44 +2742,44 @@ public function getDealsRequest($filter_id = null, $ids = null, $owner_id = null } /** - * Operation getDealsProducts + * Operation getDeal * - * Get deal products of several deals + * Get details of a deal * - * @param int[] $deal_ids An array of integers with the IDs of the deals for which the attached products will be returned. A maximum of 100 deal IDs can be provided. (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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `deal_id`, `add_time`, `update_time`, `order_nr`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * @param int $id The ID of the deal (required) + * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) + * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v2\Model\DealsProductsResponse + * @return \Pipedrive\versions\v2\Model\PostPatchGetDeal */ - public function getDealsProducts($deal_ids, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc') + public function getDeal($id, $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null) { - list($response) = $this->getDealsProductsWithHttpInfo($deal_ids, $cursor, $limit, $sort_by, $sort_direction); + list($response) = $this->getDealWithHttpInfo($id, $include_fields, $custom_fields, $include_option_labels, $include_labels); return $response; } /** - * Operation getDealsProductsWithHttpInfo + * Operation getDealWithHttpInfo * - * Get deal products of several deals + * Get details of a deal * - * @param int[] $deal_ids An array of integers with the IDs of the deals for which the attached products will be returned. A maximum of 100 deal IDs can be provided. (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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `deal_id`, `add_time`, `update_time`, `order_nr`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * @param int $id The ID of the deal (required) + * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) + * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v2\Model\DealsProductsResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v2\Model\PostPatchGetDeal, HTTP status code, HTTP response headers (array of strings) */ - public function getDealsProductsWithHttpInfo($deal_ids, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc') + public function getDealWithHttpInfo($id, $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null) { - $request = $this->getDealsProductsRequest($deal_ids, $cursor, $limit, $sort_by, $sort_direction); + $request = $this->getDealRequest($id, $include_fields, $custom_fields, $include_option_labels, $include_labels); try { $options = $this->createHttpClientOption(); @@ -6405,7 +2788,7 @@ public function getDealsProductsWithHttpInfo($deal_ids, $cursor = null, $limit = } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getDealsProductsRequest($deal_ids, $cursor, $limit, $sort_by, $sort_direction); + $request = $this->getDealRequest($id, $include_fields, $custom_fields, $include_option_labels, $include_labels); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -6430,14 +2813,14 @@ public function getDealsProductsWithHttpInfo($deal_ids, $cursor = null, $limit = switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\DealsProductsResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\PostPatchGetDeal' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DealsProductsResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetDeal', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -6457,14 +2840,14 @@ public function getDealsProductsWithHttpInfo($deal_ids, $cursor = null, $limit = } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\DealsProductsResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\PostPatchGetDeal' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DealsProductsResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetDeal', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -6474,7 +2857,7 @@ public function getDealsProductsWithHttpInfo($deal_ids, $cursor = null, $limit = case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\DealsProductsResponse', + '\Pipedrive\versions\v2\Model\PostPatchGetDeal', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6485,22 +2868,22 @@ public function getDealsProductsWithHttpInfo($deal_ids, $cursor = null, $limit = } /** - * Operation getDealsProductsAsync + * Operation getDealAsync * - * Get deal products of several deals + * Get details of a deal * - * @param int[] $deal_ids An array of integers with the IDs of the deals for which the attached products will be returned. A maximum of 100 deal IDs can be provided. (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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `deal_id`, `add_time`, `update_time`, `order_nr`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * @param int $id The ID of the deal (required) + * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) + * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getDealsProductsAsync($deal_ids, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc'): PromiseInterface + public function getDealAsync($id, $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null): PromiseInterface { - return $this->getDealsProductsAsyncWithHttpInfo($deal_ids, $cursor, $limit, $sort_by, $sort_direction) + return $this->getDealAsyncWithHttpInfo($id, $include_fields, $custom_fields, $include_option_labels, $include_labels) ->then( function ($response) { return $response[0]; @@ -6509,23 +2892,23 @@ function ($response) { } /** - * Operation getDealsProductsAsyncWithHttpInfo + * Operation getDealAsyncWithHttpInfo * - * Get deal products of several deals + * Get details of a deal * - * @param int[] $deal_ids An array of integers with the IDs of the deals for which the attached products will be returned. A maximum of 100 deal IDs can be provided. (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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `deal_id`, `add_time`, `update_time`, `order_nr`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * @param int $id The ID of the deal (required) + * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) + * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getDealsProductsAsyncWithHttpInfo($deal_ids, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc'): PromiseInterface + public function getDealAsyncWithHttpInfo($id, $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v2\Model\DealsProductsResponse'; - $request = $this->getDealsProductsRequest($deal_ids, $cursor, $limit, $sort_by, $sort_direction); + $returnType = '\Pipedrive\versions\v2\Model\PostPatchGetDeal'; + $request = $this->getDealRequest($id, $include_fields, $custom_fields, $include_option_labels, $include_labels); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -6562,76 +2945,76 @@ function ($exception) { } /** - * Create request for operation 'getDealsProducts' + * Create request for operation 'getDeal' * - * @param int[] $deal_ids An array of integers with the IDs of the deals for which the attached products will be returned. A maximum of 100 deal IDs can be provided. (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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `deal_id`, `add_time`, `update_time`, `order_nr`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * @param int $id The ID of the deal (required) + * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) + * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function getDealsProductsRequest($deal_ids, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc'): Request + public function getDealRequest($id, $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null): Request { - // verify the required parameter 'deal_ids' is set + // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ - if ($deal_ids === null || (is_array($deal_ids) && count($deal_ids) === 0)) { + if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $deal_ids when calling getDealsProducts' + 'Missing the required parameter $id when calling getDeal' ); } - $resourcePath = '/deals/products'; + $resourcePath = '/deals/{id}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - - // query params - /* @phpstan-ignore-next-line */ - if (is_array($deal_ids)) { - $deal_ids = ObjectSerializer::serializeCollection($deal_ids, 'csv', true); - } - if ($deal_ids !== null) { - $queryParams['deal_ids'] = $deal_ids; - } + // query params /* @phpstan-ignore-next-line */ - if (is_array($cursor)) { - $cursor = ObjectSerializer::serializeCollection($cursor, '', true); + if (is_array($include_fields)) { + $include_fields = ObjectSerializer::serializeCollection($include_fields, '', true); } - if ($cursor !== null) { - $queryParams['cursor'] = $cursor; + if ($include_fields !== null) { + $queryParams['include_fields'] = $include_fields; } // query params /* @phpstan-ignore-next-line */ - if (is_array($limit)) { - $limit = ObjectSerializer::serializeCollection($limit, '', true); + if (is_array($custom_fields)) { + $custom_fields = ObjectSerializer::serializeCollection($custom_fields, '', true); } - if ($limit !== null) { - $queryParams['limit'] = $limit; + if ($custom_fields !== null) { + $queryParams['custom_fields'] = $custom_fields; } // query params /* @phpstan-ignore-next-line */ - if (is_array($sort_by)) { - $sort_by = ObjectSerializer::serializeCollection($sort_by, '', true); + if (is_array($include_option_labels)) { + $include_option_labels = ObjectSerializer::serializeCollection($include_option_labels, '', true); } - if ($sort_by !== null) { - $queryParams['sort_by'] = $sort_by; + if ($include_option_labels !== null) { + $queryParams['include_option_labels'] = $include_option_labels; } // query params /* @phpstan-ignore-next-line */ - if (is_array($sort_direction)) { - $sort_direction = ObjectSerializer::serializeCollection($sort_direction, '', true); + if (is_array($include_labels)) { + $include_labels = ObjectSerializer::serializeCollection($include_labels, '', true); } - if ($sort_direction !== null) { - $queryParams['sort_direction'] = $sort_direction; + if ($include_labels !== null) { + $queryParams['include_labels'] = $include_labels; } + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } /* @phpstan-ignore-next-line */ @@ -6707,44 +3090,37 @@ public function getDealsProductsRequest($deal_ids, $cursor = null, $limit = null } /** - * Operation getInstallments + * Operation getDealConversionStatus * - * List installments added to a list of deals + * Get Deal conversion status * - * @param int[] $deal_ids An array of integers with the IDs of the deals for which the attached installments will be returned. A maximum of 100 deal IDs can be provided. (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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `billing_date`, `deal_id`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * @param int $id The ID of a deal (required) + * @param string $conversion_id The ID of the conversion (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v2\Model\InstallmentsResponse + * @return void */ - public function getInstallments($deal_ids, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc') + public function getDealConversionStatus($id, $conversion_id) { - list($response) = $this->getInstallmentsWithHttpInfo($deal_ids, $cursor, $limit, $sort_by, $sort_direction); - return $response; + $this->getDealConversionStatusWithHttpInfo($id, $conversion_id); } /** - * Operation getInstallmentsWithHttpInfo + * Operation getDealConversionStatusWithHttpInfo * - * List installments added to a list of deals + * Get Deal conversion status * - * @param int[] $deal_ids An array of integers with the IDs of the deals for which the attached installments will be returned. A maximum of 100 deal IDs can be provided. (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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `billing_date`, `deal_id`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * @param int $id The ID of a deal (required) + * @param string $conversion_id The ID of the conversion (required) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v2\Model\InstallmentsResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function getInstallmentsWithHttpInfo($deal_ids, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc') + public function getDealConversionStatusWithHttpInfo($id, $conversion_id) { - $request = $this->getInstallmentsRequest($deal_ids, $cursor, $limit, $sort_by, $sort_direction); + $request = $this->getDealConversionStatusRequest($id, $conversion_id); try { $options = $this->createHttpClientOption(); @@ -6753,7 +3129,7 @@ public function getInstallmentsWithHttpInfo($deal_ids, $cursor = null, $limit = } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getInstallmentsRequest($deal_ids, $cursor, $limit, $sort_by, $sort_direction); + $request = $this->getDealConversionStatusRequest($id, $conversion_id); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -6775,54 +3151,14 @@ public function getInstallmentsWithHttpInfo($deal_ids, $cursor = null, $limit = $statusCode = $response->getStatusCode(); - switch($statusCode) { - case 200: - /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\InstallmentsResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\InstallmentsResponse', []), - $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\v2\Model\InstallmentsResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\InstallmentsResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return [null, $statusCode, $response->getHeaders()]; } catch (ApiException $e) { switch ($e->getCode()) { - case 200: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\InstallmentsResponse', + '\Pipedrive\versions\v2\Model\GetConvertResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6833,22 +3169,19 @@ public function getInstallmentsWithHttpInfo($deal_ids, $cursor = null, $limit = } /** - * Operation getInstallmentsAsync + * Operation getDealConversionStatusAsync * - * List installments added to a list of deals + * Get Deal conversion status * - * @param int[] $deal_ids An array of integers with the IDs of the deals for which the attached installments will be returned. A maximum of 100 deal IDs can be provided. (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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `billing_date`, `deal_id`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * @param int $id The ID of a deal (required) + * @param string $conversion_id The ID of the conversion (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getInstallmentsAsync($deal_ids, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc'): PromiseInterface + public function getDealConversionStatusAsync($id, $conversion_id): PromiseInterface { - return $this->getInstallmentsAsyncWithHttpInfo($deal_ids, $cursor, $limit, $sort_by, $sort_direction) + return $this->getDealConversionStatusAsyncWithHttpInfo($id, $conversion_id) ->then( function ($response) { return $response[0]; @@ -6857,40 +3190,26 @@ function ($response) { } /** - * Operation getInstallmentsAsyncWithHttpInfo + * Operation getDealConversionStatusAsyncWithHttpInfo * - * List installments added to a list of deals + * Get Deal conversion status * - * @param int[] $deal_ids An array of integers with the IDs of the deals for which the attached installments will be returned. A maximum of 100 deal IDs can be provided. (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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `billing_date`, `deal_id`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * @param int $id The ID of a deal (required) + * @param string $conversion_id The ID of the conversion (required) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getInstallmentsAsyncWithHttpInfo($deal_ids, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc'): PromiseInterface + public function getDealConversionStatusAsyncWithHttpInfo($id, $conversion_id): PromiseInterface { - $returnType = '\Pipedrive\versions\v2\Model\InstallmentsResponse'; - $request = $this->getInstallmentsRequest($deal_ids, $cursor, $limit, $sort_by, $sort_direction); + $returnType = ''; + $request = $this->getDealConversionStatusRequest($id, $conversion_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() - ]; + return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { $response = $exception->getResponse(); @@ -6910,76 +3229,56 @@ function ($exception) { } /** - * Create request for operation 'getInstallments' + * Create request for operation 'getDealConversionStatus' * - * @param int[] $deal_ids An array of integers with the IDs of the deals for which the attached installments will be returned. A maximum of 100 deal IDs can be provided. (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 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|'id' $sort_by The field to sort by. Supported fields: `id`, `billing_date`, `deal_id`. (optional, default to 'id') - * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * @param int $id The ID of a deal (required) + * @param string $conversion_id The ID of the conversion (required) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function getInstallmentsRequest($deal_ids, $cursor = null, $limit = null, $sort_by = 'id', $sort_direction = 'asc'): Request + public function getDealConversionStatusRequest($id, $conversion_id): Request { - // verify the required parameter 'deal_ids' is set + // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ - if ($deal_ids === null || (is_array($deal_ids) && count($deal_ids) === 0)) { + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getDealConversionStatus' + ); + } + // verify the required parameter 'conversion_id' is set + /* @phpstan-ignore-next-line */ + if ($conversion_id === null || (is_array($conversion_id) && count($conversion_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $deal_ids when calling getInstallments' + 'Missing the required parameter $conversion_id when calling getDealConversionStatus' ); } - $resourcePath = '/deals/installments'; + $resourcePath = '/deals/{id}/convert/status/{conversion_id}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - /* @phpstan-ignore-next-line */ - if (is_array($deal_ids)) { - $deal_ids = ObjectSerializer::serializeCollection($deal_ids, 'csv', true); - } - if ($deal_ids !== null) { - $queryParams['deal_ids'] = $deal_ids; - } - // 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($sort_by)) { - $sort_by = ObjectSerializer::serializeCollection($sort_by, '', true); - } - if ($sort_by !== null) { - $queryParams['sort_by'] = $sort_by; - } - // query params - /* @phpstan-ignore-next-line */ - if (is_array($sort_direction)) { - $sort_direction = ObjectSerializer::serializeCollection($sort_direction, '', true); - } - if ($sort_direction !== null) { - $queryParams['sort_direction'] = $sort_direction; - } + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + // path params + if ($conversion_id !== null) { + $resourcePath = str_replace( + '{' . 'conversion_id' . '}', + ObjectSerializer::toPathValue($conversion_id), + $resourcePath + ); + } /* @phpstan-ignore-next-line */ @@ -7055,38 +3354,40 @@ public function getInstallmentsRequest($deal_ids, $cursor = null, $limit = null, } /** - * Operation postAdditionalDiscount + * Operation getDealFollowers * - * Add a discount to a deal + * List followers of a deal * * @param int $id The ID of the deal (required) - * @param object|null $body body (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 $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\v2\Model\AddAdditionalDiscountResponse + * @return \Pipedrive\versions\v2\Model\GetFollowers */ - public function postAdditionalDiscount($id, $body = null) + public function getDealFollowers($id, $limit = null, $cursor = null) { - list($response) = $this->postAdditionalDiscountWithHttpInfo($id, $body); + list($response) = $this->getDealFollowersWithHttpInfo($id, $limit, $cursor); return $response; } /** - * Operation postAdditionalDiscountWithHttpInfo + * Operation getDealFollowersWithHttpInfo * - * Add a discount to a deal + * List followers of a deal * * @param int $id The ID of the deal (required) - * @param object|null $body (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 $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\v2\Model\AddAdditionalDiscountResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v2\Model\GetFollowers, HTTP status code, HTTP response headers (array of strings) */ - public function postAdditionalDiscountWithHttpInfo($id, $body = null) + public function getDealFollowersWithHttpInfo($id, $limit = null, $cursor = null) { - $request = $this->postAdditionalDiscountRequest($id, $body); + $request = $this->getDealFollowersRequest($id, $limit, $cursor); try { $options = $this->createHttpClientOption(); @@ -7095,7 +3396,7 @@ public function postAdditionalDiscountWithHttpInfo($id, $body = null) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->postAdditionalDiscountRequest($id, $body); + $request = $this->getDealFollowersRequest($id, $limit, $cursor); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -7118,16 +3419,16 @@ public function postAdditionalDiscountWithHttpInfo($id, $body = null) switch($statusCode) { - case 201: + case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\AddAdditionalDiscountResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\GetFollowers' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddAdditionalDiscountResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetFollowers', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -7147,24 +3448,24 @@ public function postAdditionalDiscountWithHttpInfo($id, $body = null) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\AddAdditionalDiscountResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\GetFollowers' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddAdditionalDiscountResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetFollowers', []), $response->getStatusCode(), $response->getHeaders() ]; } catch (ApiException $e) { switch ($e->getCode()) { - case 201: + case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\AddAdditionalDiscountResponse', + '\Pipedrive\versions\v2\Model\GetFollowers', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7175,19 +3476,20 @@ public function postAdditionalDiscountWithHttpInfo($id, $body = null) } /** - * Operation postAdditionalDiscountAsync + * Operation getDealFollowersAsync * - * Add a discount to a deal + * List followers of a deal * * @param int $id The ID of the deal (required) - * @param object|null $body (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 $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 postAdditionalDiscountAsync($id, $body = null): PromiseInterface + public function getDealFollowersAsync($id, $limit = null, $cursor = null): PromiseInterface { - return $this->postAdditionalDiscountAsyncWithHttpInfo($id, $body) + return $this->getDealFollowersAsyncWithHttpInfo($id, $limit, $cursor) ->then( function ($response) { return $response[0]; @@ -7196,20 +3498,21 @@ function ($response) { } /** - * Operation postAdditionalDiscountAsyncWithHttpInfo + * Operation getDealFollowersAsyncWithHttpInfo * - * Add a discount to a deal + * List followers of a deal * * @param int $id The ID of the deal (required) - * @param object|null $body (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 $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 postAdditionalDiscountAsyncWithHttpInfo($id, $body = null): PromiseInterface + public function getDealFollowersAsyncWithHttpInfo($id, $limit = null, $cursor = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v2\Model\AddAdditionalDiscountResponse'; - $request = $this->postAdditionalDiscountRequest($id, $body); + $returnType = '\Pipedrive\versions\v2\Model\GetFollowers'; + $request = $this->getDealFollowersRequest($id, $limit, $cursor); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -7246,31 +3549,48 @@ function ($exception) { } /** - * Create request for operation 'postAdditionalDiscount' + * Create request for operation 'getDealFollowers' * * @param int $id The ID of the deal (required) - * @param object|null $body (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 $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 postAdditionalDiscountRequest($id, $body = null): Request + public function getDealFollowersRequest($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 postAdditionalDiscount' + 'Missing the required parameter $id when calling getDealFollowers' ); } - $resourcePath = '/deals/{id}/discounts'; + $resourcePath = '/deals/{id}/followers'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // 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($cursor)) { + $cursor = ObjectSerializer::serializeCollection($cursor, '', true); + } + if ($cursor !== null) { + $queryParams['cursor'] = $cursor; + } // path params @@ -7291,18 +3611,12 @@ public function postAdditionalDiscountRequest($id, $body = null): Request } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - ['application/json'] + [] ); } // for model (json/xml) - if (isset($body)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); - } else { - $httpBody = $body; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { /* @phpstan-ignore-next-line */ if ($multipart) { $multipartContents = []; @@ -7354,7 +3668,7 @@ public function postAdditionalDiscountRequest($id, $body = null): Request $query = Query::build($queryParams); return new Request( - 'POST', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -7362,38 +3676,40 @@ public function postAdditionalDiscountRequest($id, $body = null): Request } /** - * Operation postInstallment + * Operation getDealFollowersChangelog * - * Add an installment to a deal + * List followers changelog of a deal * * @param int $id The ID of the deal (required) - * @param object|null $body body (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 $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\v2\Model\AddInstallmentResponse + * @return \Pipedrive\versions\v2\Model\GetFollowerChangelogs */ - public function postInstallment($id, $body = null) + public function getDealFollowersChangelog($id, $limit = null, $cursor = null) { - list($response) = $this->postInstallmentWithHttpInfo($id, $body); + list($response) = $this->getDealFollowersChangelogWithHttpInfo($id, $limit, $cursor); return $response; } /** - * Operation postInstallmentWithHttpInfo + * Operation getDealFollowersChangelogWithHttpInfo * - * Add an installment to a deal + * List followers changelog of a deal * * @param int $id The ID of the deal (required) - * @param object|null $body (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 $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\v2\Model\AddInstallmentResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v2\Model\GetFollowerChangelogs, HTTP status code, HTTP response headers (array of strings) */ - public function postInstallmentWithHttpInfo($id, $body = null) + public function getDealFollowersChangelogWithHttpInfo($id, $limit = null, $cursor = null) { - $request = $this->postInstallmentRequest($id, $body); + $request = $this->getDealFollowersChangelogRequest($id, $limit, $cursor); try { $options = $this->createHttpClientOption(); @@ -7402,7 +3718,7 @@ public function postInstallmentWithHttpInfo($id, $body = null) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->postInstallmentRequest($id, $body); + $request = $this->getDealFollowersChangelogRequest($id, $limit, $cursor); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -7427,14 +3743,14 @@ public function postInstallmentWithHttpInfo($id, $body = null) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\AddInstallmentResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\GetFollowerChangelogs' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddInstallmentResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetFollowerChangelogs', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -7454,14 +3770,14 @@ public function postInstallmentWithHttpInfo($id, $body = null) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\AddInstallmentResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\GetFollowerChangelogs' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddInstallmentResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetFollowerChangelogs', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -7471,7 +3787,7 @@ public function postInstallmentWithHttpInfo($id, $body = null) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\AddInstallmentResponse', + '\Pipedrive\versions\v2\Model\GetFollowerChangelogs', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7482,19 +3798,20 @@ public function postInstallmentWithHttpInfo($id, $body = null) } /** - * Operation postInstallmentAsync + * Operation getDealFollowersChangelogAsync * - * Add an installment to a deal + * List followers changelog of a deal * * @param int $id The ID of the deal (required) - * @param object|null $body (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 $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 postInstallmentAsync($id, $body = null): PromiseInterface + public function getDealFollowersChangelogAsync($id, $limit = null, $cursor = null): PromiseInterface { - return $this->postInstallmentAsyncWithHttpInfo($id, $body) + return $this->getDealFollowersChangelogAsyncWithHttpInfo($id, $limit, $cursor) ->then( function ($response) { return $response[0]; @@ -7503,20 +3820,21 @@ function ($response) { } /** - * Operation postInstallmentAsyncWithHttpInfo + * Operation getDealFollowersChangelogAsyncWithHttpInfo * - * Add an installment to a deal + * List followers changelog of a deal * * @param int $id The ID of the deal (required) - * @param object|null $body (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 $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 postInstallmentAsyncWithHttpInfo($id, $body = null): PromiseInterface + public function getDealFollowersChangelogAsyncWithHttpInfo($id, $limit = null, $cursor = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v2\Model\AddInstallmentResponse'; - $request = $this->postInstallmentRequest($id, $body); + $returnType = '\Pipedrive\versions\v2\Model\GetFollowerChangelogs'; + $request = $this->getDealFollowersChangelogRequest($id, $limit, $cursor); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -7553,31 +3871,48 @@ function ($exception) { } /** - * Create request for operation 'postInstallment' + * Create request for operation 'getDealFollowersChangelog' * * @param int $id The ID of the deal (required) - * @param object|null $body (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 $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 postInstallmentRequest($id, $body = null): Request + public function getDealFollowersChangelogRequest($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 postInstallment' + 'Missing the required parameter $id when calling getDealFollowersChangelog' ); } - $resourcePath = '/deals/{id}/installments'; + $resourcePath = '/deals/{id}/followers/changelog'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // 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($cursor)) { + $cursor = ObjectSerializer::serializeCollection($cursor, '', true); + } + if ($cursor !== null) { + $queryParams['cursor'] = $cursor; + } // path params @@ -7598,18 +3933,12 @@ public function postInstallmentRequest($id, $body = null): Request } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - ['application/json'] + [] ); } // for model (json/xml) - if (isset($body)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); - } else { - $httpBody = $body; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { /* @phpstan-ignore-next-line */ if ($multipart) { $multipartContents = []; @@ -7661,7 +3990,7 @@ public function postInstallmentRequest($id, $body = null): Request $query = Query::build($queryParams); return new Request( - 'POST', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -7669,52 +3998,70 @@ public function postInstallmentRequest($id, $body = null): Request } /** - * Operation searchDeals + * Operation getDeals * - * Search deals + * Get all 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|null $filter_id If supplied, only deals matching the specified filter are returned (optional) + * @param string|null $ids Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. (optional) + * @param int|null $owner_id If supplied, only deals owned by the specified user are returned. If filter_id is provided, this is ignored. (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 $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|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. Multiple statuses can be included as a comma separated array. If filter_id is provided, this is ignored. (optional) + * @param string|null $updated_since If set, only deals with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) + * @param string|null $updated_until If set, only deals with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) + * @param string|'id' $sort_by The field to sort by. Supported fields: `id`, `update_time`, `add_time`. (optional, default to 'id') + * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) + * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (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 $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\v2\Model\GetDealSearchResponse + * @return \Pipedrive\versions\v2\Model\GetDeals */ - public function searchDeals($term, $fields = null, $exact_match = null, $person_id = null, $organization_id = null, $status = null, $include_fields = null, $limit = null, $cursor = null) + public function getDeals($filter_id = null, $ids = null, $owner_id = null, $person_id = null, $org_id = null, $pipeline_id = null, $stage_id = null, $status = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null, $limit = null, $cursor = null) { - list($response) = $this->searchDealsWithHttpInfo($term, $fields, $exact_match, $person_id, $organization_id, $status, $include_fields, $limit, $cursor); + list($response) = $this->getDealsWithHttpInfo($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $include_option_labels, $include_labels, $limit, $cursor); return $response; } /** - * Operation searchDealsWithHttpInfo + * Operation getDealsWithHttpInfo * - * Search deals + * Get all 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|null $filter_id If supplied, only deals matching the specified filter are returned (optional) + * @param string|null $ids Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. (optional) + * @param int|null $owner_id If supplied, only deals owned by the specified user are returned. If filter_id is provided, this is ignored. (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 $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|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. Multiple statuses can be included as a comma separated array. If filter_id is provided, this is ignored. (optional) + * @param string|null $updated_since If set, only deals with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) + * @param string|null $updated_until If set, only deals with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) + * @param string|'id' $sort_by The field to sort by. Supported fields: `id`, `update_time`, `add_time`. (optional, default to 'id') + * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) + * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (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 $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\v2\Model\GetDealSearchResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v2\Model\GetDeals, 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, $limit = null, $cursor = null) + public function getDealsWithHttpInfo($filter_id = null, $ids = null, $owner_id = null, $person_id = null, $org_id = null, $pipeline_id = null, $stage_id = null, $status = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null, $limit = null, $cursor = null) { - $request = $this->searchDealsRequest($term, $fields, $exact_match, $person_id, $organization_id, $status, $include_fields, $limit, $cursor); + $request = $this->getDealsRequest($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $include_option_labels, $include_labels, $limit, $cursor); try { $options = $this->createHttpClientOption(); @@ -7723,7 +4070,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, $limit, $cursor); + $request = $this->getDealsRequest($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $include_option_labels, $include_labels, $limit, $cursor); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -7748,14 +4095,14 @@ public function searchDealsWithHttpInfo($term, $fields = null, $exact_match = nu switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\GetDealSearchResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\GetDeals' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetDealSearchResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetDeals', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -7775,14 +4122,14 @@ public function searchDealsWithHttpInfo($term, $fields = null, $exact_match = nu } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\GetDealSearchResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\GetDeals' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetDealSearchResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetDeals', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -7792,7 +4139,7 @@ public function searchDealsWithHttpInfo($term, $fields = null, $exact_match = nu case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\GetDealSearchResponse', + '\Pipedrive\versions\v2\Model\GetDeals', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7803,26 +4150,35 @@ public function searchDealsWithHttpInfo($term, $fields = null, $exact_match = nu } /** - * Operation searchDealsAsync + * Operation getDealsAsync * - * Search deals + * Get all 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|null $filter_id If supplied, only deals matching the specified filter are returned (optional) + * @param string|null $ids Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. (optional) + * @param int|null $owner_id If supplied, only deals owned by the specified user are returned. If filter_id is provided, this is ignored. (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 $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|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. Multiple statuses can be included as a comma separated array. If filter_id is provided, this is ignored. (optional) + * @param string|null $updated_since If set, only deals with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) + * @param string|null $updated_until If set, only deals with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) + * @param string|'id' $sort_by The field to sort by. Supported fields: `id`, `update_time`, `add_time`. (optional, default to 'id') + * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) + * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (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 $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 searchDealsAsync($term, $fields = null, $exact_match = null, $person_id = null, $organization_id = null, $status = null, $include_fields = null, $limit = null, $cursor = null): PromiseInterface + public function getDealsAsync($filter_id = null, $ids = null, $owner_id = null, $person_id = null, $org_id = null, $pipeline_id = null, $stage_id = null, $status = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null, $limit = null, $cursor = null): PromiseInterface { - return $this->searchDealsAsyncWithHttpInfo($term, $fields, $exact_match, $person_id, $organization_id, $status, $include_fields, $limit, $cursor) + return $this->getDealsAsyncWithHttpInfo($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $include_option_labels, $include_labels, $limit, $cursor) ->then( function ($response) { return $response[0]; @@ -7831,27 +4187,36 @@ function ($response) { } /** - * Operation searchDealsAsyncWithHttpInfo + * Operation getDealsAsyncWithHttpInfo * - * Search deals + * Get all 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|null $filter_id If supplied, only deals matching the specified filter are returned (optional) + * @param string|null $ids Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. (optional) + * @param int|null $owner_id If supplied, only deals owned by the specified user are returned. If filter_id is provided, this is ignored. (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 $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|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. Multiple statuses can be included as a comma separated array. If filter_id is provided, this is ignored. (optional) + * @param string|null $updated_since If set, only deals with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) + * @param string|null $updated_until If set, only deals with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) + * @param string|'id' $sort_by The field to sort by. Supported fields: `id`, `update_time`, `add_time`. (optional, default to 'id') + * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) + * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (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 $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 searchDealsAsyncWithHttpInfo($term, $fields = null, $exact_match = null, $person_id = null, $organization_id = null, $status = null, $include_fields = null, $limit = null, $cursor = null): PromiseInterface + public function getDealsAsyncWithHttpInfo($filter_id = null, $ids = null, $owner_id = null, $person_id = null, $org_id = null, $pipeline_id = null, $stage_id = null, $status = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null, $limit = null, $cursor = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v2\Model\GetDealSearchResponse'; - $request = $this->searchDealsRequest($term, $fields, $exact_match, $person_id, $organization_id, $status, $include_fields, $limit, $cursor); + $returnType = '\Pipedrive\versions\v2\Model\GetDeals'; + $request = $this->getDealsRequest($filter_id, $ids, $owner_id, $person_id, $org_id, $pipeline_id, $stage_id, $status, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $include_option_labels, $include_labels, $limit, $cursor); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -7888,32 +4253,34 @@ function ($exception) { } /** - * Create request for operation 'searchDeals' + * Create request for operation 'getDeals' * - * @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|null $filter_id If supplied, only deals matching the specified filter are returned (optional) + * @param string|null $ids Optional comma separated string array of up to 100 entity ids to fetch. If filter_id is provided, this is ignored. If any of the requested entities do not exist or are not visible, they are not included in the response. (optional) + * @param int|null $owner_id If supplied, only deals owned by the specified user are returned. If filter_id is provided, this is ignored. (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 $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|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. Multiple statuses can be included as a comma separated array. If filter_id is provided, this is ignored. (optional) + * @param string|null $updated_since If set, only deals with an `update_time` later than or equal to this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) + * @param string|null $updated_until If set, only deals with an `update_time` earlier than this time are returned. In RFC3339 format, e.g. 2025-01-01T10:20:00Z. (optional) + * @param string|'id' $sort_by The field to sort by. Supported fields: `id`, `update_time`, `add_time`. (optional, default to 'id') + * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') + * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) + * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (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 $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 searchDealsRequest($term, $fields = null, $exact_match = null, $person_id = null, $organization_id = null, $status = null, $include_fields = null, $limit = null, $cursor = null): Request + public function getDealsRequest($filter_id = null, $ids = null, $owner_id = null, $person_id = null, $org_id = null, $pipeline_id = null, $stage_id = null, $status = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null, $limit = null, $cursor = 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'; $formParams = []; $queryParams = []; $headerParams = []; @@ -7922,27 +4289,27 @@ public function searchDealsRequest($term, $fields = null, $exact_match = null, $ // query params /* @phpstan-ignore-next-line */ - if (is_array($term)) { - $term = ObjectSerializer::serializeCollection($term, '', true); + if (is_array($filter_id)) { + $filter_id = ObjectSerializer::serializeCollection($filter_id, '', true); } - if ($term !== null) { - $queryParams['term'] = $term; + if ($filter_id !== null) { + $queryParams['filter_id'] = $filter_id; } // query params /* @phpstan-ignore-next-line */ - if (is_array($fields)) { - $fields = ObjectSerializer::serializeCollection($fields, '', true); + if (is_array($ids)) { + $ids = ObjectSerializer::serializeCollection($ids, '', true); } - if ($fields !== null) { - $queryParams['fields'] = $fields; + if ($ids !== null) { + $queryParams['ids'] = $ids; } // query params /* @phpstan-ignore-next-line */ - if (is_array($exact_match)) { - $exact_match = ObjectSerializer::serializeCollection($exact_match, '', true); + if (is_array($owner_id)) { + $owner_id = ObjectSerializer::serializeCollection($owner_id, '', true); } - if ($exact_match !== null) { - $queryParams['exact_match'] = $exact_match; + if ($owner_id !== null) { + $queryParams['owner_id'] = $owner_id; } // query params /* @phpstan-ignore-next-line */ @@ -7954,11 +4321,27 @@ public function searchDealsRequest($term, $fields = null, $exact_match = null, $ } // query params /* @phpstan-ignore-next-line */ - if (is_array($organization_id)) { - $organization_id = ObjectSerializer::serializeCollection($organization_id, '', true); + if (is_array($org_id)) { + $org_id = ObjectSerializer::serializeCollection($org_id, '', true); } - if ($organization_id !== null) { - $queryParams['organization_id'] = $organization_id; + if ($org_id !== null) { + $queryParams['org_id'] = $org_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 */ @@ -7970,6 +4353,38 @@ public function searchDealsRequest($term, $fields = null, $exact_match = null, $ } // query params /* @phpstan-ignore-next-line */ + if (is_array($updated_since)) { + $updated_since = ObjectSerializer::serializeCollection($updated_since, '', true); + } + if ($updated_since !== null) { + $queryParams['updated_since'] = $updated_since; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($updated_until)) { + $updated_until = ObjectSerializer::serializeCollection($updated_until, '', true); + } + if ($updated_until !== null) { + $queryParams['updated_until'] = $updated_until; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($sort_by)) { + $sort_by = ObjectSerializer::serializeCollection($sort_by, '', true); + } + if ($sort_by !== null) { + $queryParams['sort_by'] = $sort_by; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($sort_direction)) { + $sort_direction = ObjectSerializer::serializeCollection($sort_direction, '', true); + } + if ($sort_direction !== null) { + $queryParams['sort_direction'] = $sort_direction; + } + // query params + /* @phpstan-ignore-next-line */ if (is_array($include_fields)) { $include_fields = ObjectSerializer::serializeCollection($include_fields, '', true); } @@ -7978,6 +4393,30 @@ public function searchDealsRequest($term, $fields = null, $exact_match = null, $ } // query params /* @phpstan-ignore-next-line */ + if (is_array($custom_fields)) { + $custom_fields = ObjectSerializer::serializeCollection($custom_fields, '', true); + } + if ($custom_fields !== null) { + $queryParams['custom_fields'] = $custom_fields; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($include_option_labels)) { + $include_option_labels = ObjectSerializer::serializeCollection($include_option_labels, '', true); + } + if ($include_option_labels !== null) { + $queryParams['include_option_labels'] = $include_option_labels; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($include_labels)) { + $include_labels = ObjectSerializer::serializeCollection($include_labels, '', true); + } + if ($include_labels !== null) { + $queryParams['include_labels'] = $include_labels; + } + // query params + /* @phpstan-ignore-next-line */ if (is_array($limit)) { $limit = ObjectSerializer::serializeCollection($limit, '', true); } @@ -8069,40 +4508,38 @@ public function searchDealsRequest($term, $fields = null, $exact_match = null, $ } /** - * Operation updateAdditionalDiscount + * Operation postAdditionalDiscount * - * Update a discount added to a deal + * Add a discount to a deal * * @param int $id The ID of the deal (required) - * @param string $discount_id The ID of the discount (required) * @param object|null $body body (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v2\Model\UpdateAdditionalDiscountResponse + * @return \Pipedrive\versions\v2\Model\AddAdditionalDiscountResponse */ - public function updateAdditionalDiscount($id, $discount_id, $body = null) + public function postAdditionalDiscount($id, $body = null) { - list($response) = $this->updateAdditionalDiscountWithHttpInfo($id, $discount_id, $body); + list($response) = $this->postAdditionalDiscountWithHttpInfo($id, $body); return $response; } /** - * Operation updateAdditionalDiscountWithHttpInfo + * Operation postAdditionalDiscountWithHttpInfo * - * Update a discount added to a deal + * Add a discount to a deal * * @param int $id The ID of the deal (required) - * @param string $discount_id The ID of the discount (required) * @param object|null $body (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v2\Model\UpdateAdditionalDiscountResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v2\Model\AddAdditionalDiscountResponse, HTTP status code, HTTP response headers (array of strings) */ - public function updateAdditionalDiscountWithHttpInfo($id, $discount_id, $body = null) + public function postAdditionalDiscountWithHttpInfo($id, $body = null) { - $request = $this->updateAdditionalDiscountRequest($id, $discount_id, $body); + $request = $this->postAdditionalDiscountRequest($id, $body); try { $options = $this->createHttpClientOption(); @@ -8111,7 +4548,7 @@ public function updateAdditionalDiscountWithHttpInfo($id, $discount_id, $body = } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->updateAdditionalDiscountRequest($id, $discount_id, $body); + $request = $this->postAdditionalDiscountRequest($id, $body); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -8134,16 +4571,16 @@ public function updateAdditionalDiscountWithHttpInfo($id, $discount_id, $body = switch($statusCode) { - case 200: + case 201: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\UpdateAdditionalDiscountResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\AddAdditionalDiscountResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\UpdateAdditionalDiscountResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddAdditionalDiscountResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -8163,24 +4600,24 @@ public function updateAdditionalDiscountWithHttpInfo($id, $discount_id, $body = } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\UpdateAdditionalDiscountResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\AddAdditionalDiscountResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\UpdateAdditionalDiscountResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddAdditionalDiscountResponse', []), $response->getStatusCode(), $response->getHeaders() ]; } catch (ApiException $e) { switch ($e->getCode()) { - case 200: + case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\UpdateAdditionalDiscountResponse', + '\Pipedrive\versions\v2\Model\AddAdditionalDiscountResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8191,20 +4628,19 @@ public function updateAdditionalDiscountWithHttpInfo($id, $discount_id, $body = } /** - * Operation updateAdditionalDiscountAsync + * Operation postAdditionalDiscountAsync * - * Update a discount added to a deal + * Add a discount to a deal * * @param int $id The ID of the deal (required) - * @param string $discount_id The ID of the discount (required) * @param object|null $body (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function updateAdditionalDiscountAsync($id, $discount_id, $body = null): PromiseInterface + public function postAdditionalDiscountAsync($id, $body = null): PromiseInterface { - return $this->updateAdditionalDiscountAsyncWithHttpInfo($id, $discount_id, $body) + return $this->postAdditionalDiscountAsyncWithHttpInfo($id, $body) ->then( function ($response) { return $response[0]; @@ -8213,21 +4649,20 @@ function ($response) { } /** - * Operation updateAdditionalDiscountAsyncWithHttpInfo + * Operation postAdditionalDiscountAsyncWithHttpInfo * - * Update a discount added to a deal + * Add a discount to a deal * * @param int $id The ID of the deal (required) - * @param string $discount_id The ID of the discount (required) * @param object|null $body (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function updateAdditionalDiscountAsyncWithHttpInfo($id, $discount_id, $body = null): PromiseInterface + public function postAdditionalDiscountAsyncWithHttpInfo($id, $body = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v2\Model\UpdateAdditionalDiscountResponse'; - $request = $this->updateAdditionalDiscountRequest($id, $discount_id, $body); + $returnType = '\Pipedrive\versions\v2\Model\AddAdditionalDiscountResponse'; + $request = $this->postAdditionalDiscountRequest($id, $body); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -8264,33 +4699,25 @@ function ($exception) { } /** - * Create request for operation 'updateAdditionalDiscount' + * Create request for operation 'postAdditionalDiscount' * * @param int $id The ID of the deal (required) - * @param string $discount_id The ID of the discount (required) * @param object|null $body (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function updateAdditionalDiscountRequest($id, $discount_id, $body = null): Request + public function postAdditionalDiscountRequest($id, $body = 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 updateAdditionalDiscount' - ); - } - // verify the required parameter 'discount_id' is set - /* @phpstan-ignore-next-line */ - if ($discount_id === null || (is_array($discount_id) && count($discount_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $discount_id when calling updateAdditionalDiscount' + 'Missing the required parameter $id when calling postAdditionalDiscount' ); } - $resourcePath = '/deals/{id}/discounts/{discount_id}'; + $resourcePath = '/deals/{id}/discounts'; $formParams = []; $queryParams = []; $headerParams = []; @@ -8307,14 +4734,6 @@ public function updateAdditionalDiscountRequest($id, $discount_id, $body = null) $resourcePath ); } - // path params - if ($discount_id !== null) { - $resourcePath = str_replace( - '{' . 'discount_id' . '}', - ObjectSerializer::toPathValue($discount_id), - $resourcePath - ); - } /* @phpstan-ignore-next-line */ @@ -8388,7 +4807,7 @@ public function updateAdditionalDiscountRequest($id, $discount_id, $body = null) $query = Query::build($queryParams); return new Request( - 'PATCH', + 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -8396,38 +4815,52 @@ public function updateAdditionalDiscountRequest($id, $discount_id, $body = null) } /** - * Operation updateDeal + * Operation searchDeals * - * Update a deal + * Search deals * - * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v2\Model\DealRequestBody|null $deal_request_body deal_request_body (optional) + * @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|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 $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\v2\Model\PostPatchGetDeal + * @return \Pipedrive\versions\v2\Model\GetDealSearchResponse */ - public function updateDeal($id, $deal_request_body = null) + public function searchDeals($term, $fields = null, $exact_match = null, $person_id = null, $organization_id = null, $status = null, $include_fields = null, $limit = null, $cursor = null) { - list($response) = $this->updateDealWithHttpInfo($id, $deal_request_body); + list($response) = $this->searchDealsWithHttpInfo($term, $fields, $exact_match, $person_id, $organization_id, $status, $include_fields, $limit, $cursor); return $response; } /** - * Operation updateDealWithHttpInfo + * Operation searchDealsWithHttpInfo * - * Update a deal + * Search deals * - * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v2\Model\DealRequestBody|null $deal_request_body (optional) + * @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|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 $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\v2\Model\PostPatchGetDeal, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v2\Model\GetDealSearchResponse, HTTP status code, HTTP response headers (array of strings) */ - public function updateDealWithHttpInfo($id, $deal_request_body = null) + public function searchDealsWithHttpInfo($term, $fields = null, $exact_match = null, $person_id = null, $organization_id = null, $status = null, $include_fields = null, $limit = null, $cursor = null) { - $request = $this->updateDealRequest($id, $deal_request_body); + $request = $this->searchDealsRequest($term, $fields, $exact_match, $person_id, $organization_id, $status, $include_fields, $limit, $cursor); try { $options = $this->createHttpClientOption(); @@ -8436,7 +4869,7 @@ public function updateDealWithHttpInfo($id, $deal_request_body = null) } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->updateDealRequest($id, $deal_request_body); + $request = $this->searchDealsRequest($term, $fields, $exact_match, $person_id, $organization_id, $status, $include_fields, $limit, $cursor); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -8461,14 +4894,14 @@ public function updateDealWithHttpInfo($id, $deal_request_body = null) switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\PostPatchGetDeal' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\GetDealSearchResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetDeal', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetDealSearchResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -8488,14 +4921,14 @@ public function updateDealWithHttpInfo($id, $deal_request_body = null) } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\PostPatchGetDeal' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\GetDealSearchResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetDeal', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetDealSearchResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -8505,7 +4938,7 @@ public function updateDealWithHttpInfo($id, $deal_request_body = null) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\PostPatchGetDeal', + '\Pipedrive\versions\v2\Model\GetDealSearchResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8516,19 +4949,26 @@ public function updateDealWithHttpInfo($id, $deal_request_body = null) } /** - * Operation updateDealAsync + * Operation searchDealsAsync * - * Update a deal + * Search deals * - * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v2\Model\DealRequestBody|null $deal_request_body (optional) + * @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|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 $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 updateDealAsync($id, $deal_request_body = null): PromiseInterface + public function searchDealsAsync($term, $fields = null, $exact_match = null, $person_id = null, $organization_id = null, $status = null, $include_fields = null, $limit = null, $cursor = null): PromiseInterface { - return $this->updateDealAsyncWithHttpInfo($id, $deal_request_body) + return $this->searchDealsAsyncWithHttpInfo($term, $fields, $exact_match, $person_id, $organization_id, $status, $include_fields, $limit, $cursor) ->then( function ($response) { return $response[0]; @@ -8537,20 +4977,27 @@ function ($response) { } /** - * Operation updateDealAsyncWithHttpInfo + * Operation searchDealsAsyncWithHttpInfo * - * Update a deal + * Search deals * - * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v2\Model\DealRequestBody|null $deal_request_body (optional) + * @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|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 $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 updateDealAsyncWithHttpInfo($id, $deal_request_body = null): PromiseInterface + public function searchDealsAsyncWithHttpInfo($term, $fields = null, $exact_match = null, $person_id = null, $organization_id = null, $status = null, $include_fields = null, $limit = null, $cursor = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v2\Model\PostPatchGetDeal'; - $request = $this->updateDealRequest($id, $deal_request_body); + $returnType = '\Pipedrive\versions\v2\Model\GetDealSearchResponse'; + $request = $this->searchDealsRequest($term, $fields, $exact_match, $person_id, $organization_id, $status, $include_fields, $limit, $cursor); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -8587,41 +5034,112 @@ function ($exception) { } /** - * Create request for operation 'updateDeal' + * Create request for operation 'searchDeals' * - * @param int $id The ID of the deal (required) - * @param \Pipedrive\versions\v2\Model\DealRequestBody|null $deal_request_body (optional) + * @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|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 $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 updateDealRequest($id, $deal_request_body = null): Request + public function searchDealsRequest($term, $fields = null, $exact_match = null, $person_id = null, $organization_id = null, $status = null, $include_fields = null, $limit = null, $cursor = null): Request { - // verify the required parameter 'id' is set + // verify the required parameter 'term' is set /* @phpstan-ignore-next-line */ - if ($id === null || (is_array($id) && count($id) === 0)) { + if ($term === null || (is_array($term) && count($term) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling updateDeal' + 'Missing the required parameter $term when calling searchDeals' ); } - $resourcePath = '/deals/{id}'; + $resourcePath = '/deals/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($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)) { + $status = ObjectSerializer::serializeCollection($status, '', true); + } + if ($status !== null) { + $queryParams['status'] = $status; + } + // 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($limit)) { + $limit = ObjectSerializer::serializeCollection($limit, '', true); + } + if ($limit !== null) { + $queryParams['limit'] = $limit; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($cursor)) { + $cursor = ObjectSerializer::serializeCollection($cursor, '', true); + } + if ($cursor !== null) { + $queryParams['cursor'] = $cursor; + } - // path params - if ($id !== null) { - $resourcePath = str_replace( - '{' . 'id' . '}', - ObjectSerializer::toPathValue($id), - $resourcePath - ); - } /* @phpstan-ignore-next-line */ @@ -8632,18 +5150,12 @@ public function updateDealRequest($id, $deal_request_body = null): Request } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - ['application/json'] + [] ); } // for model (json/xml) - if (isset($deal_request_body)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($deal_request_body)); - } else { - $httpBody = $deal_request_body; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { /* @phpstan-ignore-next-line */ if ($multipart) { $multipartContents = []; @@ -8695,7 +5207,7 @@ public function updateDealRequest($id, $deal_request_body = null): Request $query = Query::build($queryParams); return new Request( - 'PATCH', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -8703,40 +5215,40 @@ public function updateDealRequest($id, $deal_request_body = null): Request } /** - * Operation updateDealProduct + * Operation updateAdditionalDiscount * - * Update the product attached to a deal + * Update a discount added to a deal * * @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\v2\Model\UpdateDealProductRequestBody|null $update_deal_product_request_body update_deal_product_request_body (optional) + * @param string $discount_id The ID of the discount (required) + * @param object|null $body body (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v2\Model\AddDealProductResponse + * @return \Pipedrive\versions\v2\Model\UpdateAdditionalDiscountResponse */ - public function updateDealProduct($id, $product_attachment_id, $update_deal_product_request_body = null) + public function updateAdditionalDiscount($id, $discount_id, $body = null) { - list($response) = $this->updateDealProductWithHttpInfo($id, $product_attachment_id, $update_deal_product_request_body); + list($response) = $this->updateAdditionalDiscountWithHttpInfo($id, $discount_id, $body); return $response; } /** - * Operation updateDealProductWithHttpInfo + * Operation updateAdditionalDiscountWithHttpInfo * - * Update the product attached to a deal + * Update a discount added to a deal * * @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\v2\Model\UpdateDealProductRequestBody|null $update_deal_product_request_body (optional) + * @param string $discount_id The ID of the discount (required) + * @param object|null $body (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v2\Model\AddDealProductResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v2\Model\UpdateAdditionalDiscountResponse, HTTP status code, HTTP response headers (array of strings) */ - public function updateDealProductWithHttpInfo($id, $product_attachment_id, $update_deal_product_request_body = null) + public function updateAdditionalDiscountWithHttpInfo($id, $discount_id, $body = null) { - $request = $this->updateDealProductRequest($id, $product_attachment_id, $update_deal_product_request_body); + $request = $this->updateAdditionalDiscountRequest($id, $discount_id, $body); try { $options = $this->createHttpClientOption(); @@ -8745,7 +5257,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_body); + $request = $this->updateAdditionalDiscountRequest($id, $discount_id, $body); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -8770,14 +5282,14 @@ public function updateDealProductWithHttpInfo($id, $product_attachment_id, $upda switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\AddDealProductResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\UpdateAdditionalDiscountResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddDealProductResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\UpdateAdditionalDiscountResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -8797,14 +5309,14 @@ public function updateDealProductWithHttpInfo($id, $product_attachment_id, $upda } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\AddDealProductResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\UpdateAdditionalDiscountResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddDealProductResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\UpdateAdditionalDiscountResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -8814,7 +5326,7 @@ public function updateDealProductWithHttpInfo($id, $product_attachment_id, $upda case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\AddDealProductResponse', + '\Pipedrive\versions\v2\Model\UpdateAdditionalDiscountResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8825,20 +5337,20 @@ public function updateDealProductWithHttpInfo($id, $product_attachment_id, $upda } /** - * Operation updateDealProductAsync + * Operation updateAdditionalDiscountAsync * - * Update the product attached to a deal + * Update a discount added to a deal * * @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\v2\Model\UpdateDealProductRequestBody|null $update_deal_product_request_body (optional) + * @param string $discount_id The ID of the discount (required) + * @param object|null $body (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function updateDealProductAsync($id, $product_attachment_id, $update_deal_product_request_body = null): PromiseInterface + public function updateAdditionalDiscountAsync($id, $discount_id, $body = null): PromiseInterface { - return $this->updateDealProductAsyncWithHttpInfo($id, $product_attachment_id, $update_deal_product_request_body) + return $this->updateAdditionalDiscountAsyncWithHttpInfo($id, $discount_id, $body) ->then( function ($response) { return $response[0]; @@ -8847,21 +5359,21 @@ function ($response) { } /** - * Operation updateDealProductAsyncWithHttpInfo + * Operation updateAdditionalDiscountAsyncWithHttpInfo * - * Update the product attached to a deal + * Update a discount added to a deal * * @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\v2\Model\UpdateDealProductRequestBody|null $update_deal_product_request_body (optional) + * @param string $discount_id The ID of the discount (required) + * @param object|null $body (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function updateDealProductAsyncWithHttpInfo($id, $product_attachment_id, $update_deal_product_request_body = null): PromiseInterface + public function updateAdditionalDiscountAsyncWithHttpInfo($id, $discount_id, $body = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v2\Model\AddDealProductResponse'; - $request = $this->updateDealProductRequest($id, $product_attachment_id, $update_deal_product_request_body); + $returnType = '\Pipedrive\versions\v2\Model\UpdateAdditionalDiscountResponse'; + $request = $this->updateAdditionalDiscountRequest($id, $discount_id, $body); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -8898,33 +5410,33 @@ function ($exception) { } /** - * Create request for operation 'updateDealProduct' + * Create request for operation 'updateAdditionalDiscount' * * @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\v2\Model\UpdateDealProductRequestBody|null $update_deal_product_request_body (optional) + * @param string $discount_id The ID of the discount (required) + * @param object|null $body (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function updateDealProductRequest($id, $product_attachment_id, $update_deal_product_request_body = null): Request + public function updateAdditionalDiscountRequest($id, $discount_id, $body = 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' + 'Missing the required parameter $id when calling updateAdditionalDiscount' ); } - // verify the required parameter 'product_attachment_id' is set + // verify the required parameter 'discount_id' is set /* @phpstan-ignore-next-line */ - if ($product_attachment_id === null || (is_array($product_attachment_id) && count($product_attachment_id) === 0)) { + if ($discount_id === null || (is_array($discount_id) && count($discount_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $product_attachment_id when calling updateDealProduct' + 'Missing the required parameter $discount_id when calling updateAdditionalDiscount' ); } - $resourcePath = '/deals/{id}/products/{product_attachment_id}'; + $resourcePath = '/deals/{id}/discounts/{discount_id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -8942,10 +5454,10 @@ public function updateDealProductRequest($id, $product_attachment_id, $update_de ); } // path params - if ($product_attachment_id !== null) { + if ($discount_id !== null) { $resourcePath = str_replace( - '{' . 'product_attachment_id' . '}', - ObjectSerializer::toPathValue($product_attachment_id), + '{' . 'discount_id' . '}', + ObjectSerializer::toPathValue($discount_id), $resourcePath ); } @@ -8964,11 +5476,11 @@ public function updateDealProductRequest($id, $product_attachment_id, $update_de } // for model (json/xml) - if (isset($update_deal_product_request_body)) { + if (isset($body)) { if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_deal_product_request_body)); + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); } else { - $httpBody = $update_deal_product_request_body; + $httpBody = $body; } } elseif (count($formParams) > 0) { /* @phpstan-ignore-next-line */ @@ -9030,40 +5542,38 @@ public function updateDealProductRequest($id, $product_attachment_id, $update_de } /** - * Operation updateInstallment + * Operation updateDeal * - * Update an installment added to a deal + * Update a deal * * @param int $id The ID of the deal (required) - * @param int $installment_id The ID of the installment (required) - * @param object|null $body body (optional) + * @param \Pipedrive\versions\v2\Model\DealRequestBody|null $deal_request_body deal_request_body (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return \Pipedrive\versions\v2\Model\UpdateInstallmentResponse + * @return \Pipedrive\versions\v2\Model\PostPatchGetDeal */ - public function updateInstallment($id, $installment_id, $body = null) + public function updateDeal($id, $deal_request_body = null) { - list($response) = $this->updateInstallmentWithHttpInfo($id, $installment_id, $body); + list($response) = $this->updateDealWithHttpInfo($id, $deal_request_body); return $response; } /** - * Operation updateInstallmentWithHttpInfo + * Operation updateDealWithHttpInfo * - * Update an installment added to a deal + * Update a deal * * @param int $id The ID of the deal (required) - * @param int $installment_id The ID of the installment (required) - * @param object|null $body (optional) + * @param \Pipedrive\versions\v2\Model\DealRequestBody|null $deal_request_body (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException - * @return array of \Pipedrive\versions\v2\Model\UpdateInstallmentResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \Pipedrive\versions\v2\Model\PostPatchGetDeal, HTTP status code, HTTP response headers (array of strings) */ - public function updateInstallmentWithHttpInfo($id, $installment_id, $body = null) + public function updateDealWithHttpInfo($id, $deal_request_body = null) { - $request = $this->updateInstallmentRequest($id, $installment_id, $body); + $request = $this->updateDealRequest($id, $deal_request_body); try { $options = $this->createHttpClientOption(); @@ -9072,7 +5582,7 @@ public function updateInstallmentWithHttpInfo($id, $installment_id, $body = null } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->updateInstallmentRequest($id, $installment_id, $body); + $request = $this->updateDealRequest($id, $deal_request_body); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -9097,14 +5607,14 @@ public function updateInstallmentWithHttpInfo($id, $installment_id, $body = null switch($statusCode) { case 200: /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\UpdateInstallmentResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\PostPatchGetDeal' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\UpdateInstallmentResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetDeal', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -9124,14 +5634,14 @@ public function updateInstallmentWithHttpInfo($id, $installment_id, $body = null } /* @phpstan-ignore-next-line */ - if ('\Pipedrive\versions\v2\Model\UpdateInstallmentResponse' === '\SplFileObject') { + if ('\Pipedrive\versions\v2\Model\PostPatchGetDeal' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); } return [ - ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\UpdateInstallmentResponse', []), + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetDeal', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -9141,7 +5651,7 @@ public function updateInstallmentWithHttpInfo($id, $installment_id, $body = null case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\Pipedrive\versions\v2\Model\UpdateInstallmentResponse', + '\Pipedrive\versions\v2\Model\PostPatchGetDeal', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -9152,20 +5662,19 @@ public function updateInstallmentWithHttpInfo($id, $installment_id, $body = null } /** - * Operation updateInstallmentAsync + * Operation updateDealAsync * - * Update an installment added to a deal + * Update a deal * * @param int $id The ID of the deal (required) - * @param int $installment_id The ID of the installment (required) - * @param object|null $body (optional) + * @param \Pipedrive\versions\v2\Model\DealRequestBody|null $deal_request_body (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function updateInstallmentAsync($id, $installment_id, $body = null): PromiseInterface + public function updateDealAsync($id, $deal_request_body = null): PromiseInterface { - return $this->updateInstallmentAsyncWithHttpInfo($id, $installment_id, $body) + return $this->updateDealAsyncWithHttpInfo($id, $deal_request_body) ->then( function ($response) { return $response[0]; @@ -9174,21 +5683,20 @@ function ($response) { } /** - * Operation updateInstallmentAsyncWithHttpInfo + * Operation updateDealAsyncWithHttpInfo * - * Update an installment added to a deal + * Update a deal * * @param int $id The ID of the deal (required) - * @param int $installment_id The ID of the installment (required) - * @param object|null $body (optional) + * @param \Pipedrive\versions\v2\Model\DealRequestBody|null $deal_request_body (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function updateInstallmentAsyncWithHttpInfo($id, $installment_id, $body = null): PromiseInterface + public function updateDealAsyncWithHttpInfo($id, $deal_request_body = null): PromiseInterface { - $returnType = '\Pipedrive\versions\v2\Model\UpdateInstallmentResponse'; - $request = $this->updateInstallmentRequest($id, $installment_id, $body); + $returnType = '\Pipedrive\versions\v2\Model\PostPatchGetDeal'; + $request = $this->updateDealRequest($id, $deal_request_body); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -9225,33 +5733,25 @@ function ($exception) { } /** - * Create request for operation 'updateInstallment' + * Create request for operation 'updateDeal' * * @param int $id The ID of the deal (required) - * @param int $installment_id The ID of the installment (required) - * @param object|null $body (optional) + * @param \Pipedrive\versions\v2\Model\DealRequestBody|null $deal_request_body (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function updateInstallmentRequest($id, $installment_id, $body = null): Request + public function updateDealRequest($id, $deal_request_body = 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 updateInstallment' - ); - } - // verify the required parameter 'installment_id' is set - /* @phpstan-ignore-next-line */ - if ($installment_id === null || (is_array($installment_id) && count($installment_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $installment_id when calling updateInstallment' + 'Missing the required parameter $id when calling updateDeal' ); } - $resourcePath = '/deals/{id}/installments/{installment_id}'; + $resourcePath = '/deals/{id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -9268,14 +5768,6 @@ public function updateInstallmentRequest($id, $installment_id, $body = null): Re $resourcePath ); } - // path params - if ($installment_id !== null) { - $resourcePath = str_replace( - '{' . 'installment_id' . '}', - ObjectSerializer::toPathValue($installment_id), - $resourcePath - ); - } /* @phpstan-ignore-next-line */ @@ -9291,11 +5783,11 @@ public function updateInstallmentRequest($id, $installment_id, $body = null): Re } // for model (json/xml) - if (isset($body)) { + if (isset($deal_request_body)) { if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($deal_request_body)); } else { - $httpBody = $body; + $httpBody = $deal_request_body; } } elseif (count($formParams) > 0) { /* @phpstan-ignore-next-line */ diff --git a/lib/versions/v2/Api/OrganizationsApi.php b/lib/versions/v2/Api/OrganizationsApi.php index 59067ead..7063b631 100644 --- a/lib/versions/v2/Api/OrganizationsApi.php +++ b/lib/versions/v2/Api/OrganizationsApi.php @@ -1336,14 +1336,16 @@ public function deleteOrganizationFollowerRequest($id, $follower_id): Request * @param int $id The ID of the organization (required) * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException * @return \Pipedrive\versions\v2\Model\PostPatchGetOrganization */ - public function getOrganization($id, $include_fields = null, $custom_fields = null) + public function getOrganization($id, $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null) { - list($response) = $this->getOrganizationWithHttpInfo($id, $include_fields, $custom_fields); + list($response) = $this->getOrganizationWithHttpInfo($id, $include_fields, $custom_fields, $include_option_labels, $include_labels); return $response; } @@ -1355,14 +1357,16 @@ public function getOrganization($id, $include_fields = null, $custom_fields = nu * @param int $id The ID of the organization (required) * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException * @return array of \Pipedrive\versions\v2\Model\PostPatchGetOrganization, HTTP status code, HTTP response headers (array of strings) */ - public function getOrganizationWithHttpInfo($id, $include_fields = null, $custom_fields = null) + public function getOrganizationWithHttpInfo($id, $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null) { - $request = $this->getOrganizationRequest($id, $include_fields, $custom_fields); + $request = $this->getOrganizationRequest($id, $include_fields, $custom_fields, $include_option_labels, $include_labels); try { $options = $this->createHttpClientOption(); @@ -1371,7 +1375,7 @@ public function getOrganizationWithHttpInfo($id, $include_fields = null, $custom } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getOrganizationRequest($id, $include_fields, $custom_fields); + $request = $this->getOrganizationRequest($id, $include_fields, $custom_fields, $include_option_labels, $include_labels); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -1458,13 +1462,15 @@ public function getOrganizationWithHttpInfo($id, $include_fields = null, $custom * @param int $id The ID of the organization (required) * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getOrganizationAsync($id, $include_fields = null, $custom_fields = null): PromiseInterface + public function getOrganizationAsync($id, $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null): PromiseInterface { - return $this->getOrganizationAsyncWithHttpInfo($id, $include_fields, $custom_fields) + return $this->getOrganizationAsyncWithHttpInfo($id, $include_fields, $custom_fields, $include_option_labels, $include_labels) ->then( function ($response) { return $response[0]; @@ -1480,14 +1486,16 @@ function ($response) { * @param int $id The ID of the organization (required) * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getOrganizationAsyncWithHttpInfo($id, $include_fields = null, $custom_fields = null): PromiseInterface + public function getOrganizationAsyncWithHttpInfo($id, $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null): PromiseInterface { $returnType = '\Pipedrive\versions\v2\Model\PostPatchGetOrganization'; - $request = $this->getOrganizationRequest($id, $include_fields, $custom_fields); + $request = $this->getOrganizationRequest($id, $include_fields, $custom_fields, $include_option_labels, $include_labels); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1529,11 +1537,13 @@ function ($exception) { * @param int $id The ID of the organization (required) * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function getOrganizationRequest($id, $include_fields = null, $custom_fields = null): Request + public function getOrganizationRequest($id, $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ @@ -1566,6 +1576,22 @@ public function getOrganizationRequest($id, $include_fields = null, $custom_fiel if ($custom_fields !== null) { $queryParams['custom_fields'] = $custom_fields; } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($include_option_labels)) { + $include_option_labels = ObjectSerializer::serializeCollection($include_option_labels, '', true); + } + if ($include_option_labels !== null) { + $queryParams['include_option_labels'] = $include_option_labels; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($include_labels)) { + $include_labels = ObjectSerializer::serializeCollection($include_labels, '', true); + } + if ($include_labels !== null) { + $queryParams['include_labels'] = $include_labels; + } // path params @@ -2308,6 +2334,8 @@ public function getOrganizationFollowersChangelogRequest($id, $limit = null, $cu * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (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 $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) * @@ -2315,9 +2343,9 @@ public function getOrganizationFollowersChangelogRequest($id, $limit = null, $cu * @throws InvalidArgumentException|GuzzleException * @return \Pipedrive\versions\v2\Model\GetOrganizations */ - public function getOrganizations($filter_id = null, $ids = null, $owner_id = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $limit = null, $cursor = null) + public function getOrganizations($filter_id = null, $ids = null, $owner_id = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null, $limit = null, $cursor = null) { - list($response) = $this->getOrganizationsWithHttpInfo($filter_id, $ids, $owner_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor); + list($response) = $this->getOrganizationsWithHttpInfo($filter_id, $ids, $owner_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $include_option_labels, $include_labels, $limit, $cursor); return $response; } @@ -2335,6 +2363,8 @@ public function getOrganizations($filter_id = null, $ids = null, $owner_id = nul * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (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 $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) * @@ -2342,9 +2372,9 @@ public function getOrganizations($filter_id = null, $ids = null, $owner_id = nul * @throws InvalidArgumentException|GuzzleException * @return array of \Pipedrive\versions\v2\Model\GetOrganizations, HTTP status code, HTTP response headers (array of strings) */ - public function getOrganizationsWithHttpInfo($filter_id = null, $ids = null, $owner_id = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $limit = null, $cursor = null) + public function getOrganizationsWithHttpInfo($filter_id = null, $ids = null, $owner_id = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null, $limit = null, $cursor = null) { - $request = $this->getOrganizationsRequest($filter_id, $ids, $owner_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor); + $request = $this->getOrganizationsRequest($filter_id, $ids, $owner_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $include_option_labels, $include_labels, $limit, $cursor); try { $options = $this->createHttpClientOption(); @@ -2353,7 +2383,7 @@ public function getOrganizationsWithHttpInfo($filter_id = null, $ids = null, $ow } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getOrganizationsRequest($filter_id, $ids, $owner_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor); + $request = $this->getOrganizationsRequest($filter_id, $ids, $owner_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $include_option_labels, $include_labels, $limit, $cursor); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -2446,15 +2476,17 @@ public function getOrganizationsWithHttpInfo($filter_id = null, $ids = null, $ow * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (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 $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 getOrganizationsAsync($filter_id = null, $ids = null, $owner_id = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $limit = null, $cursor = null): PromiseInterface + public function getOrganizationsAsync($filter_id = null, $ids = null, $owner_id = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null, $limit = null, $cursor = null): PromiseInterface { - return $this->getOrganizationsAsyncWithHttpInfo($filter_id, $ids, $owner_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor) + return $this->getOrganizationsAsyncWithHttpInfo($filter_id, $ids, $owner_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $include_option_labels, $include_labels, $limit, $cursor) ->then( function ($response) { return $response[0]; @@ -2476,16 +2508,18 @@ function ($response) { * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (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 $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 getOrganizationsAsyncWithHttpInfo($filter_id = null, $ids = null, $owner_id = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $limit = null, $cursor = null): PromiseInterface + public function getOrganizationsAsyncWithHttpInfo($filter_id = null, $ids = null, $owner_id = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null, $limit = null, $cursor = null): PromiseInterface { $returnType = '\Pipedrive\versions\v2\Model\GetOrganizations'; - $request = $this->getOrganizationsRequest($filter_id, $ids, $owner_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor); + $request = $this->getOrganizationsRequest($filter_id, $ids, $owner_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $include_option_labels, $include_labels, $limit, $cursor); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2533,13 +2567,15 @@ function ($exception) { * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') * @param string|null $include_fields Optional comma separated string array of additional fields to include (optional) * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (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 $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 getOrganizationsRequest($filter_id = null, $ids = null, $owner_id = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $limit = null, $cursor = null): Request + public function getOrganizationsRequest($filter_id = null, $ids = null, $owner_id = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null, $limit = null, $cursor = null): Request { $resourcePath = '/organizations'; @@ -2623,6 +2659,22 @@ public function getOrganizationsRequest($filter_id = null, $ids = null, $owner_i } // query params /* @phpstan-ignore-next-line */ + if (is_array($include_option_labels)) { + $include_option_labels = ObjectSerializer::serializeCollection($include_option_labels, '', true); + } + if ($include_option_labels !== null) { + $queryParams['include_option_labels'] = $include_option_labels; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($include_labels)) { + $include_labels = ObjectSerializer::serializeCollection($include_labels, '', true); + } + if ($include_labels !== null) { + $queryParams['include_labels'] = $include_labels; + } + // query params + /* @phpstan-ignore-next-line */ if (is_array($limit)) { $limit = ObjectSerializer::serializeCollection($limit, '', true); } diff --git a/lib/versions/v2/Api/PersonsApi.php b/lib/versions/v2/Api/PersonsApi.php index d47c0cb2..46d8964d 100644 --- a/lib/versions/v2/Api/PersonsApi.php +++ b/lib/versions/v2/Api/PersonsApi.php @@ -1336,14 +1336,16 @@ public function deletePersonFollowerRequest($id, $follower_id): Request * @param int $id The ID of the person (required) * @param string|null $include_fields Optional comma separated string array of additional fields to include. `marketing_status` and `doi_status` can only be included if the company has marketing app enabled. (optional) * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException * @return \Pipedrive\versions\v2\Model\PostPatchGetPerson */ - public function getPerson($id, $include_fields = null, $custom_fields = null) + public function getPerson($id, $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null) { - list($response) = $this->getPersonWithHttpInfo($id, $include_fields, $custom_fields); + list($response) = $this->getPersonWithHttpInfo($id, $include_fields, $custom_fields, $include_option_labels, $include_labels); return $response; } @@ -1355,14 +1357,16 @@ public function getPerson($id, $include_fields = null, $custom_fields = null) * @param int $id The ID of the person (required) * @param string|null $include_fields Optional comma separated string array of additional fields to include. `marketing_status` and `doi_status` can only be included if the company has marketing app enabled. (optional) * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (optional) * * @throws ApiException on non-2xx response * @throws InvalidArgumentException|GuzzleException * @return array of \Pipedrive\versions\v2\Model\PostPatchGetPerson, HTTP status code, HTTP response headers (array of strings) */ - public function getPersonWithHttpInfo($id, $include_fields = null, $custom_fields = null) + public function getPersonWithHttpInfo($id, $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null) { - $request = $this->getPersonRequest($id, $include_fields, $custom_fields); + $request = $this->getPersonRequest($id, $include_fields, $custom_fields, $include_option_labels, $include_labels); try { $options = $this->createHttpClientOption(); @@ -1371,7 +1375,7 @@ public function getPersonWithHttpInfo($id, $include_fields = null, $custom_field } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getPersonRequest($id, $include_fields, $custom_fields); + $request = $this->getPersonRequest($id, $include_fields, $custom_fields, $include_option_labels, $include_labels); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -1458,13 +1462,15 @@ public function getPersonWithHttpInfo($id, $include_fields = null, $custom_field * @param int $id The ID of the person (required) * @param string|null $include_fields Optional comma separated string array of additional fields to include. `marketing_status` and `doi_status` can only be included if the company has marketing app enabled. (optional) * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getPersonAsync($id, $include_fields = null, $custom_fields = null): PromiseInterface + public function getPersonAsync($id, $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null): PromiseInterface { - return $this->getPersonAsyncWithHttpInfo($id, $include_fields, $custom_fields) + return $this->getPersonAsyncWithHttpInfo($id, $include_fields, $custom_fields, $include_option_labels, $include_labels) ->then( function ($response) { return $response[0]; @@ -1480,14 +1486,16 @@ function ($response) { * @param int $id The ID of the person (required) * @param string|null $include_fields Optional comma separated string array of additional fields to include. `marketing_status` and `doi_status` can only be included if the company has marketing app enabled. (optional) * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return PromiseInterface */ - public function getPersonAsyncWithHttpInfo($id, $include_fields = null, $custom_fields = null): PromiseInterface + public function getPersonAsyncWithHttpInfo($id, $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null): PromiseInterface { $returnType = '\Pipedrive\versions\v2\Model\PostPatchGetPerson'; - $request = $this->getPersonRequest($id, $include_fields, $custom_fields); + $request = $this->getPersonRequest($id, $include_fields, $custom_fields, $include_option_labels, $include_labels); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1529,11 +1537,13 @@ function ($exception) { * @param int $id The ID of the person (required) * @param string|null $include_fields Optional comma separated string array of additional fields to include. `marketing_status` and `doi_status` can only be included if the company has marketing app enabled. (optional) * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (optional) * * @throws InvalidArgumentException|OAuthProviderException * @return Request */ - public function getPersonRequest($id, $include_fields = null, $custom_fields = null): Request + public function getPersonRequest($id, $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null): Request { // verify the required parameter 'id' is set /* @phpstan-ignore-next-line */ @@ -1566,6 +1576,22 @@ public function getPersonRequest($id, $include_fields = null, $custom_fields = n if ($custom_fields !== null) { $queryParams['custom_fields'] = $custom_fields; } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($include_option_labels)) { + $include_option_labels = ObjectSerializer::serializeCollection($include_option_labels, '', true); + } + if ($include_option_labels !== null) { + $queryParams['include_option_labels'] = $include_option_labels; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($include_labels)) { + $include_labels = ObjectSerializer::serializeCollection($include_labels, '', true); + } + if ($include_labels !== null) { + $queryParams['include_labels'] = $include_labels; + } // path params @@ -2606,6 +2632,8 @@ public function getPersonPictureRequest($id): Request * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') * @param string|null $include_fields Optional comma separated string array of additional fields to include. `marketing_status` and `doi_status` can only be included if the company has marketing app enabled. (optional) * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (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 $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) * @@ -2613,9 +2641,9 @@ public function getPersonPictureRequest($id): Request * @throws InvalidArgumentException|GuzzleException * @return \Pipedrive\versions\v2\Model\GetPersons */ - public function getPersons($filter_id = null, $ids = null, $owner_id = null, $org_id = null, $deal_id = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $limit = null, $cursor = null) + public function getPersons($filter_id = null, $ids = null, $owner_id = null, $org_id = null, $deal_id = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null, $limit = null, $cursor = null) { - list($response) = $this->getPersonsWithHttpInfo($filter_id, $ids, $owner_id, $org_id, $deal_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor); + list($response) = $this->getPersonsWithHttpInfo($filter_id, $ids, $owner_id, $org_id, $deal_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $include_option_labels, $include_labels, $limit, $cursor); return $response; } @@ -2635,6 +2663,8 @@ public function getPersons($filter_id = null, $ids = null, $owner_id = null, $or * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') * @param string|null $include_fields Optional comma separated string array of additional fields to include. `marketing_status` and `doi_status` can only be included if the company has marketing app enabled. (optional) * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (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 $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) * @@ -2642,9 +2672,9 @@ public function getPersons($filter_id = null, $ids = null, $owner_id = null, $or * @throws InvalidArgumentException|GuzzleException * @return array of \Pipedrive\versions\v2\Model\GetPersons, HTTP status code, HTTP response headers (array of strings) */ - public function getPersonsWithHttpInfo($filter_id = null, $ids = null, $owner_id = null, $org_id = null, $deal_id = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $limit = null, $cursor = null) + public function getPersonsWithHttpInfo($filter_id = null, $ids = null, $owner_id = null, $org_id = null, $deal_id = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null, $limit = null, $cursor = null) { - $request = $this->getPersonsRequest($filter_id, $ids, $owner_id, $org_id, $deal_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor); + $request = $this->getPersonsRequest($filter_id, $ids, $owner_id, $org_id, $deal_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $include_option_labels, $include_labels, $limit, $cursor); try { $options = $this->createHttpClientOption(); @@ -2653,7 +2683,7 @@ public function getPersonsWithHttpInfo($filter_id = null, $ids = null, $owner_id } catch (RequestException $e) { if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { $this->config->refreshToken(); - $request = $this->getPersonsRequest($filter_id, $ids, $owner_id, $org_id, $deal_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor); + $request = $this->getPersonsRequest($filter_id, $ids, $owner_id, $org_id, $deal_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $include_option_labels, $include_labels, $limit, $cursor); $response = $this->client->send($request, $options); } else { throw new ApiException( @@ -2748,15 +2778,17 @@ public function getPersonsWithHttpInfo($filter_id = null, $ids = null, $owner_id * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') * @param string|null $include_fields Optional comma separated string array of additional fields to include. `marketing_status` and `doi_status` can only be included if the company has marketing app enabled. (optional) * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (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 $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 getPersonsAsync($filter_id = null, $ids = null, $owner_id = null, $org_id = null, $deal_id = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $limit = null, $cursor = null): PromiseInterface + public function getPersonsAsync($filter_id = null, $ids = null, $owner_id = null, $org_id = null, $deal_id = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null, $limit = null, $cursor = null): PromiseInterface { - return $this->getPersonsAsyncWithHttpInfo($filter_id, $ids, $owner_id, $org_id, $deal_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor) + return $this->getPersonsAsyncWithHttpInfo($filter_id, $ids, $owner_id, $org_id, $deal_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $include_option_labels, $include_labels, $limit, $cursor) ->then( function ($response) { return $response[0]; @@ -2780,16 +2812,18 @@ function ($response) { * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') * @param string|null $include_fields Optional comma separated string array of additional fields to include. `marketing_status` and `doi_status` can only be included if the company has marketing app enabled. (optional) * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (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 $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 getPersonsAsyncWithHttpInfo($filter_id = null, $ids = null, $owner_id = null, $org_id = null, $deal_id = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $limit = null, $cursor = null): PromiseInterface + public function getPersonsAsyncWithHttpInfo($filter_id = null, $ids = null, $owner_id = null, $org_id = null, $deal_id = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null, $limit = null, $cursor = null): PromiseInterface { $returnType = '\Pipedrive\versions\v2\Model\GetPersons'; - $request = $this->getPersonsRequest($filter_id, $ids, $owner_id, $org_id, $deal_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $limit, $cursor); + $request = $this->getPersonsRequest($filter_id, $ids, $owner_id, $org_id, $deal_id, $updated_since, $updated_until, $sort_by, $sort_direction, $include_fields, $custom_fields, $include_option_labels, $include_labels, $limit, $cursor); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2839,13 +2873,15 @@ function ($exception) { * @param string|'asc' $sort_direction The sorting direction. Supported values: `asc`, `desc`. (optional, default to 'asc') * @param string|null $include_fields Optional comma separated string array of additional fields to include. `marketing_status` and `doi_status` can only be included if the company has marketing app enabled. (optional) * @param string|null $custom_fields Optional comma separated string array of custom fields keys to include. If you are only interested in a particular set of custom fields, please use this parameter for faster results and smaller response.<br/>A maximum of 15 keys is allowed. (optional) + * @param bool|null $include_option_labels When provided with a 'true' value, single option and multiple option custom fields values contain objects in the form of '{ id: number, label: string }' instead of plain id (optional) + * @param bool|null $include_labels When provided with 'true' value, response will include an array of label objects in the form of '{ id: number, label: string }' (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 $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 getPersonsRequest($filter_id = null, $ids = null, $owner_id = null, $org_id = null, $deal_id = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $limit = null, $cursor = null): Request + public function getPersonsRequest($filter_id = null, $ids = null, $owner_id = null, $org_id = null, $deal_id = null, $updated_since = null, $updated_until = null, $sort_by = 'id', $sort_direction = 'asc', $include_fields = null, $custom_fields = null, $include_option_labels = null, $include_labels = null, $limit = null, $cursor = null): Request { $resourcePath = '/persons'; @@ -2945,6 +2981,22 @@ public function getPersonsRequest($filter_id = null, $ids = null, $owner_id = nu } // query params /* @phpstan-ignore-next-line */ + if (is_array($include_option_labels)) { + $include_option_labels = ObjectSerializer::serializeCollection($include_option_labels, '', true); + } + if ($include_option_labels !== null) { + $queryParams['include_option_labels'] = $include_option_labels; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($include_labels)) { + $include_labels = ObjectSerializer::serializeCollection($include_labels, '', true); + } + if ($include_labels !== null) { + $queryParams['include_labels'] = $include_labels; + } + // query params + /* @phpstan-ignore-next-line */ if (is_array($limit)) { $limit = ObjectSerializer::serializeCollection($limit, '', true); } diff --git a/lib/versions/v2/Api/ProjectBoardsApi.php b/lib/versions/v2/Api/ProjectBoardsApi.php new file mode 100644 index 00000000..24629057 --- /dev/null +++ b/lib/versions/v2/Api/ProjectBoardsApi.php @@ -0,0 +1,1612 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation addProjectBoard + * + * Add a project board + * + * @param \Pipedrive\versions\v2\Model\BoardRequestBody $board_request_body board_request_body (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\PostPatchGetBoard + */ + public function addProjectBoard($board_request_body) + { + list($response) = $this->addProjectBoardWithHttpInfo($board_request_body); + return $response; + } + + /** + * Operation addProjectBoardWithHttpInfo + * + * Add a project board + * + * @param \Pipedrive\versions\v2\Model\BoardRequestBody $board_request_body (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\PostPatchGetBoard, HTTP status code, HTTP response headers (array of strings) + */ + public function addProjectBoardWithHttpInfo($board_request_body) + { + $request = $this->addProjectBoardRequest($board_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->addProjectBoardRequest($board_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 200: + /* @phpstan-ignore-next-line */ + if ('\Pipedrive\versions\v2\Model\PostPatchGetBoard' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetBoard', []), + $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\v2\Model\PostPatchGetBoard' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetBoard', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\PostPatchGetBoard', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation addProjectBoardAsync + * + * Add a project board + * + * @param \Pipedrive\versions\v2\Model\BoardRequestBody $board_request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addProjectBoardAsync($board_request_body): PromiseInterface + { + return $this->addProjectBoardAsyncWithHttpInfo($board_request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addProjectBoardAsyncWithHttpInfo + * + * Add a project board + * + * @param \Pipedrive\versions\v2\Model\BoardRequestBody $board_request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addProjectBoardAsyncWithHttpInfo($board_request_body): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\PostPatchGetBoard'; + $request = $this->addProjectBoardRequest($board_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 'addProjectBoard' + * + * @param \Pipedrive\versions\v2\Model\BoardRequestBody $board_request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function addProjectBoardRequest($board_request_body): Request + { + // verify the required parameter 'board_request_body' is set + /* @phpstan-ignore-next-line */ + if ($board_request_body === null || (is_array($board_request_body) && count($board_request_body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $board_request_body when calling addProjectBoard' + ); + } + + $resourcePath = '/boards'; + $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($board_request_body)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($board_request_body)); + } else { + $httpBody = $board_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 deleteProjectBoard + * + * Delete a project board + * + * @param int $id The ID of the project board (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\DeleteProjectBoardResponse + */ + public function deleteProjectBoard($id) + { + list($response) = $this->deleteProjectBoardWithHttpInfo($id); + return $response; + } + + /** + * Operation deleteProjectBoardWithHttpInfo + * + * Delete a project board + * + * @param int $id The ID of the project board (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\DeleteProjectBoardResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteProjectBoardWithHttpInfo($id) + { + $request = $this->deleteProjectBoardRequest($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->deleteProjectBoardRequest($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\v2\Model\DeleteProjectBoardResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteProjectBoardResponse', []), + $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\v2\Model\DeleteProjectBoardResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteProjectBoardResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\DeleteProjectBoardResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteProjectBoardAsync + * + * Delete a project board + * + * @param int $id The ID of the project board (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteProjectBoardAsync($id): PromiseInterface + { + return $this->deleteProjectBoardAsyncWithHttpInfo($id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteProjectBoardAsyncWithHttpInfo + * + * Delete a project board + * + * @param int $id The ID of the project board (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteProjectBoardAsyncWithHttpInfo($id): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\DeleteProjectBoardResponse'; + $request = $this->deleteProjectBoardRequest($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 'deleteProjectBoard' + * + * @param int $id The ID of the project board (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function deleteProjectBoardRequest($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 deleteProjectBoard' + ); + } + + $resourcePath = '/boards/{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 getProjectsBoard + * + * Get details of a project board + * + * @param int $id The ID of the project board (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\PostPatchGetBoard + */ + public function getProjectsBoard($id) + { + list($response) = $this->getProjectsBoardWithHttpInfo($id); + return $response; + } + + /** + * Operation getProjectsBoardWithHttpInfo + * + * Get details of a project board + * + * @param int $id The ID of the project board (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\PostPatchGetBoard, HTTP status code, HTTP response headers (array of strings) + */ + public function getProjectsBoardWithHttpInfo($id) + { + $request = $this->getProjectsBoardRequest($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->getProjectsBoardRequest($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\v2\Model\PostPatchGetBoard' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetBoard', []), + $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\v2\Model\PostPatchGetBoard' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetBoard', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\PostPatchGetBoard', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getProjectsBoardAsync + * + * Get details of a project board + * + * @param int $id The ID of the project board (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectsBoardAsync($id): PromiseInterface + { + return $this->getProjectsBoardAsyncWithHttpInfo($id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProjectsBoardAsyncWithHttpInfo + * + * Get details of a project board + * + * @param int $id The ID of the project board (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectsBoardAsyncWithHttpInfo($id): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\PostPatchGetBoard'; + $request = $this->getProjectsBoardRequest($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 'getProjectsBoard' + * + * @param int $id The ID of the project board (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function getProjectsBoardRequest($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 getProjectsBoard' + ); + } + + $resourcePath = '/boards/{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 getProjectsBoards + * + * Get all project boards + * + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\GetBoards + */ + public function getProjectsBoards() + { + list($response) = $this->getProjectsBoardsWithHttpInfo(); + return $response; + } + + /** + * Operation getProjectsBoardsWithHttpInfo + * + * Get all project boards + * + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\GetBoards, HTTP status code, HTTP response headers (array of strings) + */ + public function getProjectsBoardsWithHttpInfo() + { + $request = $this->getProjectsBoardsRequest(); + + 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->getProjectsBoardsRequest(); + $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\v2\Model\GetBoards' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetBoards', []), + $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\v2\Model\GetBoards' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetBoards', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetBoards', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getProjectsBoardsAsync + * + * Get all project boards + * + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectsBoardsAsync(): PromiseInterface + { + return $this->getProjectsBoardsAsyncWithHttpInfo() + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProjectsBoardsAsyncWithHttpInfo + * + * Get all project boards + * + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectsBoardsAsyncWithHttpInfo(): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetBoards'; + $request = $this->getProjectsBoardsRequest(); + + 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 'getProjectsBoards' + * + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function getProjectsBoardsRequest(): Request + { + + $resourcePath = '/boards'; + $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'], + [] + ); + } + + // 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 updateProjectBoard + * + * Update a project board + * + * @param int $id The ID of the project board (required) + * @param \Pipedrive\versions\v2\Model\BoardRequestBody|null $board_request_body board_request_body (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\PostPatchGetBoard + */ + public function updateProjectBoard($id, $board_request_body = null) + { + list($response) = $this->updateProjectBoardWithHttpInfo($id, $board_request_body); + return $response; + } + + /** + * Operation updateProjectBoardWithHttpInfo + * + * Update a project board + * + * @param int $id The ID of the project board (required) + * @param \Pipedrive\versions\v2\Model\BoardRequestBody|null $board_request_body (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\PostPatchGetBoard, HTTP status code, HTTP response headers (array of strings) + */ + public function updateProjectBoardWithHttpInfo($id, $board_request_body = null) + { + $request = $this->updateProjectBoardRequest($id, $board_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->updateProjectBoardRequest($id, $board_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 200: + /* @phpstan-ignore-next-line */ + if ('\Pipedrive\versions\v2\Model\PostPatchGetBoard' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetBoard', []), + $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\v2\Model\PostPatchGetBoard' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetBoard', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\PostPatchGetBoard', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateProjectBoardAsync + * + * Update a project board + * + * @param int $id The ID of the project board (required) + * @param \Pipedrive\versions\v2\Model\BoardRequestBody|null $board_request_body (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function updateProjectBoardAsync($id, $board_request_body = null): PromiseInterface + { + return $this->updateProjectBoardAsyncWithHttpInfo($id, $board_request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateProjectBoardAsyncWithHttpInfo + * + * Update a project board + * + * @param int $id The ID of the project board (required) + * @param \Pipedrive\versions\v2\Model\BoardRequestBody|null $board_request_body (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function updateProjectBoardAsyncWithHttpInfo($id, $board_request_body = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\PostPatchGetBoard'; + $request = $this->updateProjectBoardRequest($id, $board_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 'updateProjectBoard' + * + * @param int $id The ID of the project board (required) + * @param \Pipedrive\versions\v2\Model\BoardRequestBody|null $board_request_body (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function updateProjectBoardRequest($id, $board_request_body = 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 updateProjectBoard' + ); + } + + $resourcePath = '/boards/{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($board_request_body)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($board_request_body)); + } else { + $httpBody = $board_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( + 'PATCH', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/versions/v2/Api/ProjectFieldsApi.php b/lib/versions/v2/Api/ProjectFieldsApi.php new file mode 100644 index 00000000..1e2c150c --- /dev/null +++ b/lib/versions/v2/Api/ProjectFieldsApi.php @@ -0,0 +1,2587 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation addProjectField + * + * Create one project field + * + * @param \Pipedrive\versions\v2\Model\CreateProjectFieldRequest $create_project_field_request create_project_field_request (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\CreateProjectField + */ + public function addProjectField($create_project_field_request) + { + list($response) = $this->addProjectFieldWithHttpInfo($create_project_field_request); + return $response; + } + + /** + * Operation addProjectFieldWithHttpInfo + * + * Create one project field + * + * @param \Pipedrive\versions\v2\Model\CreateProjectFieldRequest $create_project_field_request (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\CreateProjectField, HTTP status code, HTTP response headers (array of strings) + */ + public function addProjectFieldWithHttpInfo($create_project_field_request) + { + $request = $this->addProjectFieldRequest($create_project_field_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->addProjectFieldRequest($create_project_field_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\v2\Model\CreateProjectField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\CreateProjectField', []), + $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\v2\Model\CreateProjectField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\CreateProjectField', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\CreateProjectField', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation addProjectFieldAsync + * + * Create one project field + * + * @param \Pipedrive\versions\v2\Model\CreateProjectFieldRequest $create_project_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addProjectFieldAsync($create_project_field_request): PromiseInterface + { + return $this->addProjectFieldAsyncWithHttpInfo($create_project_field_request) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addProjectFieldAsyncWithHttpInfo + * + * Create one project field + * + * @param \Pipedrive\versions\v2\Model\CreateProjectFieldRequest $create_project_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addProjectFieldAsyncWithHttpInfo($create_project_field_request): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\CreateProjectField'; + $request = $this->addProjectFieldRequest($create_project_field_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 'addProjectField' + * + * @param \Pipedrive\versions\v2\Model\CreateProjectFieldRequest $create_project_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function addProjectFieldRequest($create_project_field_request): Request + { + // verify the required parameter 'create_project_field_request' is set + /* @phpstan-ignore-next-line */ + if ($create_project_field_request === null || (is_array($create_project_field_request) && count($create_project_field_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $create_project_field_request when calling addProjectField' + ); + } + + $resourcePath = '/projectFields'; + $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($create_project_field_request)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($create_project_field_request)); + } else { + $httpBody = $create_project_field_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 addProjectFieldOptions + * + * Add project field options in bulk + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body request_body (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\InlineResponse200 + */ + public function addProjectFieldOptions($field_code, $request_body) + { + list($response) = $this->addProjectFieldOptionsWithHttpInfo($field_code, $request_body); + return $response; + } + + /** + * Operation addProjectFieldOptionsWithHttpInfo + * + * Add project field options in bulk + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\InlineResponse200, HTTP status code, HTTP response headers (array of strings) + */ + public function addProjectFieldOptionsWithHttpInfo($field_code, $request_body) + { + $request = $this->addProjectFieldOptionsRequest($field_code, $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->addProjectFieldOptionsRequest($field_code, $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 200: + /* @phpstan-ignore-next-line */ + if ('\Pipedrive\versions\v2\Model\InlineResponse200' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\InlineResponse200', []), + $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\v2\Model\InlineResponse200' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\InlineResponse200', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\InlineResponse200', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation addProjectFieldOptionsAsync + * + * Add project field options in bulk + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addProjectFieldOptionsAsync($field_code, $request_body): PromiseInterface + { + return $this->addProjectFieldOptionsAsyncWithHttpInfo($field_code, $request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addProjectFieldOptionsAsyncWithHttpInfo + * + * Add project field options in bulk + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addProjectFieldOptionsAsyncWithHttpInfo($field_code, $request_body): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\InlineResponse200'; + $request = $this->addProjectFieldOptionsRequest($field_code, $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 'addProjectFieldOptions' + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function addProjectFieldOptionsRequest($field_code, $request_body): Request + { + // verify the required parameter 'field_code' is set + /* @phpstan-ignore-next-line */ + if ($field_code === null || (is_array($field_code) && count($field_code) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $field_code when calling addProjectFieldOptions' + ); + } + // verify the required parameter 'request_body' is set + /* @phpstan-ignore-next-line */ + if ($request_body === null || (is_array($request_body) && count($request_body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request_body when calling addProjectFieldOptions' + ); + } + + $resourcePath = '/projectFields/{field_code}/options'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($field_code !== null) { + $resourcePath = str_replace( + '{' . 'field_code' . '}', + ObjectSerializer::toPathValue($field_code), + $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($request_body)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request_body)); + } else { + $httpBody = $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 deleteProjectField + * + * Delete one project field + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\DeleteProjectField + */ + public function deleteProjectField($field_code) + { + list($response) = $this->deleteProjectFieldWithHttpInfo($field_code); + return $response; + } + + /** + * Operation deleteProjectFieldWithHttpInfo + * + * Delete one project field + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\DeleteProjectField, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteProjectFieldWithHttpInfo($field_code) + { + $request = $this->deleteProjectFieldRequest($field_code); + + 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->deleteProjectFieldRequest($field_code); + $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\v2\Model\DeleteProjectField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteProjectField', []), + $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\v2\Model\DeleteProjectField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteProjectField', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\DeleteProjectField', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteProjectFieldAsync + * + * Delete one project field + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteProjectFieldAsync($field_code): PromiseInterface + { + return $this->deleteProjectFieldAsyncWithHttpInfo($field_code) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteProjectFieldAsyncWithHttpInfo + * + * Delete one project field + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteProjectFieldAsyncWithHttpInfo($field_code): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\DeleteProjectField'; + $request = $this->deleteProjectFieldRequest($field_code); + + 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 'deleteProjectField' + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function deleteProjectFieldRequest($field_code): Request + { + // verify the required parameter 'field_code' is set + /* @phpstan-ignore-next-line */ + if ($field_code === null || (is_array($field_code) && count($field_code) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $field_code when calling deleteProjectField' + ); + } + + $resourcePath = '/projectFields/{field_code}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($field_code !== null) { + $resourcePath = str_replace( + '{' . 'field_code' . '}', + ObjectSerializer::toPathValue($field_code), + $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 deleteProjectFieldOptions + * + * Delete project field options in bulk + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body request_body (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\InlineResponse200 + */ + public function deleteProjectFieldOptions($field_code, $request_body) + { + list($response) = $this->deleteProjectFieldOptionsWithHttpInfo($field_code, $request_body); + return $response; + } + + /** + * Operation deleteProjectFieldOptionsWithHttpInfo + * + * Delete project field options in bulk + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\InlineResponse200, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteProjectFieldOptionsWithHttpInfo($field_code, $request_body) + { + $request = $this->deleteProjectFieldOptionsRequest($field_code, $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->deleteProjectFieldOptionsRequest($field_code, $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 200: + /* @phpstan-ignore-next-line */ + if ('\Pipedrive\versions\v2\Model\InlineResponse200' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\InlineResponse200', []), + $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\v2\Model\InlineResponse200' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\InlineResponse200', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\InlineResponse200', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteProjectFieldOptionsAsync + * + * Delete project field options in bulk + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteProjectFieldOptionsAsync($field_code, $request_body): PromiseInterface + { + return $this->deleteProjectFieldOptionsAsyncWithHttpInfo($field_code, $request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteProjectFieldOptionsAsyncWithHttpInfo + * + * Delete project field options in bulk + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteProjectFieldOptionsAsyncWithHttpInfo($field_code, $request_body): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\InlineResponse200'; + $request = $this->deleteProjectFieldOptionsRequest($field_code, $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 'deleteProjectFieldOptions' + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function deleteProjectFieldOptionsRequest($field_code, $request_body): Request + { + // verify the required parameter 'field_code' is set + /* @phpstan-ignore-next-line */ + if ($field_code === null || (is_array($field_code) && count($field_code) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $field_code when calling deleteProjectFieldOptions' + ); + } + // verify the required parameter 'request_body' is set + /* @phpstan-ignore-next-line */ + if ($request_body === null || (is_array($request_body) && count($request_body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request_body when calling deleteProjectFieldOptions' + ); + } + + $resourcePath = '/projectFields/{field_code}/options'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($field_code !== null) { + $resourcePath = str_replace( + '{' . 'field_code' . '}', + ObjectSerializer::toPathValue($field_code), + $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($request_body)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request_body)); + } else { + $httpBody = $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( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getProjectField + * + * Get one project field + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\GetProjectField + */ + public function getProjectField($field_code) + { + list($response) = $this->getProjectFieldWithHttpInfo($field_code); + return $response; + } + + /** + * Operation getProjectFieldWithHttpInfo + * + * Get one project field + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\GetProjectField, HTTP status code, HTTP response headers (array of strings) + */ + public function getProjectFieldWithHttpInfo($field_code) + { + $request = $this->getProjectFieldRequest($field_code); + + 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->getProjectFieldRequest($field_code); + $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\v2\Model\GetProjectField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProjectField', []), + $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\v2\Model\GetProjectField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProjectField', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetProjectField', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getProjectFieldAsync + * + * Get one project field + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectFieldAsync($field_code): PromiseInterface + { + return $this->getProjectFieldAsyncWithHttpInfo($field_code) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProjectFieldAsyncWithHttpInfo + * + * Get one project field + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectFieldAsyncWithHttpInfo($field_code): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetProjectField'; + $request = $this->getProjectFieldRequest($field_code); + + 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 'getProjectField' + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function getProjectFieldRequest($field_code): Request + { + // verify the required parameter 'field_code' is set + /* @phpstan-ignore-next-line */ + if ($field_code === null || (is_array($field_code) && count($field_code) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $field_code when calling getProjectField' + ); + } + + $resourcePath = '/projectFields/{field_code}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($field_code !== null) { + $resourcePath = str_replace( + '{' . 'field_code' . '}', + ObjectSerializer::toPathValue($field_code), + $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 getProjectFields + * + * Get all project fields + * + * @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 $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\v2\Model\GetProjectFields + */ + public function getProjectFields($limit = null, $cursor = null) + { + list($response) = $this->getProjectFieldsWithHttpInfo($limit, $cursor); + return $response; + } + + /** + * Operation getProjectFieldsWithHttpInfo + * + * Get all project fields + * + * @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 $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\v2\Model\GetProjectFields, HTTP status code, HTTP response headers (array of strings) + */ + public function getProjectFieldsWithHttpInfo($limit = null, $cursor = null) + { + $request = $this->getProjectFieldsRequest($limit, $cursor); + + 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->getProjectFieldsRequest($limit, $cursor); + $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\v2\Model\GetProjectFields' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProjectFields', []), + $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\v2\Model\GetProjectFields' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProjectFields', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetProjectFields', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getProjectFieldsAsync + * + * Get all project fields + * + * @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 $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 getProjectFieldsAsync($limit = null, $cursor = null): PromiseInterface + { + return $this->getProjectFieldsAsyncWithHttpInfo($limit, $cursor) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProjectFieldsAsyncWithHttpInfo + * + * Get all project fields + * + * @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 $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 getProjectFieldsAsyncWithHttpInfo($limit = null, $cursor = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetProjectFields'; + $request = $this->getProjectFieldsRequest($limit, $cursor); + + 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 'getProjectFields' + * + * @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 $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 getProjectFieldsRequest($limit = null, $cursor = null): Request + { + + $resourcePath = '/projectFields'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // 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($cursor)) { + $cursor = ObjectSerializer::serializeCollection($cursor, '', true); + } + if ($cursor !== null) { + $queryParams['cursor'] = $cursor; + } + + + + + /* @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 updateProjectField + * + * Update one project field + * + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdateProjectFieldRequest $update_project_field_request update_project_field_request (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\GetProjectField + */ + public function updateProjectField($field_code, $update_project_field_request) + { + list($response) = $this->updateProjectFieldWithHttpInfo($field_code, $update_project_field_request); + return $response; + } + + /** + * Operation updateProjectFieldWithHttpInfo + * + * Update one project field + * + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdateProjectFieldRequest $update_project_field_request (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\GetProjectField, HTTP status code, HTTP response headers (array of strings) + */ + public function updateProjectFieldWithHttpInfo($field_code, $update_project_field_request) + { + $request = $this->updateProjectFieldRequest($field_code, $update_project_field_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->updateProjectFieldRequest($field_code, $update_project_field_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\v2\Model\GetProjectField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProjectField', []), + $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\v2\Model\GetProjectField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProjectField', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetProjectField', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateProjectFieldAsync + * + * Update one project field + * + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdateProjectFieldRequest $update_project_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function updateProjectFieldAsync($field_code, $update_project_field_request): PromiseInterface + { + return $this->updateProjectFieldAsyncWithHttpInfo($field_code, $update_project_field_request) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateProjectFieldAsyncWithHttpInfo + * + * Update one project field + * + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdateProjectFieldRequest $update_project_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function updateProjectFieldAsyncWithHttpInfo($field_code, $update_project_field_request): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetProjectField'; + $request = $this->updateProjectFieldRequest($field_code, $update_project_field_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 'updateProjectField' + * + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdateProjectFieldRequest $update_project_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function updateProjectFieldRequest($field_code, $update_project_field_request): Request + { + // verify the required parameter 'field_code' is set + /* @phpstan-ignore-next-line */ + if ($field_code === null || (is_array($field_code) && count($field_code) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $field_code when calling updateProjectField' + ); + } + // verify the required parameter 'update_project_field_request' is set + /* @phpstan-ignore-next-line */ + if ($update_project_field_request === null || (is_array($update_project_field_request) && count($update_project_field_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $update_project_field_request when calling updateProjectField' + ); + } + + $resourcePath = '/projectFields/{field_code}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($field_code !== null) { + $resourcePath = str_replace( + '{' . 'field_code' . '}', + ObjectSerializer::toPathValue($field_code), + $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_project_field_request)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_project_field_request)); + } else { + $httpBody = $update_project_field_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( + 'PATCH', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateProjectFieldOptions + * + * Update project field options in bulk + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body request_body (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\InlineResponse200 + */ + public function updateProjectFieldOptions($field_code, $request_body) + { + list($response) = $this->updateProjectFieldOptionsWithHttpInfo($field_code, $request_body); + return $response; + } + + /** + * Operation updateProjectFieldOptionsWithHttpInfo + * + * Update project field options in bulk + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\InlineResponse200, HTTP status code, HTTP response headers (array of strings) + */ + public function updateProjectFieldOptionsWithHttpInfo($field_code, $request_body) + { + $request = $this->updateProjectFieldOptionsRequest($field_code, $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->updateProjectFieldOptionsRequest($field_code, $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 200: + /* @phpstan-ignore-next-line */ + if ('\Pipedrive\versions\v2\Model\InlineResponse200' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\InlineResponse200', []), + $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\v2\Model\InlineResponse200' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\InlineResponse200', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\InlineResponse200', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateProjectFieldOptionsAsync + * + * Update project field options in bulk + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function updateProjectFieldOptionsAsync($field_code, $request_body): PromiseInterface + { + return $this->updateProjectFieldOptionsAsyncWithHttpInfo($field_code, $request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateProjectFieldOptionsAsyncWithHttpInfo + * + * Update project field options in bulk + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function updateProjectFieldOptionsAsyncWithHttpInfo($field_code, $request_body): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\InlineResponse200'; + $request = $this->updateProjectFieldOptionsRequest($field_code, $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 'updateProjectFieldOptions' + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function updateProjectFieldOptionsRequest($field_code, $request_body): Request + { + // verify the required parameter 'field_code' is set + /* @phpstan-ignore-next-line */ + if ($field_code === null || (is_array($field_code) && count($field_code) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $field_code when calling updateProjectFieldOptions' + ); + } + // verify the required parameter 'request_body' is set + /* @phpstan-ignore-next-line */ + if ($request_body === null || (is_array($request_body) && count($request_body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $request_body when calling updateProjectFieldOptions' + ); + } + + $resourcePath = '/projectFields/{field_code}/options'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($field_code !== null) { + $resourcePath = str_replace( + '{' . 'field_code' . '}', + ObjectSerializer::toPathValue($field_code), + $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($request_body)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($request_body)); + } else { + $httpBody = $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( + 'PATCH', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/versions/v2/Api/ProjectPhasesApi.php b/lib/versions/v2/Api/ProjectPhasesApi.php new file mode 100644 index 00000000..9e6b33f7 --- /dev/null +++ b/lib/versions/v2/Api/ProjectPhasesApi.php @@ -0,0 +1,1632 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation addProjectPhase + * + * Add a project phase + * + * @param \Pipedrive\versions\v2\Model\PhaseRequestBody $phase_request_body phase_request_body (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\PostPatchGetPhase + */ + public function addProjectPhase($phase_request_body) + { + list($response) = $this->addProjectPhaseWithHttpInfo($phase_request_body); + return $response; + } + + /** + * Operation addProjectPhaseWithHttpInfo + * + * Add a project phase + * + * @param \Pipedrive\versions\v2\Model\PhaseRequestBody $phase_request_body (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\PostPatchGetPhase, HTTP status code, HTTP response headers (array of strings) + */ + public function addProjectPhaseWithHttpInfo($phase_request_body) + { + $request = $this->addProjectPhaseRequest($phase_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->addProjectPhaseRequest($phase_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 200: + /* @phpstan-ignore-next-line */ + if ('\Pipedrive\versions\v2\Model\PostPatchGetPhase' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetPhase', []), + $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\v2\Model\PostPatchGetPhase' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetPhase', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\PostPatchGetPhase', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation addProjectPhaseAsync + * + * Add a project phase + * + * @param \Pipedrive\versions\v2\Model\PhaseRequestBody $phase_request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addProjectPhaseAsync($phase_request_body): PromiseInterface + { + return $this->addProjectPhaseAsyncWithHttpInfo($phase_request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addProjectPhaseAsyncWithHttpInfo + * + * Add a project phase + * + * @param \Pipedrive\versions\v2\Model\PhaseRequestBody $phase_request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addProjectPhaseAsyncWithHttpInfo($phase_request_body): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\PostPatchGetPhase'; + $request = $this->addProjectPhaseRequest($phase_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 'addProjectPhase' + * + * @param \Pipedrive\versions\v2\Model\PhaseRequestBody $phase_request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function addProjectPhaseRequest($phase_request_body): Request + { + // verify the required parameter 'phase_request_body' is set + /* @phpstan-ignore-next-line */ + if ($phase_request_body === null || (is_array($phase_request_body) && count($phase_request_body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $phase_request_body when calling addProjectPhase' + ); + } + + $resourcePath = '/phases'; + $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($phase_request_body)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($phase_request_body)); + } else { + $httpBody = $phase_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 deleteProjectPhase + * + * Delete a project phase + * + * @param int $id The ID of the project phase (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\DeleteProjectPhaseResponse + */ + public function deleteProjectPhase($id) + { + list($response) = $this->deleteProjectPhaseWithHttpInfo($id); + return $response; + } + + /** + * Operation deleteProjectPhaseWithHttpInfo + * + * Delete a project phase + * + * @param int $id The ID of the project phase (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\DeleteProjectPhaseResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteProjectPhaseWithHttpInfo($id) + { + $request = $this->deleteProjectPhaseRequest($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->deleteProjectPhaseRequest($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\v2\Model\DeleteProjectPhaseResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteProjectPhaseResponse', []), + $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\v2\Model\DeleteProjectPhaseResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteProjectPhaseResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\DeleteProjectPhaseResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteProjectPhaseAsync + * + * Delete a project phase + * + * @param int $id The ID of the project phase (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteProjectPhaseAsync($id): PromiseInterface + { + return $this->deleteProjectPhaseAsyncWithHttpInfo($id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteProjectPhaseAsyncWithHttpInfo + * + * Delete a project phase + * + * @param int $id The ID of the project phase (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteProjectPhaseAsyncWithHttpInfo($id): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\DeleteProjectPhaseResponse'; + $request = $this->deleteProjectPhaseRequest($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 'deleteProjectPhase' + * + * @param int $id The ID of the project phase (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function deleteProjectPhaseRequest($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 deleteProjectPhase' + ); + } + + $resourcePath = '/phases/{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 getProjectsPhase + * + * Get details of a project phase + * + * @param int $id The ID of the project phase (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\PostPatchGetPhase + */ + public function getProjectsPhase($id) + { + list($response) = $this->getProjectsPhaseWithHttpInfo($id); + return $response; + } + + /** + * Operation getProjectsPhaseWithHttpInfo + * + * Get details of a project phase + * + * @param int $id The ID of the project phase (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\PostPatchGetPhase, HTTP status code, HTTP response headers (array of strings) + */ + public function getProjectsPhaseWithHttpInfo($id) + { + $request = $this->getProjectsPhaseRequest($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->getProjectsPhaseRequest($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\v2\Model\PostPatchGetPhase' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetPhase', []), + $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\v2\Model\PostPatchGetPhase' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetPhase', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\PostPatchGetPhase', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getProjectsPhaseAsync + * + * Get details of a project phase + * + * @param int $id The ID of the project phase (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectsPhaseAsync($id): PromiseInterface + { + return $this->getProjectsPhaseAsyncWithHttpInfo($id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProjectsPhaseAsyncWithHttpInfo + * + * Get details of a project phase + * + * @param int $id The ID of the project phase (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectsPhaseAsyncWithHttpInfo($id): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\PostPatchGetPhase'; + $request = $this->getProjectsPhaseRequest($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 'getProjectsPhase' + * + * @param int $id The ID of the project phase (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function getProjectsPhaseRequest($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 getProjectsPhase' + ); + } + + $resourcePath = '/phases/{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 getProjectsPhases + * + * Get project phases + * + * @param int $board_id The ID of the board for which phases are requested (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\GetPhases + */ + public function getProjectsPhases($board_id) + { + list($response) = $this->getProjectsPhasesWithHttpInfo($board_id); + return $response; + } + + /** + * Operation getProjectsPhasesWithHttpInfo + * + * Get project phases + * + * @param int $board_id The ID of the board for which phases are requested (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\GetPhases, HTTP status code, HTTP response headers (array of strings) + */ + public function getProjectsPhasesWithHttpInfo($board_id) + { + $request = $this->getProjectsPhasesRequest($board_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->getProjectsPhasesRequest($board_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\v2\Model\GetPhases' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetPhases', []), + $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\v2\Model\GetPhases' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetPhases', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetPhases', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getProjectsPhasesAsync + * + * Get project phases + * + * @param int $board_id The ID of the board for which phases are requested (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectsPhasesAsync($board_id): PromiseInterface + { + return $this->getProjectsPhasesAsyncWithHttpInfo($board_id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProjectsPhasesAsyncWithHttpInfo + * + * Get project phases + * + * @param int $board_id The ID of the board for which phases are requested (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectsPhasesAsyncWithHttpInfo($board_id): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetPhases'; + $request = $this->getProjectsPhasesRequest($board_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 'getProjectsPhases' + * + * @param int $board_id The ID of the board for which phases are requested (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function getProjectsPhasesRequest($board_id): Request + { + // verify the required parameter 'board_id' is set + /* @phpstan-ignore-next-line */ + if ($board_id === null || (is_array($board_id) && count($board_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $board_id when calling getProjectsPhases' + ); + } + + $resourcePath = '/phases'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + /* @phpstan-ignore-next-line */ + if (is_array($board_id)) { + $board_id = ObjectSerializer::serializeCollection($board_id, '', true); + } + if ($board_id !== null) { + $queryParams['board_id'] = $board_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 updateProjectPhase + * + * Update a project phase + * + * @param int $id The ID of the project phase (required) + * @param \Pipedrive\versions\v2\Model\PhaseRequestBody|null $phase_request_body phase_request_body (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\PostPatchGetPhase + */ + public function updateProjectPhase($id, $phase_request_body = null) + { + list($response) = $this->updateProjectPhaseWithHttpInfo($id, $phase_request_body); + return $response; + } + + /** + * Operation updateProjectPhaseWithHttpInfo + * + * Update a project phase + * + * @param int $id The ID of the project phase (required) + * @param \Pipedrive\versions\v2\Model\PhaseRequestBody|null $phase_request_body (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\PostPatchGetPhase, HTTP status code, HTTP response headers (array of strings) + */ + public function updateProjectPhaseWithHttpInfo($id, $phase_request_body = null) + { + $request = $this->updateProjectPhaseRequest($id, $phase_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->updateProjectPhaseRequest($id, $phase_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 200: + /* @phpstan-ignore-next-line */ + if ('\Pipedrive\versions\v2\Model\PostPatchGetPhase' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetPhase', []), + $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\v2\Model\PostPatchGetPhase' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetPhase', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\PostPatchGetPhase', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateProjectPhaseAsync + * + * Update a project phase + * + * @param int $id The ID of the project phase (required) + * @param \Pipedrive\versions\v2\Model\PhaseRequestBody|null $phase_request_body (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function updateProjectPhaseAsync($id, $phase_request_body = null): PromiseInterface + { + return $this->updateProjectPhaseAsyncWithHttpInfo($id, $phase_request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateProjectPhaseAsyncWithHttpInfo + * + * Update a project phase + * + * @param int $id The ID of the project phase (required) + * @param \Pipedrive\versions\v2\Model\PhaseRequestBody|null $phase_request_body (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function updateProjectPhaseAsyncWithHttpInfo($id, $phase_request_body = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\PostPatchGetPhase'; + $request = $this->updateProjectPhaseRequest($id, $phase_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 'updateProjectPhase' + * + * @param int $id The ID of the project phase (required) + * @param \Pipedrive\versions\v2\Model\PhaseRequestBody|null $phase_request_body (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function updateProjectPhaseRequest($id, $phase_request_body = 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 updateProjectPhase' + ); + } + + $resourcePath = '/phases/{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($phase_request_body)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($phase_request_body)); + } else { + $httpBody = $phase_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( + 'PATCH', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/versions/v2/Api/ProjectTemplatesApi.php b/lib/versions/v2/Api/ProjectTemplatesApi.php new file mode 100644 index 00000000..1e64bc8a --- /dev/null +++ b/lib/versions/v2/Api/ProjectTemplatesApi.php @@ -0,0 +1,741 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation getProjectTemplate + * + * Get details of a template + * + * @param int $id The ID of the project template (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\GetProjectTemplateResponse + */ + public function getProjectTemplate($id) + { + list($response) = $this->getProjectTemplateWithHttpInfo($id); + return $response; + } + + /** + * Operation getProjectTemplateWithHttpInfo + * + * Get details of a template + * + * @param int $id The ID of the project template (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\GetProjectTemplateResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getProjectTemplateWithHttpInfo($id) + { + $request = $this->getProjectTemplateRequest($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->getProjectTemplateRequest($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\v2\Model\GetProjectTemplateResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProjectTemplateResponse', []), + $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\v2\Model\GetProjectTemplateResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProjectTemplateResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetProjectTemplateResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getProjectTemplateAsync + * + * Get details of a template + * + * @param int $id The ID of the project template (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectTemplateAsync($id): PromiseInterface + { + return $this->getProjectTemplateAsyncWithHttpInfo($id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProjectTemplateAsyncWithHttpInfo + * + * Get details of a template + * + * @param int $id The ID of the project template (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectTemplateAsyncWithHttpInfo($id): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetProjectTemplateResponse'; + $request = $this->getProjectTemplateRequest($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 'getProjectTemplate' + * + * @param int $id The ID of the project template (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function getProjectTemplateRequest($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 getProjectTemplate' + ); + } + + $resourcePath = '/projectTemplates/{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 getProjectTemplates + * + * Get all project templates + * + * @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) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\GetProjectTemplatesResponse + */ + public function getProjectTemplates($cursor = null, $limit = null) + { + list($response) = $this->getProjectTemplatesWithHttpInfo($cursor, $limit); + return $response; + } + + /** + * Operation getProjectTemplatesWithHttpInfo + * + * Get all project templates + * + * @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) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\GetProjectTemplatesResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getProjectTemplatesWithHttpInfo($cursor = null, $limit = null) + { + $request = $this->getProjectTemplatesRequest($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->getProjectTemplatesRequest($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\v2\Model\GetProjectTemplatesResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProjectTemplatesResponse', []), + $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\v2\Model\GetProjectTemplatesResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProjectTemplatesResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetProjectTemplatesResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getProjectTemplatesAsync + * + * Get all project templates + * + * @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) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectTemplatesAsync($cursor = null, $limit = null): PromiseInterface + { + return $this->getProjectTemplatesAsyncWithHttpInfo($cursor, $limit) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProjectTemplatesAsyncWithHttpInfo + * + * Get all project templates + * + * @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) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectTemplatesAsyncWithHttpInfo($cursor = null, $limit = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetProjectTemplatesResponse'; + $request = $this->getProjectTemplatesRequest($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 'getProjectTemplates' + * + * @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) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function getProjectTemplatesRequest($cursor = null, $limit = null): Request + { + + $resourcePath = '/projectTemplates'; + $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; + } + + + + + /* @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 + ); + } + + /** + * Create http client option + * + * @throws RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/versions/v2/Api/ProjectsApi.php b/lib/versions/v2/Api/ProjectsApi.php new file mode 100644 index 00000000..b9df88d4 --- /dev/null +++ b/lib/versions/v2/Api/ProjectsApi.php @@ -0,0 +1,3306 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation addProject + * + * Add a project + * + * @param \Pipedrive\versions\v2\Model\ProjectRequestBody $project_request_body project_request_body (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\PostPatchGetProject + */ + public function addProject($project_request_body) + { + list($response) = $this->addProjectWithHttpInfo($project_request_body); + return $response; + } + + /** + * Operation addProjectWithHttpInfo + * + * Add a project + * + * @param \Pipedrive\versions\v2\Model\ProjectRequestBody $project_request_body (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\PostPatchGetProject, HTTP status code, HTTP response headers (array of strings) + */ + public function addProjectWithHttpInfo($project_request_body) + { + $request = $this->addProjectRequest($project_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->addProjectRequest($project_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\v2\Model\PostPatchGetProject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetProject', []), + $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\v2\Model\PostPatchGetProject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetProject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\PostPatchGetProject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation addProjectAsync + * + * Add a project + * + * @param \Pipedrive\versions\v2\Model\ProjectRequestBody $project_request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addProjectAsync($project_request_body): PromiseInterface + { + return $this->addProjectAsyncWithHttpInfo($project_request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addProjectAsyncWithHttpInfo + * + * Add a project + * + * @param \Pipedrive\versions\v2\Model\ProjectRequestBody $project_request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addProjectAsyncWithHttpInfo($project_request_body): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\PostPatchGetProject'; + $request = $this->addProjectRequest($project_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 'addProject' + * + * @param \Pipedrive\versions\v2\Model\ProjectRequestBody $project_request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function addProjectRequest($project_request_body): Request + { + // verify the required parameter 'project_request_body' is set + /* @phpstan-ignore-next-line */ + if ($project_request_body === null || (is_array($project_request_body) && count($project_request_body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $project_request_body when calling addProject' + ); + } + + $resourcePath = '/projects'; + $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($project_request_body)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($project_request_body)); + } else { + $httpBody = $project_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 archiveProject + * + * Archive a project + * + * @param int $id The ID of the project (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\PostPatchGetProject + */ + public function archiveProject($id) + { + list($response) = $this->archiveProjectWithHttpInfo($id); + return $response; + } + + /** + * Operation archiveProjectWithHttpInfo + * + * Archive a project + * + * @param int $id The ID of the project (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\PostPatchGetProject, HTTP status code, HTTP response headers (array of strings) + */ + public function archiveProjectWithHttpInfo($id) + { + $request = $this->archiveProjectRequest($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->archiveProjectRequest($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\v2\Model\PostPatchGetProject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetProject', []), + $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\v2\Model\PostPatchGetProject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetProject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\PostPatchGetProject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation archiveProjectAsync + * + * Archive a project + * + * @param int $id The ID of the project (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function archiveProjectAsync($id): PromiseInterface + { + return $this->archiveProjectAsyncWithHttpInfo($id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation archiveProjectAsyncWithHttpInfo + * + * Archive a project + * + * @param int $id The ID of the project (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function archiveProjectAsyncWithHttpInfo($id): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\PostPatchGetProject'; + $request = $this->archiveProjectRequest($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 'archiveProject' + * + * @param int $id The ID of the project (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function archiveProjectRequest($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 archiveProject' + ); + } + + $resourcePath = '/projects/{id}/archive'; + $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 deleteProject + * + * Delete a project + * + * @param int $id The ID of the project (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\DeleteProjectResponse + */ + public function deleteProject($id) + { + list($response) = $this->deleteProjectWithHttpInfo($id); + return $response; + } + + /** + * Operation deleteProjectWithHttpInfo + * + * Delete a project + * + * @param int $id The ID of the project (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\DeleteProjectResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteProjectWithHttpInfo($id) + { + $request = $this->deleteProjectRequest($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->deleteProjectRequest($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\v2\Model\DeleteProjectResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteProjectResponse', []), + $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\v2\Model\DeleteProjectResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteProjectResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\DeleteProjectResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteProjectAsync + * + * Delete a project + * + * @param int $id The ID of the project (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteProjectAsync($id): PromiseInterface + { + return $this->deleteProjectAsyncWithHttpInfo($id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteProjectAsyncWithHttpInfo + * + * Delete a project + * + * @param int $id The ID of the project (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteProjectAsyncWithHttpInfo($id): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\DeleteProjectResponse'; + $request = $this->deleteProjectRequest($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 'deleteProject' + * + * @param int $id The ID of the project (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function deleteProjectRequest($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 deleteProject' + ); + } + + $resourcePath = '/projects/{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 getArchivedProjects + * + * Get all archived projects + * + * @param int|null $filter_id If supplied, only projects matching the specified filter are returned (optional) + * @param string|null $status If supplied, includes only projects with the specified statuses. Possible values are `open`, `completed`, `canceled` and `deleted`. By default `deleted` projects are not returned. (optional) + * @param int|null $phase_id If supplied, only projects in the specified phase are returned (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 $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\v2\Model\GetProjects + */ + public function getArchivedProjects($filter_id = null, $status = null, $phase_id = null, $limit = null, $cursor = null) + { + list($response) = $this->getArchivedProjectsWithHttpInfo($filter_id, $status, $phase_id, $limit, $cursor); + return $response; + } + + /** + * Operation getArchivedProjectsWithHttpInfo + * + * Get all archived projects + * + * @param int|null $filter_id If supplied, only projects matching the specified filter are returned (optional) + * @param string|null $status If supplied, includes only projects with the specified statuses. Possible values are `open`, `completed`, `canceled` and `deleted`. By default `deleted` projects are not returned. (optional) + * @param int|null $phase_id If supplied, only projects in the specified phase are returned (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 $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\v2\Model\GetProjects, HTTP status code, HTTP response headers (array of strings) + */ + public function getArchivedProjectsWithHttpInfo($filter_id = null, $status = null, $phase_id = null, $limit = null, $cursor = null) + { + $request = $this->getArchivedProjectsRequest($filter_id, $status, $phase_id, $limit, $cursor); + + 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->getArchivedProjectsRequest($filter_id, $status, $phase_id, $limit, $cursor); + $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\v2\Model\GetProjects' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProjects', []), + $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\v2\Model\GetProjects' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProjects', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetProjects', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getArchivedProjectsAsync + * + * Get all archived projects + * + * @param int|null $filter_id If supplied, only projects matching the specified filter are returned (optional) + * @param string|null $status If supplied, includes only projects with the specified statuses. Possible values are `open`, `completed`, `canceled` and `deleted`. By default `deleted` projects are not returned. (optional) + * @param int|null $phase_id If supplied, only projects in the specified phase are returned (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 $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 getArchivedProjectsAsync($filter_id = null, $status = null, $phase_id = null, $limit = null, $cursor = null): PromiseInterface + { + return $this->getArchivedProjectsAsyncWithHttpInfo($filter_id, $status, $phase_id, $limit, $cursor) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getArchivedProjectsAsyncWithHttpInfo + * + * Get all archived projects + * + * @param int|null $filter_id If supplied, only projects matching the specified filter are returned (optional) + * @param string|null $status If supplied, includes only projects with the specified statuses. Possible values are `open`, `completed`, `canceled` and `deleted`. By default `deleted` projects are not returned. (optional) + * @param int|null $phase_id If supplied, only projects in the specified phase are returned (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 $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 getArchivedProjectsAsyncWithHttpInfo($filter_id = null, $status = null, $phase_id = null, $limit = null, $cursor = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetProjects'; + $request = $this->getArchivedProjectsRequest($filter_id, $status, $phase_id, $limit, $cursor); + + 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 'getArchivedProjects' + * + * @param int|null $filter_id If supplied, only projects matching the specified filter are returned (optional) + * @param string|null $status If supplied, includes only projects with the specified statuses. Possible values are `open`, `completed`, `canceled` and `deleted`. By default `deleted` projects are not returned. (optional) + * @param int|null $phase_id If supplied, only projects in the specified phase are returned (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 $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 getArchivedProjectsRequest($filter_id = null, $status = null, $phase_id = null, $limit = null, $cursor = null): Request + { + + $resourcePath = '/projects/archived'; + $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($status)) { + $status = ObjectSerializer::serializeCollection($status, '', true); + } + if ($status !== null) { + $queryParams['status'] = $status; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($phase_id)) { + $phase_id = ObjectSerializer::serializeCollection($phase_id, '', true); + } + if ($phase_id !== null) { + $queryParams['phase_id'] = $phase_id; + } + // 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($cursor)) { + $cursor = ObjectSerializer::serializeCollection($cursor, '', true); + } + if ($cursor !== null) { + $queryParams['cursor'] = $cursor; + } + + + + + /* @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 getProject + * + * Get details of a project + * + * @param int $id The ID of the project (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\PostPatchGetProject + */ + public function getProject($id) + { + list($response) = $this->getProjectWithHttpInfo($id); + return $response; + } + + /** + * Operation getProjectWithHttpInfo + * + * Get details of a project + * + * @param int $id The ID of the project (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\PostPatchGetProject, HTTP status code, HTTP response headers (array of strings) + */ + public function getProjectWithHttpInfo($id) + { + $request = $this->getProjectRequest($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->getProjectRequest($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\v2\Model\PostPatchGetProject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetProject', []), + $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\v2\Model\PostPatchGetProject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetProject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\PostPatchGetProject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getProjectAsync + * + * Get details of a project + * + * @param int $id The ID of the project (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectAsync($id): PromiseInterface + { + return $this->getProjectAsyncWithHttpInfo($id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProjectAsyncWithHttpInfo + * + * Get details of a project + * + * @param int $id The ID of the project (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectAsyncWithHttpInfo($id): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\PostPatchGetProject'; + $request = $this->getProjectRequest($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 'getProject' + * + * @param int $id The ID of the project (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function getProjectRequest($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 getProject' + ); + } + + $resourcePath = '/projects/{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 getProjectChangelog + * + * List updates about project field values + * + * @param int $id The ID of the project (required) + * @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 $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\v2\Model\ProjectChangelogResponse + */ + public function getProjectChangelog($id, $limit = null, $cursor = null) + { + list($response) = $this->getProjectChangelogWithHttpInfo($id, $limit, $cursor); + return $response; + } + + /** + * Operation getProjectChangelogWithHttpInfo + * + * List updates about project field values + * + * @param int $id The ID of the project (required) + * @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 $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\v2\Model\ProjectChangelogResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getProjectChangelogWithHttpInfo($id, $limit = null, $cursor = null) + { + $request = $this->getProjectChangelogRequest($id, $limit, $cursor); + + 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->getProjectChangelogRequest($id, $limit, $cursor); + $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\v2\Model\ProjectChangelogResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\ProjectChangelogResponse', []), + $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\v2\Model\ProjectChangelogResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\ProjectChangelogResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\ProjectChangelogResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getProjectChangelogAsync + * + * List updates about project field values + * + * @param int $id The ID of the project (required) + * @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 $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 getProjectChangelogAsync($id, $limit = null, $cursor = null): PromiseInterface + { + return $this->getProjectChangelogAsyncWithHttpInfo($id, $limit, $cursor) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProjectChangelogAsyncWithHttpInfo + * + * List updates about project field values + * + * @param int $id The ID of the project (required) + * @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 $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 getProjectChangelogAsyncWithHttpInfo($id, $limit = null, $cursor = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\ProjectChangelogResponse'; + $request = $this->getProjectChangelogRequest($id, $limit, $cursor); + + 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 'getProjectChangelog' + * + * @param int $id The ID of the project (required) + * @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 $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 getProjectChangelogRequest($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 getProjectChangelog' + ); + } + + $resourcePath = '/projects/{id}/changelog'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // 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($cursor)) { + $cursor = ObjectSerializer::serializeCollection($cursor, '', true); + } + if ($cursor !== null) { + $queryParams['cursor'] = $cursor; + } + + + // 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 getProjectUsers + * + * List permitted users + * + * @param int $id The ID of the project (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\GetProjectPermittedUsersResponse + */ + public function getProjectUsers($id) + { + list($response) = $this->getProjectUsersWithHttpInfo($id); + return $response; + } + + /** + * Operation getProjectUsersWithHttpInfo + * + * List permitted users + * + * @param int $id The ID of the project (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\GetProjectPermittedUsersResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getProjectUsersWithHttpInfo($id) + { + $request = $this->getProjectUsersRequest($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->getProjectUsersRequest($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\v2\Model\GetProjectPermittedUsersResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProjectPermittedUsersResponse', []), + $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\v2\Model\GetProjectPermittedUsersResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProjectPermittedUsersResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetProjectPermittedUsersResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getProjectUsersAsync + * + * List permitted users + * + * @param int $id The ID of the project (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectUsersAsync($id): PromiseInterface + { + return $this->getProjectUsersAsyncWithHttpInfo($id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProjectUsersAsyncWithHttpInfo + * + * List permitted users + * + * @param int $id The ID of the project (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProjectUsersAsyncWithHttpInfo($id): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetProjectPermittedUsersResponse'; + $request = $this->getProjectUsersRequest($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 'getProjectUsers' + * + * @param int $id The ID of the project (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function getProjectUsersRequest($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 getProjectUsers' + ); + } + + $resourcePath = '/projects/{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 getProjects + * + * Get all projects + * + * @param int|null $filter_id If supplied, only projects matching the specified filter are returned (optional) + * @param string|null $status If supplied, includes only projects with the specified statuses. Possible values are `open`, `completed`, `canceled` and `deleted`. By default `deleted` projects are not returned. (optional) + * @param int|null $phase_id If supplied, only projects in the specified phase are returned (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 $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\v2\Model\GetProjects + */ + public function getProjects($filter_id = null, $status = null, $phase_id = null, $limit = null, $cursor = null) + { + list($response) = $this->getProjectsWithHttpInfo($filter_id, $status, $phase_id, $limit, $cursor); + return $response; + } + + /** + * Operation getProjectsWithHttpInfo + * + * Get all projects + * + * @param int|null $filter_id If supplied, only projects matching the specified filter are returned (optional) + * @param string|null $status If supplied, includes only projects with the specified statuses. Possible values are `open`, `completed`, `canceled` and `deleted`. By default `deleted` projects are not returned. (optional) + * @param int|null $phase_id If supplied, only projects in the specified phase are returned (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 $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\v2\Model\GetProjects, HTTP status code, HTTP response headers (array of strings) + */ + public function getProjectsWithHttpInfo($filter_id = null, $status = null, $phase_id = null, $limit = null, $cursor = null) + { + $request = $this->getProjectsRequest($filter_id, $status, $phase_id, $limit, $cursor); + + 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->getProjectsRequest($filter_id, $status, $phase_id, $limit, $cursor); + $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\v2\Model\GetProjects' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProjects', []), + $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\v2\Model\GetProjects' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProjects', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetProjects', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getProjectsAsync + * + * Get all projects + * + * @param int|null $filter_id If supplied, only projects matching the specified filter are returned (optional) + * @param string|null $status If supplied, includes only projects with the specified statuses. Possible values are `open`, `completed`, `canceled` and `deleted`. By default `deleted` projects are not returned. (optional) + * @param int|null $phase_id If supplied, only projects in the specified phase are returned (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 $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 getProjectsAsync($filter_id = null, $status = null, $phase_id = null, $limit = null, $cursor = null): PromiseInterface + { + return $this->getProjectsAsyncWithHttpInfo($filter_id, $status, $phase_id, $limit, $cursor) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProjectsAsyncWithHttpInfo + * + * Get all projects + * + * @param int|null $filter_id If supplied, only projects matching the specified filter are returned (optional) + * @param string|null $status If supplied, includes only projects with the specified statuses. Possible values are `open`, `completed`, `canceled` and `deleted`. By default `deleted` projects are not returned. (optional) + * @param int|null $phase_id If supplied, only projects in the specified phase are returned (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 $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 getProjectsAsyncWithHttpInfo($filter_id = null, $status = null, $phase_id = null, $limit = null, $cursor = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetProjects'; + $request = $this->getProjectsRequest($filter_id, $status, $phase_id, $limit, $cursor); + + 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 'getProjects' + * + * @param int|null $filter_id If supplied, only projects matching the specified filter are returned (optional) + * @param string|null $status If supplied, includes only projects with the specified statuses. Possible values are `open`, `completed`, `canceled` and `deleted`. By default `deleted` projects are not returned. (optional) + * @param int|null $phase_id If supplied, only projects in the specified phase are returned (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 $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 getProjectsRequest($filter_id = null, $status = null, $phase_id = null, $limit = null, $cursor = null): Request + { + + $resourcePath = '/projects'; + $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($status)) { + $status = ObjectSerializer::serializeCollection($status, '', true); + } + if ($status !== null) { + $queryParams['status'] = $status; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($phase_id)) { + $phase_id = ObjectSerializer::serializeCollection($phase_id, '', true); + } + if ($phase_id !== null) { + $queryParams['phase_id'] = $phase_id; + } + // 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($cursor)) { + $cursor = ObjectSerializer::serializeCollection($cursor, '', true); + } + if ($cursor !== null) { + $queryParams['cursor'] = $cursor; + } + + + + + /* @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 searchProjects + * + * Search projects + * + * @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 projects by the provided person ID (optional) + * @param int|null $organization_id Will filter projects by the provided organization ID (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 $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\v2\Model\ProjectSearchResponse + */ + public function searchProjects($term, $fields = null, $exact_match = null, $person_id = null, $organization_id = null, $limit = null, $cursor = null) + { + list($response) = $this->searchProjectsWithHttpInfo($term, $fields, $exact_match, $person_id, $organization_id, $limit, $cursor); + return $response; + } + + /** + * Operation searchProjectsWithHttpInfo + * + * Search projects + * + * @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 projects by the provided person ID (optional) + * @param int|null $organization_id Will filter projects by the provided organization ID (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 $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\v2\Model\ProjectSearchResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function searchProjectsWithHttpInfo($term, $fields = null, $exact_match = null, $person_id = null, $organization_id = null, $limit = null, $cursor = null) + { + $request = $this->searchProjectsRequest($term, $fields, $exact_match, $person_id, $organization_id, $limit, $cursor); + + 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->searchProjectsRequest($term, $fields, $exact_match, $person_id, $organization_id, $limit, $cursor); + $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\v2\Model\ProjectSearchResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\ProjectSearchResponse', []), + $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\v2\Model\ProjectSearchResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\ProjectSearchResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\ProjectSearchResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation searchProjectsAsync + * + * Search projects + * + * @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 projects by the provided person ID (optional) + * @param int|null $organization_id Will filter projects by the provided organization ID (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 $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 searchProjectsAsync($term, $fields = null, $exact_match = null, $person_id = null, $organization_id = null, $limit = null, $cursor = null): PromiseInterface + { + return $this->searchProjectsAsyncWithHttpInfo($term, $fields, $exact_match, $person_id, $organization_id, $limit, $cursor) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation searchProjectsAsyncWithHttpInfo + * + * Search projects + * + * @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 projects by the provided person ID (optional) + * @param int|null $organization_id Will filter projects by the provided organization ID (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 $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 searchProjectsAsyncWithHttpInfo($term, $fields = null, $exact_match = null, $person_id = null, $organization_id = null, $limit = null, $cursor = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\ProjectSearchResponse'; + $request = $this->searchProjectsRequest($term, $fields, $exact_match, $person_id, $organization_id, $limit, $cursor); + + 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 'searchProjects' + * + * @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 projects by the provided person ID (optional) + * @param int|null $organization_id Will filter projects by the provided organization ID (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 $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 searchProjectsRequest($term, $fields = null, $exact_match = null, $person_id = null, $organization_id = null, $limit = null, $cursor = 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 searchProjects' + ); + } + + $resourcePath = '/projects/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($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($limit)) { + $limit = ObjectSerializer::serializeCollection($limit, '', true); + } + if ($limit !== null) { + $queryParams['limit'] = $limit; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($cursor)) { + $cursor = ObjectSerializer::serializeCollection($cursor, '', true); + } + if ($cursor !== null) { + $queryParams['cursor'] = $cursor; + } + + + + + /* @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 updateProject + * + * Update a project + * + * @param int $id The ID of the project (required) + * @param \Pipedrive\versions\v2\Model\ProjectRequestBody|null $project_request_body project_request_body (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\PostPatchGetProject + */ + public function updateProject($id, $project_request_body = null) + { + list($response) = $this->updateProjectWithHttpInfo($id, $project_request_body); + return $response; + } + + /** + * Operation updateProjectWithHttpInfo + * + * Update a project + * + * @param int $id The ID of the project (required) + * @param \Pipedrive\versions\v2\Model\ProjectRequestBody|null $project_request_body (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\PostPatchGetProject, HTTP status code, HTTP response headers (array of strings) + */ + public function updateProjectWithHttpInfo($id, $project_request_body = null) + { + $request = $this->updateProjectRequest($id, $project_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->updateProjectRequest($id, $project_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 200: + /* @phpstan-ignore-next-line */ + if ('\Pipedrive\versions\v2\Model\PostPatchGetProject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetProject', []), + $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\v2\Model\PostPatchGetProject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\PostPatchGetProject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\PostPatchGetProject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateProjectAsync + * + * Update a project + * + * @param int $id The ID of the project (required) + * @param \Pipedrive\versions\v2\Model\ProjectRequestBody|null $project_request_body (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function updateProjectAsync($id, $project_request_body = null): PromiseInterface + { + return $this->updateProjectAsyncWithHttpInfo($id, $project_request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateProjectAsyncWithHttpInfo + * + * Update a project + * + * @param int $id The ID of the project (required) + * @param \Pipedrive\versions\v2\Model\ProjectRequestBody|null $project_request_body (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function updateProjectAsyncWithHttpInfo($id, $project_request_body = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\PostPatchGetProject'; + $request = $this->updateProjectRequest($id, $project_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 'updateProject' + * + * @param int $id The ID of the project (required) + * @param \Pipedrive\versions\v2\Model\ProjectRequestBody|null $project_request_body (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function updateProjectRequest($id, $project_request_body = 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 updateProject' + ); + } + + $resourcePath = '/projects/{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($project_request_body)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($project_request_body)); + } else { + $httpBody = $project_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( + 'PATCH', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/versions/v2/Api/TasksApi.php b/lib/versions/v2/Api/TasksApi.php new file mode 100644 index 00000000..136ad445 --- /dev/null +++ b/lib/versions/v2/Api/TasksApi.php @@ -0,0 +1,1703 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation addTask + * + * Add a task + * + * @param \Pipedrive\versions\v2\Model\TaskPostRequest $task_post_request task_post_request (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\AddTaskResponse + */ + public function addTask($task_post_request) + { + list($response) = $this->addTaskWithHttpInfo($task_post_request); + return $response; + } + + /** + * Operation addTaskWithHttpInfo + * + * Add a task + * + * @param \Pipedrive\versions\v2\Model\TaskPostRequest $task_post_request (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\AddTaskResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function addTaskWithHttpInfo($task_post_request) + { + $request = $this->addTaskRequest($task_post_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->addTaskRequest($task_post_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\v2\Model\AddTaskResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddTaskResponse', []), + $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\v2\Model\AddTaskResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\AddTaskResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\AddTaskResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation addTaskAsync + * + * Add a task + * + * @param \Pipedrive\versions\v2\Model\TaskPostRequest $task_post_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addTaskAsync($task_post_request): PromiseInterface + { + return $this->addTaskAsyncWithHttpInfo($task_post_request) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addTaskAsyncWithHttpInfo + * + * Add a task + * + * @param \Pipedrive\versions\v2\Model\TaskPostRequest $task_post_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addTaskAsyncWithHttpInfo($task_post_request): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\AddTaskResponse'; + $request = $this->addTaskRequest($task_post_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 'addTask' + * + * @param \Pipedrive\versions\v2\Model\TaskPostRequest $task_post_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function addTaskRequest($task_post_request): Request + { + // verify the required parameter 'task_post_request' is set + /* @phpstan-ignore-next-line */ + if ($task_post_request === null || (is_array($task_post_request) && count($task_post_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $task_post_request when calling addTask' + ); + } + + $resourcePath = '/tasks'; + $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($task_post_request)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($task_post_request)); + } else { + $httpBody = $task_post_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 deleteTask + * + * Delete a task + * + * @param int $id The ID of the task (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\DeleteTaskResponse + */ + public function deleteTask($id) + { + list($response) = $this->deleteTaskWithHttpInfo($id); + return $response; + } + + /** + * Operation deleteTaskWithHttpInfo + * + * Delete a task + * + * @param int $id The ID of the task (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\DeleteTaskResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteTaskWithHttpInfo($id) + { + $request = $this->deleteTaskRequest($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->deleteTaskRequest($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\v2\Model\DeleteTaskResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteTaskResponse', []), + $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\v2\Model\DeleteTaskResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteTaskResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\DeleteTaskResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteTaskAsync + * + * Delete a task + * + * @param int $id The ID of the task (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteTaskAsync($id): PromiseInterface + { + return $this->deleteTaskAsyncWithHttpInfo($id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteTaskAsyncWithHttpInfo + * + * Delete a task + * + * @param int $id The ID of the task (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteTaskAsyncWithHttpInfo($id): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\DeleteTaskResponse'; + $request = $this->deleteTaskRequest($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 'deleteTask' + * + * @param int $id The ID of the task (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function deleteTaskRequest($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 deleteTask' + ); + } + + $resourcePath = '/tasks/{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 getTask + * + * Get details of a task + * + * @param int $id The ID of the task (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\GetTaskResponse + */ + public function getTask($id) + { + list($response) = $this->getTaskWithHttpInfo($id); + return $response; + } + + /** + * Operation getTaskWithHttpInfo + * + * Get details of a task + * + * @param int $id The ID of the task (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\GetTaskResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getTaskWithHttpInfo($id) + { + $request = $this->getTaskRequest($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->getTaskRequest($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\v2\Model\GetTaskResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetTaskResponse', []), + $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\v2\Model\GetTaskResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetTaskResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetTaskResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getTaskAsync + * + * Get details of a task + * + * @param int $id The ID of the task (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getTaskAsync($id): PromiseInterface + { + return $this->getTaskAsyncWithHttpInfo($id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getTaskAsyncWithHttpInfo + * + * Get details of a task + * + * @param int $id The ID of the task (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getTaskAsyncWithHttpInfo($id): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetTaskResponse'; + $request = $this->getTaskRequest($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 'getTask' + * + * @param int $id The ID of the task (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function getTaskRequest($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 getTask' + ); + } + + $resourcePath = '/tasks/{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 getTasks + * + * Get all tasks + * + * @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 bool|null $is_done Whether the task is done or not. If omitted, both done and not done tasks are returned. (optional) + * @param bool|null $is_milestone Whether the task is a milestone or not. If omitted, both milestone and non-milestone tasks are returned. (optional) + * @param int|null $assignee_id If supplied, only tasks assigned to this user are returned (optional) + * @param int|null $project_id If supplied, only tasks belonging to this project are returned (optional) + * @param string|null $parent_task_id If `null` is supplied, only root-level tasks (without a parent) are returned. If an integer is supplied, only subtasks of that specific task are returned. By default all tasks are returned. (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\GetTasksResponse + */ + public function getTasks($cursor = null, $limit = null, $is_done = null, $is_milestone = null, $assignee_id = null, $project_id = null, $parent_task_id = null) + { + list($response) = $this->getTasksWithHttpInfo($cursor, $limit, $is_done, $is_milestone, $assignee_id, $project_id, $parent_task_id); + return $response; + } + + /** + * Operation getTasksWithHttpInfo + * + * Get all tasks + * + * @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 bool|null $is_done Whether the task is done or not. If omitted, both done and not done tasks are returned. (optional) + * @param bool|null $is_milestone Whether the task is a milestone or not. If omitted, both milestone and non-milestone tasks are returned. (optional) + * @param int|null $assignee_id If supplied, only tasks assigned to this user are returned (optional) + * @param int|null $project_id If supplied, only tasks belonging to this project are returned (optional) + * @param string|null $parent_task_id If `null` is supplied, only root-level tasks (without a parent) are returned. If an integer is supplied, only subtasks of that specific task are returned. By default all tasks are returned. (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\GetTasksResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getTasksWithHttpInfo($cursor = null, $limit = null, $is_done = null, $is_milestone = null, $assignee_id = null, $project_id = null, $parent_task_id = null) + { + $request = $this->getTasksRequest($cursor, $limit, $is_done, $is_milestone, $assignee_id, $project_id, $parent_task_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->getTasksRequest($cursor, $limit, $is_done, $is_milestone, $assignee_id, $project_id, $parent_task_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\v2\Model\GetTasksResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetTasksResponse', []), + $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\v2\Model\GetTasksResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetTasksResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetTasksResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getTasksAsync + * + * Get all tasks + * + * @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 bool|null $is_done Whether the task is done or not. If omitted, both done and not done tasks are returned. (optional) + * @param bool|null $is_milestone Whether the task is a milestone or not. If omitted, both milestone and non-milestone tasks are returned. (optional) + * @param int|null $assignee_id If supplied, only tasks assigned to this user are returned (optional) + * @param int|null $project_id If supplied, only tasks belonging to this project are returned (optional) + * @param string|null $parent_task_id If `null` is supplied, only root-level tasks (without a parent) are returned. If an integer is supplied, only subtasks of that specific task are returned. By default all tasks are returned. (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getTasksAsync($cursor = null, $limit = null, $is_done = null, $is_milestone = null, $assignee_id = null, $project_id = null, $parent_task_id = null): PromiseInterface + { + return $this->getTasksAsyncWithHttpInfo($cursor, $limit, $is_done, $is_milestone, $assignee_id, $project_id, $parent_task_id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getTasksAsyncWithHttpInfo + * + * Get all tasks + * + * @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 bool|null $is_done Whether the task is done or not. If omitted, both done and not done tasks are returned. (optional) + * @param bool|null $is_milestone Whether the task is a milestone or not. If omitted, both milestone and non-milestone tasks are returned. (optional) + * @param int|null $assignee_id If supplied, only tasks assigned to this user are returned (optional) + * @param int|null $project_id If supplied, only tasks belonging to this project are returned (optional) + * @param string|null $parent_task_id If `null` is supplied, only root-level tasks (without a parent) are returned. If an integer is supplied, only subtasks of that specific task are returned. By default all tasks are returned. (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getTasksAsyncWithHttpInfo($cursor = null, $limit = null, $is_done = null, $is_milestone = null, $assignee_id = null, $project_id = null, $parent_task_id = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetTasksResponse'; + $request = $this->getTasksRequest($cursor, $limit, $is_done, $is_milestone, $assignee_id, $project_id, $parent_task_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 'getTasks' + * + * @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 bool|null $is_done Whether the task is done or not. If omitted, both done and not done tasks are returned. (optional) + * @param bool|null $is_milestone Whether the task is a milestone or not. If omitted, both milestone and non-milestone tasks are returned. (optional) + * @param int|null $assignee_id If supplied, only tasks assigned to this user are returned (optional) + * @param int|null $project_id If supplied, only tasks belonging to this project are returned (optional) + * @param string|null $parent_task_id If `null` is supplied, only root-level tasks (without a parent) are returned. If an integer is supplied, only subtasks of that specific task are returned. By default all tasks are returned. (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function getTasksRequest($cursor = null, $limit = null, $is_done = null, $is_milestone = null, $assignee_id = null, $project_id = null, $parent_task_id = null): Request + { + + $resourcePath = '/tasks'; + $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($is_done)) { + $is_done = ObjectSerializer::serializeCollection($is_done, '', true); + } + if ($is_done !== null) { + $queryParams['is_done'] = $is_done; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($is_milestone)) { + $is_milestone = ObjectSerializer::serializeCollection($is_milestone, '', true); + } + if ($is_milestone !== null) { + $queryParams['is_milestone'] = $is_milestone; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($assignee_id)) { + $assignee_id = ObjectSerializer::serializeCollection($assignee_id, '', true); + } + if ($assignee_id !== null) { + $queryParams['assignee_id'] = $assignee_id; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($project_id)) { + $project_id = ObjectSerializer::serializeCollection($project_id, '', true); + } + if ($project_id !== null) { + $queryParams['project_id'] = $project_id; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($parent_task_id)) { + $parent_task_id = ObjectSerializer::serializeCollection($parent_task_id, '', true); + } + if ($parent_task_id !== null) { + $queryParams['parent_task_id'] = $parent_task_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 updateTask + * + * Update a task + * + * @param int $id The ID of the task (required) + * @param \Pipedrive\versions\v2\Model\TaskPatchRequest|null $task_patch_request task_patch_request (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\UpdateTaskResponse + */ + public function updateTask($id, $task_patch_request = null) + { + list($response) = $this->updateTaskWithHttpInfo($id, $task_patch_request); + return $response; + } + + /** + * Operation updateTaskWithHttpInfo + * + * Update a task + * + * @param int $id The ID of the task (required) + * @param \Pipedrive\versions\v2\Model\TaskPatchRequest|null $task_patch_request (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\UpdateTaskResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function updateTaskWithHttpInfo($id, $task_patch_request = null) + { + $request = $this->updateTaskRequest($id, $task_patch_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->updateTaskRequest($id, $task_patch_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\v2\Model\UpdateTaskResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\UpdateTaskResponse', []), + $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\v2\Model\UpdateTaskResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\UpdateTaskResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\UpdateTaskResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateTaskAsync + * + * Update a task + * + * @param int $id The ID of the task (required) + * @param \Pipedrive\versions\v2\Model\TaskPatchRequest|null $task_patch_request (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function updateTaskAsync($id, $task_patch_request = null): PromiseInterface + { + return $this->updateTaskAsyncWithHttpInfo($id, $task_patch_request) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateTaskAsyncWithHttpInfo + * + * Update a task + * + * @param int $id The ID of the task (required) + * @param \Pipedrive\versions\v2\Model\TaskPatchRequest|null $task_patch_request (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function updateTaskAsyncWithHttpInfo($id, $task_patch_request = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\UpdateTaskResponse'; + $request = $this->updateTaskRequest($id, $task_patch_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 'updateTask' + * + * @param int $id The ID of the task (required) + * @param \Pipedrive\versions\v2\Model\TaskPatchRequest|null $task_patch_request (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function updateTaskRequest($id, $task_patch_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 updateTask' + ); + } + + $resourcePath = '/tasks/{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($task_patch_request)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($task_patch_request)); + } else { + $httpBody = $task_patch_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( + 'PATCH', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/versions/v2/Model/AddProductRequestBody.php b/lib/versions/v2/Model/AddProductRequestBody.php index 810e09d7..2457b8cd 100644 --- a/lib/versions/v2/Model/AddProductRequestBody.php +++ b/lib/versions/v2/Model/AddProductRequestBody.php @@ -553,7 +553,7 @@ public function getCustomFields() /** * Sets custom_fields * - * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes + * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. * * @return self */ diff --git a/lib/versions/v2/Model/AddTaskResponse.php b/lib/versions/v2/Model/AddTaskResponse.php new file mode 100644 index 00000000..bad7b523 --- /dev/null +++ b/lib/versions/v2/Model/AddTaskResponse.php @@ -0,0 +1,405 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class AddTaskResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'AddTaskResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'success' => 'bool', + 'data' => '\Pipedrive\versions\v2\Model\TaskItem', + 'additional_data' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success' => null, + 'data' => null, + 'additional_data' => 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 = [ + 'success' => 'success', + 'data' => 'data', + 'additional_data' => 'additional_data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'data' => 'setData', + 'additional_data' => 'setAdditionalData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'data' => 'getData', + 'additional_data' => 'getAdditionalData' + ]; + + /** + * 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['success'] = $data['success'] ?? null; + $this->container['data'] = $data['data'] ?? null; + $this->container['additional_data'] = $data['additional_data'] ?? 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 success + * + * @return bool|null + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool|null $success If the response is successful or not + * + * @return self + */ + public function setSuccess($success): self + { + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets data + * + * @return \Pipedrive\versions\v2\Model\TaskItem|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\TaskItem|null $data data + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets additional_data + * + * @return object|null + */ + public function getAdditionalData() + { + return $this->container['additional_data']; + } + + /** + * Sets additional_data + * + * @param object|null $additional_data additional_data + * + * @return self + */ + public function setAdditionalData($additional_data): self + { + $this->container['additional_data'] = $additional_data; + + 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/v2/Model/BaseProduct.php b/lib/versions/v2/Model/BaseProduct.php index 36306da6..e2b34055 100644 --- a/lib/versions/v2/Model/BaseProduct.php +++ b/lib/versions/v2/Model/BaseProduct.php @@ -523,7 +523,7 @@ public function getCustomFields() /** * Sets custom_fields * - * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes + * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. * * @return self */ diff --git a/lib/versions/v2/Model/BaseProductAllOf.php b/lib/versions/v2/Model/BaseProductAllOf.php index cb1cc119..97dfcacc 100644 --- a/lib/versions/v2/Model/BaseProductAllOf.php +++ b/lib/versions/v2/Model/BaseProductAllOf.php @@ -511,7 +511,7 @@ public function getCustomFields() /** * Sets custom_fields * - * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes + * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. * * @return self */ diff --git a/lib/versions/v2/Model/BoardItem.php b/lib/versions/v2/Model/BoardItem.php new file mode 100644 index 00000000..6696b154 --- /dev/null +++ b/lib/versions/v2/Model/BoardItem.php @@ -0,0 +1,465 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class BoardItem implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'BoardItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'id' => 'int', + 'name' => 'string', + 'order_nr' => 'int', + 'add_time' => 'string', + 'update_time' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'order_nr' => null, + 'add_time' => null, + 'update_time' => 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', + 'name' => 'name', + 'order_nr' => 'order_nr', + 'add_time' => 'add_time', + 'update_time' => 'update_time' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'order_nr' => 'setOrderNr', + 'add_time' => 'setAddTime', + 'update_time' => 'setUpdateTime' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'order_nr' => 'getOrderNr', + 'add_time' => 'getAddTime', + 'update_time' => 'getUpdateTime' + ]; + + /** + * 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; + $this->container['name'] = $data['name'] ?? null; + $this->container['order_nr'] = $data['order_nr'] ?? null; + $this->container['add_time'] = $data['add_time'] ?? null; + $this->container['update_time'] = $data['update_time'] ?? 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 project board + * + * @return self + */ + public function setId($id): self + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The name of the project board + * + * @return self + */ + public function setName($name): self + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets order_nr + * + * @return int|null + */ + public function getOrderNr() + { + return $this->container['order_nr']; + } + + /** + * Sets order_nr + * + * @param int|null $order_nr The order of the board + * + * @return self + */ + public function setOrderNr($order_nr): self + { + $this->container['order_nr'] = $order_nr; + + 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 creation date and time of the board in ISO 8601 format + * + * @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 date and time of the board in ISO 8601 format + * + * @return self + */ + public function setUpdateTime($update_time): self + { + $this->container['update_time'] = $update_time; + + 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/v2/Model/BoardRequestBody.php b/lib/versions/v2/Model/BoardRequestBody.php new file mode 100644 index 00000000..25a24da2 --- /dev/null +++ b/lib/versions/v2/Model/BoardRequestBody.php @@ -0,0 +1,384 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class BoardRequestBody implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'BoardRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'name' => 'string', + 'order_nr' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'order_nr' => 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 = [ + 'name' => 'name', + 'order_nr' => 'order_nr' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'order_nr' => 'setOrderNr' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'order_nr' => 'getOrderNr' + ]; + + /** + * 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['name'] = $data['name'] ?? null; + $this->container['order_nr'] = $data['order_nr'] ?? 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 = []; + + if (!is_null($this->container['order_nr']) && ($this->container['order_nr'] < 1)) { + $invalidProperties[] = "invalid value for 'order_nr', must be bigger than or equal to 1."; + } + + 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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The name of the project board + * + * @return self + */ + public function setName($name): self + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets order_nr + * + * @return int|null + */ + public function getOrderNr() + { + return $this->container['order_nr']; + } + + /** + * Sets order_nr + * + * @param int|null $order_nr The order of the board. Must be between 1 and the total number of boards + 1. + * + * @return self + */ + public function setOrderNr($order_nr): self + { + + if (!is_null($order_nr) && ($order_nr < 1)) { + throw new \InvalidArgumentException('invalid value for $order_nr when calling BoardRequestBody., must be bigger than or equal to 1.'); + } + + $this->container['order_nr'] = $order_nr; + + 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/v2/Model/CreateProjectField.php b/lib/versions/v2/Model/CreateProjectField.php new file mode 100644 index 00000000..218fcdad --- /dev/null +++ b/lib/versions/v2/Model/CreateProjectField.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class CreateProjectField implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'CreateProjectField'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'success' => 'bool', + 'data' => '\Pipedrive\versions\v2\Model\ProjectFieldItem' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success' => null, + 'data' => 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 = [ + 'success' => 'success', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'data' => 'getData' + ]; + + /** + * 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['success'] = $data['success'] ?? null; + $this->container['data'] = $data['data'] ?? 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 success + * + * @return bool|null + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool|null $success Whether the request was successful + * + * @return self + */ + public function setSuccess($success): self + { + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets data + * + * @return \Pipedrive\versions\v2\Model\ProjectFieldItem|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\ProjectFieldItem|null $data data + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + 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/v2/Model/CreateProjectFieldRequest.php b/lib/versions/v2/Model/CreateProjectFieldRequest.php new file mode 100644 index 00000000..a144cbd8 --- /dev/null +++ b/lib/versions/v2/Model/CreateProjectFieldRequest.php @@ -0,0 +1,580 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class CreateProjectFieldRequest implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'CreateProjectFieldRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'field_name' => 'string', + 'field_type' => 'string', + 'options' => '\Pipedrive\versions\v2\Model\CreateDealFieldRequestOptions[]', + 'ui_visibility' => 'array', + 'important_fields' => 'array', + 'required_fields' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'field_name' => null, + 'field_type' => null, + 'options' => null, + 'ui_visibility' => null, + 'important_fields' => null, + 'required_fields' => 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 = [ + 'field_name' => 'field_name', + 'field_type' => 'field_type', + 'options' => 'options', + 'ui_visibility' => 'ui_visibility', + 'important_fields' => 'important_fields', + 'required_fields' => 'required_fields' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'field_name' => 'setFieldName', + 'field_type' => 'setFieldType', + 'options' => 'setOptions', + 'ui_visibility' => 'setUiVisibility', + 'important_fields' => 'setImportantFields', + 'required_fields' => 'setRequiredFields' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'field_name' => 'getFieldName', + 'field_type' => 'getFieldType', + 'options' => 'getOptions', + 'ui_visibility' => 'getUiVisibility', + 'important_fields' => 'getImportantFields', + 'required_fields' => 'getRequiredFields' + ]; + + /** + * 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; + } + + const FIELD_TYPE_VARCHAR = 'varchar'; + const FIELD_TYPE_TEXT = 'text'; + const FIELD_TYPE_DOUBLE = 'double'; + const FIELD_TYPE_PHONE = 'phone'; + const FIELD_TYPE_DATE = 'date'; + const FIELD_TYPE_DATERANGE = 'daterange'; + const FIELD_TYPE_TIME = 'time'; + const FIELD_TYPE_TIMERANGE = 'timerange'; + const FIELD_TYPE_SET = 'set'; + const FIELD_TYPE_ENUM = 'enum'; + const FIELD_TYPE_VARCHAR_AUTO = 'varchar_auto'; + const FIELD_TYPE_ADDRESS = 'address'; + const FIELD_TYPE_MONETARY = 'monetary'; + const FIELD_TYPE_ORG = 'org'; + const FIELD_TYPE_PEOPLE = 'people'; + const FIELD_TYPE_USER = 'user'; + + /** + * Gets allowable values of the enum + * + * @phpstan-return array + * @phpsalm-return array + * @return (string|int)[] + */ + public function getFieldTypeAllowableValues(): array + { + return [ + self::FIELD_TYPE_VARCHAR, + self::FIELD_TYPE_TEXT, + self::FIELD_TYPE_DOUBLE, + self::FIELD_TYPE_PHONE, + self::FIELD_TYPE_DATE, + self::FIELD_TYPE_DATERANGE, + self::FIELD_TYPE_TIME, + self::FIELD_TYPE_TIMERANGE, + self::FIELD_TYPE_SET, + self::FIELD_TYPE_ENUM, + self::FIELD_TYPE_VARCHAR_AUTO, + self::FIELD_TYPE_ADDRESS, + self::FIELD_TYPE_MONETARY, + self::FIELD_TYPE_ORG, + self::FIELD_TYPE_PEOPLE, + self::FIELD_TYPE_USER, + ]; + } + + /** + * 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['field_name'] = $data['field_name'] ?? null; + $this->container['field_type'] = $data['field_type'] ?? null; + $this->container['options'] = $data['options'] ?? null; + $this->container['ui_visibility'] = $data['ui_visibility'] ?? null; + $this->container['important_fields'] = $data['important_fields'] ?? null; + $this->container['required_fields'] = $data['required_fields'] ?? 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 = []; + + if ($this->container['field_name'] === null) { + $invalidProperties[] = "'field_name' can't be null"; + } + if ((mb_strlen($this->container['field_name']) > 255)) { + $invalidProperties[] = "invalid value for 'field_name', the character length must be smaller than or equal to 255."; + } + + if ((mb_strlen($this->container['field_name']) < 1)) { + $invalidProperties[] = "invalid value for 'field_name', the character length must be bigger than or equal to 1."; + } + + if ($this->container['field_type'] === null) { + $invalidProperties[] = "'field_type' can't be null"; + } + $allowedValues = $this->getFieldTypeAllowableValues(); + if (!is_null($this->container['field_type']) && !in_array($this->container['field_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'field_type', must be one of '%s'", + $this->container['field_type'], + implode("', '", $allowedValues) + ); + } + + 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 field_name + * + * @return string + */ + public function getFieldName() + { + return $this->container['field_name']; + } + + /** + * Sets field_name + * + * @param string $field_name Field name + * + * @return self + */ + public function setFieldName($field_name): self + { + if ((mb_strlen($field_name) > 255)) { + throw new \InvalidArgumentException('invalid length for $field_name when calling CreateProjectFieldRequest., must be smaller than or equal to 255.'); + } + if ((mb_strlen($field_name) < 1)) { + throw new \InvalidArgumentException('invalid length for $field_name when calling CreateProjectFieldRequest., must be bigger than or equal to 1.'); + } + + $this->container['field_name'] = $field_name; + + return $this; + } + + /** + * Gets field_type + * + * @return string + */ + public function getFieldType() + { + return $this->container['field_type']; + } + + /** + * Sets field_type + * + * @param string $field_type The type of the field
ValueDescription
`varchar`Text (up to 255 characters)
`varchar_auto`Autocomplete text (up to 255 characters)
`text`Long text (up to 65k characters)
`double`Numeric value
`monetary`Monetary field (has a numeric value and a currency value)
`date`Date (format YYYY-MM-DD)
`set`Options field with a possibility of having multiple chosen options
`enum`Options field with a single possible chosen option
`user`User field (contains a user ID of another Pipedrive user)
`org`Organization field (contains an organization ID which is stored on the same account)
`people`Person field (contains a person ID which is stored on the same account)
`phone`Phone field (up to 255 numbers and/or characters)
`time`Time field (format HH:MM:SS)
`timerange`Time-range field (has a start time and end time value, both HH:MM:SS)
`daterange`Date-range field (has a start date and end date value, both YYYY-MM-DD)
`address`Address field
+ * + * @return self + */ + public function setFieldType($field_type): self + { + $allowedValues = $this->getFieldTypeAllowableValues(); + if (!in_array($field_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'field_type', must be one of '%s'", + $field_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['field_type'] = $field_type; + + return $this; + } + + /** + * Gets options + * + * @return \Pipedrive\versions\v2\Model\CreateDealFieldRequestOptions[]|null + */ + public function getOptions() + { + return $this->container['options']; + } + + /** + * Sets options + * + * @param \Pipedrive\versions\v2\Model\CreateDealFieldRequestOptions[]|null $options Field options (required for enum and set field types) + * + * @return self + */ + public function setOptions($options): self + { + $this->container['options'] = $options; + + return $this; + } + + /** + * Gets ui_visibility + * + * @return array|null + */ + public function getUiVisibility() + { + return $this->container['ui_visibility']; + } + + /** + * Sets ui_visibility + * + * @param array|null $ui_visibility UI visibility settings for the field. Controls where the field appears in the Pipedrive web UI. + * + * @return self + */ + public function setUiVisibility($ui_visibility): self + { + $this->container['ui_visibility'] = $ui_visibility; + + return $this; + } + + /** + * Gets important_fields + * + * @return array|null + */ + public function getImportantFields() + { + return $this->container['important_fields']; + } + + /** + * Sets important_fields + * + * @param array|null $important_fields Configuration for highlighting the field at specific stages. + * + * @return self + */ + public function setImportantFields($important_fields): self + { + $this->container['important_fields'] = $important_fields; + + return $this; + } + + /** + * Gets required_fields + * + * @return array|null + */ + public function getRequiredFields() + { + return $this->container['required_fields']; + } + + /** + * Sets required_fields + * + * @param array|null $required_fields Required fields configuration for marking the field as mandatory when interacted with in the Pipedrive web UI. + * + * @return self + */ + public function setRequiredFields($required_fields): self + { + $this->container['required_fields'] = $required_fields; + + 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/v2/Model/Deal.php b/lib/versions/v2/Model/Deal.php index 77aeb405..afeb31fd 100644 --- a/lib/versions/v2/Model/Deal.php +++ b/lib/versions/v2/Model/Deal.php @@ -1171,7 +1171,7 @@ public function getCustomFields() /** * Sets custom_fields * - * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes + * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. * * @return self */ diff --git a/lib/versions/v2/Model/DealItem.php b/lib/versions/v2/Model/DealItem.php index 75c87307..9716babf 100644 --- a/lib/versions/v2/Model/DealItem.php +++ b/lib/versions/v2/Model/DealItem.php @@ -1171,7 +1171,7 @@ public function getCustomFields() /** * Sets custom_fields * - * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes + * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. * * @return self */ diff --git a/lib/versions/v2/Model/DealRequestBody.php b/lib/versions/v2/Model/DealRequestBody.php index a9bdec2f..aca07fa3 100644 --- a/lib/versions/v2/Model/DealRequestBody.php +++ b/lib/versions/v2/Model/DealRequestBody.php @@ -841,7 +841,7 @@ public function getCustomFields() /** * Sets custom_fields * - * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes + * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. * * @return self */ diff --git a/lib/versions/v2/Model/DeleteProjectBoardResponse.php b/lib/versions/v2/Model/DeleteProjectBoardResponse.php new file mode 100644 index 00000000..b4c1b28c --- /dev/null +++ b/lib/versions/v2/Model/DeleteProjectBoardResponse.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DeleteProjectBoardResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'DeleteProjectBoardResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'success' => 'bool', + 'data' => '\Pipedrive\versions\v2\Model\DeleteProjectBoardResponseData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success' => null, + 'data' => 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 = [ + 'success' => 'success', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'data' => 'getData' + ]; + + /** + * 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['success'] = $data['success'] ?? null; + $this->container['data'] = $data['data'] ?? 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 success + * + * @return bool|null + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool|null $success If the response is successful or not + * + * @return self + */ + public function setSuccess($success): self + { + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets data + * + * @return \Pipedrive\versions\v2\Model\DeleteProjectBoardResponseData|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\DeleteProjectBoardResponseData|null $data data + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + 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/v2/Model/DeleteProjectBoardResponseData.php b/lib/versions/v2/Model/DeleteProjectBoardResponseData.php new file mode 100644 index 00000000..496ba4ba --- /dev/null +++ b/lib/versions/v2/Model/DeleteProjectBoardResponseData.php @@ -0,0 +1,345 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DeleteProjectBoardResponseData implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'DeleteProjectBoardResponse_data'; + + /** + * 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 deleted project board + * + * @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/v2/Model/DeleteProjectField.php b/lib/versions/v2/Model/DeleteProjectField.php new file mode 100644 index 00000000..05f6d1d2 --- /dev/null +++ b/lib/versions/v2/Model/DeleteProjectField.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DeleteProjectField implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'DeleteProjectField'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'success' => 'bool', + 'data' => '\Pipedrive\versions\v2\Model\DeleteProjectFieldData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success' => null, + 'data' => 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 = [ + 'success' => 'success', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'data' => 'getData' + ]; + + /** + * 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['success'] = $data['success'] ?? null; + $this->container['data'] = $data['data'] ?? 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 success + * + * @return bool|null + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool|null $success Whether the request was successful + * + * @return self + */ + public function setSuccess($success): self + { + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets data + * + * @return \Pipedrive\versions\v2\Model\DeleteProjectFieldData|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\DeleteProjectFieldData|null $data data + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + 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/v2/Model/DeleteProjectFieldData.php b/lib/versions/v2/Model/DeleteProjectFieldData.php new file mode 100644 index 00000000..e7e91fef --- /dev/null +++ b/lib/versions/v2/Model/DeleteProjectFieldData.php @@ -0,0 +1,540 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DeleteProjectFieldData implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'DeleteProjectField_data'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'field_name' => 'string', + 'field_code' => 'string', + 'field_type' => 'string', + 'options' => 'object[]', + 'subfields' => 'object[]', + 'is_custom_field' => 'bool', + 'is_optional_response_field' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'field_name' => null, + 'field_code' => null, + 'field_type' => null, + 'options' => null, + 'subfields' => null, + 'is_custom_field' => null, + 'is_optional_response_field' => 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 = [ + 'field_name' => 'field_name', + 'field_code' => 'field_code', + 'field_type' => 'field_type', + 'options' => 'options', + 'subfields' => 'subfields', + 'is_custom_field' => 'is_custom_field', + 'is_optional_response_field' => 'is_optional_response_field' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'field_name' => 'setFieldName', + 'field_code' => 'setFieldCode', + 'field_type' => 'setFieldType', + 'options' => 'setOptions', + 'subfields' => 'setSubfields', + 'is_custom_field' => 'setIsCustomField', + 'is_optional_response_field' => 'setIsOptionalResponseField' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'field_name' => 'getFieldName', + 'field_code' => 'getFieldCode', + 'field_type' => 'getFieldType', + 'options' => 'getOptions', + 'subfields' => 'getSubfields', + 'is_custom_field' => 'getIsCustomField', + 'is_optional_response_field' => 'getIsOptionalResponseField' + ]; + + /** + * 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['field_name'] = $data['field_name'] ?? null; + $this->container['field_code'] = $data['field_code'] ?? null; + $this->container['field_type'] = $data['field_type'] ?? null; + $this->container['options'] = $data['options'] ?? null; + $this->container['subfields'] = $data['subfields'] ?? null; + $this->container['is_custom_field'] = $data['is_custom_field'] ?? null; + $this->container['is_optional_response_field'] = $data['is_optional_response_field'] ?? 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 = []; + + if ($this->container['field_name'] === null) { + $invalidProperties[] = "'field_name' can't be null"; + } + if ($this->container['field_code'] === null) { + $invalidProperties[] = "'field_code' can't be null"; + } + if ($this->container['field_type'] === null) { + $invalidProperties[] = "'field_type' can't be null"; + } + if ($this->container['is_custom_field'] === null) { + $invalidProperties[] = "'is_custom_field' can't be null"; + } + if ($this->container['is_optional_response_field'] === null) { + $invalidProperties[] = "'is_optional_response_field' can't be null"; + } + 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 field_name + * + * @return string + */ + public function getFieldName() + { + return $this->container['field_name']; + } + + /** + * Sets field_name + * + * @param string $field_name The display name/label of the field + * + * @return self + */ + public function setFieldName($field_name): self + { + $this->container['field_name'] = $field_name; + + return $this; + } + + /** + * Gets field_code + * + * @return string + */ + public function getFieldCode() + { + return $this->container['field_code']; + } + + /** + * Sets field_code + * + * @param string $field_code The unique identifier for the field (40-character hash for custom fields) + * + * @return self + */ + public function setFieldCode($field_code): self + { + $this->container['field_code'] = $field_code; + + return $this; + } + + /** + * Gets field_type + * + * @return string + */ + public function getFieldType() + { + return $this->container['field_type']; + } + + /** + * Sets field_type + * + * @param string $field_type The type of the field + * + * @return self + */ + public function setFieldType($field_type): self + { + $this->container['field_type'] = $field_type; + + return $this; + } + + /** + * Gets options + * + * @return object[]|null + */ + public function getOptions() + { + return $this->container['options']; + } + + /** + * Sets options + * + * @param object[]|null $options Array of available options for enum/set fields, null for other field types + * + * @return self + */ + public function setOptions($options): self + { + $this->container['options'] = $options; + + return $this; + } + + /** + * Gets subfields + * + * @return object[]|null + */ + public function getSubfields() + { + return $this->container['subfields']; + } + + /** + * Sets subfields + * + * @param object[]|null $subfields Array of subfields for complex field types, null for simple field types + * + * @return self + */ + public function setSubfields($subfields): self + { + $this->container['subfields'] = $subfields; + + return $this; + } + + /** + * Gets is_custom_field + * + * @return bool + */ + public function getIsCustomField() + { + return $this->container['is_custom_field']; + } + + /** + * Sets is_custom_field + * + * @param bool $is_custom_field Whether this is a user-created custom field + * + * @return self + */ + public function setIsCustomField($is_custom_field): self + { + $this->container['is_custom_field'] = $is_custom_field; + + return $this; + } + + /** + * Gets is_optional_response_field + * + * @return bool + */ + public function getIsOptionalResponseField() + { + return $this->container['is_optional_response_field']; + } + + /** + * Sets is_optional_response_field + * + * @param bool $is_optional_response_field Whether this field is not returned by default in entity responses + * + * @return self + */ + public function setIsOptionalResponseField($is_optional_response_field): self + { + $this->container['is_optional_response_field'] = $is_optional_response_field; + + 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/v2/Model/DeleteProjectPhaseResponse.php b/lib/versions/v2/Model/DeleteProjectPhaseResponse.php new file mode 100644 index 00000000..b11729a0 --- /dev/null +++ b/lib/versions/v2/Model/DeleteProjectPhaseResponse.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DeleteProjectPhaseResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'DeleteProjectPhaseResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'success' => 'bool', + 'data' => '\Pipedrive\versions\v2\Model\DeleteProjectPhaseResponseData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success' => null, + 'data' => 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 = [ + 'success' => 'success', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'data' => 'getData' + ]; + + /** + * 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['success'] = $data['success'] ?? null; + $this->container['data'] = $data['data'] ?? 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 success + * + * @return bool|null + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool|null $success If the response is successful or not + * + * @return self + */ + public function setSuccess($success): self + { + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets data + * + * @return \Pipedrive\versions\v2\Model\DeleteProjectPhaseResponseData|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\DeleteProjectPhaseResponseData|null $data data + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + 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/v2/Model/DeleteProjectPhaseResponseData.php b/lib/versions/v2/Model/DeleteProjectPhaseResponseData.php new file mode 100644 index 00000000..cf532e12 --- /dev/null +++ b/lib/versions/v2/Model/DeleteProjectPhaseResponseData.php @@ -0,0 +1,345 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DeleteProjectPhaseResponseData implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'DeleteProjectPhaseResponse_data'; + + /** + * 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 deleted project phase + * + * @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/v2/Model/DeleteProjectResponse.php b/lib/versions/v2/Model/DeleteProjectResponse.php new file mode 100644 index 00000000..ebbb8bb4 --- /dev/null +++ b/lib/versions/v2/Model/DeleteProjectResponse.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DeleteProjectResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'DeleteProjectResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'success' => 'bool', + 'data' => '\Pipedrive\versions\v2\Model\DeleteProjectResponseData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success' => null, + 'data' => 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 = [ + 'success' => 'success', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'data' => 'getData' + ]; + + /** + * 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['success'] = $data['success'] ?? null; + $this->container['data'] = $data['data'] ?? 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 success + * + * @return bool|null + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool|null $success If the response is successful or not + * + * @return self + */ + public function setSuccess($success): self + { + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets data + * + * @return \Pipedrive\versions\v2\Model\DeleteProjectResponseData|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\DeleteProjectResponseData|null $data data + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + 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/v2/Model/DeleteProjectResponseData.php b/lib/versions/v2/Model/DeleteProjectResponseData.php new file mode 100644 index 00000000..88a2a5fa --- /dev/null +++ b/lib/versions/v2/Model/DeleteProjectResponseData.php @@ -0,0 +1,345 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DeleteProjectResponseData implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'DeleteProjectResponse_data'; + + /** + * 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 deleted project + * + * @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/v2/Model/DeleteTaskResponse.php b/lib/versions/v2/Model/DeleteTaskResponse.php new file mode 100644 index 00000000..3fbf5a39 --- /dev/null +++ b/lib/versions/v2/Model/DeleteTaskResponse.php @@ -0,0 +1,405 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DeleteTaskResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'DeleteTaskResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'success' => 'bool', + 'data' => '\Pipedrive\versions\v2\Model\DeleteTaskResponseData', + 'additional_data' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success' => null, + 'data' => null, + 'additional_data' => 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 = [ + 'success' => 'success', + 'data' => 'data', + 'additional_data' => 'additional_data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'data' => 'setData', + 'additional_data' => 'setAdditionalData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'data' => 'getData', + 'additional_data' => 'getAdditionalData' + ]; + + /** + * 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['success'] = $data['success'] ?? null; + $this->container['data'] = $data['data'] ?? null; + $this->container['additional_data'] = $data['additional_data'] ?? 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 success + * + * @return bool|null + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool|null $success If the response is successful or not + * + * @return self + */ + public function setSuccess($success): self + { + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets data + * + * @return \Pipedrive\versions\v2\Model\DeleteTaskResponseData|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\DeleteTaskResponseData|null $data data + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets additional_data + * + * @return object|null + */ + public function getAdditionalData() + { + return $this->container['additional_data']; + } + + /** + * Sets additional_data + * + * @param object|null $additional_data additional_data + * + * @return self + */ + public function setAdditionalData($additional_data): self + { + $this->container['additional_data'] = $additional_data; + + 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/v2/Model/DeleteTaskResponseData.php b/lib/versions/v2/Model/DeleteTaskResponseData.php new file mode 100644 index 00000000..d28d7e1b --- /dev/null +++ b/lib/versions/v2/Model/DeleteTaskResponseData.php @@ -0,0 +1,345 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DeleteTaskResponseData implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'DeleteTaskResponse_data'; + + /** + * 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 deleted task + * + * @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/v2/Model/GetBoards.php b/lib/versions/v2/Model/GetBoards.php new file mode 100644 index 00000000..ac2e6396 --- /dev/null +++ b/lib/versions/v2/Model/GetBoards.php @@ -0,0 +1,405 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetBoards implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'GetBoards'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'success' => 'bool', + 'data' => '\Pipedrive\versions\v2\Model\BoardItem[]', + 'additional_data' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success' => null, + 'data' => null, + 'additional_data' => 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 = [ + 'success' => 'success', + 'data' => 'data', + 'additional_data' => 'additional_data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'data' => 'setData', + 'additional_data' => 'setAdditionalData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'data' => 'getData', + 'additional_data' => 'getAdditionalData' + ]; + + /** + * 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['success'] = $data['success'] ?? null; + $this->container['data'] = $data['data'] ?? null; + $this->container['additional_data'] = $data['additional_data'] ?? 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 success + * + * @return bool|null + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool|null $success If the response is successful or not + * + * @return self + */ + public function setSuccess($success): self + { + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets data + * + * @return \Pipedrive\versions\v2\Model\BoardItem[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\BoardItem[]|null $data The array of project boards + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets additional_data + * + * @return object|null + */ + public function getAdditionalData() + { + return $this->container['additional_data']; + } + + /** + * Sets additional_data + * + * @param object|null $additional_data additional_data + * + * @return self + */ + public function setAdditionalData($additional_data): self + { + $this->container['additional_data'] = $additional_data; + + 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/v2/Model/GetPhases.php b/lib/versions/v2/Model/GetPhases.php new file mode 100644 index 00000000..e52e5a7d --- /dev/null +++ b/lib/versions/v2/Model/GetPhases.php @@ -0,0 +1,405 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetPhases implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'GetPhases'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'success' => 'bool', + 'data' => '\Pipedrive\versions\v2\Model\PhaseItem[]', + 'additional_data' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success' => null, + 'data' => null, + 'additional_data' => 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 = [ + 'success' => 'success', + 'data' => 'data', + 'additional_data' => 'additional_data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'data' => 'setData', + 'additional_data' => 'setAdditionalData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'data' => 'getData', + 'additional_data' => 'getAdditionalData' + ]; + + /** + * 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['success'] = $data['success'] ?? null; + $this->container['data'] = $data['data'] ?? null; + $this->container['additional_data'] = $data['additional_data'] ?? 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 success + * + * @return bool|null + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool|null $success If the response is successful or not + * + * @return self + */ + public function setSuccess($success): self + { + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets data + * + * @return \Pipedrive\versions\v2\Model\PhaseItem[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\PhaseItem[]|null $data The array of project phases + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets additional_data + * + * @return object|null + */ + public function getAdditionalData() + { + return $this->container['additional_data']; + } + + /** + * Sets additional_data + * + * @param object|null $additional_data additional_data + * + * @return self + */ + public function setAdditionalData($additional_data): self + { + $this->container['additional_data'] = $additional_data; + + 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/v2/Model/GetProjectField.php b/lib/versions/v2/Model/GetProjectField.php new file mode 100644 index 00000000..245b8819 --- /dev/null +++ b/lib/versions/v2/Model/GetProjectField.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetProjectField implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'GetProjectField'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'success' => 'bool', + 'data' => '\Pipedrive\versions\v2\Model\ProjectFieldItem' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success' => null, + 'data' => 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 = [ + 'success' => 'success', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'data' => 'getData' + ]; + + /** + * 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['success'] = $data['success'] ?? null; + $this->container['data'] = $data['data'] ?? 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 success + * + * @return bool|null + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool|null $success Whether the request was successful + * + * @return self + */ + public function setSuccess($success): self + { + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets data + * + * @return \Pipedrive\versions\v2\Model\ProjectFieldItem|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\ProjectFieldItem|null $data data + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + 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/v2/Model/GetProjectFields.php b/lib/versions/v2/Model/GetProjectFields.php new file mode 100644 index 00000000..2b21caec --- /dev/null +++ b/lib/versions/v2/Model/GetProjectFields.php @@ -0,0 +1,405 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetProjectFields implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'GetProjectFields'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'success' => 'bool', + 'data' => '\Pipedrive\versions\v2\Model\ProjectFieldItem[]', + 'additional_data' => '\Pipedrive\versions\v2\Model\GetActivityFieldsAdditionalData' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success' => null, + 'data' => null, + 'additional_data' => 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 = [ + 'success' => 'success', + 'data' => 'data', + 'additional_data' => 'additional_data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'data' => 'setData', + 'additional_data' => 'setAdditionalData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'data' => 'getData', + 'additional_data' => 'getAdditionalData' + ]; + + /** + * 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['success'] = $data['success'] ?? null; + $this->container['data'] = $data['data'] ?? null; + $this->container['additional_data'] = $data['additional_data'] ?? 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 success + * + * @return bool|null + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool|null $success Whether the request was successful + * + * @return self + */ + public function setSuccess($success): self + { + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets data + * + * @return \Pipedrive\versions\v2\Model\ProjectFieldItem[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\ProjectFieldItem[]|null $data data + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets additional_data + * + * @return \Pipedrive\versions\v2\Model\GetActivityFieldsAdditionalData|null + */ + public function getAdditionalData() + { + return $this->container['additional_data']; + } + + /** + * Sets additional_data + * + * @param \Pipedrive\versions\v2\Model\GetActivityFieldsAdditionalData|null $additional_data additional_data + * + * @return self + */ + public function setAdditionalData($additional_data): self + { + $this->container['additional_data'] = $additional_data; + + 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/v2/Model/GetProjectPermittedUsersResponse.php b/lib/versions/v2/Model/GetProjectPermittedUsersResponse.php new file mode 100644 index 00000000..0fe566fd --- /dev/null +++ b/lib/versions/v2/Model/GetProjectPermittedUsersResponse.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetProjectPermittedUsersResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'GetProjectPermittedUsersResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'success' => 'bool', + 'data' => 'int[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success' => null, + 'data' => 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 = [ + 'success' => 'success', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'data' => 'getData' + ]; + + /** + * 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['success'] = $data['success'] ?? null; + $this->container['data'] = $data['data'] ?? 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 success + * + * @return bool|null + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool|null $success If the response is successful or not + * + * @return self + */ + public function setSuccess($success): self + { + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets data + * + * @return int[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param int[]|null $data The list of permitted user IDs + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + 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/v2/Model/GetProjectTemplateResponse.php b/lib/versions/v2/Model/GetProjectTemplateResponse.php new file mode 100644 index 00000000..5e7c23fd --- /dev/null +++ b/lib/versions/v2/Model/GetProjectTemplateResponse.php @@ -0,0 +1,405 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetProjectTemplateResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'GetProjectTemplateResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'success' => 'bool', + 'data' => '\Pipedrive\versions\v2\Model\ProjectTemplateItem', + 'additional_data' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success' => null, + 'data' => null, + 'additional_data' => 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 = [ + 'success' => 'success', + 'data' => 'data', + 'additional_data' => 'additional_data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'data' => 'setData', + 'additional_data' => 'setAdditionalData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'data' => 'getData', + 'additional_data' => 'getAdditionalData' + ]; + + /** + * 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['success'] = $data['success'] ?? null; + $this->container['data'] = $data['data'] ?? null; + $this->container['additional_data'] = $data['additional_data'] ?? 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 success + * + * @return bool|null + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool|null $success If the response is successful or not + * + * @return self + */ + public function setSuccess($success): self + { + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets data + * + * @return \Pipedrive\versions\v2\Model\ProjectTemplateItem|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\ProjectTemplateItem|null $data data + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets additional_data + * + * @return object|null + */ + public function getAdditionalData() + { + return $this->container['additional_data']; + } + + /** + * Sets additional_data + * + * @param object|null $additional_data additional_data + * + * @return self + */ + public function setAdditionalData($additional_data): self + { + $this->container['additional_data'] = $additional_data; + + 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/v2/Model/GetProjectTemplatesResponse.php b/lib/versions/v2/Model/GetProjectTemplatesResponse.php new file mode 100644 index 00000000..f700b2aa --- /dev/null +++ b/lib/versions/v2/Model/GetProjectTemplatesResponse.php @@ -0,0 +1,405 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetProjectTemplatesResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'GetProjectTemplatesResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'success' => 'bool', + 'data' => '\Pipedrive\versions\v2\Model\ProjectTemplateItem[]', + 'additional_data' => '\Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success' => null, + 'data' => null, + 'additional_data' => 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 = [ + 'success' => 'success', + 'data' => 'data', + 'additional_data' => 'additional_data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'data' => 'setData', + 'additional_data' => 'setAdditionalData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'data' => 'getData', + 'additional_data' => 'getAdditionalData' + ]; + + /** + * 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['success'] = $data['success'] ?? null; + $this->container['data'] = $data['data'] ?? null; + $this->container['additional_data'] = $data['additional_data'] ?? 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 success + * + * @return bool|null + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool|null $success If the response is successful or not + * + * @return self + */ + public function setSuccess($success): self + { + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets data + * + * @return \Pipedrive\versions\v2\Model\ProjectTemplateItem[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\ProjectTemplateItem[]|null $data data + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets additional_data + * + * @return \Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination|null + */ + public function getAdditionalData() + { + return $this->container['additional_data']; + } + + /** + * Sets additional_data + * + * @param \Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination|null $additional_data additional_data + * + * @return self + */ + public function setAdditionalData($additional_data): self + { + $this->container['additional_data'] = $additional_data; + + 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/v2/Model/GetProjects.php b/lib/versions/v2/Model/GetProjects.php new file mode 100644 index 00000000..de61d1d2 --- /dev/null +++ b/lib/versions/v2/Model/GetProjects.php @@ -0,0 +1,405 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetProjects implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'GetProjects'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'success' => 'bool', + 'data' => '\Pipedrive\versions\v2\Model\ProjectItem[]', + 'additional_data' => '\Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success' => null, + 'data' => null, + 'additional_data' => 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 = [ + 'success' => 'success', + 'data' => 'data', + 'additional_data' => 'additional_data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'data' => 'setData', + 'additional_data' => 'setAdditionalData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'data' => 'getData', + 'additional_data' => 'getAdditionalData' + ]; + + /** + * 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['success'] = $data['success'] ?? null; + $this->container['data'] = $data['data'] ?? null; + $this->container['additional_data'] = $data['additional_data'] ?? 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 success + * + * @return bool|null + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool|null $success If the response is successful or not + * + * @return self + */ + public function setSuccess($success): self + { + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets data + * + * @return \Pipedrive\versions\v2\Model\ProjectItem[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\ProjectItem[]|null $data Projects array + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets additional_data + * + * @return \Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination|null + */ + public function getAdditionalData() + { + return $this->container['additional_data']; + } + + /** + * Sets additional_data + * + * @param \Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination|null $additional_data additional_data + * + * @return self + */ + public function setAdditionalData($additional_data): self + { + $this->container['additional_data'] = $additional_data; + + 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/v2/Model/GetProjectsAllOf.php b/lib/versions/v2/Model/GetProjectsAllOf.php new file mode 100644 index 00000000..43d00e38 --- /dev/null +++ b/lib/versions/v2/Model/GetProjectsAllOf.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetProjectsAllOf implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'GetProjects_allOf'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'data' => '\Pipedrive\versions\v2\Model\ProjectItem[]', + 'additional_data' => '\Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'data' => null, + 'additional_data' => 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 = [ + 'data' => 'data', + 'additional_data' => 'additional_data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'data' => 'setData', + 'additional_data' => 'setAdditionalData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'data' => 'getData', + 'additional_data' => 'getAdditionalData' + ]; + + /** + * 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['data'] = $data['data'] ?? null; + $this->container['additional_data'] = $data['additional_data'] ?? 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 data + * + * @return \Pipedrive\versions\v2\Model\ProjectItem[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\ProjectItem[]|null $data Projects array + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets additional_data + * + * @return \Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination|null + */ + public function getAdditionalData() + { + return $this->container['additional_data']; + } + + /** + * Sets additional_data + * + * @param \Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination|null $additional_data additional_data + * + * @return self + */ + public function setAdditionalData($additional_data): self + { + $this->container['additional_data'] = $additional_data; + + 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/v2/Model/GetTaskResponse.php b/lib/versions/v2/Model/GetTaskResponse.php new file mode 100644 index 00000000..b15d5ceb --- /dev/null +++ b/lib/versions/v2/Model/GetTaskResponse.php @@ -0,0 +1,405 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetTaskResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'GetTaskResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'success' => 'bool', + 'data' => '\Pipedrive\versions\v2\Model\TaskItem', + 'additional_data' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success' => null, + 'data' => null, + 'additional_data' => 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 = [ + 'success' => 'success', + 'data' => 'data', + 'additional_data' => 'additional_data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'data' => 'setData', + 'additional_data' => 'setAdditionalData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'data' => 'getData', + 'additional_data' => 'getAdditionalData' + ]; + + /** + * 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['success'] = $data['success'] ?? null; + $this->container['data'] = $data['data'] ?? null; + $this->container['additional_data'] = $data['additional_data'] ?? 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 success + * + * @return bool|null + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool|null $success If the response is successful or not + * + * @return self + */ + public function setSuccess($success): self + { + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets data + * + * @return \Pipedrive\versions\v2\Model\TaskItem|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\TaskItem|null $data data + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets additional_data + * + * @return object|null + */ + public function getAdditionalData() + { + return $this->container['additional_data']; + } + + /** + * Sets additional_data + * + * @param object|null $additional_data additional_data + * + * @return self + */ + public function setAdditionalData($additional_data): self + { + $this->container['additional_data'] = $additional_data; + + 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/v2/Model/GetTasksResponse.php b/lib/versions/v2/Model/GetTasksResponse.php new file mode 100644 index 00000000..cbd2c734 --- /dev/null +++ b/lib/versions/v2/Model/GetTasksResponse.php @@ -0,0 +1,405 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetTasksResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'GetTasksResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'success' => 'bool', + 'data' => '\Pipedrive\versions\v2\Model\TaskItem[]', + 'additional_data' => '\Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success' => null, + 'data' => null, + 'additional_data' => 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 = [ + 'success' => 'success', + 'data' => 'data', + 'additional_data' => 'additional_data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'data' => 'setData', + 'additional_data' => 'setAdditionalData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'data' => 'getData', + 'additional_data' => 'getAdditionalData' + ]; + + /** + * 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['success'] = $data['success'] ?? null; + $this->container['data'] = $data['data'] ?? null; + $this->container['additional_data'] = $data['additional_data'] ?? 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 success + * + * @return bool|null + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool|null $success If the response is successful or not + * + * @return self + */ + public function setSuccess($success): self + { + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets data + * + * @return \Pipedrive\versions\v2\Model\TaskItem[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\TaskItem[]|null $data data + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets additional_data + * + * @return \Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination|null + */ + public function getAdditionalData() + { + return $this->container['additional_data']; + } + + /** + * Sets additional_data + * + * @param \Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination|null $additional_data additional_data + * + * @return self + */ + public function setAdditionalData($additional_data): self + { + $this->container['additional_data'] = $additional_data; + + 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/v2/Model/OrganizationItem.php b/lib/versions/v2/Model/OrganizationItem.php index 4e907436..8c9575a1 100644 --- a/lib/versions/v2/Model/OrganizationItem.php +++ b/lib/versions/v2/Model/OrganizationItem.php @@ -511,7 +511,7 @@ public function getCustomFields() /** * Sets custom_fields * - * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes + * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. * * @return self */ diff --git a/lib/versions/v2/Model/OrganizationRequestBody.php b/lib/versions/v2/Model/OrganizationRequestBody.php index e086ff99..9dcc0ceb 100644 --- a/lib/versions/v2/Model/OrganizationRequestBody.php +++ b/lib/versions/v2/Model/OrganizationRequestBody.php @@ -451,7 +451,7 @@ public function getCustomFields() /** * Sets custom_fields * - * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes + * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. * * @return self */ diff --git a/lib/versions/v2/Model/Person.php b/lib/versions/v2/Model/Person.php index c3cc77f5..dd32b8a1 100644 --- a/lib/versions/v2/Model/Person.php +++ b/lib/versions/v2/Model/Person.php @@ -811,7 +811,7 @@ public function getCustomFields() /** * Sets custom_fields * - * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes + * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. * * @return self */ diff --git a/lib/versions/v2/Model/PersonItem.php b/lib/versions/v2/Model/PersonItem.php index 8863bd14..628e717b 100644 --- a/lib/versions/v2/Model/PersonItem.php +++ b/lib/versions/v2/Model/PersonItem.php @@ -811,7 +811,7 @@ public function getCustomFields() /** * Sets custom_fields * - * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes + * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. * * @return self */ diff --git a/lib/versions/v2/Model/PersonRequestBody.php b/lib/versions/v2/Model/PersonRequestBody.php index cf2072e8..66889c3b 100644 --- a/lib/versions/v2/Model/PersonRequestBody.php +++ b/lib/versions/v2/Model/PersonRequestBody.php @@ -581,7 +581,7 @@ public function getCustomFields() /** * Sets custom_fields * - * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes + * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. * * @return self */ diff --git a/lib/versions/v2/Model/PhaseItem.php b/lib/versions/v2/Model/PhaseItem.php new file mode 100644 index 00000000..f8d6926e --- /dev/null +++ b/lib/versions/v2/Model/PhaseItem.php @@ -0,0 +1,495 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class PhaseItem implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'PhaseItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'id' => 'int', + 'name' => 'string', + 'board_id' => 'int', + 'order_nr' => 'int', + 'add_time' => 'string', + 'update_time' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'board_id' => null, + 'order_nr' => null, + 'add_time' => null, + 'update_time' => 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', + 'name' => 'name', + 'board_id' => 'board_id', + 'order_nr' => 'order_nr', + 'add_time' => 'add_time', + 'update_time' => 'update_time' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'board_id' => 'setBoardId', + 'order_nr' => 'setOrderNr', + 'add_time' => 'setAddTime', + 'update_time' => 'setUpdateTime' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'board_id' => 'getBoardId', + 'order_nr' => 'getOrderNr', + 'add_time' => 'getAddTime', + 'update_time' => 'getUpdateTime' + ]; + + /** + * 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; + $this->container['name'] = $data['name'] ?? null; + $this->container['board_id'] = $data['board_id'] ?? null; + $this->container['order_nr'] = $data['order_nr'] ?? null; + $this->container['add_time'] = $data['add_time'] ?? null; + $this->container['update_time'] = $data['update_time'] ?? 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 project phase + * + * @return self + */ + public function setId($id): self + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The name of the project phase + * + * @return self + */ + public function setName($name): self + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets board_id + * + * @return int|null + */ + public function getBoardId() + { + return $this->container['board_id']; + } + + /** + * Sets board_id + * + * @param int|null $board_id The ID of the project board this phase belongs to + * + * @return self + */ + public function setBoardId($board_id): self + { + $this->container['board_id'] = $board_id; + + return $this; + } + + /** + * Gets order_nr + * + * @return int|null + */ + public function getOrderNr() + { + return $this->container['order_nr']; + } + + /** + * Sets order_nr + * + * @param int|null $order_nr The order of the phase within its board + * + * @return self + */ + public function setOrderNr($order_nr): self + { + $this->container['order_nr'] = $order_nr; + + 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 creation date and time of the phase in ISO 8601 format + * + * @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 date and time of the phase in ISO 8601 format + * + * @return self + */ + public function setUpdateTime($update_time): self + { + $this->container['update_time'] = $update_time; + + 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/v2/Model/PhaseRequestBody.php b/lib/versions/v2/Model/PhaseRequestBody.php new file mode 100644 index 00000000..49f4632e --- /dev/null +++ b/lib/versions/v2/Model/PhaseRequestBody.php @@ -0,0 +1,414 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class PhaseRequestBody implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'PhaseRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'name' => 'string', + 'board_id' => 'int', + 'order_nr' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'board_id' => null, + 'order_nr' => 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 = [ + 'name' => 'name', + 'board_id' => 'board_id', + 'order_nr' => 'order_nr' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'board_id' => 'setBoardId', + 'order_nr' => 'setOrderNr' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'board_id' => 'getBoardId', + 'order_nr' => 'getOrderNr' + ]; + + /** + * 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['name'] = $data['name'] ?? null; + $this->container['board_id'] = $data['board_id'] ?? null; + $this->container['order_nr'] = $data['order_nr'] ?? 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 = []; + + if (!is_null($this->container['order_nr']) && ($this->container['order_nr'] < 1)) { + $invalidProperties[] = "invalid value for 'order_nr', must be bigger than or equal to 1."; + } + + 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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The name of the project phase + * + * @return self + */ + public function setName($name): self + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets board_id + * + * @return int|null + */ + public function getBoardId() + { + return $this->container['board_id']; + } + + /** + * Sets board_id + * + * @param int|null $board_id The ID of the project board to add the phase to + * + * @return self + */ + public function setBoardId($board_id): self + { + $this->container['board_id'] = $board_id; + + return $this; + } + + /** + * Gets order_nr + * + * @return int|null + */ + public function getOrderNr() + { + return $this->container['order_nr']; + } + + /** + * Sets order_nr + * + * @param int|null $order_nr The order of the phase within its board. Must be between 1 and the total number of phases on the board + 1. + * + * @return self + */ + public function setOrderNr($order_nr): self + { + + if (!is_null($order_nr) && ($order_nr < 1)) { + throw new \InvalidArgumentException('invalid value for $order_nr when calling PhaseRequestBody., must be bigger than or equal to 1.'); + } + + $this->container['order_nr'] = $order_nr; + + 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/v2/Model/PostPatchGetBoard.php b/lib/versions/v2/Model/PostPatchGetBoard.php new file mode 100644 index 00000000..94ba29b4 --- /dev/null +++ b/lib/versions/v2/Model/PostPatchGetBoard.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class PostPatchGetBoard implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'PostPatchGetBoard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'success' => 'bool', + 'data' => '\Pipedrive\versions\v2\Model\BoardItem' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success' => null, + 'data' => 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 = [ + 'success' => 'success', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'data' => 'getData' + ]; + + /** + * 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['success'] = $data['success'] ?? null; + $this->container['data'] = $data['data'] ?? 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 success + * + * @return bool|null + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool|null $success If the response is successful or not + * + * @return self + */ + public function setSuccess($success): self + { + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets data + * + * @return \Pipedrive\versions\v2\Model\BoardItem|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\BoardItem|null $data data + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + 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/v2/Model/PostPatchGetPhase.php b/lib/versions/v2/Model/PostPatchGetPhase.php new file mode 100644 index 00000000..e19a3280 --- /dev/null +++ b/lib/versions/v2/Model/PostPatchGetPhase.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class PostPatchGetPhase implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'PostPatchGetPhase'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'success' => 'bool', + 'data' => '\Pipedrive\versions\v2\Model\PhaseItem' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success' => null, + 'data' => 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 = [ + 'success' => 'success', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'data' => 'getData' + ]; + + /** + * 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['success'] = $data['success'] ?? null; + $this->container['data'] = $data['data'] ?? 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 success + * + * @return bool|null + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool|null $success If the response is successful or not + * + * @return self + */ + public function setSuccess($success): self + { + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets data + * + * @return \Pipedrive\versions\v2\Model\PhaseItem|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\PhaseItem|null $data data + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + 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/v2/Model/PostPatchGetProject.php b/lib/versions/v2/Model/PostPatchGetProject.php new file mode 100644 index 00000000..cfb1fe93 --- /dev/null +++ b/lib/versions/v2/Model/PostPatchGetProject.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class PostPatchGetProject implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'PostPatchGetProject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'success' => 'bool', + 'data' => '\Pipedrive\versions\v2\Model\ProjectItem' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success' => null, + 'data' => 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 = [ + 'success' => 'success', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'data' => 'getData' + ]; + + /** + * 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['success'] = $data['success'] ?? null; + $this->container['data'] = $data['data'] ?? 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 success + * + * @return bool|null + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool|null $success If the response is successful or not + * + * @return self + */ + public function setSuccess($success): self + { + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets data + * + * @return \Pipedrive\versions\v2\Model\ProjectItem|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\ProjectItem|null $data data + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + 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/v2/Model/PostPatchGetProjectAllOf.php b/lib/versions/v2/Model/PostPatchGetProjectAllOf.php new file mode 100644 index 00000000..d39a7ec0 --- /dev/null +++ b/lib/versions/v2/Model/PostPatchGetProjectAllOf.php @@ -0,0 +1,345 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class PostPatchGetProjectAllOf implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'PostPatchGetProject_allOf'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'data' => '\Pipedrive\versions\v2\Model\ProjectItem' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'data' => 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 = [ + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'data' => 'getData' + ]; + + /** + * 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['data'] = $data['data'] ?? 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 data + * + * @return \Pipedrive\versions\v2\Model\ProjectItem|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\ProjectItem|null $data data + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + 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/v2/Model/ProductRequest.php b/lib/versions/v2/Model/ProductRequest.php index 36064960..8c5634ce 100644 --- a/lib/versions/v2/Model/ProductRequest.php +++ b/lib/versions/v2/Model/ProductRequest.php @@ -511,7 +511,7 @@ public function getCustomFields() /** * Sets custom_fields * - * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes + * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. * * @return self */ diff --git a/lib/versions/v2/Model/ProductWithArrayPrices.php b/lib/versions/v2/Model/ProductWithArrayPrices.php index adc6252f..dd763a70 100644 --- a/lib/versions/v2/Model/ProductWithArrayPrices.php +++ b/lib/versions/v2/Model/ProductWithArrayPrices.php @@ -529,7 +529,7 @@ public function getCustomFields() /** * Sets custom_fields * - * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes + * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. * * @return self */ diff --git a/lib/versions/v2/Model/ProjectChangelogResponse.php b/lib/versions/v2/Model/ProjectChangelogResponse.php new file mode 100644 index 00000000..07b8dc2e --- /dev/null +++ b/lib/versions/v2/Model/ProjectChangelogResponse.php @@ -0,0 +1,405 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ProjectChangelogResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ProjectChangelogResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'success' => 'bool', + 'data' => '\Pipedrive\versions\v2\Model\ProjectChangelogResponseData[]', + 'additional_data' => '\Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success' => null, + 'data' => null, + 'additional_data' => 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 = [ + 'success' => 'success', + 'data' => 'data', + 'additional_data' => 'additional_data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'data' => 'setData', + 'additional_data' => 'setAdditionalData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'data' => 'getData', + 'additional_data' => 'getAdditionalData' + ]; + + /** + * 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['success'] = $data['success'] ?? null; + $this->container['data'] = $data['data'] ?? null; + $this->container['additional_data'] = $data['additional_data'] ?? 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 success + * + * @return bool|null + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool|null $success success + * + * @return self + */ + public function setSuccess($success): self + { + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets data + * + * @return \Pipedrive\versions\v2\Model\ProjectChangelogResponseData[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\ProjectChangelogResponseData[]|null $data data + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets additional_data + * + * @return \Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination|null + */ + public function getAdditionalData() + { + return $this->container['additional_data']; + } + + /** + * Sets additional_data + * + * @param \Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination|null $additional_data additional_data + * + * @return self + */ + public function setAdditionalData($additional_data): self + { + $this->container['additional_data'] = $additional_data; + + 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/v2/Model/ProjectChangelogResponseData.php b/lib/versions/v2/Model/ProjectChangelogResponseData.php new file mode 100644 index 00000000..81f1013d --- /dev/null +++ b/lib/versions/v2/Model/ProjectChangelogResponseData.php @@ -0,0 +1,495 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ProjectChangelogResponseData implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ProjectChangelogResponse_data'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'change_source' => 'string', + 'change_source_user_agent' => 'string', + 'time' => 'string', + 'new_values' => 'array', + 'old_values' => 'array', + 'actor_user_id' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'change_source' => null, + 'change_source_user_agent' => null, + 'time' => null, + 'new_values' => null, + 'old_values' => null, + 'actor_user_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 = [ + 'change_source' => 'change_source', + 'change_source_user_agent' => 'change_source_user_agent', + 'time' => 'time', + 'new_values' => 'new_values', + 'old_values' => 'old_values', + 'actor_user_id' => 'actor_user_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'change_source' => 'setChangeSource', + 'change_source_user_agent' => 'setChangeSourceUserAgent', + 'time' => 'setTime', + 'new_values' => 'setNewValues', + 'old_values' => 'setOldValues', + 'actor_user_id' => 'setActorUserId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'change_source' => 'getChangeSource', + 'change_source_user_agent' => 'getChangeSourceUserAgent', + 'time' => 'getTime', + 'new_values' => 'getNewValues', + 'old_values' => 'getOldValues', + 'actor_user_id' => 'getActorUserId' + ]; + + /** + * 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['change_source'] = $data['change_source'] ?? null; + $this->container['change_source_user_agent'] = $data['change_source_user_agent'] ?? null; + $this->container['time'] = $data['time'] ?? null; + $this->container['new_values'] = $data['new_values'] ?? null; + $this->container['old_values'] = $data['old_values'] ?? null; + $this->container['actor_user_id'] = $data['actor_user_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 change_source + * + * @return string|null + */ + public function getChangeSource() + { + return $this->container['change_source']; + } + + /** + * Sets change_source + * + * @param string|null $change_source The source of change, for example 'app', 'mobile', 'api', etc. + * + * @return self + */ + public function setChangeSource($change_source): self + { + $this->container['change_source'] = $change_source; + + return $this; + } + + /** + * Gets change_source_user_agent + * + * @return string|null + */ + public function getChangeSourceUserAgent() + { + return $this->container['change_source_user_agent']; + } + + /** + * Sets change_source_user_agent + * + * @param string|null $change_source_user_agent The user agent from which the change was made + * + * @return self + */ + public function setChangeSourceUserAgent($change_source_user_agent): self + { + $this->container['change_source_user_agent'] = $change_source_user_agent; + + return $this; + } + + /** + * Gets time + * + * @return string|null + */ + public function getTime() + { + return $this->container['time']; + } + + /** + * Sets time + * + * @param string|null $time The date and time of the change in ISO 8601 format + * + * @return self + */ + public function setTime($time): self + { + $this->container['time'] = $time; + + return $this; + } + + /** + * Gets new_values + * + * @return array|null + */ + public function getNewValues() + { + return $this->container['new_values']; + } + + /** + * Sets new_values + * + * @param array|null $new_values A map of field keys to their new values after the change + * + * @return self + */ + public function setNewValues($new_values): self + { + $this->container['new_values'] = $new_values; + + return $this; + } + + /** + * Gets old_values + * + * @return array|null + */ + public function getOldValues() + { + return $this->container['old_values']; + } + + /** + * Sets old_values + * + * @param array|null $old_values A map of field keys to their previous values before the change + * + * @return self + */ + public function setOldValues($old_values): self + { + $this->container['old_values'] = $old_values; + + return $this; + } + + /** + * Gets actor_user_id + * + * @return int|null + */ + public function getActorUserId() + { + return $this->container['actor_user_id']; + } + + /** + * Sets actor_user_id + * + * @param int|null $actor_user_id The ID of the user who made the change + * + * @return self + */ + public function setActorUserId($actor_user_id): self + { + $this->container['actor_user_id'] = $actor_user_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/v2/Model/ProjectFieldItem.php b/lib/versions/v2/Model/ProjectFieldItem.php new file mode 100644 index 00000000..8af58418 --- /dev/null +++ b/lib/versions/v2/Model/ProjectFieldItem.php @@ -0,0 +1,728 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ProjectFieldItem implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ProjectFieldItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'field_name' => 'string', + 'field_code' => 'string', + 'field_type' => 'string', + 'options' => '\Pipedrive\versions\v2\Model\ActivityFieldItemOptions[]', + 'subfields' => '\Pipedrive\versions\v2\Model\ActivityFieldItemSubfields[]', + 'is_custom_field' => 'bool', + 'is_optional_response_field' => 'bool', + 'ui_visibility' => '\Pipedrive\versions\v2\Model\ProjectFieldItemUiVisibility', + 'important_fields' => '\Pipedrive\versions\v2\Model\PersonFieldItemImportantFields', + 'required_fields' => '\Pipedrive\versions\v2\Model\PersonFieldItemRequiredFields' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'field_name' => null, + 'field_code' => null, + 'field_type' => null, + 'options' => null, + 'subfields' => null, + 'is_custom_field' => null, + 'is_optional_response_field' => null, + 'ui_visibility' => null, + 'important_fields' => null, + 'required_fields' => 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 = [ + 'field_name' => 'field_name', + 'field_code' => 'field_code', + 'field_type' => 'field_type', + 'options' => 'options', + 'subfields' => 'subfields', + 'is_custom_field' => 'is_custom_field', + 'is_optional_response_field' => 'is_optional_response_field', + 'ui_visibility' => 'ui_visibility', + 'important_fields' => 'important_fields', + 'required_fields' => 'required_fields' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'field_name' => 'setFieldName', + 'field_code' => 'setFieldCode', + 'field_type' => 'setFieldType', + 'options' => 'setOptions', + 'subfields' => 'setSubfields', + 'is_custom_field' => 'setIsCustomField', + 'is_optional_response_field' => 'setIsOptionalResponseField', + 'ui_visibility' => 'setUiVisibility', + 'important_fields' => 'setImportantFields', + 'required_fields' => 'setRequiredFields' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'field_name' => 'getFieldName', + 'field_code' => 'getFieldCode', + 'field_type' => 'getFieldType', + 'options' => 'getOptions', + 'subfields' => 'getSubfields', + 'is_custom_field' => 'getIsCustomField', + 'is_optional_response_field' => 'getIsOptionalResponseField', + 'ui_visibility' => 'getUiVisibility', + 'important_fields' => 'getImportantFields', + 'required_fields' => 'getRequiredFields' + ]; + + /** + * 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; + } + + const FIELD_TYPE_INT = 'int'; + const FIELD_TYPE_DOUBLE = 'double'; + const FIELD_TYPE_BOOLEAN = 'boolean'; + const FIELD_TYPE_VARCHAR = 'varchar'; + const FIELD_TYPE_TEXT = 'text'; + const FIELD_TYPE_PHONE = 'phone'; + const FIELD_TYPE_VARCHAR_OPTIONS = 'varchar_options'; + const FIELD_TYPE_VARCHAR_AUTO = 'varchar_auto'; + const FIELD_TYPE_DATE = 'date'; + const FIELD_TYPE_DATERANGE = 'daterange'; + const FIELD_TYPE_TIME = 'time'; + const FIELD_TYPE_TIMERANGE = 'timerange'; + const FIELD_TYPE_ENUM = 'enum'; + const FIELD_TYPE_SET = 'set'; + const FIELD_TYPE_ADDRESS = 'address'; + const FIELD_TYPE_MONETARY = 'monetary'; + const FIELD_TYPE_DEAL = 'deal'; + const FIELD_TYPE_DEALS = 'deals'; + const FIELD_TYPE_LEAD = 'lead'; + const FIELD_TYPE_ORG = 'org'; + const FIELD_TYPE_PEOPLE = 'people'; + const FIELD_TYPE_PROJECT = 'project'; + const FIELD_TYPE_STAGE = 'stage'; + const FIELD_TYPE_USER = 'user'; + const FIELD_TYPE_ACTIVITY = 'activity'; + const FIELD_TYPE_JSON = 'json'; + const FIELD_TYPE_PICTURE = 'picture'; + const FIELD_TYPE_STATUS = 'status'; + const FIELD_TYPE_VISIBLE_TO = 'visible_to'; + const FIELD_TYPE_PRICE_LIST = 'price_list'; + const FIELD_TYPE_BILLING_FREQUENCY = 'billing_frequency'; + const FIELD_TYPE_PROJECTS_BOARD = 'projects_board'; + const FIELD_TYPE_PROJECTS_PHASE = 'projects_phase'; + + /** + * Gets allowable values of the enum + * + * @phpstan-return array + * @phpsalm-return array + * @return (string|int)[] + */ + public function getFieldTypeAllowableValues(): array + { + return [ + self::FIELD_TYPE_INT, + self::FIELD_TYPE_DOUBLE, + self::FIELD_TYPE_BOOLEAN, + self::FIELD_TYPE_VARCHAR, + self::FIELD_TYPE_TEXT, + self::FIELD_TYPE_PHONE, + self::FIELD_TYPE_VARCHAR_OPTIONS, + self::FIELD_TYPE_VARCHAR_AUTO, + self::FIELD_TYPE_DATE, + self::FIELD_TYPE_DATERANGE, + self::FIELD_TYPE_TIME, + self::FIELD_TYPE_TIMERANGE, + self::FIELD_TYPE_ENUM, + self::FIELD_TYPE_SET, + self::FIELD_TYPE_ADDRESS, + self::FIELD_TYPE_MONETARY, + self::FIELD_TYPE_DEAL, + self::FIELD_TYPE_DEALS, + self::FIELD_TYPE_LEAD, + self::FIELD_TYPE_ORG, + self::FIELD_TYPE_PEOPLE, + self::FIELD_TYPE_PROJECT, + self::FIELD_TYPE_STAGE, + self::FIELD_TYPE_USER, + self::FIELD_TYPE_ACTIVITY, + self::FIELD_TYPE_JSON, + self::FIELD_TYPE_PICTURE, + self::FIELD_TYPE_STATUS, + self::FIELD_TYPE_VISIBLE_TO, + self::FIELD_TYPE_PRICE_LIST, + self::FIELD_TYPE_BILLING_FREQUENCY, + self::FIELD_TYPE_PROJECTS_BOARD, + self::FIELD_TYPE_PROJECTS_PHASE, + ]; + } + + /** + * 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['field_name'] = $data['field_name'] ?? null; + $this->container['field_code'] = $data['field_code'] ?? null; + $this->container['field_type'] = $data['field_type'] ?? null; + $this->container['options'] = $data['options'] ?? null; + $this->container['subfields'] = $data['subfields'] ?? null; + $this->container['is_custom_field'] = $data['is_custom_field'] ?? null; + $this->container['is_optional_response_field'] = $data['is_optional_response_field'] ?? null; + $this->container['ui_visibility'] = $data['ui_visibility'] ?? null; + $this->container['important_fields'] = $data['important_fields'] ?? null; + $this->container['required_fields'] = $data['required_fields'] ?? 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 = []; + + if ($this->container['field_name'] === null) { + $invalidProperties[] = "'field_name' can't be null"; + } + if ($this->container['field_code'] === null) { + $invalidProperties[] = "'field_code' can't be null"; + } + if ($this->container['field_type'] === null) { + $invalidProperties[] = "'field_type' can't be null"; + } + $allowedValues = $this->getFieldTypeAllowableValues(); + if (!is_null($this->container['field_type']) && !in_array($this->container['field_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'field_type', must be one of '%s'", + $this->container['field_type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['is_custom_field'] === null) { + $invalidProperties[] = "'is_custom_field' can't be null"; + } + if ($this->container['is_optional_response_field'] === null) { + $invalidProperties[] = "'is_optional_response_field' can't be null"; + } + 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 field_name + * + * @return string + */ + public function getFieldName() + { + return $this->container['field_name']; + } + + /** + * Sets field_name + * + * @param string $field_name The display name/label of the field + * + * @return self + */ + public function setFieldName($field_name): self + { + $this->container['field_name'] = $field_name; + + return $this; + } + + /** + * Gets field_code + * + * @return string + */ + public function getFieldCode() + { + return $this->container['field_code']; + } + + /** + * Sets field_code + * + * @param string $field_code The unique identifier for the field (40-character hash for custom fields) + * + * @return self + */ + public function setFieldCode($field_code): self + { + $this->container['field_code'] = $field_code; + + return $this; + } + + /** + * Gets field_type + * + * @return string + */ + public function getFieldType() + { + return $this->container['field_type']; + } + + /** + * Sets field_type + * + * @param string $field_type The type of the field + * + * @return self + */ + public function setFieldType($field_type): self + { + $allowedValues = $this->getFieldTypeAllowableValues(); + if (!in_array($field_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'field_type', must be one of '%s'", + $field_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['field_type'] = $field_type; + + return $this; + } + + /** + * Gets options + * + * @return \Pipedrive\versions\v2\Model\ActivityFieldItemOptions[]|null + */ + public function getOptions() + { + return $this->container['options']; + } + + /** + * Sets options + * + * @param \Pipedrive\versions\v2\Model\ActivityFieldItemOptions[]|null $options Array of available options for enum/set fields, null for other field types + * + * @return self + */ + public function setOptions($options): self + { + $this->container['options'] = $options; + + return $this; + } + + /** + * Gets subfields + * + * @return \Pipedrive\versions\v2\Model\ActivityFieldItemSubfields[]|null + */ + public function getSubfields() + { + return $this->container['subfields']; + } + + /** + * Sets subfields + * + * @param \Pipedrive\versions\v2\Model\ActivityFieldItemSubfields[]|null $subfields Array of subfields for complex field types (address, monetary), null for simple field types + * + * @return self + */ + public function setSubfields($subfields): self + { + $this->container['subfields'] = $subfields; + + return $this; + } + + /** + * Gets is_custom_field + * + * @return bool + */ + public function getIsCustomField() + { + return $this->container['is_custom_field']; + } + + /** + * Sets is_custom_field + * + * @param bool $is_custom_field Whether this is a user-created custom field + * + * @return self + */ + public function setIsCustomField($is_custom_field): self + { + $this->container['is_custom_field'] = $is_custom_field; + + return $this; + } + + /** + * Gets is_optional_response_field + * + * @return bool + */ + public function getIsOptionalResponseField() + { + return $this->container['is_optional_response_field']; + } + + /** + * Sets is_optional_response_field + * + * @param bool $is_optional_response_field Whether this field is not returned by default in entity responses + * + * @return self + */ + public function setIsOptionalResponseField($is_optional_response_field): self + { + $this->container['is_optional_response_field'] = $is_optional_response_field; + + return $this; + } + + /** + * Gets ui_visibility + * + * @return \Pipedrive\versions\v2\Model\ProjectFieldItemUiVisibility|null + */ + public function getUiVisibility() + { + return $this->container['ui_visibility']; + } + + /** + * Sets ui_visibility + * + * @param \Pipedrive\versions\v2\Model\ProjectFieldItemUiVisibility|null $ui_visibility ui_visibility + * + * @return self + */ + public function setUiVisibility($ui_visibility): self + { + $this->container['ui_visibility'] = $ui_visibility; + + return $this; + } + + /** + * Gets important_fields + * + * @return \Pipedrive\versions\v2\Model\PersonFieldItemImportantFields|null + */ + public function getImportantFields() + { + return $this->container['important_fields']; + } + + /** + * Sets important_fields + * + * @param \Pipedrive\versions\v2\Model\PersonFieldItemImportantFields|null $important_fields important_fields + * + * @return self + */ + public function setImportantFields($important_fields): self + { + $this->container['important_fields'] = $important_fields; + + return $this; + } + + /** + * Gets required_fields + * + * @return \Pipedrive\versions\v2\Model\PersonFieldItemRequiredFields|null + */ + public function getRequiredFields() + { + return $this->container['required_fields']; + } + + /** + * Sets required_fields + * + * @param \Pipedrive\versions\v2\Model\PersonFieldItemRequiredFields|null $required_fields required_fields + * + * @return self + */ + public function setRequiredFields($required_fields): self + { + $this->container['required_fields'] = $required_fields; + + 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/v2/Model/ProjectFieldItemUiVisibility.php b/lib/versions/v2/Model/ProjectFieldItemUiVisibility.php new file mode 100644 index 00000000..082005a5 --- /dev/null +++ b/lib/versions/v2/Model/ProjectFieldItemUiVisibility.php @@ -0,0 +1,376 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ProjectFieldItemUiVisibility implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ProjectFieldItem_ui_visibility'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'add_visible_flag' => 'bool', + 'details_visible_flag' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'add_visible_flag' => null, + 'details_visible_flag' => 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 = [ + 'add_visible_flag' => 'add_visible_flag', + 'details_visible_flag' => 'details_visible_flag' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'add_visible_flag' => 'setAddVisibleFlag', + 'details_visible_flag' => 'setDetailsVisibleFlag' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'add_visible_flag' => 'getAddVisibleFlag', + 'details_visible_flag' => 'getDetailsVisibleFlag' + ]; + + /** + * 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['add_visible_flag'] = $data['add_visible_flag'] ?? null; + $this->container['details_visible_flag'] = $data['details_visible_flag'] ?? 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 add_visible_flag + * + * @return bool|null + */ + public function getAddVisibleFlag() + { + return $this->container['add_visible_flag']; + } + + /** + * Sets add_visible_flag + * + * @param bool|null $add_visible_flag Whether the field is shown in the add modal + * + * @return self + */ + public function setAddVisibleFlag($add_visible_flag): self + { + $this->container['add_visible_flag'] = $add_visible_flag; + + return $this; + } + + /** + * Gets details_visible_flag + * + * @return bool|null + */ + public function getDetailsVisibleFlag() + { + return $this->container['details_visible_flag']; + } + + /** + * Sets details_visible_flag + * + * @param bool|null $details_visible_flag Whether the field is shown in the details view + * + * @return self + */ + public function setDetailsVisibleFlag($details_visible_flag): self + { + $this->container['details_visible_flag'] = $details_visible_flag; + + 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/v2/Model/ProjectItem.php b/lib/versions/v2/Model/ProjectItem.php new file mode 100644 index 00000000..67ebc9b5 --- /dev/null +++ b/lib/versions/v2/Model/ProjectItem.php @@ -0,0 +1,885 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ProjectItem implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ProjectItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'id' => 'int', + 'title' => 'string', + 'description' => 'string', + 'status' => 'string', + 'board_id' => 'int', + 'phase_id' => 'int', + 'owner_id' => 'int', + 'start_date' => '\DateTime', + 'end_date' => '\DateTime', + 'deal_ids' => 'int[]', + 'person_ids' => 'int[]', + 'org_ids' => 'int[]', + 'label_ids' => 'int[]', + 'health_status' => 'string', + 'add_time' => 'string', + 'update_time' => 'string', + 'status_change_time' => 'string', + 'archive_time' => 'string', + 'custom_fields' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'title' => null, + 'description' => null, + 'status' => null, + 'board_id' => null, + 'phase_id' => null, + 'owner_id' => null, + 'start_date' => 'date', + 'end_date' => 'date', + 'deal_ids' => null, + 'person_ids' => null, + 'org_ids' => null, + 'label_ids' => null, + 'health_status' => null, + 'add_time' => null, + 'update_time' => null, + 'status_change_time' => null, + 'archive_time' => null, + 'custom_fields' => 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', + 'title' => 'title', + 'description' => 'description', + 'status' => 'status', + 'board_id' => 'board_id', + 'phase_id' => 'phase_id', + 'owner_id' => 'owner_id', + 'start_date' => 'start_date', + 'end_date' => 'end_date', + 'deal_ids' => 'deal_ids', + 'person_ids' => 'person_ids', + 'org_ids' => 'org_ids', + 'label_ids' => 'label_ids', + 'health_status' => 'health_status', + 'add_time' => 'add_time', + 'update_time' => 'update_time', + 'status_change_time' => 'status_change_time', + 'archive_time' => 'archive_time', + 'custom_fields' => 'custom_fields' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'title' => 'setTitle', + 'description' => 'setDescription', + 'status' => 'setStatus', + 'board_id' => 'setBoardId', + 'phase_id' => 'setPhaseId', + 'owner_id' => 'setOwnerId', + 'start_date' => 'setStartDate', + 'end_date' => 'setEndDate', + 'deal_ids' => 'setDealIds', + 'person_ids' => 'setPersonIds', + 'org_ids' => 'setOrgIds', + 'label_ids' => 'setLabelIds', + 'health_status' => 'setHealthStatus', + 'add_time' => 'setAddTime', + 'update_time' => 'setUpdateTime', + 'status_change_time' => 'setStatusChangeTime', + 'archive_time' => 'setArchiveTime', + 'custom_fields' => 'setCustomFields' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'title' => 'getTitle', + 'description' => 'getDescription', + 'status' => 'getStatus', + 'board_id' => 'getBoardId', + 'phase_id' => 'getPhaseId', + 'owner_id' => 'getOwnerId', + 'start_date' => 'getStartDate', + 'end_date' => 'getEndDate', + 'deal_ids' => 'getDealIds', + 'person_ids' => 'getPersonIds', + 'org_ids' => 'getOrgIds', + 'label_ids' => 'getLabelIds', + 'health_status' => 'getHealthStatus', + 'add_time' => 'getAddTime', + 'update_time' => 'getUpdateTime', + 'status_change_time' => 'getStatusChangeTime', + 'archive_time' => 'getArchiveTime', + 'custom_fields' => 'getCustomFields' + ]; + + /** + * 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; + $this->container['title'] = $data['title'] ?? null; + $this->container['description'] = $data['description'] ?? null; + $this->container['status'] = $data['status'] ?? null; + $this->container['board_id'] = $data['board_id'] ?? null; + $this->container['phase_id'] = $data['phase_id'] ?? null; + $this->container['owner_id'] = $data['owner_id'] ?? null; + $this->container['start_date'] = $data['start_date'] ?? null; + $this->container['end_date'] = $data['end_date'] ?? null; + $this->container['deal_ids'] = $data['deal_ids'] ?? null; + $this->container['person_ids'] = $data['person_ids'] ?? null; + $this->container['org_ids'] = $data['org_ids'] ?? null; + $this->container['label_ids'] = $data['label_ids'] ?? null; + $this->container['health_status'] = $data['health_status'] ?? null; + $this->container['add_time'] = $data['add_time'] ?? null; + $this->container['update_time'] = $data['update_time'] ?? null; + $this->container['status_change_time'] = $data['status_change_time'] ?? null; + $this->container['archive_time'] = $data['archive_time'] ?? null; + $this->container['custom_fields'] = $data['custom_fields'] ?? 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 project + * + * @return self + */ + public function setId($id): self + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the project + * + * @return self + */ + public function setTitle($title): self + { + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description The description of the project + * + * @return self + */ + public function setDescription($description): self + { + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status The status of the project + * + * @return self + */ + public function setStatus($status): self + { + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets board_id + * + * @return int|null + */ + public function getBoardId() + { + return $this->container['board_id']; + } + + /** + * Sets board_id + * + * @param int|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 int|null + */ + public function getPhaseId() + { + return $this->container['phase_id']; + } + + /** + * Sets phase_id + * + * @param int|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 owner_id + * + * @return int|null + */ + public function getOwnerId() + { + return $this->container['owner_id']; + } + + /** + * Sets owner_id + * + * @param int|null $owner_id The ID of the user who owns the project + * + * @return self + */ + public function setOwnerId($owner_id): self + { + $this->container['owner_id'] = $owner_id; + + return $this; + } + + /** + * Gets start_date + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['start_date']; + } + + /** + * Sets start_date + * + * @param \DateTime|null $start_date The start date of the project. Format: YYYY-MM-DD + * + * @return self + */ + public function setStartDate($start_date): self + { + $this->container['start_date'] = $start_date; + + return $this; + } + + /** + * Gets end_date + * + * @return \DateTime|null + */ + public function getEndDate() + { + return $this->container['end_date']; + } + + /** + * Sets end_date + * + * @param \DateTime|null $end_date The end date of the project. Format: YYYY-MM-DD + * + * @return self + */ + public function setEndDate($end_date): self + { + $this->container['end_date'] = $end_date; + + return $this; + } + + /** + * Gets deal_ids + * + * @return int[]|null + */ + public function getDealIds() + { + return $this->container['deal_ids']; + } + + /** + * Sets deal_ids + * + * @param int[]|null $deal_ids An array of IDs of the deals this project is associated with + * + * @return self + */ + public function setDealIds($deal_ids): self + { + $this->container['deal_ids'] = $deal_ids; + + return $this; + } + + /** + * Gets person_ids + * + * @return int[]|null + */ + public function getPersonIds() + { + return $this->container['person_ids']; + } + + /** + * Sets person_ids + * + * @param int[]|null $person_ids An array of IDs of the persons this project is associated with + * + * @return self + */ + public function setPersonIds($person_ids): self + { + $this->container['person_ids'] = $person_ids; + + return $this; + } + + /** + * Gets org_ids + * + * @return int[]|null + */ + public function getOrgIds() + { + return $this->container['org_ids']; + } + + /** + * Sets org_ids + * + * @param int[]|null $org_ids An array of IDs of the organizations this project is associated with + * + * @return self + */ + public function setOrgIds($org_ids): self + { + $this->container['org_ids'] = $org_ids; + + return $this; + } + + /** + * Gets label_ids + * + * @return int[]|null + */ + public function getLabelIds() + { + return $this->container['label_ids']; + } + + /** + * Sets label_ids + * + * @param int[]|null $label_ids An array of IDs of the labels this project has + * + * @return self + */ + public function setLabelIds($label_ids): self + { + $this->container['label_ids'] = $label_ids; + + return $this; + } + + /** + * Gets health_status + * + * @return string|null + */ + public function getHealthStatus() + { + return $this->container['health_status']; + } + + /** + * Sets health_status + * + * @param string|null $health_status The health status of the project + * + * @return self + */ + public function setHealthStatus($health_status): self + { + $this->container['health_status'] = $health_status; + + 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 creation date and time of the project in ISO 8601 format + * + * @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 last updated date and time of the project in ISO 8601 format + * + * @return self + */ + public function setUpdateTime($update_time): self + { + $this->container['update_time'] = $update_time; + + return $this; + } + + /** + * Gets status_change_time + * + * @return string|null + */ + public function getStatusChangeTime() + { + return $this->container['status_change_time']; + } + + /** + * Sets status_change_time + * + * @param string|null $status_change_time The date and time of the last status change of the project in ISO 8601 format + * + * @return self + */ + public function setStatusChangeTime($status_change_time): self + { + $this->container['status_change_time'] = $status_change_time; + + return $this; + } + + /** + * Gets archive_time + * + * @return string|null + */ + public function getArchiveTime() + { + return $this->container['archive_time']; + } + + /** + * Sets archive_time + * + * @param string|null $archive_time The date and time the project was archived in ISO 8601 format. If not archived, this field is null. + * + * @return self + */ + public function setArchiveTime($archive_time): self + { + $this->container['archive_time'] = $archive_time; + + return $this; + } + + /** + * Gets custom_fields + * + * @return array|null + */ + public function getCustomFields() + { + return $this->container['custom_fields']; + } + + /** + * Sets custom_fields + * + * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. + * + * @return self + */ + public function setCustomFields($custom_fields): self + { + $this->container['custom_fields'] = $custom_fields; + + 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/v2/Model/ProjectRequestBody.php b/lib/versions/v2/Model/ProjectRequestBody.php new file mode 100644 index 00000000..7fd25c1f --- /dev/null +++ b/lib/versions/v2/Model/ProjectRequestBody.php @@ -0,0 +1,735 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ProjectRequestBody implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ProjectRequestBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'title' => 'string', + 'description' => 'string', + 'status' => 'string', + 'board_id' => 'int', + 'phase_id' => 'int', + 'owner_id' => 'int', + 'start_date' => '\DateTime', + 'end_date' => '\DateTime', + 'deal_ids' => 'int[]', + 'person_ids' => 'int[]', + 'org_ids' => 'int[]', + 'label_ids' => 'int[]', + 'template_id' => 'int', + 'custom_fields' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'title' => null, + 'description' => null, + 'status' => null, + 'board_id' => null, + 'phase_id' => null, + 'owner_id' => null, + 'start_date' => 'date', + 'end_date' => 'date', + 'deal_ids' => null, + 'person_ids' => null, + 'org_ids' => null, + 'label_ids' => null, + 'template_id' => null, + 'custom_fields' => 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 = [ + 'title' => 'title', + 'description' => 'description', + 'status' => 'status', + 'board_id' => 'board_id', + 'phase_id' => 'phase_id', + 'owner_id' => 'owner_id', + 'start_date' => 'start_date', + 'end_date' => 'end_date', + 'deal_ids' => 'deal_ids', + 'person_ids' => 'person_ids', + 'org_ids' => 'org_ids', + 'label_ids' => 'label_ids', + 'template_id' => 'template_id', + 'custom_fields' => 'custom_fields' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'title' => 'setTitle', + 'description' => 'setDescription', + 'status' => 'setStatus', + 'board_id' => 'setBoardId', + 'phase_id' => 'setPhaseId', + 'owner_id' => 'setOwnerId', + 'start_date' => 'setStartDate', + 'end_date' => 'setEndDate', + 'deal_ids' => 'setDealIds', + 'person_ids' => 'setPersonIds', + 'org_ids' => 'setOrgIds', + 'label_ids' => 'setLabelIds', + 'template_id' => 'setTemplateId', + 'custom_fields' => 'setCustomFields' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'title' => 'getTitle', + 'description' => 'getDescription', + 'status' => 'getStatus', + 'board_id' => 'getBoardId', + 'phase_id' => 'getPhaseId', + 'owner_id' => 'getOwnerId', + 'start_date' => 'getStartDate', + 'end_date' => 'getEndDate', + 'deal_ids' => 'getDealIds', + 'person_ids' => 'getPersonIds', + 'org_ids' => 'getOrgIds', + 'label_ids' => 'getLabelIds', + 'template_id' => 'getTemplateId', + 'custom_fields' => 'getCustomFields' + ]; + + /** + * 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['title'] = $data['title'] ?? null; + $this->container['description'] = $data['description'] ?? null; + $this->container['status'] = $data['status'] ?? null; + $this->container['board_id'] = $data['board_id'] ?? null; + $this->container['phase_id'] = $data['phase_id'] ?? null; + $this->container['owner_id'] = $data['owner_id'] ?? null; + $this->container['start_date'] = $data['start_date'] ?? null; + $this->container['end_date'] = $data['end_date'] ?? null; + $this->container['deal_ids'] = $data['deal_ids'] ?? null; + $this->container['person_ids'] = $data['person_ids'] ?? null; + $this->container['org_ids'] = $data['org_ids'] ?? null; + $this->container['label_ids'] = $data['label_ids'] ?? null; + $this->container['template_id'] = $data['template_id'] ?? null; + $this->container['custom_fields'] = $data['custom_fields'] ?? 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 title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the project + * + * @return self + */ + public function setTitle($title): self + { + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description The description of the project + * + * @return self + */ + public function setDescription($description): self + { + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status The status of the project + * + * @return self + */ + public function setStatus($status): self + { + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets board_id + * + * @return int|null + */ + public function getBoardId() + { + return $this->container['board_id']; + } + + /** + * Sets board_id + * + * @param int|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 int|null + */ + public function getPhaseId() + { + return $this->container['phase_id']; + } + + /** + * Sets phase_id + * + * @param int|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 owner_id + * + * @return int|null + */ + public function getOwnerId() + { + return $this->container['owner_id']; + } + + /** + * Sets owner_id + * + * @param int|null $owner_id The ID of the user who owns the project + * + * @return self + */ + public function setOwnerId($owner_id): self + { + $this->container['owner_id'] = $owner_id; + + return $this; + } + + /** + * Gets start_date + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['start_date']; + } + + /** + * Sets start_date + * + * @param \DateTime|null $start_date The start date of the project. Format: YYYY-MM-DD + * + * @return self + */ + public function setStartDate($start_date): self + { + $this->container['start_date'] = $start_date; + + return $this; + } + + /** + * Gets end_date + * + * @return \DateTime|null + */ + public function getEndDate() + { + return $this->container['end_date']; + } + + /** + * Sets end_date + * + * @param \DateTime|null $end_date The end date of the project. Format: YYYY-MM-DD + * + * @return self + */ + public function setEndDate($end_date): self + { + $this->container['end_date'] = $end_date; + + return $this; + } + + /** + * Gets deal_ids + * + * @return int[]|null + */ + public function getDealIds() + { + return $this->container['deal_ids']; + } + + /** + * Sets deal_ids + * + * @param int[]|null $deal_ids An array of IDs of the deals this project is associated with + * + * @return self + */ + public function setDealIds($deal_ids): self + { + $this->container['deal_ids'] = $deal_ids; + + return $this; + } + + /** + * Gets person_ids + * + * @return int[]|null + */ + public function getPersonIds() + { + return $this->container['person_ids']; + } + + /** + * Sets person_ids + * + * @param int[]|null $person_ids An array of IDs of the persons this project is associated with + * + * @return self + */ + public function setPersonIds($person_ids): self + { + $this->container['person_ids'] = $person_ids; + + return $this; + } + + /** + * Gets org_ids + * + * @return int[]|null + */ + public function getOrgIds() + { + return $this->container['org_ids']; + } + + /** + * Sets org_ids + * + * @param int[]|null $org_ids An array of IDs of the organizations this project is associated with + * + * @return self + */ + public function setOrgIds($org_ids): self + { + $this->container['org_ids'] = $org_ids; + + return $this; + } + + /** + * Gets label_ids + * + * @return int[]|null + */ + public function getLabelIds() + { + return $this->container['label_ids']; + } + + /** + * Sets label_ids + * + * @param int[]|null $label_ids An array of IDs of the labels this project has + * + * @return self + */ + public function setLabelIds($label_ids): self + { + $this->container['label_ids'] = $label_ids; + + return $this; + } + + /** + * Gets template_id + * + * @return int|null + */ + public function getTemplateId() + { + return $this->container['template_id']; + } + + /** + * Sets template_id + * + * @param int|null $template_id The ID of the template the project will be based on. Only used when creating a new project. + * + * @return self + */ + public function setTemplateId($template_id): self + { + $this->container['template_id'] = $template_id; + + return $this; + } + + /** + * Gets custom_fields + * + * @return array|null + */ + public function getCustomFields() + { + return $this->container['custom_fields']; + } + + /** + * Sets custom_fields + * + * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. + * + * @return self + */ + public function setCustomFields($custom_fields): self + { + $this->container['custom_fields'] = $custom_fields; + + 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/v2/Model/ProjectSearchItem.php b/lib/versions/v2/Model/ProjectSearchItem.php new file mode 100644 index 00000000..3d0c068c --- /dev/null +++ b/lib/versions/v2/Model/ProjectSearchItem.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ProjectSearchItem implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ProjectSearchItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'result_score' => 'float', + 'item' => '\Pipedrive\versions\v2\Model\ProjectSearchItemItem' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'result_score' => null, + 'item' => 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 = [ + 'result_score' => 'result_score', + 'item' => 'item' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'result_score' => 'setResultScore', + 'item' => 'setItem' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'result_score' => 'getResultScore', + 'item' => 'getItem' + ]; + + /** + * 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['result_score'] = $data['result_score'] ?? null; + $this->container['item'] = $data['item'] ?? 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 result_score + * + * @return float|null + */ + public function getResultScore() + { + return $this->container['result_score']; + } + + /** + * Sets result_score + * + * @param float|null $result_score Search result relevancy + * + * @return self + */ + public function setResultScore($result_score): self + { + $this->container['result_score'] = $result_score; + + return $this; + } + + /** + * Gets item + * + * @return \Pipedrive\versions\v2\Model\ProjectSearchItemItem|null + */ + public function getItem() + { + return $this->container['item']; + } + + /** + * Sets item + * + * @param \Pipedrive\versions\v2\Model\ProjectSearchItemItem|null $item item + * + * @return self + */ + public function setItem($item): self + { + $this->container['item'] = $item; + + 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/v2/Model/ProjectSearchItemItem.php b/lib/versions/v2/Model/ProjectSearchItemItem.php new file mode 100644 index 00000000..2a4f2df2 --- /dev/null +++ b/lib/versions/v2/Model/ProjectSearchItemItem.php @@ -0,0 +1,765 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ProjectSearchItemItem implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ProjectSearchItem_item'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'id' => 'int', + 'type' => 'string', + 'title' => 'string', + 'status' => 'string', + 'owner' => '\Pipedrive\versions\v2\Model\ProjectSearchItemItemOwner', + 'board_id' => 'int', + 'phase' => '\Pipedrive\versions\v2\Model\ProjectSearchItemItemPhase', + 'person' => '\Pipedrive\versions\v2\Model\ProjectSearchItemItemPerson', + 'organization' => '\Pipedrive\versions\v2\Model\ProjectSearchItemItemOrganization', + 'deal' => '\Pipedrive\versions\v2\Model\ProjectSearchItemItemDeal', + 'deal_count' => 'int', + 'description' => 'string', + 'end_date' => 'string', + 'custom_fields' => 'string[]', + 'notes' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'type' => null, + 'title' => null, + 'status' => null, + 'owner' => null, + 'board_id' => null, + 'phase' => null, + 'person' => null, + 'organization' => null, + 'deal' => null, + 'deal_count' => null, + 'description' => null, + 'end_date' => null, + 'custom_fields' => null, + 'notes' => 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', + 'type' => 'type', + 'title' => 'title', + 'status' => 'status', + 'owner' => 'owner', + 'board_id' => 'board_id', + 'phase' => 'phase', + 'person' => 'person', + 'organization' => 'organization', + 'deal' => 'deal', + 'deal_count' => 'deal_count', + 'description' => 'description', + 'end_date' => 'end_date', + 'custom_fields' => 'custom_fields', + 'notes' => 'notes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'type' => 'setType', + 'title' => 'setTitle', + 'status' => 'setStatus', + 'owner' => 'setOwner', + 'board_id' => 'setBoardId', + 'phase' => 'setPhase', + 'person' => 'setPerson', + 'organization' => 'setOrganization', + 'deal' => 'setDeal', + 'deal_count' => 'setDealCount', + 'description' => 'setDescription', + 'end_date' => 'setEndDate', + 'custom_fields' => 'setCustomFields', + 'notes' => 'setNotes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'type' => 'getType', + 'title' => 'getTitle', + 'status' => 'getStatus', + 'owner' => 'getOwner', + 'board_id' => 'getBoardId', + 'phase' => 'getPhase', + 'person' => 'getPerson', + 'organization' => 'getOrganization', + 'deal' => 'getDeal', + 'deal_count' => 'getDealCount', + 'description' => 'getDescription', + 'end_date' => 'getEndDate', + 'custom_fields' => 'getCustomFields', + 'notes' => 'getNotes' + ]; + + /** + * 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; + $this->container['type'] = $data['type'] ?? null; + $this->container['title'] = $data['title'] ?? null; + $this->container['status'] = $data['status'] ?? null; + $this->container['owner'] = $data['owner'] ?? null; + $this->container['board_id'] = $data['board_id'] ?? null; + $this->container['phase'] = $data['phase'] ?? null; + $this->container['person'] = $data['person'] ?? null; + $this->container['organization'] = $data['organization'] ?? null; + $this->container['deal'] = $data['deal'] ?? null; + $this->container['deal_count'] = $data['deal_count'] ?? null; + $this->container['description'] = $data['description'] ?? null; + $this->container['end_date'] = $data['end_date'] ?? null; + $this->container['custom_fields'] = $data['custom_fields'] ?? null; + $this->container['notes'] = $data['notes'] ?? 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 project + * + * @return self + */ + public function setId($id): self + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type The type of the item + * + * @return self + */ + public function setType($type): self + { + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the project + * + * @return self + */ + public function setTitle($title): self + { + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status The status of the project + * + * @return self + */ + public function setStatus($status): self + { + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets owner + * + * @return \Pipedrive\versions\v2\Model\ProjectSearchItemItemOwner|null + */ + public function getOwner() + { + return $this->container['owner']; + } + + /** + * Sets owner + * + * @param \Pipedrive\versions\v2\Model\ProjectSearchItemItemOwner|null $owner owner + * + * @return self + */ + public function setOwner($owner): self + { + $this->container['owner'] = $owner; + + return $this; + } + + /** + * Gets board_id + * + * @return int|null + */ + public function getBoardId() + { + return $this->container['board_id']; + } + + /** + * Sets board_id + * + * @param int|null $board_id The ID of the board the project belongs to + * + * @return self + */ + public function setBoardId($board_id): self + { + $this->container['board_id'] = $board_id; + + return $this; + } + + /** + * Gets phase + * + * @return \Pipedrive\versions\v2\Model\ProjectSearchItemItemPhase|null + */ + public function getPhase() + { + return $this->container['phase']; + } + + /** + * Sets phase + * + * @param \Pipedrive\versions\v2\Model\ProjectSearchItemItemPhase|null $phase phase + * + * @return self + */ + public function setPhase($phase): self + { + $this->container['phase'] = $phase; + + return $this; + } + + /** + * Gets person + * + * @return \Pipedrive\versions\v2\Model\ProjectSearchItemItemPerson|null + */ + public function getPerson() + { + return $this->container['person']; + } + + /** + * Sets person + * + * @param \Pipedrive\versions\v2\Model\ProjectSearchItemItemPerson|null $person person + * + * @return self + */ + public function setPerson($person): self + { + $this->container['person'] = $person; + + return $this; + } + + /** + * Gets organization + * + * @return \Pipedrive\versions\v2\Model\ProjectSearchItemItemOrganization|null + */ + public function getOrganization() + { + return $this->container['organization']; + } + + /** + * Sets organization + * + * @param \Pipedrive\versions\v2\Model\ProjectSearchItemItemOrganization|null $organization organization + * + * @return self + */ + public function setOrganization($organization): self + { + $this->container['organization'] = $organization; + + return $this; + } + + /** + * Gets deal + * + * @return \Pipedrive\versions\v2\Model\ProjectSearchItemItemDeal|null + */ + public function getDeal() + { + return $this->container['deal']; + } + + /** + * Sets deal + * + * @param \Pipedrive\versions\v2\Model\ProjectSearchItemItemDeal|null $deal deal + * + * @return self + */ + public function setDeal($deal): self + { + $this->container['deal'] = $deal; + + return $this; + } + + /** + * Gets deal_count + * + * @return int|null + */ + public function getDealCount() + { + return $this->container['deal_count']; + } + + /** + * Sets deal_count + * + * @param int|null $deal_count The number of deals associated with the project + * + * @return self + */ + public function setDealCount($deal_count): self + { + $this->container['deal_count'] = $deal_count; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description The description of the project + * + * @return self + */ + public function setDescription($description): self + { + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets end_date + * + * @return string|null + */ + public function getEndDate() + { + return $this->container['end_date']; + } + + /** + * Sets end_date + * + * @param string|null $end_date The end date of the project + * + * @return self + */ + public function setEndDate($end_date): self + { + $this->container['end_date'] = $end_date; + + return $this; + } + + /** + * Gets custom_fields + * + * @return string[]|null + */ + public function getCustomFields() + { + return $this->container['custom_fields']; + } + + /** + * Sets custom_fields + * + * @param string[]|null $custom_fields Custom fields + * + * @return self + */ + public function setCustomFields($custom_fields): self + { + $this->container['custom_fields'] = $custom_fields; + + return $this; + } + + /** + * Gets notes + * + * @return string[]|null + */ + public function getNotes() + { + return $this->container['notes']; + } + + /** + * Sets notes + * + * @param string[]|null $notes An array of notes + * + * @return self + */ + public function setNotes($notes): self + { + $this->container['notes'] = $notes; + + 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/v2/Model/ProjectSearchItemItemDeal.php b/lib/versions/v2/Model/ProjectSearchItemItemDeal.php new file mode 100644 index 00000000..95a0a044 --- /dev/null +++ b/lib/versions/v2/Model/ProjectSearchItemItemDeal.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ProjectSearchItemItemDeal implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ProjectSearchItem_item_deal'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'id' => 'int', + 'title' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'title' => 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', + 'title' => 'title' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'title' => 'setTitle' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'title' => 'getTitle' + ]; + + /** + * 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; + $this->container['title'] = $data['title'] ?? 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 deal the project is associated with + * + * @return self + */ + public function setId($id): self + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the deal the project is associated with + * + * @return self + */ + public function setTitle($title): self + { + $this->container['title'] = $title; + + 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/v2/Model/ProjectSearchItemItemOrganization.php b/lib/versions/v2/Model/ProjectSearchItemItemOrganization.php new file mode 100644 index 00000000..10779146 --- /dev/null +++ b/lib/versions/v2/Model/ProjectSearchItemItemOrganization.php @@ -0,0 +1,405 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ProjectSearchItemItemOrganization implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ProjectSearchItem_item_organization'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'id' => 'int', + 'name' => 'string', + 'address' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'address' => 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', + 'name' => 'name', + 'address' => 'address' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'address' => 'setAddress' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'address' => 'getAddress' + ]; + + /** + * 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; + $this->container['name'] = $data['name'] ?? null; + $this->container['address'] = $data['address'] ?? 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 organization the project is associated with + * + * @return self + */ + public function setId($id): self + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The name of the organization the project is associated with + * + * @return self + */ + public function setName($name): self + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets address + * + * @return string|null + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param string|null $address The address of the organization the project is associated with + * + * @return self + */ + public function setAddress($address): self + { + $this->container['address'] = $address; + + 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/v2/Model/ProjectSearchItemItemOwner.php b/lib/versions/v2/Model/ProjectSearchItemItemOwner.php new file mode 100644 index 00000000..72f18058 --- /dev/null +++ b/lib/versions/v2/Model/ProjectSearchItemItemOwner.php @@ -0,0 +1,345 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ProjectSearchItemItemOwner implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ProjectSearchItem_item_owner'; + + /** + * 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 owner of the project + * + * @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/v2/Model/ProjectSearchItemItemPerson.php b/lib/versions/v2/Model/ProjectSearchItemItemPerson.php new file mode 100644 index 00000000..7b8f4f3e --- /dev/null +++ b/lib/versions/v2/Model/ProjectSearchItemItemPerson.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ProjectSearchItemItemPerson implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ProjectSearchItem_item_person'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'id' => 'int', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => 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', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName' + ]; + + /** + * 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; + $this->container['name'] = $data['name'] ?? 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 person the project is associated with + * + * @return self + */ + public function setId($id): self + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The name of the person the project is associated with + * + * @return self + */ + public function setName($name): self + { + $this->container['name'] = $name; + + 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/v2/Model/ProjectSearchItemItemPhase.php b/lib/versions/v2/Model/ProjectSearchItemItemPhase.php new file mode 100644 index 00000000..c68b3c1e --- /dev/null +++ b/lib/versions/v2/Model/ProjectSearchItemItemPhase.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ProjectSearchItemItemPhase implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ProjectSearchItem_item_phase'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'id' => 'int', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => 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', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName' + ]; + + /** + * 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; + $this->container['name'] = $data['name'] ?? 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 phase + * + * @return self + */ + public function setId($id): self + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The name of the phase + * + * @return self + */ + public function setName($name): self + { + $this->container['name'] = $name; + + 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/v2/Model/ProjectSearchResponse.php b/lib/versions/v2/Model/ProjectSearchResponse.php new file mode 100644 index 00000000..cd9ec3f1 --- /dev/null +++ b/lib/versions/v2/Model/ProjectSearchResponse.php @@ -0,0 +1,405 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ProjectSearchResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ProjectSearchResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'success' => 'bool', + 'data' => '\Pipedrive\versions\v2\Model\ProjectSearchResponseAllOfData', + 'additional_data' => '\Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success' => null, + 'data' => null, + 'additional_data' => 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 = [ + 'success' => 'success', + 'data' => 'data', + 'additional_data' => 'additional_data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'data' => 'setData', + 'additional_data' => 'setAdditionalData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'data' => 'getData', + 'additional_data' => 'getAdditionalData' + ]; + + /** + * 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['success'] = $data['success'] ?? null; + $this->container['data'] = $data['data'] ?? null; + $this->container['additional_data'] = $data['additional_data'] ?? 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 success + * + * @return bool|null + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool|null $success If the response is successful or not + * + * @return self + */ + public function setSuccess($success): self + { + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets data + * + * @return \Pipedrive\versions\v2\Model\ProjectSearchResponseAllOfData|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\ProjectSearchResponseAllOfData|null $data data + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets additional_data + * + * @return \Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination|null + */ + public function getAdditionalData() + { + return $this->container['additional_data']; + } + + /** + * Sets additional_data + * + * @param \Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination|null $additional_data additional_data + * + * @return self + */ + public function setAdditionalData($additional_data): self + { + $this->container['additional_data'] = $additional_data; + + 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/v2/Model/ProjectSearchResponseAllOf.php b/lib/versions/v2/Model/ProjectSearchResponseAllOf.php new file mode 100644 index 00000000..afa72559 --- /dev/null +++ b/lib/versions/v2/Model/ProjectSearchResponseAllOf.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ProjectSearchResponseAllOf implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ProjectSearchResponse_allOf'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'data' => '\Pipedrive\versions\v2\Model\ProjectSearchResponseAllOfData', + 'additional_data' => '\Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'data' => null, + 'additional_data' => 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 = [ + 'data' => 'data', + 'additional_data' => 'additional_data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'data' => 'setData', + 'additional_data' => 'setAdditionalData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'data' => 'getData', + 'additional_data' => 'getAdditionalData' + ]; + + /** + * 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['data'] = $data['data'] ?? null; + $this->container['additional_data'] = $data['additional_data'] ?? 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 data + * + * @return \Pipedrive\versions\v2\Model\ProjectSearchResponseAllOfData|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\ProjectSearchResponseAllOfData|null $data data + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets additional_data + * + * @return \Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination|null + */ + public function getAdditionalData() + { + return $this->container['additional_data']; + } + + /** + * Sets additional_data + * + * @param \Pipedrive\versions\v2\Model\AdditionalDataWithCursorPagination|null $additional_data additional_data + * + * @return self + */ + public function setAdditionalData($additional_data): self + { + $this->container['additional_data'] = $additional_data; + + 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/v2/Model/ProjectSearchResponseAllOfData.php b/lib/versions/v2/Model/ProjectSearchResponseAllOfData.php new file mode 100644 index 00000000..08c77bb6 --- /dev/null +++ b/lib/versions/v2/Model/ProjectSearchResponseAllOfData.php @@ -0,0 +1,345 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ProjectSearchResponseAllOfData implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ProjectSearchResponse_allOf_data'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'items' => '\Pipedrive\versions\v2\Model\ProjectSearchItem[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'items' => 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 = [ + 'items' => 'items' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'items' => 'setItems' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'items' => 'getItems' + ]; + + /** + * 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['items'] = $data['items'] ?? 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 items + * + * @return \Pipedrive\versions\v2\Model\ProjectSearchItem[]|null + */ + public function getItems() + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \Pipedrive\versions\v2\Model\ProjectSearchItem[]|null $items The array of found projects + * + * @return self + */ + public function setItems($items): self + { + $this->container['items'] = $items; + + 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/v2/Model/ProjectTemplateItem.php b/lib/versions/v2/Model/ProjectTemplateItem.php new file mode 100644 index 00000000..7c9f7cdc --- /dev/null +++ b/lib/versions/v2/Model/ProjectTemplateItem.php @@ -0,0 +1,525 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ProjectTemplateItem implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ProjectTemplateItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'id' => 'int', + 'title' => 'string', + 'description' => 'string', + 'projects_board_id' => 'int', + 'owner_id' => 'int', + 'add_time' => 'string', + 'update_time' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'title' => null, + 'description' => null, + 'projects_board_id' => null, + 'owner_id' => null, + 'add_time' => null, + 'update_time' => 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', + 'title' => 'title', + 'description' => 'description', + 'projects_board_id' => 'projects_board_id', + 'owner_id' => 'owner_id', + 'add_time' => 'add_time', + 'update_time' => 'update_time' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'title' => 'setTitle', + 'description' => 'setDescription', + 'projects_board_id' => 'setProjectsBoardId', + 'owner_id' => 'setOwnerId', + 'add_time' => 'setAddTime', + 'update_time' => 'setUpdateTime' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'title' => 'getTitle', + 'description' => 'getDescription', + 'projects_board_id' => 'getProjectsBoardId', + 'owner_id' => 'getOwnerId', + 'add_time' => 'getAddTime', + 'update_time' => 'getUpdateTime' + ]; + + /** + * 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; + $this->container['title'] = $data['title'] ?? null; + $this->container['description'] = $data['description'] ?? null; + $this->container['projects_board_id'] = $data['projects_board_id'] ?? null; + $this->container['owner_id'] = $data['owner_id'] ?? null; + $this->container['add_time'] = $data['add_time'] ?? null; + $this->container['update_time'] = $data['update_time'] ?? 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 project template + * + * @return self + */ + public function setId($id): self + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the project template + * + * @return self + */ + public function setTitle($title): self + { + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description The description of the project template + * + * @return self + */ + public function setDescription($description): self + { + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets projects_board_id + * + * @return int|null + */ + public function getProjectsBoardId() + { + return $this->container['projects_board_id']; + } + + /** + * Sets projects_board_id + * + * @param int|null $projects_board_id The ID of the project board this template is associated with + * + * @return self + */ + public function setProjectsBoardId($projects_board_id): self + { + $this->container['projects_board_id'] = $projects_board_id; + + return $this; + } + + /** + * Gets owner_id + * + * @return int|null + */ + public function getOwnerId() + { + return $this->container['owner_id']; + } + + /** + * Sets owner_id + * + * @param int|null $owner_id The ID of the owner of the project template + * + * @return self + */ + public function setOwnerId($owner_id): self + { + $this->container['owner_id'] = $owner_id; + + 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 creation date and time of the project template in ISO 8601 format + * + * @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 date and time of the project template in ISO 8601 format + * + * @return self + */ + public function setUpdateTime($update_time): self + { + $this->container['update_time'] = $update_time; + + 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/v2/Model/TaskItem.php b/lib/versions/v2/Model/TaskItem.php new file mode 100644 index 00000000..53adcd21 --- /dev/null +++ b/lib/versions/v2/Model/TaskItem.php @@ -0,0 +1,789 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class TaskItem implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'TaskItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'id' => 'int', + 'title' => 'string', + 'creator_id' => 'int', + 'description' => 'string', + 'project_id' => 'int', + 'is_done' => 'bool', + 'is_milestone' => 'bool', + 'due_date' => '\DateTime', + 'start_date' => '\DateTime', + 'parent_task_id' => 'int', + 'assignee_ids' => 'int[]', + 'priority' => 'int', + 'add_time' => 'string', + 'update_time' => 'string', + 'marked_as_done_time' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'title' => null, + 'creator_id' => null, + 'description' => null, + 'project_id' => null, + 'is_done' => null, + 'is_milestone' => null, + 'due_date' => 'date', + 'start_date' => 'date', + 'parent_task_id' => null, + 'assignee_ids' => null, + 'priority' => null, + 'add_time' => null, + 'update_time' => null, + 'marked_as_done_time' => 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', + 'title' => 'title', + 'creator_id' => 'creator_id', + 'description' => 'description', + 'project_id' => 'project_id', + 'is_done' => 'is_done', + 'is_milestone' => 'is_milestone', + 'due_date' => 'due_date', + 'start_date' => 'start_date', + 'parent_task_id' => 'parent_task_id', + 'assignee_ids' => 'assignee_ids', + 'priority' => 'priority', + 'add_time' => 'add_time', + 'update_time' => 'update_time', + 'marked_as_done_time' => 'marked_as_done_time' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'title' => 'setTitle', + 'creator_id' => 'setCreatorId', + 'description' => 'setDescription', + 'project_id' => 'setProjectId', + 'is_done' => 'setIsDone', + 'is_milestone' => 'setIsMilestone', + 'due_date' => 'setDueDate', + 'start_date' => 'setStartDate', + 'parent_task_id' => 'setParentTaskId', + 'assignee_ids' => 'setAssigneeIds', + 'priority' => 'setPriority', + 'add_time' => 'setAddTime', + 'update_time' => 'setUpdateTime', + 'marked_as_done_time' => 'setMarkedAsDoneTime' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'title' => 'getTitle', + 'creator_id' => 'getCreatorId', + 'description' => 'getDescription', + 'project_id' => 'getProjectId', + 'is_done' => 'getIsDone', + 'is_milestone' => 'getIsMilestone', + 'due_date' => 'getDueDate', + 'start_date' => 'getStartDate', + 'parent_task_id' => 'getParentTaskId', + 'assignee_ids' => 'getAssigneeIds', + 'priority' => 'getPriority', + 'add_time' => 'getAddTime', + 'update_time' => 'getUpdateTime', + 'marked_as_done_time' => 'getMarkedAsDoneTime' + ]; + + /** + * 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; + $this->container['title'] = $data['title'] ?? null; + $this->container['creator_id'] = $data['creator_id'] ?? null; + $this->container['description'] = $data['description'] ?? null; + $this->container['project_id'] = $data['project_id'] ?? null; + $this->container['is_done'] = $data['is_done'] ?? null; + $this->container['is_milestone'] = $data['is_milestone'] ?? null; + $this->container['due_date'] = $data['due_date'] ?? null; + $this->container['start_date'] = $data['start_date'] ?? null; + $this->container['parent_task_id'] = $data['parent_task_id'] ?? null; + $this->container['assignee_ids'] = $data['assignee_ids'] ?? null; + $this->container['priority'] = $data['priority'] ?? null; + $this->container['add_time'] = $data['add_time'] ?? null; + $this->container['update_time'] = $data['update_time'] ?? null; + $this->container['marked_as_done_time'] = $data['marked_as_done_time'] ?? 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 = []; + + if (!is_null($this->container['title']) && (mb_strlen($this->container['title']) > 255)) { + $invalidProperties[] = "invalid value for 'title', the character length must be smaller than or equal to 255."; + } + + if (!is_null($this->container['title']) && (mb_strlen($this->container['title']) < 1)) { + $invalidProperties[] = "invalid value for 'title', the character length must be bigger than or equal to 1."; + } + + if (!is_null($this->container['priority']) && ($this->container['priority'] < 0)) { + $invalidProperties[] = "invalid value for 'priority', must be bigger than or equal to 0."; + } + + 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 task + * + * @return self + */ + public function setId($id): self + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the task + * + * @return self + */ + public function setTitle($title): self + { + if (!is_null($title) && (mb_strlen($title) > 255)) { + throw new \InvalidArgumentException('invalid length for $title when calling TaskItem., must be smaller than or equal to 255.'); + } + if (!is_null($title) && (mb_strlen($title) < 1)) { + throw new \InvalidArgumentException('invalid length for $title when calling TaskItem., must be bigger than or equal to 1.'); + } + + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets creator_id + * + * @return int|null + */ + public function getCreatorId() + { + return $this->container['creator_id']; + } + + /** + * Sets creator_id + * + * @param int|null $creator_id The ID of the user who created the task + * + * @return self + */ + public function setCreatorId($creator_id): self + { + $this->container['creator_id'] = $creator_id; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description The description of the task + * + * @return self + */ + public function setDescription($description): self + { + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets project_id + * + * @return int|null + */ + public function getProjectId() + { + return $this->container['project_id']; + } + + /** + * Sets project_id + * + * @param int|null $project_id The ID of the project this task is associated with + * + * @return self + */ + public function setProjectId($project_id): self + { + $this->container['project_id'] = $project_id; + + return $this; + } + + /** + * Gets is_done + * + * @return bool|null + */ + public function getIsDone() + { + return $this->container['is_done']; + } + + /** + * Sets is_done + * + * @param bool|null $is_done Whether the task is done or not. + * + * @return self + */ + public function setIsDone($is_done): self + { + $this->container['is_done'] = $is_done; + + return $this; + } + + /** + * Gets is_milestone + * + * @return bool|null + */ + public function getIsMilestone() + { + return $this->container['is_milestone']; + } + + /** + * Sets is_milestone + * + * @param bool|null $is_milestone Whether the task is a milestone or not. + * + * @return self + */ + public function setIsMilestone($is_milestone): self + { + $this->container['is_milestone'] = $is_milestone; + + return $this; + } + + /** + * Gets due_date + * + * @return \DateTime|null + */ + public function getDueDate() + { + return $this->container['due_date']; + } + + /** + * Sets due_date + * + * @param \DateTime|null $due_date The due date of the task. Format: YYYY-MM-DD. + * + * @return self + */ + public function setDueDate($due_date): self + { + $this->container['due_date'] = $due_date; + + return $this; + } + + /** + * Gets start_date + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['start_date']; + } + + /** + * Sets start_date + * + * @param \DateTime|null $start_date The start date of the task. Format: YYYY-MM-DD. + * + * @return self + */ + public function setStartDate($start_date): self + { + $this->container['start_date'] = $start_date; + + return $this; + } + + /** + * Gets parent_task_id + * + * @return int|null + */ + public function getParentTaskId() + { + return $this->container['parent_task_id']; + } + + /** + * Sets parent_task_id + * + * @param int|null $parent_task_id The ID of the parent task. If `null`, the task is a root-level task. + * + * @return self + */ + public function setParentTaskId($parent_task_id): self + { + $this->container['parent_task_id'] = $parent_task_id; + + return $this; + } + + /** + * Gets assignee_ids + * + * @return int[]|null + */ + public function getAssigneeIds() + { + return $this->container['assignee_ids']; + } + + /** + * Sets assignee_ids + * + * @param int[]|null $assignee_ids The IDs of users assigned to the task + * + * @return self + */ + public function setAssigneeIds($assignee_ids): self + { + $this->container['assignee_ids'] = $assignee_ids; + + return $this; + } + + /** + * Gets priority + * + * @return int|null + */ + public function getPriority() + { + return $this->container['priority']; + } + + /** + * Sets priority + * + * @param int|null $priority The priority of the task + * + * @return self + */ + public function setPriority($priority): self + { + + if (!is_null($priority) && ($priority < 0)) { + throw new \InvalidArgumentException('invalid value for $priority when calling TaskItem., must be bigger than or equal to 0.'); + } + + $this->container['priority'] = $priority; + + 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 creation date and time of the task in ISO 8601 format + * + * @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 date and time of the task in ISO 8601 format + * + * @return self + */ + public function setUpdateTime($update_time): self + { + $this->container['update_time'] = $update_time; + + return $this; + } + + /** + * Gets marked_as_done_time + * + * @return string|null + */ + public function getMarkedAsDoneTime() + { + return $this->container['marked_as_done_time']; + } + + /** + * Sets marked_as_done_time + * + * @param string|null $marked_as_done_time The date and time the task was marked as done in ISO 8601 format + * + * @return self + */ + public function setMarkedAsDoneTime($marked_as_done_time): self + { + $this->container['marked_as_done_time'] = $marked_as_done_time; + + 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/v2/Model/TaskPatchRequest.php b/lib/versions/v2/Model/TaskPatchRequest.php new file mode 100644 index 00000000..976c4c38 --- /dev/null +++ b/lib/versions/v2/Model/TaskPatchRequest.php @@ -0,0 +1,749 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class TaskPatchRequest implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'TaskPatchRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'title' => 'string', + 'project_id' => 'int', + 'parent_task_id' => 'int', + 'description' => 'string', + 'done' => 'int', + 'milestone' => 'int', + 'due_date' => '\DateTime', + 'start_date' => '\DateTime', + 'assignee_id' => 'int', + 'assignee_ids' => 'int[]', + 'priority' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'title' => null, + 'project_id' => null, + 'parent_task_id' => null, + 'description' => null, + 'done' => null, + 'milestone' => null, + 'due_date' => 'date', + 'start_date' => 'date', + 'assignee_id' => null, + 'assignee_ids' => null, + 'priority' => 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 = [ + 'title' => 'title', + 'project_id' => 'project_id', + 'parent_task_id' => 'parent_task_id', + 'description' => 'description', + 'done' => 'done', + 'milestone' => 'milestone', + 'due_date' => 'due_date', + 'start_date' => 'start_date', + 'assignee_id' => 'assignee_id', + 'assignee_ids' => 'assignee_ids', + 'priority' => 'priority' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'title' => 'setTitle', + 'project_id' => 'setProjectId', + 'parent_task_id' => 'setParentTaskId', + 'description' => 'setDescription', + 'done' => 'setDone', + 'milestone' => 'setMilestone', + 'due_date' => 'setDueDate', + 'start_date' => 'setStartDate', + 'assignee_id' => 'setAssigneeId', + 'assignee_ids' => 'setAssigneeIds', + 'priority' => 'setPriority' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'title' => 'getTitle', + 'project_id' => 'getProjectId', + 'parent_task_id' => 'getParentTaskId', + 'description' => 'getDescription', + 'done' => 'getDone', + 'milestone' => 'getMilestone', + 'due_date' => 'getDueDate', + 'start_date' => 'getStartDate', + 'assignee_id' => 'getAssigneeId', + 'assignee_ids' => 'getAssigneeIds', + 'priority' => 'getPriority' + ]; + + /** + * 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; + } + + const DONE_0 = 0; + const DONE_1 = 1; + const MILESTONE_0 = 0; + const MILESTONE_1 = 1; + + /** + * Gets allowable values of the enum + * + * @phpstan-return array + * @phpsalm-return array + * @return (string|int)[] + */ + public function getDoneAllowableValues(): array + { + return [ + self::DONE_0, + self::DONE_1, + ]; + } + + /** + * Gets allowable values of the enum + * + * @phpstan-return array + * @phpsalm-return array + * @return (string|int)[] + */ + public function getMilestoneAllowableValues(): array + { + return [ + self::MILESTONE_0, + self::MILESTONE_1, + ]; + } + + /** + * 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['title'] = $data['title'] ?? null; + $this->container['project_id'] = $data['project_id'] ?? null; + $this->container['parent_task_id'] = $data['parent_task_id'] ?? null; + $this->container['description'] = $data['description'] ?? null; + $this->container['done'] = $data['done'] ?? null; + $this->container['milestone'] = $data['milestone'] ?? null; + $this->container['due_date'] = $data['due_date'] ?? null; + $this->container['start_date'] = $data['start_date'] ?? null; + $this->container['assignee_id'] = $data['assignee_id'] ?? null; + $this->container['assignee_ids'] = $data['assignee_ids'] ?? null; + $this->container['priority'] = $data['priority'] ?? 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 = []; + + if (!is_null($this->container['title']) && (mb_strlen($this->container['title']) > 255)) { + $invalidProperties[] = "invalid value for 'title', the character length must be smaller than or equal to 255."; + } + + if (!is_null($this->container['title']) && (mb_strlen($this->container['title']) < 1)) { + $invalidProperties[] = "invalid value for 'title', the character length must be bigger than or equal to 1."; + } + + $allowedValues = $this->getDoneAllowableValues(); + if (!is_null($this->container['done']) && !in_array($this->container['done'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'done', must be one of '%s'", + $this->container['done'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getMilestoneAllowableValues(); + if (!is_null($this->container['milestone']) && !in_array($this->container['milestone'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'milestone', must be one of '%s'", + $this->container['milestone'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['assignee_ids']) && (count($this->container['assignee_ids']) > 10)) { + $invalidProperties[] = "invalid value for 'assignee_ids', number of items must be less than or equal to 10."; + } + + if (!is_null($this->container['priority']) && ($this->container['priority'] < 0)) { + $invalidProperties[] = "invalid value for 'priority', must be bigger than or equal to 0."; + } + + 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 title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the task + * + * @return self + */ + public function setTitle($title): self + { + if (!is_null($title) && (mb_strlen($title) > 255)) { + throw new \InvalidArgumentException('invalid length for $title when calling TaskPatchRequest., must be smaller than or equal to 255.'); + } + if (!is_null($title) && (mb_strlen($title) < 1)) { + throw new \InvalidArgumentException('invalid length for $title when calling TaskPatchRequest., must be bigger than or equal to 1.'); + } + + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets project_id + * + * @return int|null + */ + public function getProjectId() + { + return $this->container['project_id']; + } + + /** + * Sets project_id + * + * @param int|null $project_id The ID of the project this task is associated with + * + * @return self + */ + public function setProjectId($project_id): self + { + $this->container['project_id'] = $project_id; + + return $this; + } + + /** + * Gets parent_task_id + * + * @return int|null + */ + public function getParentTaskId() + { + return $this->container['parent_task_id']; + } + + /** + * Sets parent_task_id + * + * @param int|null $parent_task_id The ID of the parent task. Cannot be the ID of a task that is already a subtask. + * + * @return self + */ + public function setParentTaskId($parent_task_id): self + { + $this->container['parent_task_id'] = $parent_task_id; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description The description of the task + * + * @return self + */ + public function setDescription($description): self + { + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets done + * + * @return int|null + */ + public function getDone() + { + return $this->container['done']; + } + + /** + * Sets done + * + * @param int|null $done Whether the task is done or not. `0` = Not done, `1` = Done. + * + * @return self + */ + public function setDone($done): self + { + $allowedValues = $this->getDoneAllowableValues(); + if (!is_null($done) && !in_array($done, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'done', must be one of '%s'", + $done, + implode("', '", $allowedValues) + ) + ); + } + $this->container['done'] = $done; + + return $this; + } + + /** + * Gets milestone + * + * @return int|null + */ + public function getMilestone() + { + return $this->container['milestone']; + } + + /** + * Sets milestone + * + * @param int|null $milestone Whether the task is a milestone or not. `0` = Not a milestone, `1` = Milestone. + * + * @return self + */ + public function setMilestone($milestone): self + { + $allowedValues = $this->getMilestoneAllowableValues(); + if (!is_null($milestone) && !in_array($milestone, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'milestone', must be one of '%s'", + $milestone, + implode("', '", $allowedValues) + ) + ); + } + $this->container['milestone'] = $milestone; + + return $this; + } + + /** + * Gets due_date + * + * @return \DateTime|null + */ + public function getDueDate() + { + return $this->container['due_date']; + } + + /** + * Sets due_date + * + * @param \DateTime|null $due_date The due date of the task. Format: YYYY-MM-DD. + * + * @return self + */ + public function setDueDate($due_date): self + { + $this->container['due_date'] = $due_date; + + return $this; + } + + /** + * Gets start_date + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['start_date']; + } + + /** + * Sets start_date + * + * @param \DateTime|null $start_date The start date of the task. Format: YYYY-MM-DD. + * + * @return self + */ + public function setStartDate($start_date): self + { + $this->container['start_date'] = $start_date; + + return $this; + } + + /** + * Gets assignee_id + * + * @return int|null + */ + public function getAssigneeId() + { + return $this->container['assignee_id']; + } + + /** + * Sets assignee_id + * + * @param int|null $assignee_id The ID of the user assigned to the task. When set, the `assignee_ids` field will be overwritten with this value. + * + * @return self + */ + public function setAssigneeId($assignee_id): self + { + $this->container['assignee_id'] = $assignee_id; + + return $this; + } + + /** + * Gets assignee_ids + * + * @return int[]|null + */ + public function getAssigneeIds() + { + return $this->container['assignee_ids']; + } + + /** + * Sets assignee_ids + * + * @param int[]|null $assignee_ids The IDs of users assigned to the task. When set, the `assignee_id` field will be set to the first value in this array, or `null` if empty. + * + * @return self + */ + public function setAssigneeIds($assignee_ids): self + { + + if (!is_null($assignee_ids) && (count($assignee_ids) > 10)) { + throw new \InvalidArgumentException('invalid value for $assignee_ids when calling TaskPatchRequest., number of items must be less than or equal to 10.'); + } + $this->container['assignee_ids'] = $assignee_ids; + + return $this; + } + + /** + * Gets priority + * + * @return int|null + */ + public function getPriority() + { + return $this->container['priority']; + } + + /** + * Sets priority + * + * @param int|null $priority The priority of the task + * + * @return self + */ + public function setPriority($priority): self + { + + if (!is_null($priority) && ($priority < 0)) { + throw new \InvalidArgumentException('invalid value for $priority when calling TaskPatchRequest., must be bigger than or equal to 0.'); + } + + $this->container['priority'] = $priority; + + 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/v2/Model/TaskPostRequest.php b/lib/versions/v2/Model/TaskPostRequest.php new file mode 100644 index 00000000..48725acc --- /dev/null +++ b/lib/versions/v2/Model/TaskPostRequest.php @@ -0,0 +1,755 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class TaskPostRequest implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'TaskPostRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'title' => 'string', + 'project_id' => 'int', + 'parent_task_id' => 'int', + 'description' => 'string', + 'done' => 'int', + 'milestone' => 'int', + 'due_date' => '\DateTime', + 'start_date' => '\DateTime', + 'assignee_id' => 'int', + 'assignee_ids' => 'int[]', + 'priority' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'title' => null, + 'project_id' => null, + 'parent_task_id' => null, + 'description' => null, + 'done' => null, + 'milestone' => null, + 'due_date' => 'date', + 'start_date' => 'date', + 'assignee_id' => null, + 'assignee_ids' => null, + 'priority' => 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 = [ + 'title' => 'title', + 'project_id' => 'project_id', + 'parent_task_id' => 'parent_task_id', + 'description' => 'description', + 'done' => 'done', + 'milestone' => 'milestone', + 'due_date' => 'due_date', + 'start_date' => 'start_date', + 'assignee_id' => 'assignee_id', + 'assignee_ids' => 'assignee_ids', + 'priority' => 'priority' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'title' => 'setTitle', + 'project_id' => 'setProjectId', + 'parent_task_id' => 'setParentTaskId', + 'description' => 'setDescription', + 'done' => 'setDone', + 'milestone' => 'setMilestone', + 'due_date' => 'setDueDate', + 'start_date' => 'setStartDate', + 'assignee_id' => 'setAssigneeId', + 'assignee_ids' => 'setAssigneeIds', + 'priority' => 'setPriority' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'title' => 'getTitle', + 'project_id' => 'getProjectId', + 'parent_task_id' => 'getParentTaskId', + 'description' => 'getDescription', + 'done' => 'getDone', + 'milestone' => 'getMilestone', + 'due_date' => 'getDueDate', + 'start_date' => 'getStartDate', + 'assignee_id' => 'getAssigneeId', + 'assignee_ids' => 'getAssigneeIds', + 'priority' => 'getPriority' + ]; + + /** + * 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; + } + + const DONE_0 = 0; + const DONE_1 = 1; + const MILESTONE_0 = 0; + const MILESTONE_1 = 1; + + /** + * Gets allowable values of the enum + * + * @phpstan-return array + * @phpsalm-return array + * @return (string|int)[] + */ + public function getDoneAllowableValues(): array + { + return [ + self::DONE_0, + self::DONE_1, + ]; + } + + /** + * Gets allowable values of the enum + * + * @phpstan-return array + * @phpsalm-return array + * @return (string|int)[] + */ + public function getMilestoneAllowableValues(): array + { + return [ + self::MILESTONE_0, + self::MILESTONE_1, + ]; + } + + /** + * 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['title'] = $data['title'] ?? null; + $this->container['project_id'] = $data['project_id'] ?? null; + $this->container['parent_task_id'] = $data['parent_task_id'] ?? null; + $this->container['description'] = $data['description'] ?? null; + $this->container['done'] = $data['done'] ?? null; + $this->container['milestone'] = $data['milestone'] ?? null; + $this->container['due_date'] = $data['due_date'] ?? null; + $this->container['start_date'] = $data['start_date'] ?? null; + $this->container['assignee_id'] = $data['assignee_id'] ?? null; + $this->container['assignee_ids'] = $data['assignee_ids'] ?? null; + $this->container['priority'] = $data['priority'] ?? 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 = []; + + if ($this->container['title'] === null) { + $invalidProperties[] = "'title' can't be null"; + } + if ((mb_strlen($this->container['title']) > 255)) { + $invalidProperties[] = "invalid value for 'title', the character length must be smaller than or equal to 255."; + } + + if ((mb_strlen($this->container['title']) < 1)) { + $invalidProperties[] = "invalid value for 'title', the character length must be bigger than or equal to 1."; + } + + if ($this->container['project_id'] === null) { + $invalidProperties[] = "'project_id' can't be null"; + } + $allowedValues = $this->getDoneAllowableValues(); + if (!is_null($this->container['done']) && !in_array($this->container['done'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'done', must be one of '%s'", + $this->container['done'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getMilestoneAllowableValues(); + if (!is_null($this->container['milestone']) && !in_array($this->container['milestone'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'milestone', must be one of '%s'", + $this->container['milestone'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['assignee_ids']) && (count($this->container['assignee_ids']) > 10)) { + $invalidProperties[] = "invalid value for 'assignee_ids', number of items must be less than or equal to 10."; + } + + if (!is_null($this->container['priority']) && ($this->container['priority'] < 0)) { + $invalidProperties[] = "invalid value for 'priority', must be bigger than or equal to 0."; + } + + 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 title + * + * @return string + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string $title The title of the task + * + * @return self + */ + public function setTitle($title): self + { + if ((mb_strlen($title) > 255)) { + throw new \InvalidArgumentException('invalid length for $title when calling TaskPostRequest., must be smaller than or equal to 255.'); + } + if ((mb_strlen($title) < 1)) { + throw new \InvalidArgumentException('invalid length for $title when calling TaskPostRequest., must be bigger than or equal to 1.'); + } + + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets project_id + * + * @return int + */ + public function getProjectId() + { + return $this->container['project_id']; + } + + /** + * Sets project_id + * + * @param int $project_id The ID of the project this task is associated with + * + * @return self + */ + public function setProjectId($project_id): self + { + $this->container['project_id'] = $project_id; + + return $this; + } + + /** + * Gets parent_task_id + * + * @return int|null + */ + public function getParentTaskId() + { + return $this->container['parent_task_id']; + } + + /** + * Sets parent_task_id + * + * @param int|null $parent_task_id The ID of the parent task. Cannot be the ID of a task that is already a subtask. + * + * @return self + */ + public function setParentTaskId($parent_task_id): self + { + $this->container['parent_task_id'] = $parent_task_id; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description The description of the task + * + * @return self + */ + public function setDescription($description): self + { + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets done + * + * @return int|null + */ + public function getDone() + { + return $this->container['done']; + } + + /** + * Sets done + * + * @param int|null $done Whether the task is done or not. `0` = Not done, `1` = Done. + * + * @return self + */ + public function setDone($done): self + { + $allowedValues = $this->getDoneAllowableValues(); + if (!is_null($done) && !in_array($done, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'done', must be one of '%s'", + $done, + implode("', '", $allowedValues) + ) + ); + } + $this->container['done'] = $done; + + return $this; + } + + /** + * Gets milestone + * + * @return int|null + */ + public function getMilestone() + { + return $this->container['milestone']; + } + + /** + * Sets milestone + * + * @param int|null $milestone Whether the task is a milestone or not. `0` = Not a milestone, `1` = Milestone. + * + * @return self + */ + public function setMilestone($milestone): self + { + $allowedValues = $this->getMilestoneAllowableValues(); + if (!is_null($milestone) && !in_array($milestone, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'milestone', must be one of '%s'", + $milestone, + implode("', '", $allowedValues) + ) + ); + } + $this->container['milestone'] = $milestone; + + return $this; + } + + /** + * Gets due_date + * + * @return \DateTime|null + */ + public function getDueDate() + { + return $this->container['due_date']; + } + + /** + * Sets due_date + * + * @param \DateTime|null $due_date The due date of the task. Format: YYYY-MM-DD. + * + * @return self + */ + public function setDueDate($due_date): self + { + $this->container['due_date'] = $due_date; + + return $this; + } + + /** + * Gets start_date + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['start_date']; + } + + /** + * Sets start_date + * + * @param \DateTime|null $start_date The start date of the task. Format: YYYY-MM-DD. + * + * @return self + */ + public function setStartDate($start_date): self + { + $this->container['start_date'] = $start_date; + + return $this; + } + + /** + * Gets assignee_id + * + * @return int|null + */ + public function getAssigneeId() + { + return $this->container['assignee_id']; + } + + /** + * Sets assignee_id + * + * @param int|null $assignee_id The ID of the user assigned to the task. When set, the `assignee_ids` field will be overwritten with this value. + * + * @return self + */ + public function setAssigneeId($assignee_id): self + { + $this->container['assignee_id'] = $assignee_id; + + return $this; + } + + /** + * Gets assignee_ids + * + * @return int[]|null + */ + public function getAssigneeIds() + { + return $this->container['assignee_ids']; + } + + /** + * Sets assignee_ids + * + * @param int[]|null $assignee_ids The IDs of users assigned to the task. When set, the `assignee_id` field will be set to the first value in this array, or `null` if empty. + * + * @return self + */ + public function setAssigneeIds($assignee_ids): self + { + + if (!is_null($assignee_ids) && (count($assignee_ids) > 10)) { + throw new \InvalidArgumentException('invalid value for $assignee_ids when calling TaskPostRequest., number of items must be less than or equal to 10.'); + } + $this->container['assignee_ids'] = $assignee_ids; + + return $this; + } + + /** + * Gets priority + * + * @return int|null + */ + public function getPriority() + { + return $this->container['priority']; + } + + /** + * Sets priority + * + * @param int|null $priority The priority of the task + * + * @return self + */ + public function setPriority($priority): self + { + + if (!is_null($priority) && ($priority < 0)) { + throw new \InvalidArgumentException('invalid value for $priority when calling TaskPostRequest., must be bigger than or equal to 0.'); + } + + $this->container['priority'] = $priority; + + 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/v2/Model/UpdateOrganizationFieldRequest.php b/lib/versions/v2/Model/UpdateOrganizationFieldRequest.php index 73fdadc9..505f20b6 100644 --- a/lib/versions/v2/Model/UpdateOrganizationFieldRequest.php +++ b/lib/versions/v2/Model/UpdateOrganizationFieldRequest.php @@ -69,8 +69,7 @@ class UpdateOrganizationFieldRequest implements ModelInterface, ArrayAccess, Jso 'field_name' => 'string', 'ui_visibility' => 'array', 'important_fields' => 'array', - 'required_fields' => 'array', - 'description' => 'string' + 'required_fields' => 'array' ]; /** @@ -84,8 +83,7 @@ class UpdateOrganizationFieldRequest implements ModelInterface, ArrayAccess, Jso 'field_name' => null, 'ui_visibility' => null, 'important_fields' => null, - 'required_fields' => null, - 'description' => null + 'required_fields' => null ]; /** @@ -122,8 +120,7 @@ public static function openAPIFormats(): array 'field_name' => 'field_name', 'ui_visibility' => 'ui_visibility', 'important_fields' => 'important_fields', - 'required_fields' => 'required_fields', - 'description' => 'description' + 'required_fields' => 'required_fields' ]; /** @@ -135,8 +132,7 @@ public static function openAPIFormats(): array 'field_name' => 'setFieldName', 'ui_visibility' => 'setUiVisibility', 'important_fields' => 'setImportantFields', - 'required_fields' => 'setRequiredFields', - 'description' => 'setDescription' + 'required_fields' => 'setRequiredFields' ]; /** @@ -148,8 +144,7 @@ public static function openAPIFormats(): array 'field_name' => 'getFieldName', 'ui_visibility' => 'getUiVisibility', 'important_fields' => 'getImportantFields', - 'required_fields' => 'getRequiredFields', - 'description' => 'getDescription' + 'required_fields' => 'getRequiredFields' ]; /** @@ -223,7 +218,6 @@ public function __construct(array $data = null) $this->container['ui_visibility'] = $data['ui_visibility'] ?? null; $this->container['important_fields'] = $data['important_fields'] ?? null; $this->container['required_fields'] = $data['required_fields'] ?? null; - $this->container['description'] = $data['description'] ?? null; } /** @@ -362,30 +356,6 @@ public function setRequiredFields($required_fields): self return $this; } - - /** - * Gets description - * - * @return string|null - */ - public function getDescription() - { - return $this->container['description']; - } - - /** - * Sets description - * - * @param string|null $description Field description - * - * @return self - */ - public function setDescription($description): self - { - $this->container['description'] = $description; - - return $this; - } /** * Returns true if offset exists. False otherwise. * diff --git a/lib/versions/v2/Model/UpdateProductRequestBody.php b/lib/versions/v2/Model/UpdateProductRequestBody.php index b2a81851..897cad95 100644 --- a/lib/versions/v2/Model/UpdateProductRequestBody.php +++ b/lib/versions/v2/Model/UpdateProductRequestBody.php @@ -553,7 +553,7 @@ public function getCustomFields() /** * Sets custom_fields * - * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes + * @param array|null $custom_fields An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes. To clear a custom field value, set it to `null`. For multi-option fields (field type `set`), use `null` to clear the selection — sending an empty array `[]` is not supported and will result in a validation error. * * @return self */ diff --git a/lib/versions/v2/Model/UpdateProjectFieldRequest.php b/lib/versions/v2/Model/UpdateProjectFieldRequest.php new file mode 100644 index 00000000..bc5c0e8a --- /dev/null +++ b/lib/versions/v2/Model/UpdateProjectFieldRequest.php @@ -0,0 +1,450 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class UpdateProjectFieldRequest implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'UpdateProjectFieldRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'field_name' => 'string', + 'ui_visibility' => 'array', + 'important_fields' => 'array', + 'required_fields' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'field_name' => null, + 'ui_visibility' => null, + 'important_fields' => null, + 'required_fields' => 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 = [ + 'field_name' => 'field_name', + 'ui_visibility' => 'ui_visibility', + 'important_fields' => 'important_fields', + 'required_fields' => 'required_fields' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'field_name' => 'setFieldName', + 'ui_visibility' => 'setUiVisibility', + 'important_fields' => 'setImportantFields', + 'required_fields' => 'setRequiredFields' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'field_name' => 'getFieldName', + 'ui_visibility' => 'getUiVisibility', + 'important_fields' => 'getImportantFields', + 'required_fields' => 'getRequiredFields' + ]; + + /** + * 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['field_name'] = $data['field_name'] ?? null; + $this->container['ui_visibility'] = $data['ui_visibility'] ?? null; + $this->container['important_fields'] = $data['important_fields'] ?? null; + $this->container['required_fields'] = $data['required_fields'] ?? 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 = []; + + if (!is_null($this->container['field_name']) && (mb_strlen($this->container['field_name']) > 255)) { + $invalidProperties[] = "invalid value for 'field_name', the character length must be smaller than or equal to 255."; + } + + if (!is_null($this->container['field_name']) && (mb_strlen($this->container['field_name']) < 1)) { + $invalidProperties[] = "invalid value for 'field_name', the character length must be bigger than or equal to 1."; + } + + 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 field_name + * + * @return string|null + */ + public function getFieldName() + { + return $this->container['field_name']; + } + + /** + * Sets field_name + * + * @param string|null $field_name Field name + * + * @return self + */ + public function setFieldName($field_name): self + { + if (!is_null($field_name) && (mb_strlen($field_name) > 255)) { + throw new \InvalidArgumentException('invalid length for $field_name when calling UpdateProjectFieldRequest., must be smaller than or equal to 255.'); + } + if (!is_null($field_name) && (mb_strlen($field_name) < 1)) { + throw new \InvalidArgumentException('invalid length for $field_name when calling UpdateProjectFieldRequest., must be bigger than or equal to 1.'); + } + + $this->container['field_name'] = $field_name; + + return $this; + } + + /** + * Gets ui_visibility + * + * @return array|null + */ + public function getUiVisibility() + { + return $this->container['ui_visibility']; + } + + /** + * Sets ui_visibility + * + * @param array|null $ui_visibility UI visibility settings for the field. Controls where the field appears in the Pipedrive web UI. + * + * @return self + */ + public function setUiVisibility($ui_visibility): self + { + $this->container['ui_visibility'] = $ui_visibility; + + return $this; + } + + /** + * Gets important_fields + * + * @return array|null + */ + public function getImportantFields() + { + return $this->container['important_fields']; + } + + /** + * Sets important_fields + * + * @param array|null $important_fields Configuration for highlighting the field at specific stages. + * + * @return self + */ + public function setImportantFields($important_fields): self + { + $this->container['important_fields'] = $important_fields; + + return $this; + } + + /** + * Gets required_fields + * + * @return array|null + */ + public function getRequiredFields() + { + return $this->container['required_fields']; + } + + /** + * Sets required_fields + * + * @param array|null $required_fields Required fields configuration for marking the field as mandatory when interacted with in the Pipedrive web UI. + * + * @return self + */ + public function setRequiredFields($required_fields): self + { + $this->container['required_fields'] = $required_fields; + + 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/v2/Model/UpdateTaskResponse.php b/lib/versions/v2/Model/UpdateTaskResponse.php new file mode 100644 index 00000000..f01b04f9 --- /dev/null +++ b/lib/versions/v2/Model/UpdateTaskResponse.php @@ -0,0 +1,405 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class UpdateTaskResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'UpdateTaskResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'success' => 'bool', + 'data' => '\Pipedrive\versions\v2\Model\TaskItem', + 'additional_data' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success' => null, + 'data' => null, + 'additional_data' => 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 = [ + 'success' => 'success', + 'data' => 'data', + 'additional_data' => 'additional_data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'data' => 'setData', + 'additional_data' => 'setAdditionalData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'data' => 'getData', + 'additional_data' => 'getAdditionalData' + ]; + + /** + * 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['success'] = $data['success'] ?? null; + $this->container['data'] = $data['data'] ?? null; + $this->container['additional_data'] = $data['additional_data'] ?? 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 success + * + * @return bool|null + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool|null $success If the response is successful or not + * + * @return self + */ + public function setSuccess($success): self + { + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets data + * + * @return \Pipedrive\versions\v2\Model\TaskItem|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\TaskItem|null $data data + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets additional_data + * + * @return object|null + */ + public function getAdditionalData() + { + return $this->container['additional_data']; + } + + /** + * Sets additional_data + * + * @param object|null $additional_data additional_data + * + * @return self + */ + public function setAdditionalData($additional_data): self + { + $this->container['additional_data'] = $additional_data; + + 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); + } +} + + From 45a1703eead190a29d8e72365d3157117f88921a Mon Sep 17 00:00:00 2001 From: Denis Date: Tue, 5 May 2026 15:12:51 +0300 Subject: [PATCH 3/3] Release v16.0.0 --- CHANGELOG.md | 2 ++ lib/versions/v1/Configuration.php | 4 ++-- lib/versions/v2/Configuration.php | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de411fcf..c7be9455 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -90,6 +90,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Changed - Changed `board_id` and `phase_id` to be optional in `POST /api/v1/projects` +## [16.0.0](https://github.com/pipedrive/client-php/compare/15.7.0...16.0.0) (2026-05-05) + ## [15.7.0](https://github.com/pipedrive/client-php/compare/15.6.0...15.7.0) (2026-05-05) ## [15.6.0](https://github.com/pipedrive/client-php/compare/15.5.0...15.6.0) (2026-05-05) diff --git a/lib/versions/v1/Configuration.php b/lib/versions/v1/Configuration.php index 86e83cbd..2e6c14bc 100644 --- a/lib/versions/v1/Configuration.php +++ b/lib/versions/v1/Configuration.php @@ -111,11 +111,11 @@ class Configuration */ protected string $host = 'https://api.pipedrive.com/v1'; /** - * User agent of the HTTP request, set to "Pipedrive-SDK-PHP-15.x" by default + * User agent of the HTTP request, set to "Pipedrive-SDK-PHP-16.x" by default * * @var string */ - protected string $userAgent = 'Pipedrive-SDK-PHP-15.x'; + protected string $userAgent = 'Pipedrive-SDK-PHP-16.x'; /** * Debug switch (default set to false) diff --git a/lib/versions/v2/Configuration.php b/lib/versions/v2/Configuration.php index 5b016eef..62a4384a 100644 --- a/lib/versions/v2/Configuration.php +++ b/lib/versions/v2/Configuration.php @@ -111,11 +111,11 @@ class Configuration */ protected string $host = 'https://api.pipedrive.com/api/v2'; /** - * User agent of the HTTP request, set to "Pipedrive-SDK-PHP-15.x" by default + * User agent of the HTTP request, set to "Pipedrive-SDK-PHP-16.x" by default * * @var string */ - protected string $userAgent = 'Pipedrive-SDK-PHP-15.x'; + protected string $userAgent = 'Pipedrive-SDK-PHP-16.x'; /** * Debug switch (default set to false)