diff --git a/CHANGELOG.md b/CHANGELOG.md index 67df6c6..c7be945 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,16 +6,92 @@ 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 `source_deal_id` field to Lead schema to track the deal ID when a lead is converted from a deal -- Added `source_lead_id` field to v2 Deal schema to track the lead ID when a deal is converted from a lead +- Added `source_lead_id` field to v2 Deal schema to track the lead ID when a lead is converted from a lead - Added `include_field_code` query parameter to Filters endpoints: - `GET /v1/filters/{id}` - `PUT /v1/filters/{id}` - `POST /v1/filters` - When set to `true`, each condition in the response includes a `field_code` field identifying the field by its code name. The value is `null` if the field code cannot be resolved. +- Added `assignee_ids` field to Tasks endpoints: + - `GET /v1/tasks` + - `GET /v1/tasks/{id}` + - `POST /v1/tasks` + - `PUT /v1/tasks/{id}` +### Removed +- Removed deprecated v1 endpoints that have v2 equivalents. See the [deprecation announcement](https://developers.pipedrive.com/changelog/post/deprecation-of-selected-api-v1-endpoints) for details. Please migrate to the corresponding v2 endpoints listed below: + - `GET /v1/activities` → `GET /api/v2/activities` + - `GET /v1/activities/collection` → `GET /api/v2/activities` + - `GET /v1/activities/{id}` → `GET /api/v2/activities/{id}` + - `POST /v1/activities` → `POST /api/v2/activities` + - `PUT /v1/activities/{id}` → `PATCH /api/v2/activities/{id}` + - `DELETE /v1/activities/{id}` → `DELETE /api/v2/activities/{id}` + - `GET /v1/deals` → `GET /api/v2/deals` + - `GET /v1/deals/collection` → `GET /api/v2/deals` + - `GET /v1/deals/{id}` → `GET /api/v2/deals/{id}` + - `GET /v1/deals/search` → `GET /api/v2/deals/search` + - `POST /v1/deals` → `POST /api/v2/deals` + - `PUT /v1/deals/{id}` → `PATCH /api/v2/deals/{id}` + - `DELETE /v1/deals/{id}` → `DELETE /api/v2/deals/{id}` + - `GET /v1/deals/{id}/activities` → `GET /api/v2/activities?deal_id={id}` + - `GET /v1/deals/{id}/persons` → `GET /api/v2/persons?deal_id={id}` + - `GET /v1/deals/{id}/products` → `GET /api/v2/deals/{id}/products` + - `POST /v1/deals/{id}/products` → `POST /api/v2/deals/{id}/products` + - `PUT /v1/deals/{id}/products/{product_attachment_id}` → `PATCH /api/v2/deals/{id}/products/{product_attachment_id}` + - `DELETE /v1/deals/{id}/products/{product_attachment_id}` → `DELETE /api/v2/deals/{id}/products/{product_attachment_id}` + - `GET /v1/itemSearch` → `GET /api/v2/itemSearch` + - `GET /v1/itemSearch/field` → `GET /api/v2/itemSearch/field` + - `GET /v1/organizations` → `GET /api/v2/organizations` + - `GET /v1/organizations/collection` → `GET /api/v2/organizations` + - `GET /v1/organizations/{id}` → `GET /api/v2/organizations/{id}` + - `GET /v1/organizations/search` → `GET /api/v2/organizations/search` + - `POST /v1/organizations` → `POST /api/v2/organizations` + - `PUT /v1/organizations/{id}` → `PATCH /api/v2/organizations/{id}` + - `DELETE /v1/organizations/{id}` → `DELETE /api/v2/organizations/{id}` + - `GET /v1/organizations/{id}/deals` → `GET /api/v2/deals?org_id={id}` + - `GET /v1/organizations/{id}/activities` → `GET /api/v2/activities?org_id={id}` + - `GET /v1/organizations/{id}/persons` → `GET /api/v2/persons?org_id={id}` + - `GET /v1/persons` → `GET /api/v2/persons` + - `GET /v1/persons/collection` → `GET /api/v2/persons` + - `GET /v1/persons/{id}` → `GET /api/v2/persons/{id}` + - `GET /v1/persons/search` → `GET /api/v2/persons/search` + - `POST /v1/persons` → `POST /api/v2/persons` + - `PUT /v1/persons/{id}` → `PATCH /api/v2/persons/{id}` + - `DELETE /v1/persons/{id}` → `DELETE /api/v2/persons/{id}` + - `GET /v1/persons/{id}/deals` → `GET /api/v2/deals?person_id={id}` + - `GET /v1/persons/{id}/activities` → `GET /api/v2/activities?person_id={id}` + - `GET /v1/pipelines` → `GET /api/v2/pipelines` + - `GET /v1/pipelines/{id}` → `GET /api/v2/pipelines/{id}` + - `POST /v1/pipelines` → `POST /api/v2/pipelines` + - `PUT /v1/pipelines/{id}` → `PATCH /api/v2/pipelines/{id}` + - `DELETE /v1/pipelines/{id}` → `DELETE /api/v2/pipelines/{id}` + - `GET /v1/products` → `GET /api/v2/products` + - `GET /v1/products/{id}` → `GET /api/v2/products/{id}` + - `GET /v1/products/search` → `GET /api/v2/products/search` + - `POST /v1/products` → `POST /api/v2/products` + - `PUT /v1/products/{id}` → `PATCH /api/v2/products/{id}` + - `DELETE /v1/products/{id}` → `DELETE /api/v2/products/{id}` + - `GET /v1/stages` → `GET /api/v2/stages` + - `GET /v1/stages/{id}` → `GET /api/v2/stages/{id}` + - `POST /v1/stages` → `POST /api/v2/stages` + - `PUT /v1/stages/{id}` → `PATCH /api/v2/stages/{id}` + - `DELETE /v1/stages/{id}` → `DELETE /api/v2/stages/{id}` +### Fixed +- Made `picture_id`, `org_id`, `label`, `last_name`, `cc_email`, `last_incoming_mail_time`, and `last_outgoing_mail_time` nullable in person and organization schemas to match real API behavior ### 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/docs/versions/v1/Api/NotesApi.md b/docs/versions/v1/Api/NotesApi.md index 0c1af19..25635ea 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 0000000..45e44d7 --- /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 0000000..a1d9167 --- /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 1c32825..47c9253 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 07af26b..4bc1857 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 cb0efa1..dd0e1d4 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 dfcf1e9..c37c677 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 830af4d..efd66d5 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 0000000..b530144 --- /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 2db2dcd..abb1309 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 44ae5e5..c5ab855 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 30a5862..5790cbc 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 6d74303..3d388d1 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 8585394..0638e41 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 0000000..cef0bb1 --- /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 0000000..b3d61d2 --- /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 f88e568..5a998fe 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 b67f8d5..a6ae707 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 056f637..8ffe983 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 0000000..49e4d0f --- /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 0000000..97a72b6 --- /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 0000000..47c5b7f --- /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 0000000..499d744 --- /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 0000000..47b0e91 --- /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 0000000..5175c09 --- /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 ffa422b..85b8801 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 0000000..3048aab --- /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 c46c279..5bf91a0 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 dbce82f..e13bc72 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 0000000..60c80e0 --- /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 0000000..c580ab7 --- /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 0000000..902189c --- /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 0000000..6501933 --- /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 80b3aea..51966b3 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 ea025fc..283bf6e 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 2cd5bbf..10778b9 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 0000000..285fa30 --- /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 0000000..b62a805 --- /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 0000000..895aab9 --- /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 0000000..ef60bd9 --- /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 0000000..b1b058c --- /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 0000000..2da67b2 --- /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 0000000..138a009 --- /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 0000000..2e4e01e --- /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 0000000..e406ea9 --- /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 0000000..1592a88 --- /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 0000000..8546446 --- /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 0000000..5548d6a --- /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 0000000..6fad148 --- /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 0000000..33c6a9d --- /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 0000000..820a6c0 --- /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 0000000..12d68a4 --- /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 0000000..67fe855 --- /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 0000000..0cbca78 --- /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 0000000..2f40500 --- /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 0000000..a293ef1 --- /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 0000000..860b207 --- /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 d6980dd..ed52137 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 9c1e3c8..3f9623e 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 d8b178c..fc01b57 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 8ef3ee4..d3c3c56 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 4cfa884..5b9c0c3 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 0000000..ee5df7c --- /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 0000000..5905529 --- /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 0000000..38fbe40 --- /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 0000000..48b5339 --- /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 0000000..0e1bf99 --- /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 0000000..3f10368 --- /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 c1e4541..98acd18 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 a30a749..9837674 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 0000000..1b10429 --- /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 0000000..5de8ab8 --- /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 0000000..9306974 --- /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 0000000..e8c3831 --- /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 0000000..f5050fe --- /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 0000000..5892a1f --- /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 0000000..17e6057 --- /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 0000000..cb4ef23 --- /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 0000000..7c9ffba --- /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 0000000..a8fd0de --- /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 0000000..10ca0de --- /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 0000000..ab037db --- /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 0000000..f748c3b --- /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 0000000..f851deb --- /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 0000000..d8f2637 --- /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 0000000..b09212e --- /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 0000000..71ca0ce --- /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 0000000..03660bb --- /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 0000000..ddc2e1e --- /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 0000000..f707d38 --- /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 c117d79..67c03e1 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 a7ae010..efbc02d 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 0000000..ec09583 --- /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 0000000..5426f79 --- /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 352c51c..9aa7382 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 7deeed6..e786a26 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 0000000..65c89a9 --- /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 0000000..0c82644 --- /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 e0ee7fe..d779745 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 18da14c..f43d2bc 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/Configuration.php b/lib/versions/v1/Configuration.php index 86e83cb..2e6c14b 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/v1/Model/AddNoteRequest.php b/lib/versions/v1/Model/AddNoteRequest.php index f917e99..2697791 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 c1f591f..5209c3e 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 a5267d9..fd72f50 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 0000000..cf8242c --- /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 4e13c11..cf335e6 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 5becc54..5ae8cfc 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 928b5be..87c2128 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 6b6d043..8d199c8 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 0000000..ce13f76 --- /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 0000000..3b854a6 --- /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 67ad71a..35e8a09 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 59067ea..7063b63 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 d47c0cb..46d8964 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 0000000..2462905 --- /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 0000000..1e2c150 --- /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 0000000..9e6b33f --- /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 0000000..1e64bc8 --- /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 0000000..b9df88d --- /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 0000000..136ad44 --- /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/Configuration.php b/lib/versions/v2/Configuration.php index 5b016ee..62a4384 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) diff --git a/lib/versions/v2/Model/AddProductRequestBody.php b/lib/versions/v2/Model/AddProductRequestBody.php index 810e09d..2457b8c 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 0000000..bad7b52 --- /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 36306da..e2b3405 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 cb1cc11..97dfcac 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 0000000..6696b15 --- /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 0000000..25a24da --- /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 0000000..218fcda --- /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 0000000..a144cbd --- /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 77aeb40..afeb31f 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 75c8730..9716bab 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 a9bdec2..aca07fa 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 0000000..b4c1b28 --- /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 0000000..496ba4b --- /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 0000000..05f6d1d --- /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 0000000..e7e91fe --- /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 0000000..b11729a --- /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 0000000..cf532e1 --- /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 0000000..ebbb8bb --- /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 0000000..88a2a5f --- /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 0000000..3fbf5a3 --- /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 0000000..d28d7e1 --- /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 0000000..ac2e639 --- /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 0000000..e52e5a7 --- /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 0000000..245b881 --- /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 0000000..2b21cae --- /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 0000000..0fe566f --- /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 0000000..5e7c23f --- /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 0000000..f700b2a --- /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 0000000..de61d1d --- /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 0000000..43d00e3 --- /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 0000000..b15d5ce --- /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 0000000..cbd2c73 --- /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 4e90743..8c9575a 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 e086ff9..9dcc0ce 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 c3cc77f..dd32b8a 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 8863bd1..628e717 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 cf2072e..66889c3 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 0000000..f8d6926 --- /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 0000000..49f4632 --- /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 0000000..94ba29b --- /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 0000000..e19a328 --- /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 0000000..cfb1fe9 --- /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 0000000..d39a7ec --- /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 3606496..8c5634c 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 adc6252..dd763a7 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 0000000..07b8dc2 --- /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 0000000..81f1013 --- /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 0000000..8af5841 --- /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 0000000..082005a --- /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 0000000..67ebc9b --- /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 0000000..7fd25c1 --- /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 0000000..3d0c068 --- /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 0000000..2a4f2df --- /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 0000000..95a0a04 --- /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 0000000..1077914 --- /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 0000000..72f1805 --- /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 0000000..7b8f4f3 --- /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 0000000..c68b3c1 --- /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 0000000..cd9ec3f --- /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 0000000..afa7255 --- /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 0000000..08c77bb --- /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 0000000..7c9f7cd --- /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 0000000..53adcd2 --- /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 0000000..976c4c3 --- /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 0000000..48725ac --- /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 73fdadc..505f20b 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 b2a8185..897cad9 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 0000000..bc5c0e8 --- /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 0000000..f01b04f --- /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); + } +} + +