From c6ed67f82c4938bb5b4b5b051c18a2c59c7ff544 Mon Sep 17 00:00:00 2001 From: pipedrive-bot Date: Tue, 2 Dec 2025 09:13:08 +0000 Subject: [PATCH 1/2] Build 295 - version-minor --- CHANGELOG.md | 32 + docs/versions/v2/Api/ActivityFieldsApi.md | 145 + docs/versions/v2/Api/DealFieldsApi.md | 549 ++++ docs/versions/v2/Api/OrganizationFieldsApi.md | 549 ++++ docs/versions/v2/Api/PersonFieldsApi.md | 549 ++++ docs/versions/v2/Api/ProductFieldsApi.md | 549 ++++ docs/versions/v2/Model/ActivityFieldItem.md | 16 + .../v2/Model/ActivityFieldItemOptions.md | 13 + .../v2/Model/ActivityFieldItemSubfields.md | 11 + .../v2/Model/ActivityFieldItemUiVisibility.md | 10 + docs/versions/v2/Model/CreateDealField.md | 10 + .../v2/Model/CreateDealFieldRequest.md | 15 + .../v2/Model/CreateDealFieldRequestOptions.md | 9 + .../v2/Model/CreateOrganizationField.md | 10 + .../Model/CreateOrganizationFieldRequest.md | 15 + docs/versions/v2/Model/CreatePersonField.md | 10 + .../v2/Model/CreatePersonFieldRequest.md | 15 + docs/versions/v2/Model/CreateProductField.md | 10 + .../v2/Model/CreateProductFieldRequest.md | 13 + docs/versions/v2/Model/DealFieldItem.md | 19 + .../v2/Model/DealFieldItemImportantFields.md | 10 + .../v2/Model/DealFieldItemRequiredFields.md | 11 + .../v2/Model/DealFieldItemUiVisibility.md | 12 + ...ealFieldItemUiVisibilityShowInPipelines.md | 10 + docs/versions/v2/Model/DeleteDealField.md | 10 + docs/versions/v2/Model/DeleteDealFieldData.md | 16 + .../v2/Model/DeleteOrganizationField.md | 10 + docs/versions/v2/Model/DeletePersonField.md | 10 + .../v2/Model/DeletePersonFieldData.md | 15 + docs/versions/v2/Model/DeleteProductField.md | 10 + docs/versions/v2/Model/FieldOption.md | 10 + docs/versions/v2/Model/GetActivityField.md | 10 + docs/versions/v2/Model/GetActivityFields.md | 11 + .../Model/GetActivityFieldsAdditionalData.md | 9 + docs/versions/v2/Model/GetDealField.md | 10 + docs/versions/v2/Model/GetDealFields.md | 11 + .../versions/v2/Model/GetOrganizationField.md | 10 + .../v2/Model/GetOrganizationFields.md | 11 + docs/versions/v2/Model/GetPersonField.md | 10 + docs/versions/v2/Model/GetPersonFields.md | 11 + docs/versions/v2/Model/GetProductField.md | 10 + docs/versions/v2/Model/GetProductFields.md | 11 + docs/versions/v2/Model/InlineResponse200.md | 11 + .../v2/Model/OrganizationFieldItem.md | 18 + .../OrganizationFieldItemUiVisibility.md | 12 + ...ldItemUiVisibilityShowInAddPersonDialog.md | 10 + docs/versions/v2/Model/PersonFieldItem.md | 18 + .../Model/PersonFieldItemImportantFields.md | 10 + .../v2/Model/PersonFieldItemRequiredFields.md | 9 + .../v2/Model/PersonFieldItemUiVisibility.md | 11 + ...ieldItemUiVisibilityShowInAddDealDialog.md | 10 + docs/versions/v2/Model/ProductFieldItem.md | 16 + .../v2/Model/UpdateDealFieldRequest.md | 13 + .../Model/UpdateOrganizationFieldRequest.md | 13 + .../v2/Model/UpdatePersonFieldRequest.md | 13 + .../v2/Model/UpdateProductFieldRequest.md | 11 + docs/versions/v2/README.md | 84 + lib/versions/v2/Api/ActivityFieldsApi.php | 767 +++++ lib/versions/v2/Api/DealFieldsApi.php | 2613 +++++++++++++++++ lib/versions/v2/Api/OrganizationFieldsApi.php | 2613 +++++++++++++++++ lib/versions/v2/Api/PersonFieldsApi.php | 2613 +++++++++++++++++ lib/versions/v2/Api/ProductFieldsApi.php | 2613 +++++++++++++++++ lib/versions/v2/Model/ActivityFieldItem.php | 668 +++++ .../v2/Model/ActivityFieldItemOptions.php | 465 +++ .../v2/Model/ActivityFieldItemSubfields.php | 405 +++ .../Model/ActivityFieldItemUiVisibility.php | 376 +++ lib/versions/v2/Model/CreateDealField.php | 375 +++ .../v2/Model/CreateDealFieldRequest.php | 610 ++++ .../Model/CreateDealFieldRequestOptions.php | 348 +++ .../v2/Model/CreateOrganizationField.php | 375 +++ .../Model/CreateOrganizationFieldRequest.php | 610 ++++ lib/versions/v2/Model/CreatePersonField.php | 375 +++ .../v2/Model/CreatePersonFieldRequest.php | 610 ++++ lib/versions/v2/Model/CreateProductField.php | 375 +++ .../v2/Model/CreateProductFieldRequest.php | 550 ++++ lib/versions/v2/Model/DealFieldItem.php | 761 +++++ .../v2/Model/DealFieldItemImportantFields.php | 376 +++ .../v2/Model/DealFieldItemRequiredFields.php | 432 +++ .../v2/Model/DealFieldItemUiVisibility.php | 436 +++ ...alFieldItemUiVisibilityShowInPipelines.php | 376 +++ lib/versions/v2/Model/DeleteDealField.php | 375 +++ lib/versions/v2/Model/DeleteDealFieldData.php | 573 ++++ .../v2/Model/DeleteOrganizationField.php | 375 +++ lib/versions/v2/Model/DeletePersonField.php | 375 +++ .../v2/Model/DeletePersonFieldData.php | 540 ++++ lib/versions/v2/Model/DeleteProductField.php | 375 +++ lib/versions/v2/Model/FieldOption.php | 381 +++ lib/versions/v2/Model/GetActivityField.php | 375 +++ lib/versions/v2/Model/GetActivityFields.php | 405 +++ .../Model/GetActivityFieldsAdditionalData.php | 345 +++ lib/versions/v2/Model/GetDealField.php | 375 +++ lib/versions/v2/Model/GetDealFields.php | 405 +++ .../v2/Model/GetOrganizationField.php | 375 +++ .../v2/Model/GetOrganizationFields.php | 405 +++ lib/versions/v2/Model/GetPersonField.php | 375 +++ lib/versions/v2/Model/GetPersonFields.php | 405 +++ lib/versions/v2/Model/GetProductField.php | 375 +++ lib/versions/v2/Model/GetProductFields.php | 405 +++ lib/versions/v2/Model/InlineResponse200.php | 405 +++ .../v2/Model/OrganizationFieldItem.php | 728 +++++ .../OrganizationFieldItemUiVisibility.php | 436 +++ ...dItemUiVisibilityShowInAddPersonDialog.php | 376 +++ lib/versions/v2/Model/PersonFieldItem.php | 728 +++++ .../Model/PersonFieldItemImportantFields.php | 376 +++ .../Model/PersonFieldItemRequiredFields.php | 346 +++ .../v2/Model/PersonFieldItemUiVisibility.php | 406 +++ ...eldItemUiVisibilityShowInAddDealDialog.php | 376 +++ lib/versions/v2/Model/ProductFieldItem.php | 668 +++++ .../v2/Model/UpdateDealFieldRequest.php | 480 +++ .../Model/UpdateOrganizationFieldRequest.php | 480 +++ .../v2/Model/UpdatePersonFieldRequest.php | 480 +++ .../v2/Model/UpdateProductFieldRequest.php | 420 +++ 112 files changed, 36732 insertions(+) create mode 100644 docs/versions/v2/Api/ActivityFieldsApi.md create mode 100644 docs/versions/v2/Api/DealFieldsApi.md create mode 100644 docs/versions/v2/Api/OrganizationFieldsApi.md create mode 100644 docs/versions/v2/Api/PersonFieldsApi.md create mode 100644 docs/versions/v2/Api/ProductFieldsApi.md create mode 100644 docs/versions/v2/Model/ActivityFieldItem.md create mode 100644 docs/versions/v2/Model/ActivityFieldItemOptions.md create mode 100644 docs/versions/v2/Model/ActivityFieldItemSubfields.md create mode 100644 docs/versions/v2/Model/ActivityFieldItemUiVisibility.md create mode 100644 docs/versions/v2/Model/CreateDealField.md create mode 100644 docs/versions/v2/Model/CreateDealFieldRequest.md create mode 100644 docs/versions/v2/Model/CreateDealFieldRequestOptions.md create mode 100644 docs/versions/v2/Model/CreateOrganizationField.md create mode 100644 docs/versions/v2/Model/CreateOrganizationFieldRequest.md create mode 100644 docs/versions/v2/Model/CreatePersonField.md create mode 100644 docs/versions/v2/Model/CreatePersonFieldRequest.md create mode 100644 docs/versions/v2/Model/CreateProductField.md create mode 100644 docs/versions/v2/Model/CreateProductFieldRequest.md create mode 100644 docs/versions/v2/Model/DealFieldItem.md create mode 100644 docs/versions/v2/Model/DealFieldItemImportantFields.md create mode 100644 docs/versions/v2/Model/DealFieldItemRequiredFields.md create mode 100644 docs/versions/v2/Model/DealFieldItemUiVisibility.md create mode 100644 docs/versions/v2/Model/DealFieldItemUiVisibilityShowInPipelines.md create mode 100644 docs/versions/v2/Model/DeleteDealField.md create mode 100644 docs/versions/v2/Model/DeleteDealFieldData.md create mode 100644 docs/versions/v2/Model/DeleteOrganizationField.md create mode 100644 docs/versions/v2/Model/DeletePersonField.md create mode 100644 docs/versions/v2/Model/DeletePersonFieldData.md create mode 100644 docs/versions/v2/Model/DeleteProductField.md create mode 100644 docs/versions/v2/Model/FieldOption.md create mode 100644 docs/versions/v2/Model/GetActivityField.md create mode 100644 docs/versions/v2/Model/GetActivityFields.md create mode 100644 docs/versions/v2/Model/GetActivityFieldsAdditionalData.md create mode 100644 docs/versions/v2/Model/GetDealField.md create mode 100644 docs/versions/v2/Model/GetDealFields.md create mode 100644 docs/versions/v2/Model/GetOrganizationField.md create mode 100644 docs/versions/v2/Model/GetOrganizationFields.md create mode 100644 docs/versions/v2/Model/GetPersonField.md create mode 100644 docs/versions/v2/Model/GetPersonFields.md create mode 100644 docs/versions/v2/Model/GetProductField.md create mode 100644 docs/versions/v2/Model/GetProductFields.md create mode 100644 docs/versions/v2/Model/InlineResponse200.md create mode 100644 docs/versions/v2/Model/OrganizationFieldItem.md create mode 100644 docs/versions/v2/Model/OrganizationFieldItemUiVisibility.md create mode 100644 docs/versions/v2/Model/OrganizationFieldItemUiVisibilityShowInAddPersonDialog.md create mode 100644 docs/versions/v2/Model/PersonFieldItem.md create mode 100644 docs/versions/v2/Model/PersonFieldItemImportantFields.md create mode 100644 docs/versions/v2/Model/PersonFieldItemRequiredFields.md create mode 100644 docs/versions/v2/Model/PersonFieldItemUiVisibility.md create mode 100644 docs/versions/v2/Model/PersonFieldItemUiVisibilityShowInAddDealDialog.md create mode 100644 docs/versions/v2/Model/ProductFieldItem.md create mode 100644 docs/versions/v2/Model/UpdateDealFieldRequest.md create mode 100644 docs/versions/v2/Model/UpdateOrganizationFieldRequest.md create mode 100644 docs/versions/v2/Model/UpdatePersonFieldRequest.md create mode 100644 docs/versions/v2/Model/UpdateProductFieldRequest.md create mode 100644 lib/versions/v2/Api/ActivityFieldsApi.php create mode 100644 lib/versions/v2/Api/DealFieldsApi.php create mode 100644 lib/versions/v2/Api/OrganizationFieldsApi.php create mode 100644 lib/versions/v2/Api/PersonFieldsApi.php create mode 100644 lib/versions/v2/Api/ProductFieldsApi.php create mode 100644 lib/versions/v2/Model/ActivityFieldItem.php create mode 100644 lib/versions/v2/Model/ActivityFieldItemOptions.php create mode 100644 lib/versions/v2/Model/ActivityFieldItemSubfields.php create mode 100644 lib/versions/v2/Model/ActivityFieldItemUiVisibility.php create mode 100644 lib/versions/v2/Model/CreateDealField.php create mode 100644 lib/versions/v2/Model/CreateDealFieldRequest.php create mode 100644 lib/versions/v2/Model/CreateDealFieldRequestOptions.php create mode 100644 lib/versions/v2/Model/CreateOrganizationField.php create mode 100644 lib/versions/v2/Model/CreateOrganizationFieldRequest.php create mode 100644 lib/versions/v2/Model/CreatePersonField.php create mode 100644 lib/versions/v2/Model/CreatePersonFieldRequest.php create mode 100644 lib/versions/v2/Model/CreateProductField.php create mode 100644 lib/versions/v2/Model/CreateProductFieldRequest.php create mode 100644 lib/versions/v2/Model/DealFieldItem.php create mode 100644 lib/versions/v2/Model/DealFieldItemImportantFields.php create mode 100644 lib/versions/v2/Model/DealFieldItemRequiredFields.php create mode 100644 lib/versions/v2/Model/DealFieldItemUiVisibility.php create mode 100644 lib/versions/v2/Model/DealFieldItemUiVisibilityShowInPipelines.php create mode 100644 lib/versions/v2/Model/DeleteDealField.php create mode 100644 lib/versions/v2/Model/DeleteDealFieldData.php create mode 100644 lib/versions/v2/Model/DeleteOrganizationField.php create mode 100644 lib/versions/v2/Model/DeletePersonField.php create mode 100644 lib/versions/v2/Model/DeletePersonFieldData.php create mode 100644 lib/versions/v2/Model/DeleteProductField.php create mode 100644 lib/versions/v2/Model/FieldOption.php create mode 100644 lib/versions/v2/Model/GetActivityField.php create mode 100644 lib/versions/v2/Model/GetActivityFields.php create mode 100644 lib/versions/v2/Model/GetActivityFieldsAdditionalData.php create mode 100644 lib/versions/v2/Model/GetDealField.php create mode 100644 lib/versions/v2/Model/GetDealFields.php create mode 100644 lib/versions/v2/Model/GetOrganizationField.php create mode 100644 lib/versions/v2/Model/GetOrganizationFields.php create mode 100644 lib/versions/v2/Model/GetPersonField.php create mode 100644 lib/versions/v2/Model/GetPersonFields.php create mode 100644 lib/versions/v2/Model/GetProductField.php create mode 100644 lib/versions/v2/Model/GetProductFields.php create mode 100644 lib/versions/v2/Model/InlineResponse200.php create mode 100644 lib/versions/v2/Model/OrganizationFieldItem.php create mode 100644 lib/versions/v2/Model/OrganizationFieldItemUiVisibility.php create mode 100644 lib/versions/v2/Model/OrganizationFieldItemUiVisibilityShowInAddPersonDialog.php create mode 100644 lib/versions/v2/Model/PersonFieldItem.php create mode 100644 lib/versions/v2/Model/PersonFieldItemImportantFields.php create mode 100644 lib/versions/v2/Model/PersonFieldItemRequiredFields.php create mode 100644 lib/versions/v2/Model/PersonFieldItemUiVisibility.php create mode 100644 lib/versions/v2/Model/PersonFieldItemUiVisibilityShowInAddDealDialog.php create mode 100644 lib/versions/v2/Model/ProductFieldItem.php create mode 100644 lib/versions/v2/Model/UpdateDealFieldRequest.php create mode 100644 lib/versions/v2/Model/UpdateOrganizationFieldRequest.php create mode 100644 lib/versions/v2/Model/UpdatePersonFieldRequest.php create mode 100644 lib/versions/v2/Model/UpdateProductFieldRequest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 91546fe..a01e011 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,38 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- Documented the following new v2 endpoints: + - `GET /api/v2/activityFields` + - `GET /api/v2/dealFields` + - `GET /api/v2/organizationFields` + - `GET /api/v2/personFields` + - `GET /api/v2/productFields` + - `GET /api/v2/activityFields/{field_code}` + - `GET /api/v2/dealFields/{field_code}` + - `GET /api/v2/organizationFields/{field_code}` + - `GET /api/v2/personFields/{field_code}` + - `GET /api/v2/productFields/{field_code}` + - `POST /api/v2/dealFields` + - `POST /api/v2/organizationFields` + - `POST /api/v2/personFields` + - `POST /api/v2/productFields` + - `DELETE /api/v2/dealFields/{field_code}` + - `DELETE /api/v2/organizationFields/{field_code}` + - `DELETE /api/v2/personFields/{field_code}` + - `DELETE /api/v2/productFields/{field_code}` + - `POST /api/v2/dealFields/{field_code}/options` + - `POST /api/v2/organizationFields/{field_code}/options` + - `POST /api/v2/personFields/{field_code}/options` + - `POST /api/v2/productFields/{field_code}/options` + - `PATCH /api/v2/dealFields/{field_code}/options` + - `PATCH /api/v2/organizationFields/{field_code}/options` + - `PATCH /api/v2/personFields/{field_code}/options` + - `PATCH /api/v2/productFields/{field_code}/options` + - `DELETE /api/v2/dealFields/{field_code}/options` + - `DELETE /api/v2/organizationFields/{field_code}/options` + - `DELETE /api/v2/personFields/{field_code}/options` + - `DELETE /api/v2/productFields/{field_code}/options` ## [14.4.0](https://github.com/pipedrive/client-php/compare/14.3.3...14.4.0) (2025-11-25) diff --git a/docs/versions/v2/Api/ActivityFieldsApi.md b/docs/versions/v2/Api/ActivityFieldsApi.md new file mode 100644 index 0000000..33e18af --- /dev/null +++ b/docs/versions/v2/Api/ActivityFieldsApi.md @@ -0,0 +1,145 @@ +# Pipedrive\versions\v2\ActivityFieldsApi + +All URIs are relative to https://api.pipedrive.com/api/v2. + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**getActivityField()**](ActivityFieldsApi.md#getActivityField) | **GET** /activityFields/{field_code} | Get one activity field +[**getActivityFields()**](ActivityFieldsApi.md#getActivityFields) | **GET** /activityFields | Get all activity fields + + +## `getActivityField()` + +```php +getActivityField($field_code, $include_fields): \Pipedrive\versions\v2\Model\GetActivityField +``` + +Get one activity field + +Returns metadata about a specific activity 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\ActivityFieldsApi( + // 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 +$include_fields = 'include_fields_example'; // string | Optional comma separated string array of additional data namespaces to include in response + +try { + $result = $apiInstance->getActivityField($field_code, $include_fields); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ActivityFieldsApi->getActivityField: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **field_code** | **string**| The unique code identifying the field | + **include_fields** | **string**| Optional comma separated string array of additional data namespaces to include in response | [optional] + +### Return type + +[**\Pipedrive\versions\v2\Model\GetActivityField**](../Model/GetActivityField.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) + +## `getActivityFields()` + +```php +getActivityFields($include_fields, $limit, $cursor): \Pipedrive\versions\v2\Model\GetActivityFields +``` + +Get all activity fields + +Returns metadata about all activity 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\ActivityFieldsApi( + // 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 +); +$include_fields = 'include_fields_example'; // string | Optional comma separated string array of additional data namespaces to include in response +$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->getActivityFields($include_fields, $limit, $cursor); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ActivityFieldsApi->getActivityFields: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **include_fields** | **string**| Optional comma separated string array of additional data namespaces to include in response | [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\GetActivityFields**](../Model/GetActivityFields.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/DealFieldsApi.md b/docs/versions/v2/Api/DealFieldsApi.md new file mode 100644 index 0000000..83a1fb1 --- /dev/null +++ b/docs/versions/v2/Api/DealFieldsApi.md @@ -0,0 +1,549 @@ +# Pipedrive\versions\v2\DealFieldsApi + +All URIs are relative to https://api.pipedrive.com/api/v2. + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addDealField()**](DealFieldsApi.md#addDealField) | **POST** /dealFields | Create one deal field +[**addDealFieldOptions()**](DealFieldsApi.md#addDealFieldOptions) | **POST** /dealFields/{field_code}/options | Add deal field options in bulk +[**deleteDealField()**](DealFieldsApi.md#deleteDealField) | **DELETE** /dealFields/{field_code} | Delete one deal field +[**deleteDealFieldOptions()**](DealFieldsApi.md#deleteDealFieldOptions) | **DELETE** /dealFields/{field_code}/options | Delete deal field options in bulk +[**getDealField()**](DealFieldsApi.md#getDealField) | **GET** /dealFields/{field_code} | Get one deal field +[**getDealFields()**](DealFieldsApi.md#getDealFields) | **GET** /dealFields | Get all deal fields +[**updateDealField()**](DealFieldsApi.md#updateDealField) | **PATCH** /dealFields/{field_code} | Update one deal field +[**updateDealFieldOptions()**](DealFieldsApi.md#updateDealFieldOptions) | **PATCH** /dealFields/{field_code}/options | Update deal field options in bulk + + +## `addDealField()` + +```php +addDealField($create_deal_field_request): \Pipedrive\versions\v2\Model\CreateDealField +``` + +Create one deal field + +Creates a new deal 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\DealFieldsApi( + // 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_deal_field_request = new \Pipedrive\versions\v2\Model\CreateDealFieldRequest(); // \Pipedrive\versions\v2\Model\CreateDealFieldRequest + +try { + $result = $apiInstance->addDealField($create_deal_field_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DealFieldsApi->addDealField: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **create_deal_field_request** | [**\Pipedrive\versions\v2\Model\CreateDealFieldRequest**](../Model/CreateDealFieldRequest.md)| | + +### Return type + +[**\Pipedrive\versions\v2\Model\CreateDealField**](../Model/CreateDealField.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) + +## `addDealFieldOptions()` + +```php +addDealFieldOptions($field_code, $request_body): \Pipedrive\versions\v2\Model\InlineResponse200 +``` + +Add deal field options in bulk + +Adds new options to a deal 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\DealFieldsApi( + // 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->addDealFieldOptions($field_code, $request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DealFieldsApi->addDealFieldOptions: ', $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) + +## `deleteDealField()` + +```php +deleteDealField($field_code): \Pipedrive\versions\v2\Model\DeleteDealField +``` + +Delete one deal 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\DealFieldsApi( + // 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->deleteDealField($field_code); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DealFieldsApi->deleteDealField: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **field_code** | **string**| The unique code identifying the field | + +### Return type + +[**\Pipedrive\versions\v2\Model\DeleteDealField**](../Model/DeleteDealField.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) + +## `deleteDealFieldOptions()` + +```php +deleteDealFieldOptions($field_code, $request_body): \Pipedrive\versions\v2\Model\InlineResponse200 +``` + +Delete deal field options in bulk + +Removes existing options from a deal 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\DealFieldsApi( + // 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->deleteDealFieldOptions($field_code, $request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DealFieldsApi->deleteDealFieldOptions: ', $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) + +## `getDealField()` + +```php +getDealField($field_code, $include_fields): \Pipedrive\versions\v2\Model\GetDealField +``` + +Get one deal field + +Returns metadata about a specific deal 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\DealFieldsApi( + // 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 +$include_fields = 'include_fields_example'; // string | Optional comma separated string array of additional data namespaces to include in response + +try { + $result = $apiInstance->getDealField($field_code, $include_fields); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DealFieldsApi->getDealField: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **field_code** | **string**| The unique code identifying the field | + **include_fields** | **string**| Optional comma separated string array of additional data namespaces to include in response | [optional] + +### Return type + +[**\Pipedrive\versions\v2\Model\GetDealField**](../Model/GetDealField.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) + +## `getDealFields()` + +```php +getDealFields($include_fields, $limit, $cursor): \Pipedrive\versions\v2\Model\GetDealFields +``` + +Get all deal fields + +Returns metadata about all deal 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\DealFieldsApi( + // 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 +); +$include_fields = 'include_fields_example'; // string | Optional comma separated string array of additional data namespaces to include in response +$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->getDealFields($include_fields, $limit, $cursor); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DealFieldsApi->getDealFields: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **include_fields** | **string**| Optional comma separated string array of additional data namespaces to include in response | [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\GetDealFields**](../Model/GetDealFields.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) + +## `updateDealField()` + +```php +updateDealField($field_code, $update_deal_field_request): \Pipedrive\versions\v2\Model\GetDealField +``` + +Update one deal field + +Updates a deal 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\DealFieldsApi( + // 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_deal_field_request = new \Pipedrive\versions\v2\Model\UpdateDealFieldRequest(); // \Pipedrive\versions\v2\Model\UpdateDealFieldRequest + +try { + $result = $apiInstance->updateDealField($field_code, $update_deal_field_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DealFieldsApi->updateDealField: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **field_code** | **string**| The unique code identifying the field | + **update_deal_field_request** | [**\Pipedrive\versions\v2\Model\UpdateDealFieldRequest**](../Model/UpdateDealFieldRequest.md)| | + +### Return type + +[**\Pipedrive\versions\v2\Model\GetDealField**](../Model/GetDealField.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) + +## `updateDealFieldOptions()` + +```php +updateDealFieldOptions($field_code, $request_body): \Pipedrive\versions\v2\Model\InlineResponse200 +``` + +Update deal field options in bulk + +Updates existing options for a deal 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\DealFieldsApi( + // 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->updateDealFieldOptions($field_code, $request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DealFieldsApi->updateDealFieldOptions: ', $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/OrganizationFieldsApi.md b/docs/versions/v2/Api/OrganizationFieldsApi.md new file mode 100644 index 0000000..78a8cf1 --- /dev/null +++ b/docs/versions/v2/Api/OrganizationFieldsApi.md @@ -0,0 +1,549 @@ +# Pipedrive\versions\v2\OrganizationFieldsApi + +All URIs are relative to https://api.pipedrive.com/api/v2. + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addOrganizationField()**](OrganizationFieldsApi.md#addOrganizationField) | **POST** /organizationFields | Create one organization field +[**addOrganizationFieldOptions()**](OrganizationFieldsApi.md#addOrganizationFieldOptions) | **POST** /organizationFields/{field_code}/options | Add organization field options in bulk +[**deleteOrganizationField()**](OrganizationFieldsApi.md#deleteOrganizationField) | **DELETE** /organizationFields/{field_code} | Delete one organization field +[**deleteOrganizationFieldOptions()**](OrganizationFieldsApi.md#deleteOrganizationFieldOptions) | **DELETE** /organizationFields/{field_code}/options | Delete organization field options in bulk +[**getOrganizationField()**](OrganizationFieldsApi.md#getOrganizationField) | **GET** /organizationFields/{field_code} | Get one organization field +[**getOrganizationFields()**](OrganizationFieldsApi.md#getOrganizationFields) | **GET** /organizationFields | Get all organization fields +[**updateOrganizationField()**](OrganizationFieldsApi.md#updateOrganizationField) | **PATCH** /organizationFields/{field_code} | Update one organization field +[**updateOrganizationFieldOptions()**](OrganizationFieldsApi.md#updateOrganizationFieldOptions) | **PATCH** /organizationFields/{field_code}/options | Update organization field options in bulk + + +## `addOrganizationField()` + +```php +addOrganizationField($create_organization_field_request): \Pipedrive\versions\v2\Model\CreateOrganizationField +``` + +Create one organization field + +Creates a new organization 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\OrganizationFieldsApi( + // 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_organization_field_request = new \Pipedrive\versions\v2\Model\CreateOrganizationFieldRequest(); // \Pipedrive\versions\v2\Model\CreateOrganizationFieldRequest + +try { + $result = $apiInstance->addOrganizationField($create_organization_field_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrganizationFieldsApi->addOrganizationField: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **create_organization_field_request** | [**\Pipedrive\versions\v2\Model\CreateOrganizationFieldRequest**](../Model/CreateOrganizationFieldRequest.md)| | + +### Return type + +[**\Pipedrive\versions\v2\Model\CreateOrganizationField**](../Model/CreateOrganizationField.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) + +## `addOrganizationFieldOptions()` + +```php +addOrganizationFieldOptions($field_code, $request_body): \Pipedrive\versions\v2\Model\InlineResponse200 +``` + +Add organization field options in bulk + +Adds new options to an organization 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\OrganizationFieldsApi( + // 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->addOrganizationFieldOptions($field_code, $request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrganizationFieldsApi->addOrganizationFieldOptions: ', $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) + +## `deleteOrganizationField()` + +```php +deleteOrganizationField($field_code): \Pipedrive\versions\v2\Model\DeleteOrganizationField +``` + +Delete one organization 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\OrganizationFieldsApi( + // 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->deleteOrganizationField($field_code); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrganizationFieldsApi->deleteOrganizationField: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **field_code** | **string**| The unique code identifying the field | + +### Return type + +[**\Pipedrive\versions\v2\Model\DeleteOrganizationField**](../Model/DeleteOrganizationField.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) + +## `deleteOrganizationFieldOptions()` + +```php +deleteOrganizationFieldOptions($field_code, $request_body): \Pipedrive\versions\v2\Model\InlineResponse200 +``` + +Delete organization field options in bulk + +Removes existing options from an organization 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\OrganizationFieldsApi( + // 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->deleteOrganizationFieldOptions($field_code, $request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrganizationFieldsApi->deleteOrganizationFieldOptions: ', $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) + +## `getOrganizationField()` + +```php +getOrganizationField($field_code, $include_fields): \Pipedrive\versions\v2\Model\GetOrganizationField +``` + +Get one organization field + +Returns metadata about a specific organization 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\OrganizationFieldsApi( + // 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 +$include_fields = 'include_fields_example'; // string | Optional comma separated string array of additional data namespaces to include in response + +try { + $result = $apiInstance->getOrganizationField($field_code, $include_fields); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrganizationFieldsApi->getOrganizationField: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **field_code** | **string**| The unique code identifying the field | + **include_fields** | **string**| Optional comma separated string array of additional data namespaces to include in response | [optional] + +### Return type + +[**\Pipedrive\versions\v2\Model\GetOrganizationField**](../Model/GetOrganizationField.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) + +## `getOrganizationFields()` + +```php +getOrganizationFields($include_fields, $limit, $cursor): \Pipedrive\versions\v2\Model\GetOrganizationFields +``` + +Get all organization fields + +Returns metadata about all organization 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\OrganizationFieldsApi( + // 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 +); +$include_fields = 'include_fields_example'; // string | Optional comma separated string array of additional data namespaces to include in response +$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->getOrganizationFields($include_fields, $limit, $cursor); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrganizationFieldsApi->getOrganizationFields: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **include_fields** | **string**| Optional comma separated string array of additional data namespaces to include in response | [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\GetOrganizationFields**](../Model/GetOrganizationFields.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) + +## `updateOrganizationField()` + +```php +updateOrganizationField($field_code, $update_organization_field_request): \Pipedrive\versions\v2\Model\GetOrganizationField +``` + +Update one organization field + +Updates an organization 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\OrganizationFieldsApi( + // 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_organization_field_request = new \Pipedrive\versions\v2\Model\UpdateOrganizationFieldRequest(); // \Pipedrive\versions\v2\Model\UpdateOrganizationFieldRequest + +try { + $result = $apiInstance->updateOrganizationField($field_code, $update_organization_field_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrganizationFieldsApi->updateOrganizationField: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **field_code** | **string**| The unique code identifying the field | + **update_organization_field_request** | [**\Pipedrive\versions\v2\Model\UpdateOrganizationFieldRequest**](../Model/UpdateOrganizationFieldRequest.md)| | + +### Return type + +[**\Pipedrive\versions\v2\Model\GetOrganizationField**](../Model/GetOrganizationField.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) + +## `updateOrganizationFieldOptions()` + +```php +updateOrganizationFieldOptions($field_code, $request_body): \Pipedrive\versions\v2\Model\InlineResponse200 +``` + +Update organization field options in bulk + +Updates existing options for an organization 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\OrganizationFieldsApi( + // 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->updateOrganizationFieldOptions($field_code, $request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrganizationFieldsApi->updateOrganizationFieldOptions: ', $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/PersonFieldsApi.md b/docs/versions/v2/Api/PersonFieldsApi.md new file mode 100644 index 0000000..b1dde83 --- /dev/null +++ b/docs/versions/v2/Api/PersonFieldsApi.md @@ -0,0 +1,549 @@ +# Pipedrive\versions\v2\PersonFieldsApi + +All URIs are relative to https://api.pipedrive.com/api/v2. + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addPersonField()**](PersonFieldsApi.md#addPersonField) | **POST** /personFields | Create one person field +[**addPersonFieldOptions()**](PersonFieldsApi.md#addPersonFieldOptions) | **POST** /personFields/{field_code}/options | Add person field options in bulk +[**deletePersonField()**](PersonFieldsApi.md#deletePersonField) | **DELETE** /personFields/{field_code} | Delete one person field +[**deletePersonFieldOptions()**](PersonFieldsApi.md#deletePersonFieldOptions) | **DELETE** /personFields/{field_code}/options | Delete person field options in bulk +[**getPersonField()**](PersonFieldsApi.md#getPersonField) | **GET** /personFields/{field_code} | Get one person field +[**getPersonFields()**](PersonFieldsApi.md#getPersonFields) | **GET** /personFields | Get all person fields +[**updatePersonField()**](PersonFieldsApi.md#updatePersonField) | **PATCH** /personFields/{field_code} | Update one person field +[**updatePersonFieldOptions()**](PersonFieldsApi.md#updatePersonFieldOptions) | **PATCH** /personFields/{field_code}/options | Update person field options in bulk + + +## `addPersonField()` + +```php +addPersonField($create_person_field_request): \Pipedrive\versions\v2\Model\CreatePersonField +``` + +Create one person field + +Creates a new person 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\PersonFieldsApi( + // 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_person_field_request = new \Pipedrive\versions\v2\Model\CreatePersonFieldRequest(); // \Pipedrive\versions\v2\Model\CreatePersonFieldRequest + +try { + $result = $apiInstance->addPersonField($create_person_field_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PersonFieldsApi->addPersonField: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **create_person_field_request** | [**\Pipedrive\versions\v2\Model\CreatePersonFieldRequest**](../Model/CreatePersonFieldRequest.md)| | + +### Return type + +[**\Pipedrive\versions\v2\Model\CreatePersonField**](../Model/CreatePersonField.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) + +## `addPersonFieldOptions()` + +```php +addPersonFieldOptions($field_code, $request_body): \Pipedrive\versions\v2\Model\InlineResponse200 +``` + +Add person field options in bulk + +Adds new options to a person 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\PersonFieldsApi( + // 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->addPersonFieldOptions($field_code, $request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PersonFieldsApi->addPersonFieldOptions: ', $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) + +## `deletePersonField()` + +```php +deletePersonField($field_code): \Pipedrive\versions\v2\Model\DeletePersonField +``` + +Delete one person 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\PersonFieldsApi( + // 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->deletePersonField($field_code); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PersonFieldsApi->deletePersonField: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **field_code** | **string**| The unique code identifying the field | + +### Return type + +[**\Pipedrive\versions\v2\Model\DeletePersonField**](../Model/DeletePersonField.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) + +## `deletePersonFieldOptions()` + +```php +deletePersonFieldOptions($field_code, $request_body): \Pipedrive\versions\v2\Model\InlineResponse200 +``` + +Delete person field options in bulk + +Removes existing options from a person 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\PersonFieldsApi( + // 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->deletePersonFieldOptions($field_code, $request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PersonFieldsApi->deletePersonFieldOptions: ', $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) + +## `getPersonField()` + +```php +getPersonField($field_code, $include_fields): \Pipedrive\versions\v2\Model\GetPersonField +``` + +Get one person field + +Returns metadata about a specific person 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\PersonFieldsApi( + // 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 +$include_fields = 'include_fields_example'; // string | Optional comma separated string array of additional data namespaces to include in response + +try { + $result = $apiInstance->getPersonField($field_code, $include_fields); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PersonFieldsApi->getPersonField: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **field_code** | **string**| The unique code identifying the field | + **include_fields** | **string**| Optional comma separated string array of additional data namespaces to include in response | [optional] + +### Return type + +[**\Pipedrive\versions\v2\Model\GetPersonField**](../Model/GetPersonField.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) + +## `getPersonFields()` + +```php +getPersonFields($include_fields, $limit, $cursor): \Pipedrive\versions\v2\Model\GetPersonFields +``` + +Get all person fields + +Returns metadata about all person 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\PersonFieldsApi( + // 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 +); +$include_fields = 'include_fields_example'; // string | Optional comma separated string array of additional data namespaces to include in response +$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->getPersonFields($include_fields, $limit, $cursor); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PersonFieldsApi->getPersonFields: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **include_fields** | **string**| Optional comma separated string array of additional data namespaces to include in response | [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\GetPersonFields**](../Model/GetPersonFields.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) + +## `updatePersonField()` + +```php +updatePersonField($field_code, $update_person_field_request): \Pipedrive\versions\v2\Model\GetPersonField +``` + +Update one person field + +Updates a person 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\PersonFieldsApi( + // 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_person_field_request = new \Pipedrive\versions\v2\Model\UpdatePersonFieldRequest(); // \Pipedrive\versions\v2\Model\UpdatePersonFieldRequest + +try { + $result = $apiInstance->updatePersonField($field_code, $update_person_field_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PersonFieldsApi->updatePersonField: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **field_code** | **string**| The unique code identifying the field | + **update_person_field_request** | [**\Pipedrive\versions\v2\Model\UpdatePersonFieldRequest**](../Model/UpdatePersonFieldRequest.md)| | + +### Return type + +[**\Pipedrive\versions\v2\Model\GetPersonField**](../Model/GetPersonField.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) + +## `updatePersonFieldOptions()` + +```php +updatePersonFieldOptions($field_code, $request_body): \Pipedrive\versions\v2\Model\InlineResponse200 +``` + +Update person field options in bulk + +Updates existing options for a person 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\PersonFieldsApi( + // 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->updatePersonFieldOptions($field_code, $request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PersonFieldsApi->updatePersonFieldOptions: ', $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/ProductFieldsApi.md b/docs/versions/v2/Api/ProductFieldsApi.md new file mode 100644 index 0000000..a161709 --- /dev/null +++ b/docs/versions/v2/Api/ProductFieldsApi.md @@ -0,0 +1,549 @@ +# Pipedrive\versions\v2\ProductFieldsApi + +All URIs are relative to https://api.pipedrive.com/api/v2. + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addProductField()**](ProductFieldsApi.md#addProductField) | **POST** /productFields | Create one product field +[**addProductFieldOptions()**](ProductFieldsApi.md#addProductFieldOptions) | **POST** /productFields/{field_code}/options | Add product field options in bulk +[**deleteProductField()**](ProductFieldsApi.md#deleteProductField) | **DELETE** /productFields/{field_code} | Delete one product field +[**deleteProductFieldOptions()**](ProductFieldsApi.md#deleteProductFieldOptions) | **DELETE** /productFields/{field_code}/options | Delete product field options in bulk +[**getProductField()**](ProductFieldsApi.md#getProductField) | **GET** /productFields/{field_code} | Get one product field +[**getProductFields()**](ProductFieldsApi.md#getProductFields) | **GET** /productFields | Get all product fields +[**updateProductField()**](ProductFieldsApi.md#updateProductField) | **PATCH** /productFields/{field_code} | Update one product field +[**updateProductFieldOptions()**](ProductFieldsApi.md#updateProductFieldOptions) | **PATCH** /productFields/{field_code}/options | Update product field options in bulk + + +## `addProductField()` + +```php +addProductField($create_product_field_request): \Pipedrive\versions\v2\Model\CreateProductField +``` + +Create one product field + +Creates a new product 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\ProductFieldsApi( + // 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_product_field_request = new \Pipedrive\versions\v2\Model\CreateProductFieldRequest(); // \Pipedrive\versions\v2\Model\CreateProductFieldRequest + +try { + $result = $apiInstance->addProductField($create_product_field_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProductFieldsApi->addProductField: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **create_product_field_request** | [**\Pipedrive\versions\v2\Model\CreateProductFieldRequest**](../Model/CreateProductFieldRequest.md)| | + +### Return type + +[**\Pipedrive\versions\v2\Model\CreateProductField**](../Model/CreateProductField.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) + +## `addProductFieldOptions()` + +```php +addProductFieldOptions($field_code, $request_body): \Pipedrive\versions\v2\Model\InlineResponse200 +``` + +Add product field options in bulk + +Adds new options to a product 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\ProductFieldsApi( + // 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->addProductFieldOptions($field_code, $request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProductFieldsApi->addProductFieldOptions: ', $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) + +## `deleteProductField()` + +```php +deleteProductField($field_code): \Pipedrive\versions\v2\Model\DeleteProductField +``` + +Delete one product 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\ProductFieldsApi( + // 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->deleteProductField($field_code); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProductFieldsApi->deleteProductField: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **field_code** | **string**| The unique code identifying the field | + +### Return type + +[**\Pipedrive\versions\v2\Model\DeleteProductField**](../Model/DeleteProductField.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) + +## `deleteProductFieldOptions()` + +```php +deleteProductFieldOptions($field_code, $request_body): \Pipedrive\versions\v2\Model\InlineResponse200 +``` + +Delete product field options in bulk + +Removes existing options from a product 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\ProductFieldsApi( + // 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->deleteProductFieldOptions($field_code, $request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProductFieldsApi->deleteProductFieldOptions: ', $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) + +## `getProductField()` + +```php +getProductField($field_code, $include_fields): \Pipedrive\versions\v2\Model\GetProductField +``` + +Get one product field + +Returns metadata about a specific product 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\ProductFieldsApi( + // 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 +$include_fields = 'include_fields_example'; // string | Optional comma separated string array of additional data namespaces to include in response + +try { + $result = $apiInstance->getProductField($field_code, $include_fields); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProductFieldsApi->getProductField: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **field_code** | **string**| The unique code identifying the field | + **include_fields** | **string**| Optional comma separated string array of additional data namespaces to include in response | [optional] + +### Return type + +[**\Pipedrive\versions\v2\Model\GetProductField**](../Model/GetProductField.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) + +## `getProductFields()` + +```php +getProductFields($include_fields, $limit, $cursor): \Pipedrive\versions\v2\Model\GetProductFields +``` + +Get all product fields + +Returns metadata about all product 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\ProductFieldsApi( + // 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 +); +$include_fields = 'include_fields_example'; // string | Optional comma separated string array of additional data namespaces to include in response +$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->getProductFields($include_fields, $limit, $cursor); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProductFieldsApi->getProductFields: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **include_fields** | **string**| Optional comma separated string array of additional data namespaces to include in response | [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\GetProductFields**](../Model/GetProductFields.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) + +## `updateProductField()` + +```php +updateProductField($field_code, $update_product_field_request): \Pipedrive\versions\v2\Model\GetProductField +``` + +Update one product field + +Updates a product 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\ProductFieldsApi( + // 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_product_field_request = new \Pipedrive\versions\v2\Model\UpdateProductFieldRequest(); // \Pipedrive\versions\v2\Model\UpdateProductFieldRequest + +try { + $result = $apiInstance->updateProductField($field_code, $update_product_field_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProductFieldsApi->updateProductField: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **field_code** | **string**| The unique code identifying the field | + **update_product_field_request** | [**\Pipedrive\versions\v2\Model\UpdateProductFieldRequest**](../Model/UpdateProductFieldRequest.md)| | + +### Return type + +[**\Pipedrive\versions\v2\Model\GetProductField**](../Model/GetProductField.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) + +## `updateProductFieldOptions()` + +```php +updateProductFieldOptions($field_code, $request_body): \Pipedrive\versions\v2\Model\InlineResponse200 +``` + +Update product field options in bulk + +Updates existing options for a product 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\ProductFieldsApi( + // 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->updateProductFieldOptions($field_code, $request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ProductFieldsApi->updateProductFieldOptions: ', $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/Model/ActivityFieldItem.md b/docs/versions/v2/Model/ActivityFieldItem.md new file mode 100644 index 0000000..26ec77e --- /dev/null +++ b/docs/versions/v2/Model/ActivityFieldItem.md @@ -0,0 +1,16 @@ +# # ActivityFieldItem + +## 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\ActivityFieldItemUiVisibility**](ActivityFieldItemUiVisibility.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/ActivityFieldItemOptions.md b/docs/versions/v2/Model/ActivityFieldItemOptions.md new file mode 100644 index 0000000..289f2b5 --- /dev/null +++ b/docs/versions/v2/Model/ActivityFieldItemOptions.md @@ -0,0 +1,13 @@ +# # ActivityFieldItemOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The option ID | [optional] +**label** | **string** | The option display label | [optional] +**color** | **string** | Optional color code for the option | [optional] +**update_time** | **\DateTime** | When the option was last updated | [optional] +**add_time** | **\DateTime** | When the option was created | [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/ActivityFieldItemSubfields.md b/docs/versions/v2/Model/ActivityFieldItemSubfields.md new file mode 100644 index 0000000..80c3663 --- /dev/null +++ b/docs/versions/v2/Model/ActivityFieldItemSubfields.md @@ -0,0 +1,11 @@ +# # ActivityFieldItemSubfields + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**field_code** | **string** | The subfield identifier | [optional] +**field_name** | **string** | The subfield display name | [optional] +**field_type** | **string** | The subfield type | [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/ActivityFieldItemUiVisibility.md b/docs/versions/v2/Model/ActivityFieldItemUiVisibility.md new file mode 100644 index 0000000..751cb82 --- /dev/null +++ b/docs/versions/v2/Model/ActivityFieldItemUiVisibility.md @@ -0,0 +1,10 @@ +# # ActivityFieldItemUiVisibility + +## 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 (read-only) | [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/CreateDealField.md b/docs/versions/v2/Model/CreateDealField.md new file mode 100644 index 0000000..cfdd67f --- /dev/null +++ b/docs/versions/v2/Model/CreateDealField.md @@ -0,0 +1,10 @@ +# # CreateDealField + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | Whether the request was successful | [optional] +**data** | [**\Pipedrive\versions\v2\Model\DealFieldItem**](DealFieldItem.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/CreateDealFieldRequest.md b/docs/versions/v2/Model/CreateDealFieldRequest.md new file mode 100644 index 0000000..29da64f --- /dev/null +++ b/docs/versions/v2/Model/CreateDealFieldRequest.md @@ -0,0 +1,15 @@ +# # CreateDealFieldRequest + +## 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 product ID which is stored on the same account)</td><tr><td>`phone`</td><td>Phone field (up to 255 numbers and/or characters)</td><tr><td>`time`</td><td>Time field (format HH:MM:SS)</td><tr><td>`timerange`</td><td>Time-range field (has a start time and end time value, both HH:MM:SS)</td><tr><td>`daterange`</td><td>Date-range field (has a start date and end date value, both YYYY-MM-DD)</td><tr><td>`address`</td><td>Address field</dd></table> | +**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] +**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/CreateDealFieldRequestOptions.md b/docs/versions/v2/Model/CreateDealFieldRequestOptions.md new file mode 100644 index 0000000..79271ad --- /dev/null +++ b/docs/versions/v2/Model/CreateDealFieldRequestOptions.md @@ -0,0 +1,9 @@ +# # CreateDealFieldRequestOptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**label** | **string** | The option label | + +[[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/CreateOrganizationField.md b/docs/versions/v2/Model/CreateOrganizationField.md new file mode 100644 index 0000000..539a40f --- /dev/null +++ b/docs/versions/v2/Model/CreateOrganizationField.md @@ -0,0 +1,10 @@ +# # CreateOrganizationField + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | Whether the request was successful | [optional] +**data** | [**\Pipedrive\versions\v2\Model\OrganizationFieldItem**](OrganizationFieldItem.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/CreateOrganizationFieldRequest.md b/docs/versions/v2/Model/CreateOrganizationFieldRequest.md new file mode 100644 index 0000000..1d16e4e --- /dev/null +++ b/docs/versions/v2/Model/CreateOrganizationFieldRequest.md @@ -0,0 +1,15 @@ +# # CreateOrganizationFieldRequest + +## 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 product ID which is stored on the same account)</td><tr><td>`phone`</td><td>Phone field (up to 255 numbers and/or characters)</td><tr><td>`time`</td><td>Time field (format HH:MM:SS)</td><tr><td>`timerange`</td><td>Time-range field (has a start time and end time value, both HH:MM:SS)</td><tr><td>`daterange`</td><td>Date-range field (has a start date and end date value, both YYYY-MM-DD)</td><tr><td>`address`</td><td>Address field</dd></table> | +**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] +**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/CreatePersonField.md b/docs/versions/v2/Model/CreatePersonField.md new file mode 100644 index 0000000..4200b24 --- /dev/null +++ b/docs/versions/v2/Model/CreatePersonField.md @@ -0,0 +1,10 @@ +# # CreatePersonField + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | Whether the request was successful | [optional] +**data** | [**\Pipedrive\versions\v2\Model\PersonFieldItem**](PersonFieldItem.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/CreatePersonFieldRequest.md b/docs/versions/v2/Model/CreatePersonFieldRequest.md new file mode 100644 index 0000000..1a36fe0 --- /dev/null +++ b/docs/versions/v2/Model/CreatePersonFieldRequest.md @@ -0,0 +1,15 @@ +# # CreatePersonFieldRequest + +## 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 product ID which is stored on the same account)</td><tr><td>`phone`</td><td>Phone field (up to 255 numbers and/or characters)</td><tr><td>`time`</td><td>Time field (format HH:MM:SS)</td><tr><td>`timerange`</td><td>Time-range field (has a start time and end time value, both HH:MM:SS)</td><tr><td>`daterange`</td><td>Date-range field (has a start date and end date value, both YYYY-MM-DD)</td><tr><td>`address`</td><td>Address field</dd></table> | +**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] +**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/CreateProductField.md b/docs/versions/v2/Model/CreateProductField.md new file mode 100644 index 0000000..f5525f5 --- /dev/null +++ b/docs/versions/v2/Model/CreateProductField.md @@ -0,0 +1,10 @@ +# # CreateProductField + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | Whether the request was successful | [optional] +**data** | [**\Pipedrive\versions\v2\Model\ProductFieldItem**](ProductFieldItem.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/CreateProductFieldRequest.md b/docs/versions/v2/Model/CreateProductFieldRequest.md new file mode 100644 index 0000000..b130280 --- /dev/null +++ b/docs/versions/v2/Model/CreateProductFieldRequest.md @@ -0,0 +1,13 @@ +# # CreateProductFieldRequest + +## 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 product ID which is stored on the same account)</td><tr><td>`phone`</td><td>Phone field (up to 255 numbers and/or characters)</td><tr><td>`time`</td><td>Time field (format HH:MM:SS)</td><tr><td>`timerange`</td><td>Time-range field (has a start time and end time value, both HH:MM:SS)</td><tr><td>`daterange`</td><td>Date-range field (has a start date and end date value, both YYYY-MM-DD)</td><tr><td>`address`</td><td>Address field</dd></table> | +**options** | [**\Pipedrive\versions\v2\Model\CreateDealFieldRequestOptions[]**](CreateDealFieldRequestOptions.md) | Field options (required for enum and set field types) | [optional] +**ui_visibility** | **array** | UI visibility settings for the field. Controls where the field appears in the Pipedrive web UI. Note that products have a simpler visibility model than other entity types. | [optional] +**description** | **string** | Field description | [optional] + +[[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/DealFieldItem.md b/docs/versions/v2/Model/DealFieldItem.md new file mode 100644 index 0000000..f806205 --- /dev/null +++ b/docs/versions/v2/Model/DealFieldItem.md @@ -0,0 +1,19 @@ +# # DealFieldItem + +## 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) | +**description** | **string** | The description of the field | +**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\DealFieldItemUiVisibility**](DealFieldItemUiVisibility.md) | | [optional] +**important_fields** | [**\Pipedrive\versions\v2\Model\DealFieldItemImportantFields**](DealFieldItemImportantFields.md) | | [optional] +**required_fields** | [**\Pipedrive\versions\v2\Model\DealFieldItemRequiredFields**](DealFieldItemRequiredFields.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/DealFieldItemImportantFields.md b/docs/versions/v2/Model/DealFieldItemImportantFields.md new file mode 100644 index 0000000..cd0e170 --- /dev/null +++ b/docs/versions/v2/Model/DealFieldItemImportantFields.md @@ -0,0 +1,10 @@ +# # DealFieldItemImportantFields + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enabled** | **bool** | Whether the field is marked as important | [optional] +**stage_ids** | **int[]** | Array of stage IDs where the field is important | [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/DealFieldItemRequiredFields.md b/docs/versions/v2/Model/DealFieldItemRequiredFields.md new file mode 100644 index 0000000..d1fa85d --- /dev/null +++ b/docs/versions/v2/Model/DealFieldItemRequiredFields.md @@ -0,0 +1,11 @@ +# # DealFieldItemRequiredFields + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enabled** | **bool** | Whether the field is required | [optional] +**stage_ids** | **int[]** | Array of stage IDs where the field is required | [optional] +**statuses** | **array** | Pipeline-specific status requirements, mapping pipeline ID to array of statuses | [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/DealFieldItemUiVisibility.md b/docs/versions/v2/Model/DealFieldItemUiVisibility.md new file mode 100644 index 0000000..736a2d8 --- /dev/null +++ b/docs/versions/v2/Model/DealFieldItemUiVisibility.md @@ -0,0 +1,12 @@ +# # DealFieldItemUiVisibility + +## 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] +**projects_detail_visible_flag** | **bool** | Whether the field is shown in project details view | [optional] +**show_in_pipelines** | [**\Pipedrive\versions\v2\Model\DealFieldItemUiVisibilityShowInPipelines**](DealFieldItemUiVisibilityShowInPipelines.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/DealFieldItemUiVisibilityShowInPipelines.md b/docs/versions/v2/Model/DealFieldItemUiVisibilityShowInPipelines.md new file mode 100644 index 0000000..d2d3bda --- /dev/null +++ b/docs/versions/v2/Model/DealFieldItemUiVisibilityShowInPipelines.md @@ -0,0 +1,10 @@ +# # DealFieldItemUiVisibilityShowInPipelines + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**show_in_all** | **bool** | Whether the field is shown in all pipelines | [optional] +**pipeline_ids** | **int[]** | Specific pipeline IDs where the field is shown (if show_in_all is false) | [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/DeleteDealField.md b/docs/versions/v2/Model/DeleteDealField.md new file mode 100644 index 0000000..0f2a851 --- /dev/null +++ b/docs/versions/v2/Model/DeleteDealField.md @@ -0,0 +1,10 @@ +# # DeleteDealField + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | Whether the request was successful | [optional] +**data** | [**\Pipedrive\versions\v2\Model\DeleteDealFieldData**](DeleteDealFieldData.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/DeleteDealFieldData.md b/docs/versions/v2/Model/DeleteDealFieldData.md new file mode 100644 index 0000000..765aa6c --- /dev/null +++ b/docs/versions/v2/Model/DeleteDealFieldData.md @@ -0,0 +1,16 @@ +# # DeleteDealFieldData + +## 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) | +**description** | **string** | The description of the field | +**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 (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 | + +[[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/DeleteOrganizationField.md b/docs/versions/v2/Model/DeleteOrganizationField.md new file mode 100644 index 0000000..6c85a9e --- /dev/null +++ b/docs/versions/v2/Model/DeleteOrganizationField.md @@ -0,0 +1,10 @@ +# # DeleteOrganizationField + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | Whether the request was successful | [optional] +**data** | [**\Pipedrive\versions\v2\Model\DeletePersonFieldData**](DeletePersonFieldData.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/DeletePersonField.md b/docs/versions/v2/Model/DeletePersonField.md new file mode 100644 index 0000000..b024233 --- /dev/null +++ b/docs/versions/v2/Model/DeletePersonField.md @@ -0,0 +1,10 @@ +# # DeletePersonField + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | Whether the request was successful | [optional] +**data** | [**\Pipedrive\versions\v2\Model\DeletePersonFieldData**](DeletePersonFieldData.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/DeletePersonFieldData.md b/docs/versions/v2/Model/DeletePersonFieldData.md new file mode 100644 index 0000000..04ae8cd --- /dev/null +++ b/docs/versions/v2/Model/DeletePersonFieldData.md @@ -0,0 +1,15 @@ +# # DeletePersonFieldData + +## 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 (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 | + +[[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/DeleteProductField.md b/docs/versions/v2/Model/DeleteProductField.md new file mode 100644 index 0000000..8409922 --- /dev/null +++ b/docs/versions/v2/Model/DeleteProductField.md @@ -0,0 +1,10 @@ +# # DeleteProductField + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | Whether the request was successful | [optional] +**data** | [**\Pipedrive\versions\v2\Model\DeletePersonFieldData**](DeletePersonFieldData.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/FieldOption.md b/docs/versions/v2/Model/FieldOption.md new file mode 100644 index 0000000..a8ed23f --- /dev/null +++ b/docs/versions/v2/Model/FieldOption.md @@ -0,0 +1,10 @@ +# # FieldOption + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The unique identifier of the option | +**label** | **string** | The display label of the option | + +[[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/GetActivityField.md b/docs/versions/v2/Model/GetActivityField.md new file mode 100644 index 0000000..b6b2f79 --- /dev/null +++ b/docs/versions/v2/Model/GetActivityField.md @@ -0,0 +1,10 @@ +# # GetActivityField + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | Whether the request was successful | [optional] +**data** | [**\Pipedrive\versions\v2\Model\ActivityFieldItem**](ActivityFieldItem.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/GetActivityFields.md b/docs/versions/v2/Model/GetActivityFields.md new file mode 100644 index 0000000..181fe64 --- /dev/null +++ b/docs/versions/v2/Model/GetActivityFields.md @@ -0,0 +1,11 @@ +# # GetActivityFields + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | Whether the request was successful | [optional] +**data** | [**\Pipedrive\versions\v2\Model\ActivityFieldItem[]**](ActivityFieldItem.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/GetActivityFieldsAdditionalData.md b/docs/versions/v2/Model/GetActivityFieldsAdditionalData.md new file mode 100644 index 0000000..eed9fd7 --- /dev/null +++ b/docs/versions/v2/Model/GetActivityFieldsAdditionalData.md @@ -0,0 +1,9 @@ +# # GetActivityFieldsAdditionalData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**next_cursor** | **string** | Base64url-encoded cursor for fetching the next page of results, null if no more pages | [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/GetDealField.md b/docs/versions/v2/Model/GetDealField.md new file mode 100644 index 0000000..39aad2e --- /dev/null +++ b/docs/versions/v2/Model/GetDealField.md @@ -0,0 +1,10 @@ +# # GetDealField + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | Whether the request was successful | [optional] +**data** | [**\Pipedrive\versions\v2\Model\DealFieldItem**](DealFieldItem.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/GetDealFields.md b/docs/versions/v2/Model/GetDealFields.md new file mode 100644 index 0000000..eede140 --- /dev/null +++ b/docs/versions/v2/Model/GetDealFields.md @@ -0,0 +1,11 @@ +# # GetDealFields + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | Whether the request was successful | [optional] +**data** | [**\Pipedrive\versions\v2\Model\DealFieldItem[]**](DealFieldItem.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/GetOrganizationField.md b/docs/versions/v2/Model/GetOrganizationField.md new file mode 100644 index 0000000..2dd059f --- /dev/null +++ b/docs/versions/v2/Model/GetOrganizationField.md @@ -0,0 +1,10 @@ +# # GetOrganizationField + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | Whether the request was successful | [optional] +**data** | [**\Pipedrive\versions\v2\Model\OrganizationFieldItem**](OrganizationFieldItem.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/GetOrganizationFields.md b/docs/versions/v2/Model/GetOrganizationFields.md new file mode 100644 index 0000000..481ac91 --- /dev/null +++ b/docs/versions/v2/Model/GetOrganizationFields.md @@ -0,0 +1,11 @@ +# # GetOrganizationFields + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | Whether the request was successful | [optional] +**data** | [**\Pipedrive\versions\v2\Model\OrganizationFieldItem[]**](OrganizationFieldItem.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/GetPersonField.md b/docs/versions/v2/Model/GetPersonField.md new file mode 100644 index 0000000..c0cd1a9 --- /dev/null +++ b/docs/versions/v2/Model/GetPersonField.md @@ -0,0 +1,10 @@ +# # GetPersonField + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | Whether the request was successful | [optional] +**data** | [**\Pipedrive\versions\v2\Model\PersonFieldItem**](PersonFieldItem.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/GetPersonFields.md b/docs/versions/v2/Model/GetPersonFields.md new file mode 100644 index 0000000..afe990d --- /dev/null +++ b/docs/versions/v2/Model/GetPersonFields.md @@ -0,0 +1,11 @@ +# # GetPersonFields + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | Whether the request was successful | [optional] +**data** | [**\Pipedrive\versions\v2\Model\PersonFieldItem[]**](PersonFieldItem.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/GetProductField.md b/docs/versions/v2/Model/GetProductField.md new file mode 100644 index 0000000..6c655eb --- /dev/null +++ b/docs/versions/v2/Model/GetProductField.md @@ -0,0 +1,10 @@ +# # GetProductField + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | Whether the request was successful | [optional] +**data** | [**\Pipedrive\versions\v2\Model\ProductFieldItem**](ProductFieldItem.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/GetProductFields.md b/docs/versions/v2/Model/GetProductFields.md new file mode 100644 index 0000000..961e697 --- /dev/null +++ b/docs/versions/v2/Model/GetProductFields.md @@ -0,0 +1,11 @@ +# # GetProductFields + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | Whether the request was successful | [optional] +**data** | [**\Pipedrive\versions\v2\Model\ProductFieldItem[]**](ProductFieldItem.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/InlineResponse200.md b/docs/versions/v2/Model/InlineResponse200.md new file mode 100644 index 0000000..a6e48a0 --- /dev/null +++ b/docs/versions/v2/Model/InlineResponse200.md @@ -0,0 +1,11 @@ +# # InlineResponse200 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | | [optional] +**data** | [**\Pipedrive\versions\v2\Model\FieldOption[]**](FieldOption.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/OrganizationFieldItem.md b/docs/versions/v2/Model/OrganizationFieldItem.md new file mode 100644 index 0000000..9e9a6f9 --- /dev/null +++ b/docs/versions/v2/Model/OrganizationFieldItem.md @@ -0,0 +1,18 @@ +# # OrganizationFieldItem + +## 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\OrganizationFieldItemUiVisibility**](OrganizationFieldItemUiVisibility.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/OrganizationFieldItemUiVisibility.md b/docs/versions/v2/Model/OrganizationFieldItemUiVisibility.md new file mode 100644 index 0000000..9c15ed6 --- /dev/null +++ b/docs/versions/v2/Model/OrganizationFieldItemUiVisibility.md @@ -0,0 +1,12 @@ +# # OrganizationFieldItemUiVisibility + +## 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] +**show_in_add_deal_dialog** | [**\Pipedrive\versions\v2\Model\PersonFieldItemUiVisibilityShowInAddDealDialog**](PersonFieldItemUiVisibilityShowInAddDealDialog.md) | | [optional] +**show_in_add_person_dialog** | [**\Pipedrive\versions\v2\Model\OrganizationFieldItemUiVisibilityShowInAddPersonDialog**](OrganizationFieldItemUiVisibilityShowInAddPersonDialog.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/OrganizationFieldItemUiVisibilityShowInAddPersonDialog.md b/docs/versions/v2/Model/OrganizationFieldItemUiVisibilityShowInAddPersonDialog.md new file mode 100644 index 0000000..8293693 --- /dev/null +++ b/docs/versions/v2/Model/OrganizationFieldItemUiVisibilityShowInAddPersonDialog.md @@ -0,0 +1,10 @@ +# # OrganizationFieldItemUiVisibilityShowInAddPersonDialog + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**show** | **bool** | Whether the field is shown in the add person dialog | [optional] +**order** | **int** | Display order in the add person dialog (null if not shown) | [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/PersonFieldItem.md b/docs/versions/v2/Model/PersonFieldItem.md new file mode 100644 index 0000000..63c7701 --- /dev/null +++ b/docs/versions/v2/Model/PersonFieldItem.md @@ -0,0 +1,18 @@ +# # PersonFieldItem + +## 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\PersonFieldItemUiVisibility**](PersonFieldItemUiVisibility.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/PersonFieldItemImportantFields.md b/docs/versions/v2/Model/PersonFieldItemImportantFields.md new file mode 100644 index 0000000..6d98cda --- /dev/null +++ b/docs/versions/v2/Model/PersonFieldItemImportantFields.md @@ -0,0 +1,10 @@ +# # PersonFieldItemImportantFields + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enabled** | **bool** | Whether the field is marked as important | [optional] +**stage_ids** | **int[]** | Array of deal stage IDs where the field is important | [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/PersonFieldItemRequiredFields.md b/docs/versions/v2/Model/PersonFieldItemRequiredFields.md new file mode 100644 index 0000000..2f78a42 --- /dev/null +++ b/docs/versions/v2/Model/PersonFieldItemRequiredFields.md @@ -0,0 +1,9 @@ +# # PersonFieldItemRequiredFields + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enabled** | **bool** | Whether the field is 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/v2/Model/PersonFieldItemUiVisibility.md b/docs/versions/v2/Model/PersonFieldItemUiVisibility.md new file mode 100644 index 0000000..cf1de4b --- /dev/null +++ b/docs/versions/v2/Model/PersonFieldItemUiVisibility.md @@ -0,0 +1,11 @@ +# # PersonFieldItemUiVisibility + +## 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] +**show_in_add_deal_dialog** | [**\Pipedrive\versions\v2\Model\PersonFieldItemUiVisibilityShowInAddDealDialog**](PersonFieldItemUiVisibilityShowInAddDealDialog.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/PersonFieldItemUiVisibilityShowInAddDealDialog.md b/docs/versions/v2/Model/PersonFieldItemUiVisibilityShowInAddDealDialog.md new file mode 100644 index 0000000..f2b68c6 --- /dev/null +++ b/docs/versions/v2/Model/PersonFieldItemUiVisibilityShowInAddDealDialog.md @@ -0,0 +1,10 @@ +# # PersonFieldItemUiVisibilityShowInAddDealDialog + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**show** | **bool** | Whether the field is shown in the add deal dialog | [optional] +**order** | **int** | Display order in the add deal dialog (null if not shown) | [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/ProductFieldItem.md b/docs/versions/v2/Model/ProductFieldItem.md new file mode 100644 index 0000000..b92ada6 --- /dev/null +++ b/docs/versions/v2/Model/ProductFieldItem.md @@ -0,0 +1,16 @@ +# # ProductFieldItem + +## 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\ActivityFieldItemUiVisibility**](ActivityFieldItemUiVisibility.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/UpdateDealFieldRequest.md b/docs/versions/v2/Model/UpdateDealFieldRequest.md new file mode 100644 index 0000000..281f889 --- /dev/null +++ b/docs/versions/v2/Model/UpdateDealFieldRequest.md @@ -0,0 +1,13 @@ +# # UpdateDealFieldRequest + +## 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] +**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/UpdateOrganizationFieldRequest.md b/docs/versions/v2/Model/UpdateOrganizationFieldRequest.md new file mode 100644 index 0000000..c117d79 --- /dev/null +++ b/docs/versions/v2/Model/UpdateOrganizationFieldRequest.md @@ -0,0 +1,13 @@ +# # UpdateOrganizationFieldRequest + +## 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] +**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/UpdatePersonFieldRequest.md b/docs/versions/v2/Model/UpdatePersonFieldRequest.md new file mode 100644 index 0000000..f3af30a --- /dev/null +++ b/docs/versions/v2/Model/UpdatePersonFieldRequest.md @@ -0,0 +1,13 @@ +# # UpdatePersonFieldRequest + +## 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] +**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/UpdateProductFieldRequest.md b/docs/versions/v2/Model/UpdateProductFieldRequest.md new file mode 100644 index 0000000..4c9e10d --- /dev/null +++ b/docs/versions/v2/Model/UpdateProductFieldRequest.md @@ -0,0 +1,11 @@ +# # UpdateProductFieldRequest + +## 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. Note that products have a simpler visibility model than other entity types. | [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/README.md b/docs/versions/v2/README.md index b04ddf4..6ffd006 100644 --- a/docs/versions/v2/README.md +++ b/docs/versions/v2/README.md @@ -270,6 +270,8 @@ Class | Method | HTTP request | Description *ActivitiesApi* | [**getActivities**](Api/ActivitiesApi.md#getactivities) | **GET** /activities | Get all activities *ActivitiesApi* | [**getActivity**](Api/ActivitiesApi.md#getactivity) | **GET** /activities/{id} | Get details of an activity *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* | [**convertDealToLead**](Api/BetaApi.md#convertdealtolead) | **POST** /deals/{id}/convert/lead | Convert a deal to a lead (BETA) *BetaApi* | [**convertLeadToDeal**](Api/BetaApi.md#convertleadtodeal) | **POST** /leads/{id}/convert/deal | Convert a lead to a deal (BETA) *BetaApi* | [**deleteInstallment**](Api/BetaApi.md#deleteinstallment) | **DELETE** /deals/{id}/installments/{installment_id} | Delete an installment from a deal @@ -282,6 +284,14 @@ Class | Method | HTTP request | Description *BetaApi* | [**updateInstallment**](Api/BetaApi.md#updateinstallment) | **PATCH** /deals/{id}/installments/{installment_id} | Update an installment added to a deal *BetaApi* | [**updateProductImage**](Api/BetaApi.md#updateproductimage) | **PUT** /products/{id}/images | Update an image for a product *BetaApi* | [**uploadProductImage**](Api/BetaApi.md#uploadproductimage) | **POST** /products/{id}/images | Upload an image for a product +*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 +*DealFieldsApi* | [**deleteDealFieldOptions**](Api/DealFieldsApi.md#deletedealfieldoptions) | **DELETE** /dealFields/{field_code}/options | Delete deal field options in bulk +*DealFieldsApi* | [**getDealField**](Api/DealFieldsApi.md#getdealfield) | **GET** /dealFields/{field_code} | Get one deal field +*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 *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 @@ -315,6 +325,14 @@ Class | Method | HTTP request | Description *LeadsApi* | [**convertLeadToDeal**](Api/LeadsApi.md#convertleadtodeal) | **POST** /leads/{id}/convert/deal | Convert a lead to a deal (BETA) *LeadsApi* | [**getLeadConversionStatus**](Api/LeadsApi.md#getleadconversionstatus) | **GET** /leads/{id}/convert/status/{conversion_id} | Get Lead conversion status (BETA) *LeadsApi* | [**searchLeads**](Api/LeadsApi.md#searchleads) | **GET** /leads/search | Search leads +*OrganizationFieldsApi* | [**addOrganizationField**](Api/OrganizationFieldsApi.md#addorganizationfield) | **POST** /organizationFields | Create one organization field +*OrganizationFieldsApi* | [**addOrganizationFieldOptions**](Api/OrganizationFieldsApi.md#addorganizationfieldoptions) | **POST** /organizationFields/{field_code}/options | Add organization field options in bulk +*OrganizationFieldsApi* | [**deleteOrganizationField**](Api/OrganizationFieldsApi.md#deleteorganizationfield) | **DELETE** /organizationFields/{field_code} | Delete one organization field +*OrganizationFieldsApi* | [**deleteOrganizationFieldOptions**](Api/OrganizationFieldsApi.md#deleteorganizationfieldoptions) | **DELETE** /organizationFields/{field_code}/options | Delete organization field options in bulk +*OrganizationFieldsApi* | [**getOrganizationField**](Api/OrganizationFieldsApi.md#getorganizationfield) | **GET** /organizationFields/{field_code} | Get one organization field +*OrganizationFieldsApi* | [**getOrganizationFields**](Api/OrganizationFieldsApi.md#getorganizationfields) | **GET** /organizationFields | Get all organization fields +*OrganizationFieldsApi* | [**updateOrganizationField**](Api/OrganizationFieldsApi.md#updateorganizationfield) | **PATCH** /organizationFields/{field_code} | Update one organization field +*OrganizationFieldsApi* | [**updateOrganizationFieldOptions**](Api/OrganizationFieldsApi.md#updateorganizationfieldoptions) | **PATCH** /organizationFields/{field_code}/options | Update organization field options in bulk *OrganizationsApi* | [**addOrganization**](Api/OrganizationsApi.md#addorganization) | **POST** /organizations | Add a new organization *OrganizationsApi* | [**addOrganizationFollower**](Api/OrganizationsApi.md#addorganizationfollower) | **POST** /organizations/{id}/followers | Add a follower to an organization *OrganizationsApi* | [**deleteOrganization**](Api/OrganizationsApi.md#deleteorganization) | **DELETE** /organizations/{id} | Delete a organization @@ -325,6 +343,14 @@ Class | Method | HTTP request | Description *OrganizationsApi* | [**getOrganizations**](Api/OrganizationsApi.md#getorganizations) | **GET** /organizations | Get all organizations *OrganizationsApi* | [**searchOrganization**](Api/OrganizationsApi.md#searchorganization) | **GET** /organizations/search | Search organizations *OrganizationsApi* | [**updateOrganization**](Api/OrganizationsApi.md#updateorganization) | **PATCH** /organizations/{id} | Update a organization +*PersonFieldsApi* | [**addPersonField**](Api/PersonFieldsApi.md#addpersonfield) | **POST** /personFields | Create one person field +*PersonFieldsApi* | [**addPersonFieldOptions**](Api/PersonFieldsApi.md#addpersonfieldoptions) | **POST** /personFields/{field_code}/options | Add person field options in bulk +*PersonFieldsApi* | [**deletePersonField**](Api/PersonFieldsApi.md#deletepersonfield) | **DELETE** /personFields/{field_code} | Delete one person field +*PersonFieldsApi* | [**deletePersonFieldOptions**](Api/PersonFieldsApi.md#deletepersonfieldoptions) | **DELETE** /personFields/{field_code}/options | Delete person field options in bulk +*PersonFieldsApi* | [**getPersonField**](Api/PersonFieldsApi.md#getpersonfield) | **GET** /personFields/{field_code} | Get one person field +*PersonFieldsApi* | [**getPersonFields**](Api/PersonFieldsApi.md#getpersonfields) | **GET** /personFields | Get all person fields +*PersonFieldsApi* | [**updatePersonField**](Api/PersonFieldsApi.md#updatepersonfield) | **PATCH** /personFields/{field_code} | Update one person field +*PersonFieldsApi* | [**updatePersonFieldOptions**](Api/PersonFieldsApi.md#updatepersonfieldoptions) | **PATCH** /personFields/{field_code}/options | Update person field options in bulk *PersonsApi* | [**addPerson**](Api/PersonsApi.md#addperson) | **POST** /persons | Add a new person *PersonsApi* | [**addPersonFollower**](Api/PersonsApi.md#addpersonfollower) | **POST** /persons/{id}/followers | Add a follower to a person *PersonsApi* | [**deletePerson**](Api/PersonsApi.md#deleteperson) | **DELETE** /persons/{id} | Delete a person @@ -340,6 +366,14 @@ Class | Method | HTTP request | Description *PipelinesApi* | [**getPipeline**](Api/PipelinesApi.md#getpipeline) | **GET** /pipelines/{id} | Get one pipeline *PipelinesApi* | [**getPipelines**](Api/PipelinesApi.md#getpipelines) | **GET** /pipelines | Get all pipelines *PipelinesApi* | [**updatePipeline**](Api/PipelinesApi.md#updatepipeline) | **PATCH** /pipelines/{id} | Update a pipeline +*ProductFieldsApi* | [**addProductField**](Api/ProductFieldsApi.md#addproductfield) | **POST** /productFields | Create one product field +*ProductFieldsApi* | [**addProductFieldOptions**](Api/ProductFieldsApi.md#addproductfieldoptions) | **POST** /productFields/{field_code}/options | Add product field options in bulk +*ProductFieldsApi* | [**deleteProductField**](Api/ProductFieldsApi.md#deleteproductfield) | **DELETE** /productFields/{field_code} | Delete one product field +*ProductFieldsApi* | [**deleteProductFieldOptions**](Api/ProductFieldsApi.md#deleteproductfieldoptions) | **DELETE** /productFields/{field_code}/options | Delete product field options in bulk +*ProductFieldsApi* | [**getProductField**](Api/ProductFieldsApi.md#getproductfield) | **GET** /productFields/{field_code} | Get one product field +*ProductFieldsApi* | [**getProductFields**](Api/ProductFieldsApi.md#getproductfields) | **GET** /productFields | Get all product fields +*ProductFieldsApi* | [**updateProductField**](Api/ProductFieldsApi.md#updateproductfield) | **PATCH** /productFields/{field_code} | Update one product field +*ProductFieldsApi* | [**updateProductFieldOptions**](Api/ProductFieldsApi.md#updateproductfieldoptions) | **PATCH** /productFields/{field_code}/options | Update product field options in bulk *ProductsApi* | [**addProduct**](Api/ProductsApi.md#addproduct) | **POST** /products | Add a product *ProductsApi* | [**addProductFollower**](Api/ProductsApi.md#addproductfollower) | **POST** /products/{id}/followers | Add a follower to a product *ProductsApi* | [**addProductVariation**](Api/ProductsApi.md#addproductvariation) | **POST** /products/{id}/variations | Add a product variation @@ -369,6 +403,10 @@ Class | Method | HTTP request | Description ## Documentation for models + - [ActivityFieldItem](Model/ActivityFieldItem.md) + - [ActivityFieldItemOptions](Model/ActivityFieldItemOptions.md) + - [ActivityFieldItemSubfields](Model/ActivityFieldItemSubfields.md) + - [ActivityFieldItemUiVisibility](Model/ActivityFieldItemUiVisibility.md) - [ActivityItem](Model/ActivityItem.md) - [ActivityItemAttendees](Model/ActivityItemAttendees.md) - [ActivityItemLocation](Model/ActivityItemLocation.md) @@ -400,8 +438,22 @@ Class | Method | HTTP request | Description - [BillingFrequency](Model/BillingFrequency.md) - [BillingFrequency1](Model/BillingFrequency1.md) - [ConvertEntityResponse](Model/ConvertEntityResponse.md) + - [CreateDealField](Model/CreateDealField.md) + - [CreateDealFieldRequest](Model/CreateDealFieldRequest.md) + - [CreateDealFieldRequestOptions](Model/CreateDealFieldRequestOptions.md) - [CreateManyDealProductRequestBody](Model/CreateManyDealProductRequestBody.md) - [CreateManyDealProductResponse](Model/CreateManyDealProductResponse.md) + - [CreateOrganizationField](Model/CreateOrganizationField.md) + - [CreateOrganizationFieldRequest](Model/CreateOrganizationFieldRequest.md) + - [CreatePersonField](Model/CreatePersonField.md) + - [CreatePersonFieldRequest](Model/CreatePersonFieldRequest.md) + - [CreateProductField](Model/CreateProductField.md) + - [CreateProductFieldRequest](Model/CreateProductFieldRequest.md) + - [DealFieldItem](Model/DealFieldItem.md) + - [DealFieldItemImportantFields](Model/DealFieldItemImportantFields.md) + - [DealFieldItemRequiredFields](Model/DealFieldItemRequiredFields.md) + - [DealFieldItemUiVisibility](Model/DealFieldItemUiVisibility.md) + - [DealFieldItemUiVisibilityShowInPipelines](Model/DealFieldItemUiVisibilityShowInPipelines.md) - [DealItem](Model/DealItem.md) - [DealProductRequestBody](Model/DealProductRequestBody.md) - [DealRequestBody](Model/DealRequestBody.md) @@ -416,6 +468,8 @@ Class | Method | HTTP request | Description - [DeleteActivityResponseData](Model/DeleteActivityResponseData.md) - [DeleteAdditionalDiscountResponse](Model/DeleteAdditionalDiscountResponse.md) - [DeleteAdditionalDiscountResponseData](Model/DeleteAdditionalDiscountResponseData.md) + - [DeleteDealField](Model/DeleteDealField.md) + - [DeleteDealFieldData](Model/DeleteDealFieldData.md) - [DeleteDealProduct](Model/DeleteDealProduct.md) - [DeleteDealProductData](Model/DeleteDealProductData.md) - [DeleteDealResponse](Model/DeleteDealResponse.md) @@ -427,12 +481,16 @@ Class | Method | HTTP request | Description - [DeleteManyDealProductResponse](Model/DeleteManyDealProductResponse.md) - [DeleteManyDealProductResponseAdditionalData](Model/DeleteManyDealProductResponseAdditionalData.md) - [DeleteManyDealProductResponseData](Model/DeleteManyDealProductResponseData.md) + - [DeleteOrganizationField](Model/DeleteOrganizationField.md) - [DeleteOrganizationResponse](Model/DeleteOrganizationResponse.md) - [DeleteOrganizationResponseData](Model/DeleteOrganizationResponseData.md) + - [DeletePersonField](Model/DeletePersonField.md) + - [DeletePersonFieldData](Model/DeletePersonFieldData.md) - [DeletePersonResponse](Model/DeletePersonResponse.md) - [DeletePersonResponseData](Model/DeletePersonResponseData.md) - [DeletePipelineResponse](Model/DeletePipelineResponse.md) - [DeletePipelineResponseData](Model/DeletePipelineResponseData.md) + - [DeleteProductField](Model/DeleteProductField.md) - [DeleteProductImageResponse](Model/DeleteProductImageResponse.md) - [DeleteProductImageResponseData](Model/DeleteProductImageResponseData.md) - [DeleteProductResponse](Model/DeleteProductResponse.md) @@ -441,12 +499,18 @@ Class | Method | HTTP request | Description - [DeleteProductVariationData](Model/DeleteProductVariationData.md) - [DeleteStageResponse](Model/DeleteStageResponse.md) - [DeleteStageResponseData](Model/DeleteStageResponseData.md) + - [FieldOption](Model/FieldOption.md) - [FollowerChangelogItem](Model/FollowerChangelogItem.md) - [FollowerItem](Model/FollowerItem.md) - [FollowerRequestBody](Model/FollowerRequestBody.md) - [GetActivities](Model/GetActivities.md) - [GetActivitiesAllOf](Model/GetActivitiesAllOf.md) + - [GetActivityField](Model/GetActivityField.md) + - [GetActivityFields](Model/GetActivityFields.md) + - [GetActivityFieldsAdditionalData](Model/GetActivityFieldsAdditionalData.md) - [GetConvertResponse](Model/GetConvertResponse.md) + - [GetDealField](Model/GetDealField.md) + - [GetDealFields](Model/GetDealFields.md) - [GetDealSearchResponse](Model/GetDealSearchResponse.md) - [GetDealSearchResponseAllOf](Model/GetDealSearchResponseAllOf.md) - [GetDealSearchResponseAllOfData](Model/GetDealSearchResponseAllOfData.md) @@ -460,17 +524,24 @@ Class | Method | HTTP request | Description - [GetItemSearchResponseDataData](Model/GetItemSearchResponseDataData.md) - [GetLeadSearchResponseData](Model/GetLeadSearchResponseData.md) - [GetLeadSearchResponseDataData](Model/GetLeadSearchResponseDataData.md) + - [GetOrganizationField](Model/GetOrganizationField.md) + - [GetOrganizationFields](Model/GetOrganizationFields.md) - [GetOrganizationSearchResponse](Model/GetOrganizationSearchResponse.md) - [GetOrganizationSearchResponseAllOf](Model/GetOrganizationSearchResponseAllOf.md) - [GetOrganizationSearchResponseAllOfData](Model/GetOrganizationSearchResponseAllOfData.md) - [GetOrganizations](Model/GetOrganizations.md) - [GetOrganizationsAllOf](Model/GetOrganizationsAllOf.md) + - [GetPersonField](Model/GetPersonField.md) + - [GetPersonFields](Model/GetPersonFields.md) - [GetPersons](Model/GetPersons.md) - [GetPersonsAllOf](Model/GetPersonsAllOf.md) - [GetPipelines](Model/GetPipelines.md) - [GetPipelinesAllOf](Model/GetPipelinesAllOf.md) + - [GetProductField](Model/GetProductField.md) + - [GetProductFields](Model/GetProductFields.md) - [GetStages](Model/GetStages.md) - [InlineObject](Model/InlineObject.md) + - [InlineResponse200](Model/InlineResponse200.md) - [InstallmentRequestBody](Model/InstallmentRequestBody.md) - [InstallmentsResponse](Model/InstallmentsResponse.md) - [ItemSearchFieldResponse](Model/ItemSearchFieldResponse.md) @@ -485,11 +556,19 @@ Class | Method | HTTP request | Description - [LeadSearchResponse](Model/LeadSearchResponse.md) - [NameObject](Model/NameObject.md) - [NewDealProductRequestBody](Model/NewDealProductRequestBody.md) + - [OrganizationFieldItem](Model/OrganizationFieldItem.md) + - [OrganizationFieldItemUiVisibility](Model/OrganizationFieldItemUiVisibility.md) + - [OrganizationFieldItemUiVisibilityShowInAddPersonDialog](Model/OrganizationFieldItemUiVisibilityShowInAddPersonDialog.md) - [OrganizationItem](Model/OrganizationItem.md) - [OrganizationItemAddress](Model/OrganizationItemAddress.md) - [OrganizationRequestBody](Model/OrganizationRequestBody.md) - [OrganizationSearchItem](Model/OrganizationSearchItem.md) - [OrganizationSearchItemItem](Model/OrganizationSearchItemItem.md) + - [PersonFieldItem](Model/PersonFieldItem.md) + - [PersonFieldItemImportantFields](Model/PersonFieldItemImportantFields.md) + - [PersonFieldItemRequiredFields](Model/PersonFieldItemRequiredFields.md) + - [PersonFieldItemUiVisibility](Model/PersonFieldItemUiVisibility.md) + - [PersonFieldItemUiVisibilityShowInAddDealDialog](Model/PersonFieldItemUiVisibilityShowInAddDealDialog.md) - [PersonItem](Model/PersonItem.md) - [PersonItemEmails](Model/PersonItemEmails.md) - [PersonItemIm](Model/PersonItemIm.md) @@ -515,6 +594,7 @@ Class | Method | HTTP request | Description - [PostPatchGetPerson](Model/PostPatchGetPerson.md) - [PostPatchGetPipeline](Model/PostPatchGetPipeline.md) - [PostPatchGetStage](Model/PostPatchGetStage.md) + - [ProductFieldItem](Model/ProductFieldItem.md) - [ProductImageResponse](Model/ProductImageResponse.md) - [ProductImageResponseData](Model/ProductImageResponseData.md) - [ProductRequest](Model/ProductRequest.md) @@ -534,8 +614,12 @@ Class | Method | HTTP request | Description - [StageItem](Model/StageItem.md) - [StageRequestBody](Model/StageRequestBody.md) - [UpdateAdditionalDiscountResponse](Model/UpdateAdditionalDiscountResponse.md) + - [UpdateDealFieldRequest](Model/UpdateDealFieldRequest.md) - [UpdateDealProductRequestBody](Model/UpdateDealProductRequestBody.md) - [UpdateInstallmentResponse](Model/UpdateInstallmentResponse.md) + - [UpdateOrganizationFieldRequest](Model/UpdateOrganizationFieldRequest.md) + - [UpdatePersonFieldRequest](Model/UpdatePersonFieldRequest.md) + - [UpdateProductFieldRequest](Model/UpdateProductFieldRequest.md) - [UpdateProductImageResponse](Model/UpdateProductImageResponse.md) - [UpdateProductRequestBody](Model/UpdateProductRequestBody.md) - [UpdateProductResponse](Model/UpdateProductResponse.md) diff --git a/lib/versions/v2/Api/ActivityFieldsApi.php b/lib/versions/v2/Api/ActivityFieldsApi.php new file mode 100644 index 0000000..d65384e --- /dev/null +++ b/lib/versions/v2/Api/ActivityFieldsApi.php @@ -0,0 +1,767 @@ +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 getActivityField + * + * Get one activity field + * + * @param string $field_code The unique code identifying the field (required) + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\GetActivityField + */ + public function getActivityField($field_code, $include_fields = null) + { + list($response) = $this->getActivityFieldWithHttpInfo($field_code, $include_fields); + return $response; + } + + /** + * Operation getActivityFieldWithHttpInfo + * + * Get one activity field + * + * @param string $field_code The unique code identifying the field (required) + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\GetActivityField, HTTP status code, HTTP response headers (array of strings) + */ + public function getActivityFieldWithHttpInfo($field_code, $include_fields = null) + { + $request = $this->getActivityFieldRequest($field_code, $include_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->getActivityFieldRequest($field_code, $include_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\GetActivityField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetActivityField', []), + $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\GetActivityField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetActivityField', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetActivityField', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getActivityFieldAsync + * + * Get one activity field + * + * @param string $field_code The unique code identifying the field (required) + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getActivityFieldAsync($field_code, $include_fields = null): PromiseInterface + { + return $this->getActivityFieldAsyncWithHttpInfo($field_code, $include_fields) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getActivityFieldAsyncWithHttpInfo + * + * Get one activity field + * + * @param string $field_code The unique code identifying the field (required) + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getActivityFieldAsyncWithHttpInfo($field_code, $include_fields = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetActivityField'; + $request = $this->getActivityFieldRequest($field_code, $include_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 'getActivityField' + * + * @param string $field_code The unique code identifying the field (required) + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function getActivityFieldRequest($field_code, $include_fields = null): 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 getActivityField' + ); + } + + $resourcePath = '/activityFields/{field_code}'; + $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; + } + + + // 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 getActivityFields + * + * Get all activity fields + * + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (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\GetActivityFields + */ + public function getActivityFields($include_fields = null, $limit = null, $cursor = null) + { + list($response) = $this->getActivityFieldsWithHttpInfo($include_fields, $limit, $cursor); + return $response; + } + + /** + * Operation getActivityFieldsWithHttpInfo + * + * Get all activity fields + * + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (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\GetActivityFields, HTTP status code, HTTP response headers (array of strings) + */ + public function getActivityFieldsWithHttpInfo($include_fields = null, $limit = null, $cursor = null) + { + $request = $this->getActivityFieldsRequest($include_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->getActivityFieldsRequest($include_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\GetActivityFields' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetActivityFields', []), + $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\GetActivityFields' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetActivityFields', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetActivityFields', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getActivityFieldsAsync + * + * Get all activity fields + * + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (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 getActivityFieldsAsync($include_fields = null, $limit = null, $cursor = null): PromiseInterface + { + return $this->getActivityFieldsAsyncWithHttpInfo($include_fields, $limit, $cursor) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getActivityFieldsAsyncWithHttpInfo + * + * Get all activity fields + * + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (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 getActivityFieldsAsyncWithHttpInfo($include_fields = null, $limit = null, $cursor = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetActivityFields'; + $request = $this->getActivityFieldsRequest($include_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 'getActivityFields' + * + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (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 getActivityFieldsRequest($include_fields = null, $limit = null, $cursor = null): Request + { + + $resourcePath = '/activityFields'; + $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($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 + ); + } + + /** + * 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/DealFieldsApi.php b/lib/versions/v2/Api/DealFieldsApi.php new file mode 100644 index 0000000..e0fd6f0 --- /dev/null +++ b/lib/versions/v2/Api/DealFieldsApi.php @@ -0,0 +1,2613 @@ +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 addDealField + * + * Create one deal field + * + * @param \Pipedrive\versions\v2\Model\CreateDealFieldRequest $create_deal_field_request create_deal_field_request (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\CreateDealField + */ + public function addDealField($create_deal_field_request) + { + list($response) = $this->addDealFieldWithHttpInfo($create_deal_field_request); + return $response; + } + + /** + * Operation addDealFieldWithHttpInfo + * + * Create one deal field + * + * @param \Pipedrive\versions\v2\Model\CreateDealFieldRequest $create_deal_field_request (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\CreateDealField, HTTP status code, HTTP response headers (array of strings) + */ + public function addDealFieldWithHttpInfo($create_deal_field_request) + { + $request = $this->addDealFieldRequest($create_deal_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->addDealFieldRequest($create_deal_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\CreateDealField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\CreateDealField', []), + $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\CreateDealField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\CreateDealField', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\CreateDealField', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation addDealFieldAsync + * + * Create one deal field + * + * @param \Pipedrive\versions\v2\Model\CreateDealFieldRequest $create_deal_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addDealFieldAsync($create_deal_field_request): PromiseInterface + { + return $this->addDealFieldAsyncWithHttpInfo($create_deal_field_request) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addDealFieldAsyncWithHttpInfo + * + * Create one deal field + * + * @param \Pipedrive\versions\v2\Model\CreateDealFieldRequest $create_deal_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addDealFieldAsyncWithHttpInfo($create_deal_field_request): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\CreateDealField'; + $request = $this->addDealFieldRequest($create_deal_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 'addDealField' + * + * @param \Pipedrive\versions\v2\Model\CreateDealFieldRequest $create_deal_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function addDealFieldRequest($create_deal_field_request): Request + { + // verify the required parameter 'create_deal_field_request' is set + /* @phpstan-ignore-next-line */ + if ($create_deal_field_request === null || (is_array($create_deal_field_request) && count($create_deal_field_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $create_deal_field_request when calling addDealField' + ); + } + + $resourcePath = '/dealFields'; + $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_deal_field_request)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($create_deal_field_request)); + } else { + $httpBody = $create_deal_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 addDealFieldOptions + * + * Add deal 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 addDealFieldOptions($field_code, $request_body) + { + list($response) = $this->addDealFieldOptionsWithHttpInfo($field_code, $request_body); + return $response; + } + + /** + * Operation addDealFieldOptionsWithHttpInfo + * + * Add deal 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 addDealFieldOptionsWithHttpInfo($field_code, $request_body) + { + $request = $this->addDealFieldOptionsRequest($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->addDealFieldOptionsRequest($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 addDealFieldOptionsAsync + * + * Add deal 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 addDealFieldOptionsAsync($field_code, $request_body): PromiseInterface + { + return $this->addDealFieldOptionsAsyncWithHttpInfo($field_code, $request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addDealFieldOptionsAsyncWithHttpInfo + * + * Add deal 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 addDealFieldOptionsAsyncWithHttpInfo($field_code, $request_body): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\InlineResponse200'; + $request = $this->addDealFieldOptionsRequest($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 'addDealFieldOptions' + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function addDealFieldOptionsRequest($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 addDealFieldOptions' + ); + } + // 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 addDealFieldOptions' + ); + } + + $resourcePath = '/dealFields/{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 deleteDealField + * + * Delete one deal 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\DeleteDealField + */ + public function deleteDealField($field_code) + { + list($response) = $this->deleteDealFieldWithHttpInfo($field_code); + return $response; + } + + /** + * Operation deleteDealFieldWithHttpInfo + * + * Delete one deal 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\DeleteDealField, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteDealFieldWithHttpInfo($field_code) + { + $request = $this->deleteDealFieldRequest($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->deleteDealFieldRequest($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\DeleteDealField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteDealField', []), + $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\DeleteDealField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteDealField', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\DeleteDealField', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteDealFieldAsync + * + * Delete one deal field + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteDealFieldAsync($field_code): PromiseInterface + { + return $this->deleteDealFieldAsyncWithHttpInfo($field_code) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteDealFieldAsyncWithHttpInfo + * + * Delete one deal field + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteDealFieldAsyncWithHttpInfo($field_code): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\DeleteDealField'; + $request = $this->deleteDealFieldRequest($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 'deleteDealField' + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function deleteDealFieldRequest($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 deleteDealField' + ); + } + + $resourcePath = '/dealFields/{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 deleteDealFieldOptions + * + * Delete deal 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 deleteDealFieldOptions($field_code, $request_body) + { + list($response) = $this->deleteDealFieldOptionsWithHttpInfo($field_code, $request_body); + return $response; + } + + /** + * Operation deleteDealFieldOptionsWithHttpInfo + * + * Delete deal 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 deleteDealFieldOptionsWithHttpInfo($field_code, $request_body) + { + $request = $this->deleteDealFieldOptionsRequest($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->deleteDealFieldOptionsRequest($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 deleteDealFieldOptionsAsync + * + * Delete deal 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 deleteDealFieldOptionsAsync($field_code, $request_body): PromiseInterface + { + return $this->deleteDealFieldOptionsAsyncWithHttpInfo($field_code, $request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteDealFieldOptionsAsyncWithHttpInfo + * + * Delete deal 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 deleteDealFieldOptionsAsyncWithHttpInfo($field_code, $request_body): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\InlineResponse200'; + $request = $this->deleteDealFieldOptionsRequest($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 'deleteDealFieldOptions' + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function deleteDealFieldOptionsRequest($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 deleteDealFieldOptions' + ); + } + // 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 deleteDealFieldOptions' + ); + } + + $resourcePath = '/dealFields/{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 getDealField + * + * Get one deal field + * + * @param string $field_code The unique code identifying the field (required) + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\GetDealField + */ + public function getDealField($field_code, $include_fields = null) + { + list($response) = $this->getDealFieldWithHttpInfo($field_code, $include_fields); + return $response; + } + + /** + * Operation getDealFieldWithHttpInfo + * + * Get one deal field + * + * @param string $field_code The unique code identifying the field (required) + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\GetDealField, HTTP status code, HTTP response headers (array of strings) + */ + public function getDealFieldWithHttpInfo($field_code, $include_fields = null) + { + $request = $this->getDealFieldRequest($field_code, $include_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->getDealFieldRequest($field_code, $include_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\GetDealField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetDealField', []), + $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\GetDealField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetDealField', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetDealField', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getDealFieldAsync + * + * Get one deal field + * + * @param string $field_code The unique code identifying the field (required) + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getDealFieldAsync($field_code, $include_fields = null): PromiseInterface + { + return $this->getDealFieldAsyncWithHttpInfo($field_code, $include_fields) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getDealFieldAsyncWithHttpInfo + * + * Get one deal field + * + * @param string $field_code The unique code identifying the field (required) + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getDealFieldAsyncWithHttpInfo($field_code, $include_fields = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetDealField'; + $request = $this->getDealFieldRequest($field_code, $include_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 'getDealField' + * + * @param string $field_code The unique code identifying the field (required) + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function getDealFieldRequest($field_code, $include_fields = null): 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 getDealField' + ); + } + + $resourcePath = '/dealFields/{field_code}'; + $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; + } + + + // 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 getDealFields + * + * Get all deal fields + * + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (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\GetDealFields + */ + public function getDealFields($include_fields = null, $limit = null, $cursor = null) + { + list($response) = $this->getDealFieldsWithHttpInfo($include_fields, $limit, $cursor); + return $response; + } + + /** + * Operation getDealFieldsWithHttpInfo + * + * Get all deal fields + * + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (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\GetDealFields, HTTP status code, HTTP response headers (array of strings) + */ + public function getDealFieldsWithHttpInfo($include_fields = null, $limit = null, $cursor = null) + { + $request = $this->getDealFieldsRequest($include_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->getDealFieldsRequest($include_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\GetDealFields' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetDealFields', []), + $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\GetDealFields' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetDealFields', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetDealFields', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getDealFieldsAsync + * + * Get all deal fields + * + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (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 getDealFieldsAsync($include_fields = null, $limit = null, $cursor = null): PromiseInterface + { + return $this->getDealFieldsAsyncWithHttpInfo($include_fields, $limit, $cursor) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getDealFieldsAsyncWithHttpInfo + * + * Get all deal fields + * + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (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 getDealFieldsAsyncWithHttpInfo($include_fields = null, $limit = null, $cursor = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetDealFields'; + $request = $this->getDealFieldsRequest($include_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 'getDealFields' + * + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (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 getDealFieldsRequest($include_fields = null, $limit = null, $cursor = null): Request + { + + $resourcePath = '/dealFields'; + $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($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 updateDealField + * + * Update one deal field + * + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdateDealFieldRequest $update_deal_field_request update_deal_field_request (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\GetDealField + */ + public function updateDealField($field_code, $update_deal_field_request) + { + list($response) = $this->updateDealFieldWithHttpInfo($field_code, $update_deal_field_request); + return $response; + } + + /** + * Operation updateDealFieldWithHttpInfo + * + * Update one deal field + * + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdateDealFieldRequest $update_deal_field_request (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\GetDealField, HTTP status code, HTTP response headers (array of strings) + */ + public function updateDealFieldWithHttpInfo($field_code, $update_deal_field_request) + { + $request = $this->updateDealFieldRequest($field_code, $update_deal_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->updateDealFieldRequest($field_code, $update_deal_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\GetDealField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetDealField', []), + $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\GetDealField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetDealField', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetDealField', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateDealFieldAsync + * + * Update one deal field + * + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdateDealFieldRequest $update_deal_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function updateDealFieldAsync($field_code, $update_deal_field_request): PromiseInterface + { + return $this->updateDealFieldAsyncWithHttpInfo($field_code, $update_deal_field_request) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateDealFieldAsyncWithHttpInfo + * + * Update one deal field + * + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdateDealFieldRequest $update_deal_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function updateDealFieldAsyncWithHttpInfo($field_code, $update_deal_field_request): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetDealField'; + $request = $this->updateDealFieldRequest($field_code, $update_deal_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 'updateDealField' + * + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdateDealFieldRequest $update_deal_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function updateDealFieldRequest($field_code, $update_deal_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 updateDealField' + ); + } + // verify the required parameter 'update_deal_field_request' is set + /* @phpstan-ignore-next-line */ + if ($update_deal_field_request === null || (is_array($update_deal_field_request) && count($update_deal_field_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $update_deal_field_request when calling updateDealField' + ); + } + + $resourcePath = '/dealFields/{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_deal_field_request)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_deal_field_request)); + } else { + $httpBody = $update_deal_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 updateDealFieldOptions + * + * Update deal 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 updateDealFieldOptions($field_code, $request_body) + { + list($response) = $this->updateDealFieldOptionsWithHttpInfo($field_code, $request_body); + return $response; + } + + /** + * Operation updateDealFieldOptionsWithHttpInfo + * + * Update deal 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 updateDealFieldOptionsWithHttpInfo($field_code, $request_body) + { + $request = $this->updateDealFieldOptionsRequest($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->updateDealFieldOptionsRequest($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 updateDealFieldOptionsAsync + * + * Update deal 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 updateDealFieldOptionsAsync($field_code, $request_body): PromiseInterface + { + return $this->updateDealFieldOptionsAsyncWithHttpInfo($field_code, $request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateDealFieldOptionsAsyncWithHttpInfo + * + * Update deal 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 updateDealFieldOptionsAsyncWithHttpInfo($field_code, $request_body): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\InlineResponse200'; + $request = $this->updateDealFieldOptionsRequest($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 'updateDealFieldOptions' + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function updateDealFieldOptionsRequest($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 updateDealFieldOptions' + ); + } + // 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 updateDealFieldOptions' + ); + } + + $resourcePath = '/dealFields/{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/OrganizationFieldsApi.php b/lib/versions/v2/Api/OrganizationFieldsApi.php new file mode 100644 index 0000000..7676960 --- /dev/null +++ b/lib/versions/v2/Api/OrganizationFieldsApi.php @@ -0,0 +1,2613 @@ +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 addOrganizationField + * + * Create one organization field + * + * @param \Pipedrive\versions\v2\Model\CreateOrganizationFieldRequest $create_organization_field_request create_organization_field_request (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\CreateOrganizationField + */ + public function addOrganizationField($create_organization_field_request) + { + list($response) = $this->addOrganizationFieldWithHttpInfo($create_organization_field_request); + return $response; + } + + /** + * Operation addOrganizationFieldWithHttpInfo + * + * Create one organization field + * + * @param \Pipedrive\versions\v2\Model\CreateOrganizationFieldRequest $create_organization_field_request (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\CreateOrganizationField, HTTP status code, HTTP response headers (array of strings) + */ + public function addOrganizationFieldWithHttpInfo($create_organization_field_request) + { + $request = $this->addOrganizationFieldRequest($create_organization_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->addOrganizationFieldRequest($create_organization_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\CreateOrganizationField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\CreateOrganizationField', []), + $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\CreateOrganizationField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\CreateOrganizationField', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\CreateOrganizationField', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation addOrganizationFieldAsync + * + * Create one organization field + * + * @param \Pipedrive\versions\v2\Model\CreateOrganizationFieldRequest $create_organization_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addOrganizationFieldAsync($create_organization_field_request): PromiseInterface + { + return $this->addOrganizationFieldAsyncWithHttpInfo($create_organization_field_request) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addOrganizationFieldAsyncWithHttpInfo + * + * Create one organization field + * + * @param \Pipedrive\versions\v2\Model\CreateOrganizationFieldRequest $create_organization_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addOrganizationFieldAsyncWithHttpInfo($create_organization_field_request): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\CreateOrganizationField'; + $request = $this->addOrganizationFieldRequest($create_organization_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 'addOrganizationField' + * + * @param \Pipedrive\versions\v2\Model\CreateOrganizationFieldRequest $create_organization_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function addOrganizationFieldRequest($create_organization_field_request): Request + { + // verify the required parameter 'create_organization_field_request' is set + /* @phpstan-ignore-next-line */ + if ($create_organization_field_request === null || (is_array($create_organization_field_request) && count($create_organization_field_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $create_organization_field_request when calling addOrganizationField' + ); + } + + $resourcePath = '/organizationFields'; + $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_organization_field_request)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($create_organization_field_request)); + } else { + $httpBody = $create_organization_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 addOrganizationFieldOptions + * + * Add organization 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 addOrganizationFieldOptions($field_code, $request_body) + { + list($response) = $this->addOrganizationFieldOptionsWithHttpInfo($field_code, $request_body); + return $response; + } + + /** + * Operation addOrganizationFieldOptionsWithHttpInfo + * + * Add organization 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 addOrganizationFieldOptionsWithHttpInfo($field_code, $request_body) + { + $request = $this->addOrganizationFieldOptionsRequest($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->addOrganizationFieldOptionsRequest($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 addOrganizationFieldOptionsAsync + * + * Add organization 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 addOrganizationFieldOptionsAsync($field_code, $request_body): PromiseInterface + { + return $this->addOrganizationFieldOptionsAsyncWithHttpInfo($field_code, $request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addOrganizationFieldOptionsAsyncWithHttpInfo + * + * Add organization 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 addOrganizationFieldOptionsAsyncWithHttpInfo($field_code, $request_body): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\InlineResponse200'; + $request = $this->addOrganizationFieldOptionsRequest($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 'addOrganizationFieldOptions' + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function addOrganizationFieldOptionsRequest($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 addOrganizationFieldOptions' + ); + } + // 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 addOrganizationFieldOptions' + ); + } + + $resourcePath = '/organizationFields/{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 deleteOrganizationField + * + * Delete one organization 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\DeleteOrganizationField + */ + public function deleteOrganizationField($field_code) + { + list($response) = $this->deleteOrganizationFieldWithHttpInfo($field_code); + return $response; + } + + /** + * Operation deleteOrganizationFieldWithHttpInfo + * + * Delete one organization 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\DeleteOrganizationField, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteOrganizationFieldWithHttpInfo($field_code) + { + $request = $this->deleteOrganizationFieldRequest($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->deleteOrganizationFieldRequest($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\DeleteOrganizationField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteOrganizationField', []), + $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\DeleteOrganizationField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteOrganizationField', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\DeleteOrganizationField', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteOrganizationFieldAsync + * + * Delete one organization field + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteOrganizationFieldAsync($field_code): PromiseInterface + { + return $this->deleteOrganizationFieldAsyncWithHttpInfo($field_code) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteOrganizationFieldAsyncWithHttpInfo + * + * Delete one organization field + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteOrganizationFieldAsyncWithHttpInfo($field_code): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\DeleteOrganizationField'; + $request = $this->deleteOrganizationFieldRequest($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 'deleteOrganizationField' + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function deleteOrganizationFieldRequest($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 deleteOrganizationField' + ); + } + + $resourcePath = '/organizationFields/{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 deleteOrganizationFieldOptions + * + * Delete organization 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 deleteOrganizationFieldOptions($field_code, $request_body) + { + list($response) = $this->deleteOrganizationFieldOptionsWithHttpInfo($field_code, $request_body); + return $response; + } + + /** + * Operation deleteOrganizationFieldOptionsWithHttpInfo + * + * Delete organization 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 deleteOrganizationFieldOptionsWithHttpInfo($field_code, $request_body) + { + $request = $this->deleteOrganizationFieldOptionsRequest($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->deleteOrganizationFieldOptionsRequest($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 deleteOrganizationFieldOptionsAsync + * + * Delete organization 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 deleteOrganizationFieldOptionsAsync($field_code, $request_body): PromiseInterface + { + return $this->deleteOrganizationFieldOptionsAsyncWithHttpInfo($field_code, $request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteOrganizationFieldOptionsAsyncWithHttpInfo + * + * Delete organization 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 deleteOrganizationFieldOptionsAsyncWithHttpInfo($field_code, $request_body): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\InlineResponse200'; + $request = $this->deleteOrganizationFieldOptionsRequest($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 'deleteOrganizationFieldOptions' + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function deleteOrganizationFieldOptionsRequest($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 deleteOrganizationFieldOptions' + ); + } + // 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 deleteOrganizationFieldOptions' + ); + } + + $resourcePath = '/organizationFields/{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 getOrganizationField + * + * Get one organization field + * + * @param string $field_code The unique code identifying the field (required) + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\GetOrganizationField + */ + public function getOrganizationField($field_code, $include_fields = null) + { + list($response) = $this->getOrganizationFieldWithHttpInfo($field_code, $include_fields); + return $response; + } + + /** + * Operation getOrganizationFieldWithHttpInfo + * + * Get one organization field + * + * @param string $field_code The unique code identifying the field (required) + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\GetOrganizationField, HTTP status code, HTTP response headers (array of strings) + */ + public function getOrganizationFieldWithHttpInfo($field_code, $include_fields = null) + { + $request = $this->getOrganizationFieldRequest($field_code, $include_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->getOrganizationFieldRequest($field_code, $include_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\GetOrganizationField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetOrganizationField', []), + $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\GetOrganizationField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetOrganizationField', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetOrganizationField', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getOrganizationFieldAsync + * + * Get one organization field + * + * @param string $field_code The unique code identifying the field (required) + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getOrganizationFieldAsync($field_code, $include_fields = null): PromiseInterface + { + return $this->getOrganizationFieldAsyncWithHttpInfo($field_code, $include_fields) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getOrganizationFieldAsyncWithHttpInfo + * + * Get one organization field + * + * @param string $field_code The unique code identifying the field (required) + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getOrganizationFieldAsyncWithHttpInfo($field_code, $include_fields = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetOrganizationField'; + $request = $this->getOrganizationFieldRequest($field_code, $include_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 'getOrganizationField' + * + * @param string $field_code The unique code identifying the field (required) + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function getOrganizationFieldRequest($field_code, $include_fields = null): 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 getOrganizationField' + ); + } + + $resourcePath = '/organizationFields/{field_code}'; + $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; + } + + + // 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 getOrganizationFields + * + * Get all organization fields + * + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (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\GetOrganizationFields + */ + public function getOrganizationFields($include_fields = null, $limit = null, $cursor = null) + { + list($response) = $this->getOrganizationFieldsWithHttpInfo($include_fields, $limit, $cursor); + return $response; + } + + /** + * Operation getOrganizationFieldsWithHttpInfo + * + * Get all organization fields + * + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (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\GetOrganizationFields, HTTP status code, HTTP response headers (array of strings) + */ + public function getOrganizationFieldsWithHttpInfo($include_fields = null, $limit = null, $cursor = null) + { + $request = $this->getOrganizationFieldsRequest($include_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->getOrganizationFieldsRequest($include_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\GetOrganizationFields' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetOrganizationFields', []), + $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\GetOrganizationFields' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetOrganizationFields', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetOrganizationFields', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getOrganizationFieldsAsync + * + * Get all organization fields + * + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (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 getOrganizationFieldsAsync($include_fields = null, $limit = null, $cursor = null): PromiseInterface + { + return $this->getOrganizationFieldsAsyncWithHttpInfo($include_fields, $limit, $cursor) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getOrganizationFieldsAsyncWithHttpInfo + * + * Get all organization fields + * + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (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 getOrganizationFieldsAsyncWithHttpInfo($include_fields = null, $limit = null, $cursor = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetOrganizationFields'; + $request = $this->getOrganizationFieldsRequest($include_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 'getOrganizationFields' + * + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (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 getOrganizationFieldsRequest($include_fields = null, $limit = null, $cursor = null): Request + { + + $resourcePath = '/organizationFields'; + $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($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 updateOrganizationField + * + * Update one organization field + * + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdateOrganizationFieldRequest $update_organization_field_request update_organization_field_request (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\GetOrganizationField + */ + public function updateOrganizationField($field_code, $update_organization_field_request) + { + list($response) = $this->updateOrganizationFieldWithHttpInfo($field_code, $update_organization_field_request); + return $response; + } + + /** + * Operation updateOrganizationFieldWithHttpInfo + * + * Update one organization field + * + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdateOrganizationFieldRequest $update_organization_field_request (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\GetOrganizationField, HTTP status code, HTTP response headers (array of strings) + */ + public function updateOrganizationFieldWithHttpInfo($field_code, $update_organization_field_request) + { + $request = $this->updateOrganizationFieldRequest($field_code, $update_organization_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->updateOrganizationFieldRequest($field_code, $update_organization_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\GetOrganizationField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetOrganizationField', []), + $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\GetOrganizationField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetOrganizationField', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetOrganizationField', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateOrganizationFieldAsync + * + * Update one organization field + * + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdateOrganizationFieldRequest $update_organization_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function updateOrganizationFieldAsync($field_code, $update_organization_field_request): PromiseInterface + { + return $this->updateOrganizationFieldAsyncWithHttpInfo($field_code, $update_organization_field_request) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateOrganizationFieldAsyncWithHttpInfo + * + * Update one organization field + * + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdateOrganizationFieldRequest $update_organization_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function updateOrganizationFieldAsyncWithHttpInfo($field_code, $update_organization_field_request): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetOrganizationField'; + $request = $this->updateOrganizationFieldRequest($field_code, $update_organization_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 'updateOrganizationField' + * + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdateOrganizationFieldRequest $update_organization_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function updateOrganizationFieldRequest($field_code, $update_organization_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 updateOrganizationField' + ); + } + // verify the required parameter 'update_organization_field_request' is set + /* @phpstan-ignore-next-line */ + if ($update_organization_field_request === null || (is_array($update_organization_field_request) && count($update_organization_field_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $update_organization_field_request when calling updateOrganizationField' + ); + } + + $resourcePath = '/organizationFields/{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_organization_field_request)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_organization_field_request)); + } else { + $httpBody = $update_organization_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 updateOrganizationFieldOptions + * + * Update organization 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 updateOrganizationFieldOptions($field_code, $request_body) + { + list($response) = $this->updateOrganizationFieldOptionsWithHttpInfo($field_code, $request_body); + return $response; + } + + /** + * Operation updateOrganizationFieldOptionsWithHttpInfo + * + * Update organization 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 updateOrganizationFieldOptionsWithHttpInfo($field_code, $request_body) + { + $request = $this->updateOrganizationFieldOptionsRequest($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->updateOrganizationFieldOptionsRequest($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 updateOrganizationFieldOptionsAsync + * + * Update organization 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 updateOrganizationFieldOptionsAsync($field_code, $request_body): PromiseInterface + { + return $this->updateOrganizationFieldOptionsAsyncWithHttpInfo($field_code, $request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateOrganizationFieldOptionsAsyncWithHttpInfo + * + * Update organization 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 updateOrganizationFieldOptionsAsyncWithHttpInfo($field_code, $request_body): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\InlineResponse200'; + $request = $this->updateOrganizationFieldOptionsRequest($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 'updateOrganizationFieldOptions' + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function updateOrganizationFieldOptionsRequest($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 updateOrganizationFieldOptions' + ); + } + // 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 updateOrganizationFieldOptions' + ); + } + + $resourcePath = '/organizationFields/{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/PersonFieldsApi.php b/lib/versions/v2/Api/PersonFieldsApi.php new file mode 100644 index 0000000..556b58c --- /dev/null +++ b/lib/versions/v2/Api/PersonFieldsApi.php @@ -0,0 +1,2613 @@ +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 addPersonField + * + * Create one person field + * + * @param \Pipedrive\versions\v2\Model\CreatePersonFieldRequest $create_person_field_request create_person_field_request (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\CreatePersonField + */ + public function addPersonField($create_person_field_request) + { + list($response) = $this->addPersonFieldWithHttpInfo($create_person_field_request); + return $response; + } + + /** + * Operation addPersonFieldWithHttpInfo + * + * Create one person field + * + * @param \Pipedrive\versions\v2\Model\CreatePersonFieldRequest $create_person_field_request (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\CreatePersonField, HTTP status code, HTTP response headers (array of strings) + */ + public function addPersonFieldWithHttpInfo($create_person_field_request) + { + $request = $this->addPersonFieldRequest($create_person_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->addPersonFieldRequest($create_person_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\CreatePersonField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\CreatePersonField', []), + $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\CreatePersonField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\CreatePersonField', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\CreatePersonField', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation addPersonFieldAsync + * + * Create one person field + * + * @param \Pipedrive\versions\v2\Model\CreatePersonFieldRequest $create_person_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addPersonFieldAsync($create_person_field_request): PromiseInterface + { + return $this->addPersonFieldAsyncWithHttpInfo($create_person_field_request) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addPersonFieldAsyncWithHttpInfo + * + * Create one person field + * + * @param \Pipedrive\versions\v2\Model\CreatePersonFieldRequest $create_person_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addPersonFieldAsyncWithHttpInfo($create_person_field_request): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\CreatePersonField'; + $request = $this->addPersonFieldRequest($create_person_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 'addPersonField' + * + * @param \Pipedrive\versions\v2\Model\CreatePersonFieldRequest $create_person_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function addPersonFieldRequest($create_person_field_request): Request + { + // verify the required parameter 'create_person_field_request' is set + /* @phpstan-ignore-next-line */ + if ($create_person_field_request === null || (is_array($create_person_field_request) && count($create_person_field_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $create_person_field_request when calling addPersonField' + ); + } + + $resourcePath = '/personFields'; + $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_person_field_request)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($create_person_field_request)); + } else { + $httpBody = $create_person_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 addPersonFieldOptions + * + * Add person 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 addPersonFieldOptions($field_code, $request_body) + { + list($response) = $this->addPersonFieldOptionsWithHttpInfo($field_code, $request_body); + return $response; + } + + /** + * Operation addPersonFieldOptionsWithHttpInfo + * + * Add person 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 addPersonFieldOptionsWithHttpInfo($field_code, $request_body) + { + $request = $this->addPersonFieldOptionsRequest($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->addPersonFieldOptionsRequest($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 addPersonFieldOptionsAsync + * + * Add person 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 addPersonFieldOptionsAsync($field_code, $request_body): PromiseInterface + { + return $this->addPersonFieldOptionsAsyncWithHttpInfo($field_code, $request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addPersonFieldOptionsAsyncWithHttpInfo + * + * Add person 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 addPersonFieldOptionsAsyncWithHttpInfo($field_code, $request_body): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\InlineResponse200'; + $request = $this->addPersonFieldOptionsRequest($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 'addPersonFieldOptions' + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function addPersonFieldOptionsRequest($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 addPersonFieldOptions' + ); + } + // 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 addPersonFieldOptions' + ); + } + + $resourcePath = '/personFields/{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 deletePersonField + * + * Delete one person 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\DeletePersonField + */ + public function deletePersonField($field_code) + { + list($response) = $this->deletePersonFieldWithHttpInfo($field_code); + return $response; + } + + /** + * Operation deletePersonFieldWithHttpInfo + * + * Delete one person 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\DeletePersonField, HTTP status code, HTTP response headers (array of strings) + */ + public function deletePersonFieldWithHttpInfo($field_code) + { + $request = $this->deletePersonFieldRequest($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->deletePersonFieldRequest($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\DeletePersonField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeletePersonField', []), + $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\DeletePersonField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeletePersonField', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\DeletePersonField', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deletePersonFieldAsync + * + * Delete one person field + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deletePersonFieldAsync($field_code): PromiseInterface + { + return $this->deletePersonFieldAsyncWithHttpInfo($field_code) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deletePersonFieldAsyncWithHttpInfo + * + * Delete one person field + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deletePersonFieldAsyncWithHttpInfo($field_code): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\DeletePersonField'; + $request = $this->deletePersonFieldRequest($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 'deletePersonField' + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function deletePersonFieldRequest($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 deletePersonField' + ); + } + + $resourcePath = '/personFields/{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 deletePersonFieldOptions + * + * Delete person 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 deletePersonFieldOptions($field_code, $request_body) + { + list($response) = $this->deletePersonFieldOptionsWithHttpInfo($field_code, $request_body); + return $response; + } + + /** + * Operation deletePersonFieldOptionsWithHttpInfo + * + * Delete person 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 deletePersonFieldOptionsWithHttpInfo($field_code, $request_body) + { + $request = $this->deletePersonFieldOptionsRequest($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->deletePersonFieldOptionsRequest($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 deletePersonFieldOptionsAsync + * + * Delete person 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 deletePersonFieldOptionsAsync($field_code, $request_body): PromiseInterface + { + return $this->deletePersonFieldOptionsAsyncWithHttpInfo($field_code, $request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deletePersonFieldOptionsAsyncWithHttpInfo + * + * Delete person 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 deletePersonFieldOptionsAsyncWithHttpInfo($field_code, $request_body): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\InlineResponse200'; + $request = $this->deletePersonFieldOptionsRequest($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 'deletePersonFieldOptions' + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function deletePersonFieldOptionsRequest($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 deletePersonFieldOptions' + ); + } + // 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 deletePersonFieldOptions' + ); + } + + $resourcePath = '/personFields/{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 getPersonField + * + * Get one person field + * + * @param string $field_code The unique code identifying the field (required) + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\GetPersonField + */ + public function getPersonField($field_code, $include_fields = null) + { + list($response) = $this->getPersonFieldWithHttpInfo($field_code, $include_fields); + return $response; + } + + /** + * Operation getPersonFieldWithHttpInfo + * + * Get one person field + * + * @param string $field_code The unique code identifying the field (required) + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\GetPersonField, HTTP status code, HTTP response headers (array of strings) + */ + public function getPersonFieldWithHttpInfo($field_code, $include_fields = null) + { + $request = $this->getPersonFieldRequest($field_code, $include_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->getPersonFieldRequest($field_code, $include_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\GetPersonField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetPersonField', []), + $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\GetPersonField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetPersonField', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetPersonField', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getPersonFieldAsync + * + * Get one person field + * + * @param string $field_code The unique code identifying the field (required) + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getPersonFieldAsync($field_code, $include_fields = null): PromiseInterface + { + return $this->getPersonFieldAsyncWithHttpInfo($field_code, $include_fields) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getPersonFieldAsyncWithHttpInfo + * + * Get one person field + * + * @param string $field_code The unique code identifying the field (required) + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getPersonFieldAsyncWithHttpInfo($field_code, $include_fields = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetPersonField'; + $request = $this->getPersonFieldRequest($field_code, $include_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 'getPersonField' + * + * @param string $field_code The unique code identifying the field (required) + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function getPersonFieldRequest($field_code, $include_fields = null): 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 getPersonField' + ); + } + + $resourcePath = '/personFields/{field_code}'; + $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; + } + + + // 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 getPersonFields + * + * Get all person fields + * + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (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\GetPersonFields + */ + public function getPersonFields($include_fields = null, $limit = null, $cursor = null) + { + list($response) = $this->getPersonFieldsWithHttpInfo($include_fields, $limit, $cursor); + return $response; + } + + /** + * Operation getPersonFieldsWithHttpInfo + * + * Get all person fields + * + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (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\GetPersonFields, HTTP status code, HTTP response headers (array of strings) + */ + public function getPersonFieldsWithHttpInfo($include_fields = null, $limit = null, $cursor = null) + { + $request = $this->getPersonFieldsRequest($include_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->getPersonFieldsRequest($include_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\GetPersonFields' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetPersonFields', []), + $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\GetPersonFields' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetPersonFields', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetPersonFields', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getPersonFieldsAsync + * + * Get all person fields + * + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (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 getPersonFieldsAsync($include_fields = null, $limit = null, $cursor = null): PromiseInterface + { + return $this->getPersonFieldsAsyncWithHttpInfo($include_fields, $limit, $cursor) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getPersonFieldsAsyncWithHttpInfo + * + * Get all person fields + * + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (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 getPersonFieldsAsyncWithHttpInfo($include_fields = null, $limit = null, $cursor = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetPersonFields'; + $request = $this->getPersonFieldsRequest($include_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 'getPersonFields' + * + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (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 getPersonFieldsRequest($include_fields = null, $limit = null, $cursor = null): Request + { + + $resourcePath = '/personFields'; + $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($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 updatePersonField + * + * Update one person field + * + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdatePersonFieldRequest $update_person_field_request update_person_field_request (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\GetPersonField + */ + public function updatePersonField($field_code, $update_person_field_request) + { + list($response) = $this->updatePersonFieldWithHttpInfo($field_code, $update_person_field_request); + return $response; + } + + /** + * Operation updatePersonFieldWithHttpInfo + * + * Update one person field + * + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdatePersonFieldRequest $update_person_field_request (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\GetPersonField, HTTP status code, HTTP response headers (array of strings) + */ + public function updatePersonFieldWithHttpInfo($field_code, $update_person_field_request) + { + $request = $this->updatePersonFieldRequest($field_code, $update_person_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->updatePersonFieldRequest($field_code, $update_person_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\GetPersonField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetPersonField', []), + $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\GetPersonField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetPersonField', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetPersonField', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updatePersonFieldAsync + * + * Update one person field + * + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdatePersonFieldRequest $update_person_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function updatePersonFieldAsync($field_code, $update_person_field_request): PromiseInterface + { + return $this->updatePersonFieldAsyncWithHttpInfo($field_code, $update_person_field_request) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updatePersonFieldAsyncWithHttpInfo + * + * Update one person field + * + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdatePersonFieldRequest $update_person_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function updatePersonFieldAsyncWithHttpInfo($field_code, $update_person_field_request): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetPersonField'; + $request = $this->updatePersonFieldRequest($field_code, $update_person_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 'updatePersonField' + * + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdatePersonFieldRequest $update_person_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function updatePersonFieldRequest($field_code, $update_person_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 updatePersonField' + ); + } + // verify the required parameter 'update_person_field_request' is set + /* @phpstan-ignore-next-line */ + if ($update_person_field_request === null || (is_array($update_person_field_request) && count($update_person_field_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $update_person_field_request when calling updatePersonField' + ); + } + + $resourcePath = '/personFields/{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_person_field_request)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_person_field_request)); + } else { + $httpBody = $update_person_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 updatePersonFieldOptions + * + * Update person 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 updatePersonFieldOptions($field_code, $request_body) + { + list($response) = $this->updatePersonFieldOptionsWithHttpInfo($field_code, $request_body); + return $response; + } + + /** + * Operation updatePersonFieldOptionsWithHttpInfo + * + * Update person 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 updatePersonFieldOptionsWithHttpInfo($field_code, $request_body) + { + $request = $this->updatePersonFieldOptionsRequest($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->updatePersonFieldOptionsRequest($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 updatePersonFieldOptionsAsync + * + * Update person 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 updatePersonFieldOptionsAsync($field_code, $request_body): PromiseInterface + { + return $this->updatePersonFieldOptionsAsyncWithHttpInfo($field_code, $request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updatePersonFieldOptionsAsyncWithHttpInfo + * + * Update person 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 updatePersonFieldOptionsAsyncWithHttpInfo($field_code, $request_body): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\InlineResponse200'; + $request = $this->updatePersonFieldOptionsRequest($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 'updatePersonFieldOptions' + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function updatePersonFieldOptionsRequest($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 updatePersonFieldOptions' + ); + } + // 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 updatePersonFieldOptions' + ); + } + + $resourcePath = '/personFields/{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/ProductFieldsApi.php b/lib/versions/v2/Api/ProductFieldsApi.php new file mode 100644 index 0000000..88dfdba --- /dev/null +++ b/lib/versions/v2/Api/ProductFieldsApi.php @@ -0,0 +1,2613 @@ +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 addProductField + * + * Create one product field + * + * @param \Pipedrive\versions\v2\Model\CreateProductFieldRequest $create_product_field_request create_product_field_request (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\CreateProductField + */ + public function addProductField($create_product_field_request) + { + list($response) = $this->addProductFieldWithHttpInfo($create_product_field_request); + return $response; + } + + /** + * Operation addProductFieldWithHttpInfo + * + * Create one product field + * + * @param \Pipedrive\versions\v2\Model\CreateProductFieldRequest $create_product_field_request (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\CreateProductField, HTTP status code, HTTP response headers (array of strings) + */ + public function addProductFieldWithHttpInfo($create_product_field_request) + { + $request = $this->addProductFieldRequest($create_product_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->addProductFieldRequest($create_product_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\CreateProductField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\CreateProductField', []), + $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\CreateProductField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\CreateProductField', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\CreateProductField', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation addProductFieldAsync + * + * Create one product field + * + * @param \Pipedrive\versions\v2\Model\CreateProductFieldRequest $create_product_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addProductFieldAsync($create_product_field_request): PromiseInterface + { + return $this->addProductFieldAsyncWithHttpInfo($create_product_field_request) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addProductFieldAsyncWithHttpInfo + * + * Create one product field + * + * @param \Pipedrive\versions\v2\Model\CreateProductFieldRequest $create_product_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function addProductFieldAsyncWithHttpInfo($create_product_field_request): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\CreateProductField'; + $request = $this->addProductFieldRequest($create_product_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 'addProductField' + * + * @param \Pipedrive\versions\v2\Model\CreateProductFieldRequest $create_product_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function addProductFieldRequest($create_product_field_request): Request + { + // verify the required parameter 'create_product_field_request' is set + /* @phpstan-ignore-next-line */ + if ($create_product_field_request === null || (is_array($create_product_field_request) && count($create_product_field_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $create_product_field_request when calling addProductField' + ); + } + + $resourcePath = '/productFields'; + $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_product_field_request)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($create_product_field_request)); + } else { + $httpBody = $create_product_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 addProductFieldOptions + * + * Add product 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 addProductFieldOptions($field_code, $request_body) + { + list($response) = $this->addProductFieldOptionsWithHttpInfo($field_code, $request_body); + return $response; + } + + /** + * Operation addProductFieldOptionsWithHttpInfo + * + * Add product 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 addProductFieldOptionsWithHttpInfo($field_code, $request_body) + { + $request = $this->addProductFieldOptionsRequest($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->addProductFieldOptionsRequest($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 addProductFieldOptionsAsync + * + * Add product 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 addProductFieldOptionsAsync($field_code, $request_body): PromiseInterface + { + return $this->addProductFieldOptionsAsyncWithHttpInfo($field_code, $request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addProductFieldOptionsAsyncWithHttpInfo + * + * Add product 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 addProductFieldOptionsAsyncWithHttpInfo($field_code, $request_body): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\InlineResponse200'; + $request = $this->addProductFieldOptionsRequest($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 'addProductFieldOptions' + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function addProductFieldOptionsRequest($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 addProductFieldOptions' + ); + } + // 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 addProductFieldOptions' + ); + } + + $resourcePath = '/productFields/{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 deleteProductField + * + * Delete one product 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\DeleteProductField + */ + public function deleteProductField($field_code) + { + list($response) = $this->deleteProductFieldWithHttpInfo($field_code); + return $response; + } + + /** + * Operation deleteProductFieldWithHttpInfo + * + * Delete one product 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\DeleteProductField, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteProductFieldWithHttpInfo($field_code) + { + $request = $this->deleteProductFieldRequest($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->deleteProductFieldRequest($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\DeleteProductField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteProductField', []), + $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\DeleteProductField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\DeleteProductField', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\DeleteProductField', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteProductFieldAsync + * + * Delete one product field + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteProductFieldAsync($field_code): PromiseInterface + { + return $this->deleteProductFieldAsyncWithHttpInfo($field_code) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteProductFieldAsyncWithHttpInfo + * + * Delete one product field + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function deleteProductFieldAsyncWithHttpInfo($field_code): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\DeleteProductField'; + $request = $this->deleteProductFieldRequest($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 'deleteProductField' + * + * @param string $field_code The unique code identifying the field (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function deleteProductFieldRequest($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 deleteProductField' + ); + } + + $resourcePath = '/productFields/{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 deleteProductFieldOptions + * + * Delete product 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 deleteProductFieldOptions($field_code, $request_body) + { + list($response) = $this->deleteProductFieldOptionsWithHttpInfo($field_code, $request_body); + return $response; + } + + /** + * Operation deleteProductFieldOptionsWithHttpInfo + * + * Delete product 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 deleteProductFieldOptionsWithHttpInfo($field_code, $request_body) + { + $request = $this->deleteProductFieldOptionsRequest($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->deleteProductFieldOptionsRequest($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 deleteProductFieldOptionsAsync + * + * Delete product 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 deleteProductFieldOptionsAsync($field_code, $request_body): PromiseInterface + { + return $this->deleteProductFieldOptionsAsyncWithHttpInfo($field_code, $request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteProductFieldOptionsAsyncWithHttpInfo + * + * Delete product 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 deleteProductFieldOptionsAsyncWithHttpInfo($field_code, $request_body): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\InlineResponse200'; + $request = $this->deleteProductFieldOptionsRequest($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 'deleteProductFieldOptions' + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function deleteProductFieldOptionsRequest($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 deleteProductFieldOptions' + ); + } + // 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 deleteProductFieldOptions' + ); + } + + $resourcePath = '/productFields/{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 getProductField + * + * Get one product field + * + * @param string $field_code The unique code identifying the field (required) + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\GetProductField + */ + public function getProductField($field_code, $include_fields = null) + { + list($response) = $this->getProductFieldWithHttpInfo($field_code, $include_fields); + return $response; + } + + /** + * Operation getProductFieldWithHttpInfo + * + * Get one product field + * + * @param string $field_code The unique code identifying the field (required) + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\GetProductField, HTTP status code, HTTP response headers (array of strings) + */ + public function getProductFieldWithHttpInfo($field_code, $include_fields = null) + { + $request = $this->getProductFieldRequest($field_code, $include_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->getProductFieldRequest($field_code, $include_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\GetProductField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProductField', []), + $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\GetProductField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProductField', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetProductField', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getProductFieldAsync + * + * Get one product field + * + * @param string $field_code The unique code identifying the field (required) + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProductFieldAsync($field_code, $include_fields = null): PromiseInterface + { + return $this->getProductFieldAsyncWithHttpInfo($field_code, $include_fields) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProductFieldAsyncWithHttpInfo + * + * Get one product field + * + * @param string $field_code The unique code identifying the field (required) + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getProductFieldAsyncWithHttpInfo($field_code, $include_fields = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetProductField'; + $request = $this->getProductFieldRequest($field_code, $include_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 'getProductField' + * + * @param string $field_code The unique code identifying the field (required) + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function getProductFieldRequest($field_code, $include_fields = null): 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 getProductField' + ); + } + + $resourcePath = '/productFields/{field_code}'; + $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; + } + + + // 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 getProductFields + * + * Get all product fields + * + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (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\GetProductFields + */ + public function getProductFields($include_fields = null, $limit = null, $cursor = null) + { + list($response) = $this->getProductFieldsWithHttpInfo($include_fields, $limit, $cursor); + return $response; + } + + /** + * Operation getProductFieldsWithHttpInfo + * + * Get all product fields + * + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (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\GetProductFields, HTTP status code, HTTP response headers (array of strings) + */ + public function getProductFieldsWithHttpInfo($include_fields = null, $limit = null, $cursor = null) + { + $request = $this->getProductFieldsRequest($include_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->getProductFieldsRequest($include_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\GetProductFields' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProductFields', []), + $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\GetProductFields' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProductFields', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetProductFields', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getProductFieldsAsync + * + * Get all product fields + * + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (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 getProductFieldsAsync($include_fields = null, $limit = null, $cursor = null): PromiseInterface + { + return $this->getProductFieldsAsyncWithHttpInfo($include_fields, $limit, $cursor) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProductFieldsAsyncWithHttpInfo + * + * Get all product fields + * + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (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 getProductFieldsAsyncWithHttpInfo($include_fields = null, $limit = null, $cursor = null): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetProductFields'; + $request = $this->getProductFieldsRequest($include_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 'getProductFields' + * + * @param string|null $include_fields Optional comma separated string array of additional data namespaces to include in response (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 getProductFieldsRequest($include_fields = null, $limit = null, $cursor = null): Request + { + + $resourcePath = '/productFields'; + $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($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 updateProductField + * + * Update one product field + * + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdateProductFieldRequest $update_product_field_request update_product_field_request (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\versions\v2\Model\GetProductField + */ + public function updateProductField($field_code, $update_product_field_request) + { + list($response) = $this->updateProductFieldWithHttpInfo($field_code, $update_product_field_request); + return $response; + } + + /** + * Operation updateProductFieldWithHttpInfo + * + * Update one product field + * + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdateProductFieldRequest $update_product_field_request (required) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\versions\v2\Model\GetProductField, HTTP status code, HTTP response headers (array of strings) + */ + public function updateProductFieldWithHttpInfo($field_code, $update_product_field_request) + { + $request = $this->updateProductFieldRequest($field_code, $update_product_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->updateProductFieldRequest($field_code, $update_product_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\GetProductField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProductField', []), + $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\GetProductField' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\versions\v2\Model\GetProductField', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\versions\v2\Model\GetProductField', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateProductFieldAsync + * + * Update one product field + * + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdateProductFieldRequest $update_product_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function updateProductFieldAsync($field_code, $update_product_field_request): PromiseInterface + { + return $this->updateProductFieldAsyncWithHttpInfo($field_code, $update_product_field_request) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateProductFieldAsyncWithHttpInfo + * + * Update one product field + * + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdateProductFieldRequest $update_product_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function updateProductFieldAsyncWithHttpInfo($field_code, $update_product_field_request): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\GetProductField'; + $request = $this->updateProductFieldRequest($field_code, $update_product_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 'updateProductField' + * + * @param string $field_code The unique code identifying the field (required) + * @param \Pipedrive\versions\v2\Model\UpdateProductFieldRequest $update_product_field_request (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function updateProductFieldRequest($field_code, $update_product_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 updateProductField' + ); + } + // verify the required parameter 'update_product_field_request' is set + /* @phpstan-ignore-next-line */ + if ($update_product_field_request === null || (is_array($update_product_field_request) && count($update_product_field_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $update_product_field_request when calling updateProductField' + ); + } + + $resourcePath = '/productFields/{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_product_field_request)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_product_field_request)); + } else { + $httpBody = $update_product_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 updateProductFieldOptions + * + * Update product 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 updateProductFieldOptions($field_code, $request_body) + { + list($response) = $this->updateProductFieldOptionsWithHttpInfo($field_code, $request_body); + return $response; + } + + /** + * Operation updateProductFieldOptionsWithHttpInfo + * + * Update product 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 updateProductFieldOptionsWithHttpInfo($field_code, $request_body) + { + $request = $this->updateProductFieldOptionsRequest($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->updateProductFieldOptionsRequest($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 updateProductFieldOptionsAsync + * + * Update product 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 updateProductFieldOptionsAsync($field_code, $request_body): PromiseInterface + { + return $this->updateProductFieldOptionsAsyncWithHttpInfo($field_code, $request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateProductFieldOptionsAsyncWithHttpInfo + * + * Update product 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 updateProductFieldOptionsAsyncWithHttpInfo($field_code, $request_body): PromiseInterface + { + $returnType = '\Pipedrive\versions\v2\Model\InlineResponse200'; + $request = $this->updateProductFieldOptionsRequest($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 'updateProductFieldOptions' + * + * @param string $field_code The unique code identifying the field (required) + * @param object[] $request_body (required) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function updateProductFieldOptionsRequest($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 updateProductFieldOptions' + ); + } + // 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 updateProductFieldOptions' + ); + } + + $resourcePath = '/productFields/{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/Model/ActivityFieldItem.php b/lib/versions/v2/Model/ActivityFieldItem.php new file mode 100644 index 0000000..5541409 --- /dev/null +++ b/lib/versions/v2/Model/ActivityFieldItem.php @@ -0,0 +1,668 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ActivityFieldItem implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ActivityFieldItem'; + + /** + * 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\ActivityFieldItemUiVisibility' + ]; + + /** + * 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 + ]; + + /** + * 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' + ]; + + /** + * 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' + ]; + + /** + * 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' + ]; + + /** + * 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; + } + + /** + * 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\ActivityFieldItemUiVisibility|null + */ + public function getUiVisibility() + { + return $this->container['ui_visibility']; + } + + /** + * Sets ui_visibility + * + * @param \Pipedrive\versions\v2\Model\ActivityFieldItemUiVisibility|null $ui_visibility ui_visibility + * + * @return self + */ + public function setUiVisibility($ui_visibility): self + { + $this->container['ui_visibility'] = $ui_visibility; + + 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/ActivityFieldItemOptions.php b/lib/versions/v2/Model/ActivityFieldItemOptions.php new file mode 100644 index 0000000..629ec6c --- /dev/null +++ b/lib/versions/v2/Model/ActivityFieldItemOptions.php @@ -0,0 +1,465 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ActivityFieldItemOptions implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ActivityFieldItem_options'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'id' => 'int', + 'label' => 'string', + 'color' => 'string', + 'update_time' => '\DateTime', + 'add_time' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'label' => null, + 'color' => null, + 'update_time' => 'date-time', + 'add_time' => 'date-time' + ]; + + /** + * 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', + 'label' => 'label', + 'color' => 'color', + 'update_time' => 'update_time', + 'add_time' => 'add_time' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'label' => 'setLabel', + 'color' => 'setColor', + 'update_time' => 'setUpdateTime', + 'add_time' => 'setAddTime' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'label' => 'getLabel', + 'color' => 'getColor', + 'update_time' => 'getUpdateTime', + 'add_time' => 'getAddTime' + ]; + + /** + * 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['label'] = $data['label'] ?? null; + $this->container['color'] = $data['color'] ?? null; + $this->container['update_time'] = $data['update_time'] ?? null; + $this->container['add_time'] = $data['add_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 option ID + * + * @return self + */ + public function setId($id): self + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets label + * + * @return string|null + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string|null $label The option display label + * + * @return self + */ + public function setLabel($label): self + { + $this->container['label'] = $label; + + return $this; + } + + /** + * Gets color + * + * @return string|null + */ + public function getColor() + { + return $this->container['color']; + } + + /** + * Sets color + * + * @param string|null $color Optional color code for the option + * + * @return self + */ + public function setColor($color): self + { + $this->container['color'] = $color; + + return $this; + } + + /** + * Gets update_time + * + * @return \DateTime|null + */ + public function getUpdateTime() + { + return $this->container['update_time']; + } + + /** + * Sets update_time + * + * @param \DateTime|null $update_time When the option was last updated + * + * @return self + */ + public function setUpdateTime($update_time): self + { + $this->container['update_time'] = $update_time; + + return $this; + } + + /** + * Gets add_time + * + * @return \DateTime|null + */ + public function getAddTime() + { + return $this->container['add_time']; + } + + /** + * Sets add_time + * + * @param \DateTime|null $add_time When the option was created + * + * @return self + */ + public function setAddTime($add_time): self + { + $this->container['add_time'] = $add_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/ActivityFieldItemSubfields.php b/lib/versions/v2/Model/ActivityFieldItemSubfields.php new file mode 100644 index 0000000..956e786 --- /dev/null +++ b/lib/versions/v2/Model/ActivityFieldItemSubfields.php @@ -0,0 +1,405 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ActivityFieldItemSubfields implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ActivityFieldItem_subfields'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'field_code' => 'string', + 'field_name' => 'string', + 'field_type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'field_code' => null, + 'field_name' => null, + 'field_type' => 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_code' => 'field_code', + 'field_name' => 'field_name', + 'field_type' => 'field_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'field_code' => 'setFieldCode', + 'field_name' => 'setFieldName', + 'field_type' => 'setFieldType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'field_code' => 'getFieldCode', + 'field_name' => 'getFieldName', + 'field_type' => 'getFieldType' + ]; + + /** + * 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_code'] = $data['field_code'] ?? null; + $this->container['field_name'] = $data['field_name'] ?? null; + $this->container['field_type'] = $data['field_type'] ?? 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 field_code + * + * @return string|null + */ + public function getFieldCode() + { + return $this->container['field_code']; + } + + /** + * Sets field_code + * + * @param string|null $field_code The subfield identifier + * + * @return self + */ + public function setFieldCode($field_code): self + { + $this->container['field_code'] = $field_code; + + return $this; + } + + /** + * Gets field_name + * + * @return string|null + */ + public function getFieldName() + { + return $this->container['field_name']; + } + + /** + * Sets field_name + * + * @param string|null $field_name The subfield display name + * + * @return self + */ + public function setFieldName($field_name): self + { + $this->container['field_name'] = $field_name; + + return $this; + } + + /** + * Gets field_type + * + * @return string|null + */ + public function getFieldType() + { + return $this->container['field_type']; + } + + /** + * Sets field_type + * + * @param string|null $field_type The subfield type + * + * @return self + */ + public function setFieldType($field_type): self + { + $this->container['field_type'] = $field_type; + + 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/ActivityFieldItemUiVisibility.php b/lib/versions/v2/Model/ActivityFieldItemUiVisibility.php new file mode 100644 index 0000000..927d7f7 --- /dev/null +++ b/lib/versions/v2/Model/ActivityFieldItemUiVisibility.php @@ -0,0 +1,376 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ActivityFieldItemUiVisibility implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ActivityFieldItem_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 (read-only) + * + * @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/CreateDealField.php b/lib/versions/v2/Model/CreateDealField.php new file mode 100644 index 0000000..6177e71 --- /dev/null +++ b/lib/versions/v2/Model/CreateDealField.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class CreateDealField implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'CreateDealField'; + + /** + * 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\DealFieldItem' + ]; + + /** + * 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\DealFieldItem|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\DealFieldItem|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/CreateDealFieldRequest.php b/lib/versions/v2/Model/CreateDealFieldRequest.php new file mode 100644 index 0000000..72362b4 --- /dev/null +++ b/lib/versions/v2/Model/CreateDealFieldRequest.php @@ -0,0 +1,610 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class CreateDealFieldRequest implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'CreateDealFieldRequest'; + + /** + * 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', + 'description' => 'string' + ]; + + /** + * 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, + 'description' => 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', + 'description' => 'description' + ]; + + /** + * 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', + 'description' => 'setDescription' + ]; + + /** + * 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', + 'description' => 'getDescription' + ]; + + /** + * 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; + $this->container['description'] = $data['description'] ?? 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 CreateDealFieldRequest., must be smaller than or equal to 255.'); + } + if ((mb_strlen($field_name) < 1)) { + throw new \InvalidArgumentException('invalid length for $field_name when calling CreateDealFieldRequest., 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 product ID which is stored on the same account)
`phone`Phone field (up to 255 numbers and/or characters)
`time`Time field (format HH:MM:SS)
`timerange`Time-range field (has a start time and end time value, both HH:MM:SS)
`daterange`Date-range field (has a start date and end date value, both YYYY-MM-DD)
`address`Address field
+ * + * @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; + } + + /** + * 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. + * + * @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/CreateDealFieldRequestOptions.php b/lib/versions/v2/Model/CreateDealFieldRequestOptions.php new file mode 100644 index 0000000..e31d995 --- /dev/null +++ b/lib/versions/v2/Model/CreateDealFieldRequestOptions.php @@ -0,0 +1,348 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class CreateDealFieldRequestOptions implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'CreateDealFieldRequest_options'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'label' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'label' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'label' => 'label' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'label' => 'setLabel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'label' => 'getLabel' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + * @phpstan-var array + * @psalm-var array + */ + protected array $container = []; + + /** + * Constructor + * + * @phpstan-param array|null $data + * @psalm-param array|null $data + * @param array|null $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['label'] = $data['label'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + * @phpstan-return array + * @psalm-return array + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['label'] === null) { + $invalidProperties[] = "'label' 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 label + * + * @return string + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string $label The option label + * + * @return self + */ + public function setLabel($label): self + { + $this->container['label'] = $label; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @throws JsonException + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @throws JsonException + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this), JSON_THROW_ON_ERROR); + } +} + + diff --git a/lib/versions/v2/Model/CreateOrganizationField.php b/lib/versions/v2/Model/CreateOrganizationField.php new file mode 100644 index 0000000..6cfa87b --- /dev/null +++ b/lib/versions/v2/Model/CreateOrganizationField.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class CreateOrganizationField implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'CreateOrganizationField'; + + /** + * 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\OrganizationFieldItem' + ]; + + /** + * 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\OrganizationFieldItem|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\OrganizationFieldItem|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/CreateOrganizationFieldRequest.php b/lib/versions/v2/Model/CreateOrganizationFieldRequest.php new file mode 100644 index 0000000..945ef25 --- /dev/null +++ b/lib/versions/v2/Model/CreateOrganizationFieldRequest.php @@ -0,0 +1,610 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class CreateOrganizationFieldRequest implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'CreateOrganizationFieldRequest'; + + /** + * 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', + 'description' => 'string' + ]; + + /** + * 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, + 'description' => 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', + 'description' => 'description' + ]; + + /** + * 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', + 'description' => 'setDescription' + ]; + + /** + * 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', + 'description' => 'getDescription' + ]; + + /** + * 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; + $this->container['description'] = $data['description'] ?? 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 CreateOrganizationFieldRequest., must be smaller than or equal to 255.'); + } + if ((mb_strlen($field_name) < 1)) { + throw new \InvalidArgumentException('invalid length for $field_name when calling CreateOrganizationFieldRequest., 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 product ID which is stored on the same account)
`phone`Phone field (up to 255 numbers and/or characters)
`time`Time field (format HH:MM:SS)
`timerange`Time-range field (has a start time and end time value, both HH:MM:SS)
`daterange`Date-range field (has a start date and end date value, both YYYY-MM-DD)
`address`Address field
+ * + * @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; + } + + /** + * 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. + * + * @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/CreatePersonField.php b/lib/versions/v2/Model/CreatePersonField.php new file mode 100644 index 0000000..6806f39 --- /dev/null +++ b/lib/versions/v2/Model/CreatePersonField.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class CreatePersonField implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'CreatePersonField'; + + /** + * 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\PersonFieldItem' + ]; + + /** + * 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\PersonFieldItem|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\PersonFieldItem|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/CreatePersonFieldRequest.php b/lib/versions/v2/Model/CreatePersonFieldRequest.php new file mode 100644 index 0000000..05b66ba --- /dev/null +++ b/lib/versions/v2/Model/CreatePersonFieldRequest.php @@ -0,0 +1,610 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class CreatePersonFieldRequest implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'CreatePersonFieldRequest'; + + /** + * 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', + 'description' => 'string' + ]; + + /** + * 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, + 'description' => 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', + 'description' => 'description' + ]; + + /** + * 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', + 'description' => 'setDescription' + ]; + + /** + * 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', + 'description' => 'getDescription' + ]; + + /** + * 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; + $this->container['description'] = $data['description'] ?? 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 CreatePersonFieldRequest., must be smaller than or equal to 255.'); + } + if ((mb_strlen($field_name) < 1)) { + throw new \InvalidArgumentException('invalid length for $field_name when calling CreatePersonFieldRequest., 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 product ID which is stored on the same account)
`phone`Phone field (up to 255 numbers and/or characters)
`time`Time field (format HH:MM:SS)
`timerange`Time-range field (has a start time and end time value, both HH:MM:SS)
`daterange`Date-range field (has a start date and end date value, both YYYY-MM-DD)
`address`Address field
+ * + * @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; + } + + /** + * 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. + * + * @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/CreateProductField.php b/lib/versions/v2/Model/CreateProductField.php new file mode 100644 index 0000000..61a3ab9 --- /dev/null +++ b/lib/versions/v2/Model/CreateProductField.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class CreateProductField implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'CreateProductField'; + + /** + * 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\ProductFieldItem' + ]; + + /** + * 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\ProductFieldItem|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\ProductFieldItem|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/CreateProductFieldRequest.php b/lib/versions/v2/Model/CreateProductFieldRequest.php new file mode 100644 index 0000000..9f28891 --- /dev/null +++ b/lib/versions/v2/Model/CreateProductFieldRequest.php @@ -0,0 +1,550 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class CreateProductFieldRequest implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'CreateProductFieldRequest'; + + /** + * 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', + 'description' => 'string' + ]; + + /** + * 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, + 'description' => 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', + 'description' => 'description' + ]; + + /** + * 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', + 'description' => 'setDescription' + ]; + + /** + * 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', + 'description' => 'getDescription' + ]; + + /** + * 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['description'] = $data['description'] ?? 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 CreateProductFieldRequest., must be smaller than or equal to 255.'); + } + if ((mb_strlen($field_name) < 1)) { + throw new \InvalidArgumentException('invalid length for $field_name when calling CreateProductFieldRequest., 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 product ID which is stored on the same account)
`phone`Phone field (up to 255 numbers and/or characters)
`time`Time field (format HH:MM:SS)
`timerange`Time-range field (has a start time and end time value, both HH:MM:SS)
`daterange`Date-range field (has a start date and end date value, both YYYY-MM-DD)
`address`Address field
+ * + * @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. Note that products have a simpler visibility model than other entity types. + * + * @return self + */ + public function setUiVisibility($ui_visibility): self + { + $this->container['ui_visibility'] = $ui_visibility; + + 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. + * + * @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/DealFieldItem.php b/lib/versions/v2/Model/DealFieldItem.php new file mode 100644 index 0000000..04694de --- /dev/null +++ b/lib/versions/v2/Model/DealFieldItem.php @@ -0,0 +1,761 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DealFieldItem implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'DealFieldItem'; + + /** + * 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', + 'description' => '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\DealFieldItemUiVisibility', + 'important_fields' => '\Pipedrive\versions\v2\Model\DealFieldItemImportantFields', + 'required_fields' => '\Pipedrive\versions\v2\Model\DealFieldItemRequiredFields' + ]; + + /** + * 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, + 'description' => 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', + 'description' => 'description', + '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', + 'description' => 'setDescription', + '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', + 'description' => 'getDescription', + '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['description'] = $data['description'] ?? 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['description'] === null) { + $invalidProperties[] = "'description' 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 description + * + * @return string + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string $description The description of the field + * + * @return self + */ + public function setDescription($description): self + { + $this->container['description'] = $description; + + 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\DealFieldItemUiVisibility|null + */ + public function getUiVisibility() + { + return $this->container['ui_visibility']; + } + + /** + * Sets ui_visibility + * + * @param \Pipedrive\versions\v2\Model\DealFieldItemUiVisibility|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\DealFieldItemImportantFields|null + */ + public function getImportantFields() + { + return $this->container['important_fields']; + } + + /** + * Sets important_fields + * + * @param \Pipedrive\versions\v2\Model\DealFieldItemImportantFields|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\DealFieldItemRequiredFields|null + */ + public function getRequiredFields() + { + return $this->container['required_fields']; + } + + /** + * Sets required_fields + * + * @param \Pipedrive\versions\v2\Model\DealFieldItemRequiredFields|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/DealFieldItemImportantFields.php b/lib/versions/v2/Model/DealFieldItemImportantFields.php new file mode 100644 index 0000000..1abaf63 --- /dev/null +++ b/lib/versions/v2/Model/DealFieldItemImportantFields.php @@ -0,0 +1,376 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DealFieldItemImportantFields implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'DealFieldItem_important_fields'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'enabled' => 'bool', + 'stage_ids' => 'int[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'enabled' => null, + 'stage_ids' => 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 = [ + 'enabled' => 'enabled', + 'stage_ids' => 'stage_ids' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'enabled' => 'setEnabled', + 'stage_ids' => 'setStageIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'enabled' => 'getEnabled', + 'stage_ids' => 'getStageIds' + ]; + + /** + * 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['enabled'] = $data['enabled'] ?? null; + $this->container['stage_ids'] = $data['stage_ids'] ?? 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 enabled + * + * @return bool|null + */ + public function getEnabled() + { + return $this->container['enabled']; + } + + /** + * Sets enabled + * + * @param bool|null $enabled Whether the field is marked as important + * + * @return self + */ + public function setEnabled($enabled): self + { + $this->container['enabled'] = $enabled; + + return $this; + } + + /** + * Gets stage_ids + * + * @return int[]|null + */ + public function getStageIds() + { + return $this->container['stage_ids']; + } + + /** + * Sets stage_ids + * + * @param int[]|null $stage_ids Array of stage IDs where the field is important + * + * @return self + */ + public function setStageIds($stage_ids): self + { + $this->container['stage_ids'] = $stage_ids; + + 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/DealFieldItemRequiredFields.php b/lib/versions/v2/Model/DealFieldItemRequiredFields.php new file mode 100644 index 0000000..bb10694 --- /dev/null +++ b/lib/versions/v2/Model/DealFieldItemRequiredFields.php @@ -0,0 +1,432 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DealFieldItemRequiredFields implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'DealFieldItem_required_fields'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'enabled' => 'bool', + 'stage_ids' => 'int[]', + 'statuses' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'enabled' => null, + 'stage_ids' => null, + 'statuses' => 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 = [ + 'enabled' => 'enabled', + 'stage_ids' => 'stage_ids', + 'statuses' => 'statuses' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'enabled' => 'setEnabled', + 'stage_ids' => 'setStageIds', + 'statuses' => 'setStatuses' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'enabled' => 'getEnabled', + 'stage_ids' => 'getStageIds', + 'statuses' => 'getStatuses' + ]; + + /** + * 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 STATUSES_WON = 'won'; + const STATUSES_LOST = 'lost'; + + /** + * Gets allowable values of the enum + * + * @phpstan-return array + * @phpsalm-return array + * @return (string|int)[] + */ + public function getStatusesAllowableValues(): array + { + return [ + self::STATUSES_WON, + self::STATUSES_LOST, + ]; + } + + /** + * 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['enabled'] = $data['enabled'] ?? null; + $this->container['stage_ids'] = $data['stage_ids'] ?? null; + $this->container['statuses'] = $data['statuses'] ?? 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 enabled + * + * @return bool|null + */ + public function getEnabled() + { + return $this->container['enabled']; + } + + /** + * Sets enabled + * + * @param bool|null $enabled Whether the field is required + * + * @return self + */ + public function setEnabled($enabled): self + { + $this->container['enabled'] = $enabled; + + return $this; + } + + /** + * Gets stage_ids + * + * @return int[]|null + */ + public function getStageIds() + { + return $this->container['stage_ids']; + } + + /** + * Sets stage_ids + * + * @param int[]|null $stage_ids Array of stage IDs where the field is required + * + * @return self + */ + public function setStageIds($stage_ids): self + { + $this->container['stage_ids'] = $stage_ids; + + return $this; + } + + /** + * Gets statuses + * + * @return array|null + */ + public function getStatuses() + { + return $this->container['statuses']; + } + + /** + * Sets statuses + * + * @param array|null $statuses Pipeline-specific status requirements, mapping pipeline ID to array of statuses + * + * @return self + */ + public function setStatuses($statuses): self + { + $allowedValues = $this->getStatusesAllowableValues(); + if (!is_null($statuses) && array_diff($statuses, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'statuses', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['statuses'] = $statuses; + + 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/DealFieldItemUiVisibility.php b/lib/versions/v2/Model/DealFieldItemUiVisibility.php new file mode 100644 index 0000000..e68ba08 --- /dev/null +++ b/lib/versions/v2/Model/DealFieldItemUiVisibility.php @@ -0,0 +1,436 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DealFieldItemUiVisibility implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'DealFieldItem_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', + 'projects_detail_visible_flag' => 'bool', + 'show_in_pipelines' => '\Pipedrive\versions\v2\Model\DealFieldItemUiVisibilityShowInPipelines' + ]; + + /** + * 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, + 'projects_detail_visible_flag' => null, + 'show_in_pipelines' => 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', + 'projects_detail_visible_flag' => 'projects_detail_visible_flag', + 'show_in_pipelines' => 'show_in_pipelines' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'add_visible_flag' => 'setAddVisibleFlag', + 'details_visible_flag' => 'setDetailsVisibleFlag', + 'projects_detail_visible_flag' => 'setProjectsDetailVisibleFlag', + 'show_in_pipelines' => 'setShowInPipelines' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'add_visible_flag' => 'getAddVisibleFlag', + 'details_visible_flag' => 'getDetailsVisibleFlag', + 'projects_detail_visible_flag' => 'getProjectsDetailVisibleFlag', + 'show_in_pipelines' => 'getShowInPipelines' + ]; + + /** + * 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; + $this->container['projects_detail_visible_flag'] = $data['projects_detail_visible_flag'] ?? null; + $this->container['show_in_pipelines'] = $data['show_in_pipelines'] ?? 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; + } + + /** + * Gets projects_detail_visible_flag + * + * @return bool|null + */ + public function getProjectsDetailVisibleFlag() + { + return $this->container['projects_detail_visible_flag']; + } + + /** + * Sets projects_detail_visible_flag + * + * @param bool|null $projects_detail_visible_flag Whether the field is shown in project details view + * + * @return self + */ + public function setProjectsDetailVisibleFlag($projects_detail_visible_flag): self + { + $this->container['projects_detail_visible_flag'] = $projects_detail_visible_flag; + + return $this; + } + + /** + * Gets show_in_pipelines + * + * @return \Pipedrive\versions\v2\Model\DealFieldItemUiVisibilityShowInPipelines|null + */ + public function getShowInPipelines() + { + return $this->container['show_in_pipelines']; + } + + /** + * Sets show_in_pipelines + * + * @param \Pipedrive\versions\v2\Model\DealFieldItemUiVisibilityShowInPipelines|null $show_in_pipelines show_in_pipelines + * + * @return self + */ + public function setShowInPipelines($show_in_pipelines): self + { + $this->container['show_in_pipelines'] = $show_in_pipelines; + + 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/DealFieldItemUiVisibilityShowInPipelines.php b/lib/versions/v2/Model/DealFieldItemUiVisibilityShowInPipelines.php new file mode 100644 index 0000000..5079311 --- /dev/null +++ b/lib/versions/v2/Model/DealFieldItemUiVisibilityShowInPipelines.php @@ -0,0 +1,376 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DealFieldItemUiVisibilityShowInPipelines implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'DealFieldItem_ui_visibility_show_in_pipelines'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'show_in_all' => 'bool', + 'pipeline_ids' => 'int[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'show_in_all' => null, + 'pipeline_ids' => 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 = [ + 'show_in_all' => 'show_in_all', + 'pipeline_ids' => 'pipeline_ids' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'show_in_all' => 'setShowInAll', + 'pipeline_ids' => 'setPipelineIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'show_in_all' => 'getShowInAll', + 'pipeline_ids' => 'getPipelineIds' + ]; + + /** + * 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['show_in_all'] = $data['show_in_all'] ?? null; + $this->container['pipeline_ids'] = $data['pipeline_ids'] ?? 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 show_in_all + * + * @return bool|null + */ + public function getShowInAll() + { + return $this->container['show_in_all']; + } + + /** + * Sets show_in_all + * + * @param bool|null $show_in_all Whether the field is shown in all pipelines + * + * @return self + */ + public function setShowInAll($show_in_all): self + { + $this->container['show_in_all'] = $show_in_all; + + return $this; + } + + /** + * Gets pipeline_ids + * + * @return int[]|null + */ + public function getPipelineIds() + { + return $this->container['pipeline_ids']; + } + + /** + * Sets pipeline_ids + * + * @param int[]|null $pipeline_ids Specific pipeline IDs where the field is shown (if show_in_all is false) + * + * @return self + */ + public function setPipelineIds($pipeline_ids): self + { + $this->container['pipeline_ids'] = $pipeline_ids; + + 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/DeleteDealField.php b/lib/versions/v2/Model/DeleteDealField.php new file mode 100644 index 0000000..48d099b --- /dev/null +++ b/lib/versions/v2/Model/DeleteDealField.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DeleteDealField implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'DeleteDealField'; + + /** + * 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\DeleteDealFieldData' + ]; + + /** + * 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\DeleteDealFieldData|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\DeleteDealFieldData|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/DeleteDealFieldData.php b/lib/versions/v2/Model/DeleteDealFieldData.php new file mode 100644 index 0000000..295e897 --- /dev/null +++ b/lib/versions/v2/Model/DeleteDealFieldData.php @@ -0,0 +1,573 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DeleteDealFieldData implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'DeleteDealField_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', + 'description' => '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, + 'description' => 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', + 'description' => 'description', + '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', + 'description' => 'setDescription', + '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', + 'description' => 'getDescription', + '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['description'] = $data['description'] ?? 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['description'] === null) { + $invalidProperties[] = "'description' 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 description + * + * @return string + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string $description The description of the field + * + * @return self + */ + public function setDescription($description): self + { + $this->container['description'] = $description; + + 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 (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; + } + /** + * 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/DeleteOrganizationField.php b/lib/versions/v2/Model/DeleteOrganizationField.php new file mode 100644 index 0000000..f4d4332 --- /dev/null +++ b/lib/versions/v2/Model/DeleteOrganizationField.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DeleteOrganizationField implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'DeleteOrganizationField'; + + /** + * 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\DeletePersonFieldData' + ]; + + /** + * 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\DeletePersonFieldData|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\DeletePersonFieldData|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/DeletePersonField.php b/lib/versions/v2/Model/DeletePersonField.php new file mode 100644 index 0000000..0d1558f --- /dev/null +++ b/lib/versions/v2/Model/DeletePersonField.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DeletePersonField implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'DeletePersonField'; + + /** + * 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\DeletePersonFieldData' + ]; + + /** + * 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\DeletePersonFieldData|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\DeletePersonFieldData|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/DeletePersonFieldData.php b/lib/versions/v2/Model/DeletePersonFieldData.php new file mode 100644 index 0000000..ad04ed9 --- /dev/null +++ b/lib/versions/v2/Model/DeletePersonFieldData.php @@ -0,0 +1,540 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DeletePersonFieldData implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'DeletePersonField_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 (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; + } + /** + * 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/DeleteProductField.php b/lib/versions/v2/Model/DeleteProductField.php new file mode 100644 index 0000000..0f61fe8 --- /dev/null +++ b/lib/versions/v2/Model/DeleteProductField.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DeleteProductField implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'DeleteProductField'; + + /** + * 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\DeletePersonFieldData' + ]; + + /** + * 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\DeletePersonFieldData|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\DeletePersonFieldData|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/FieldOption.php b/lib/versions/v2/Model/FieldOption.php new file mode 100644 index 0000000..ae2365a --- /dev/null +++ b/lib/versions/v2/Model/FieldOption.php @@ -0,0 +1,381 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class FieldOption implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'FieldOption'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'id' => 'int', + 'label' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'label' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'label' => 'label' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'label' => 'setLabel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'label' => 'getLabel' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + * @phpstan-var array + * @psalm-var array + */ + protected array $container = []; + + /** + * Constructor + * + * @phpstan-param array|null $data + * @psalm-param array|null $data + * @param array|null $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['id'] = $data['id'] ?? null; + $this->container['label'] = $data['label'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + * @phpstan-return array + * @psalm-return array + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['label'] === null) { + $invalidProperties[] = "'label' 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 id + * + * @return int + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int $id The unique identifier of the option + * + * @return self + */ + public function setId($id): self + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets label + * + * @return string + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string $label The display label of the option + * + * @return self + */ + public function setLabel($label): self + { + $this->container['label'] = $label; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @throws JsonException + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @throws JsonException + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this), JSON_THROW_ON_ERROR); + } +} + + diff --git a/lib/versions/v2/Model/GetActivityField.php b/lib/versions/v2/Model/GetActivityField.php new file mode 100644 index 0000000..b3c363f --- /dev/null +++ b/lib/versions/v2/Model/GetActivityField.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetActivityField implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'GetActivityField'; + + /** + * 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\ActivityFieldItem' + ]; + + /** + * 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\ActivityFieldItem|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\ActivityFieldItem|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/GetActivityFields.php b/lib/versions/v2/Model/GetActivityFields.php new file mode 100644 index 0000000..85997c8 --- /dev/null +++ b/lib/versions/v2/Model/GetActivityFields.php @@ -0,0 +1,405 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetActivityFields implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'GetActivityFields'; + + /** + * 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\ActivityFieldItem[]', + '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\ActivityFieldItem[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\ActivityFieldItem[]|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/GetActivityFieldsAdditionalData.php b/lib/versions/v2/Model/GetActivityFieldsAdditionalData.php new file mode 100644 index 0000000..1127c30 --- /dev/null +++ b/lib/versions/v2/Model/GetActivityFieldsAdditionalData.php @@ -0,0 +1,345 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetActivityFieldsAdditionalData implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'GetActivityFields_additional_data'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'next_cursor' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'next_cursor' => 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 = [ + 'next_cursor' => 'next_cursor' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'next_cursor' => 'setNextCursor' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'next_cursor' => 'getNextCursor' + ]; + + /** + * 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['next_cursor'] = $data['next_cursor'] ?? 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 next_cursor + * + * @return string|null + */ + public function getNextCursor() + { + return $this->container['next_cursor']; + } + + /** + * Sets next_cursor + * + * @param string|null $next_cursor Base64url-encoded cursor for fetching the next page of results, null if no more pages + * + * @return self + */ + public function setNextCursor($next_cursor): self + { + $this->container['next_cursor'] = $next_cursor; + + 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/GetDealField.php b/lib/versions/v2/Model/GetDealField.php new file mode 100644 index 0000000..13ced00 --- /dev/null +++ b/lib/versions/v2/Model/GetDealField.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetDealField implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'GetDealField'; + + /** + * 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\DealFieldItem' + ]; + + /** + * 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\DealFieldItem|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\DealFieldItem|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/GetDealFields.php b/lib/versions/v2/Model/GetDealFields.php new file mode 100644 index 0000000..c19357a --- /dev/null +++ b/lib/versions/v2/Model/GetDealFields.php @@ -0,0 +1,405 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetDealFields implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'GetDealFields'; + + /** + * 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\DealFieldItem[]', + '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\DealFieldItem[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\DealFieldItem[]|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/GetOrganizationField.php b/lib/versions/v2/Model/GetOrganizationField.php new file mode 100644 index 0000000..aa3e051 --- /dev/null +++ b/lib/versions/v2/Model/GetOrganizationField.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetOrganizationField implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'GetOrganizationField'; + + /** + * 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\OrganizationFieldItem' + ]; + + /** + * 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\OrganizationFieldItem|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\OrganizationFieldItem|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/GetOrganizationFields.php b/lib/versions/v2/Model/GetOrganizationFields.php new file mode 100644 index 0000000..f1e5fed --- /dev/null +++ b/lib/versions/v2/Model/GetOrganizationFields.php @@ -0,0 +1,405 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetOrganizationFields implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'GetOrganizationFields'; + + /** + * 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\OrganizationFieldItem[]', + '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\OrganizationFieldItem[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\OrganizationFieldItem[]|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/GetPersonField.php b/lib/versions/v2/Model/GetPersonField.php new file mode 100644 index 0000000..b70e963 --- /dev/null +++ b/lib/versions/v2/Model/GetPersonField.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetPersonField implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'GetPersonField'; + + /** + * 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\PersonFieldItem' + ]; + + /** + * 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\PersonFieldItem|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\PersonFieldItem|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/GetPersonFields.php b/lib/versions/v2/Model/GetPersonFields.php new file mode 100644 index 0000000..fd25c9f --- /dev/null +++ b/lib/versions/v2/Model/GetPersonFields.php @@ -0,0 +1,405 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetPersonFields implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'GetPersonFields'; + + /** + * 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\PersonFieldItem[]', + '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\PersonFieldItem[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\PersonFieldItem[]|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/GetProductField.php b/lib/versions/v2/Model/GetProductField.php new file mode 100644 index 0000000..9ca1b1b --- /dev/null +++ b/lib/versions/v2/Model/GetProductField.php @@ -0,0 +1,375 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetProductField implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'GetProductField'; + + /** + * 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\ProductFieldItem' + ]; + + /** + * 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\ProductFieldItem|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\ProductFieldItem|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/GetProductFields.php b/lib/versions/v2/Model/GetProductFields.php new file mode 100644 index 0000000..dd3e575 --- /dev/null +++ b/lib/versions/v2/Model/GetProductFields.php @@ -0,0 +1,405 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetProductFields implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'GetProductFields'; + + /** + * 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\ProductFieldItem[]', + '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\ProductFieldItem[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\ProductFieldItem[]|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/InlineResponse200.php b/lib/versions/v2/Model/InlineResponse200.php new file mode 100644 index 0000000..1515bc9 --- /dev/null +++ b/lib/versions/v2/Model/InlineResponse200.php @@ -0,0 +1,405 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class InlineResponse200 implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'inline_response_200'; + + /** + * 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\FieldOption[]', + '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 success + * + * @return self + */ + public function setSuccess($success): self + { + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets data + * + * @return \Pipedrive\versions\v2\Model\FieldOption[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\versions\v2\Model\FieldOption[]|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/OrganizationFieldItem.php b/lib/versions/v2/Model/OrganizationFieldItem.php new file mode 100644 index 0000000..0ff6730 --- /dev/null +++ b/lib/versions/v2/Model/OrganizationFieldItem.php @@ -0,0 +1,728 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class OrganizationFieldItem implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'OrganizationFieldItem'; + + /** + * 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\OrganizationFieldItemUiVisibility', + '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\OrganizationFieldItemUiVisibility|null + */ + public function getUiVisibility() + { + return $this->container['ui_visibility']; + } + + /** + * Sets ui_visibility + * + * @param \Pipedrive\versions\v2\Model\OrganizationFieldItemUiVisibility|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/OrganizationFieldItemUiVisibility.php b/lib/versions/v2/Model/OrganizationFieldItemUiVisibility.php new file mode 100644 index 0000000..3e8b03a --- /dev/null +++ b/lib/versions/v2/Model/OrganizationFieldItemUiVisibility.php @@ -0,0 +1,436 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class OrganizationFieldItemUiVisibility implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'OrganizationFieldItem_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', + 'show_in_add_deal_dialog' => '\Pipedrive\versions\v2\Model\PersonFieldItemUiVisibilityShowInAddDealDialog', + 'show_in_add_person_dialog' => '\Pipedrive\versions\v2\Model\OrganizationFieldItemUiVisibilityShowInAddPersonDialog' + ]; + + /** + * 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, + 'show_in_add_deal_dialog' => null, + 'show_in_add_person_dialog' => 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', + 'show_in_add_deal_dialog' => 'show_in_add_deal_dialog', + 'show_in_add_person_dialog' => 'show_in_add_person_dialog' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'add_visible_flag' => 'setAddVisibleFlag', + 'details_visible_flag' => 'setDetailsVisibleFlag', + 'show_in_add_deal_dialog' => 'setShowInAddDealDialog', + 'show_in_add_person_dialog' => 'setShowInAddPersonDialog' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'add_visible_flag' => 'getAddVisibleFlag', + 'details_visible_flag' => 'getDetailsVisibleFlag', + 'show_in_add_deal_dialog' => 'getShowInAddDealDialog', + 'show_in_add_person_dialog' => 'getShowInAddPersonDialog' + ]; + + /** + * 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; + $this->container['show_in_add_deal_dialog'] = $data['show_in_add_deal_dialog'] ?? null; + $this->container['show_in_add_person_dialog'] = $data['show_in_add_person_dialog'] ?? 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; + } + + /** + * Gets show_in_add_deal_dialog + * + * @return \Pipedrive\versions\v2\Model\PersonFieldItemUiVisibilityShowInAddDealDialog|null + */ + public function getShowInAddDealDialog() + { + return $this->container['show_in_add_deal_dialog']; + } + + /** + * Sets show_in_add_deal_dialog + * + * @param \Pipedrive\versions\v2\Model\PersonFieldItemUiVisibilityShowInAddDealDialog|null $show_in_add_deal_dialog show_in_add_deal_dialog + * + * @return self + */ + public function setShowInAddDealDialog($show_in_add_deal_dialog): self + { + $this->container['show_in_add_deal_dialog'] = $show_in_add_deal_dialog; + + return $this; + } + + /** + * Gets show_in_add_person_dialog + * + * @return \Pipedrive\versions\v2\Model\OrganizationFieldItemUiVisibilityShowInAddPersonDialog|null + */ + public function getShowInAddPersonDialog() + { + return $this->container['show_in_add_person_dialog']; + } + + /** + * Sets show_in_add_person_dialog + * + * @param \Pipedrive\versions\v2\Model\OrganizationFieldItemUiVisibilityShowInAddPersonDialog|null $show_in_add_person_dialog show_in_add_person_dialog + * + * @return self + */ + public function setShowInAddPersonDialog($show_in_add_person_dialog): self + { + $this->container['show_in_add_person_dialog'] = $show_in_add_person_dialog; + + 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/OrganizationFieldItemUiVisibilityShowInAddPersonDialog.php b/lib/versions/v2/Model/OrganizationFieldItemUiVisibilityShowInAddPersonDialog.php new file mode 100644 index 0000000..2870ce6 --- /dev/null +++ b/lib/versions/v2/Model/OrganizationFieldItemUiVisibilityShowInAddPersonDialog.php @@ -0,0 +1,376 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class OrganizationFieldItemUiVisibilityShowInAddPersonDialog implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'OrganizationFieldItem_ui_visibility_show_in_add_person_dialog'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'show' => 'bool', + 'order' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'show' => null, + 'order' => 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 = [ + 'show' => 'show', + 'order' => 'order' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'show' => 'setShow', + 'order' => 'setOrder' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'show' => 'getShow', + 'order' => 'getOrder' + ]; + + /** + * 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['show'] = $data['show'] ?? null; + $this->container['order'] = $data['order'] ?? 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 show + * + * @return bool|null + */ + public function getShow() + { + return $this->container['show']; + } + + /** + * Sets show + * + * @param bool|null $show Whether the field is shown in the add person dialog + * + * @return self + */ + public function setShow($show): self + { + $this->container['show'] = $show; + + return $this; + } + + /** + * Gets order + * + * @return int|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param int|null $order Display order in the add person dialog (null if not shown) + * + * @return self + */ + public function setOrder($order): self + { + $this->container['order'] = $order; + + 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/PersonFieldItem.php b/lib/versions/v2/Model/PersonFieldItem.php new file mode 100644 index 0000000..e7c292f --- /dev/null +++ b/lib/versions/v2/Model/PersonFieldItem.php @@ -0,0 +1,728 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class PersonFieldItem implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'PersonFieldItem'; + + /** + * 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\PersonFieldItemUiVisibility', + '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\PersonFieldItemUiVisibility|null + */ + public function getUiVisibility() + { + return $this->container['ui_visibility']; + } + + /** + * Sets ui_visibility + * + * @param \Pipedrive\versions\v2\Model\PersonFieldItemUiVisibility|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/PersonFieldItemImportantFields.php b/lib/versions/v2/Model/PersonFieldItemImportantFields.php new file mode 100644 index 0000000..7bffa07 --- /dev/null +++ b/lib/versions/v2/Model/PersonFieldItemImportantFields.php @@ -0,0 +1,376 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class PersonFieldItemImportantFields implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'PersonFieldItem_important_fields'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'enabled' => 'bool', + 'stage_ids' => 'int[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'enabled' => null, + 'stage_ids' => 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 = [ + 'enabled' => 'enabled', + 'stage_ids' => 'stage_ids' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'enabled' => 'setEnabled', + 'stage_ids' => 'setStageIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'enabled' => 'getEnabled', + 'stage_ids' => 'getStageIds' + ]; + + /** + * 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['enabled'] = $data['enabled'] ?? null; + $this->container['stage_ids'] = $data['stage_ids'] ?? 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 enabled + * + * @return bool|null + */ + public function getEnabled() + { + return $this->container['enabled']; + } + + /** + * Sets enabled + * + * @param bool|null $enabled Whether the field is marked as important + * + * @return self + */ + public function setEnabled($enabled): self + { + $this->container['enabled'] = $enabled; + + return $this; + } + + /** + * Gets stage_ids + * + * @return int[]|null + */ + public function getStageIds() + { + return $this->container['stage_ids']; + } + + /** + * Sets stage_ids + * + * @param int[]|null $stage_ids Array of deal stage IDs where the field is important + * + * @return self + */ + public function setStageIds($stage_ids): self + { + $this->container['stage_ids'] = $stage_ids; + + 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/PersonFieldItemRequiredFields.php b/lib/versions/v2/Model/PersonFieldItemRequiredFields.php new file mode 100644 index 0000000..b8b5f4f --- /dev/null +++ b/lib/versions/v2/Model/PersonFieldItemRequiredFields.php @@ -0,0 +1,346 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class PersonFieldItemRequiredFields implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'PersonFieldItem_required_fields'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'enabled' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'enabled' => 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 = [ + 'enabled' => 'enabled' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'enabled' => 'setEnabled' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'enabled' => 'getEnabled' + ]; + + /** + * 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['enabled'] = $data['enabled'] ?? 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 enabled + * + * @return bool|null + */ + public function getEnabled() + { + return $this->container['enabled']; + } + + /** + * Sets enabled + * + * @param bool|null $enabled Whether the field is required + * + * @return self + */ + public function setEnabled($enabled): self + { + $this->container['enabled'] = $enabled; + + 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/PersonFieldItemUiVisibility.php b/lib/versions/v2/Model/PersonFieldItemUiVisibility.php new file mode 100644 index 0000000..d4b15b1 --- /dev/null +++ b/lib/versions/v2/Model/PersonFieldItemUiVisibility.php @@ -0,0 +1,406 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class PersonFieldItemUiVisibility implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'PersonFieldItem_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', + 'show_in_add_deal_dialog' => '\Pipedrive\versions\v2\Model\PersonFieldItemUiVisibilityShowInAddDealDialog' + ]; + + /** + * 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, + 'show_in_add_deal_dialog' => 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', + 'show_in_add_deal_dialog' => 'show_in_add_deal_dialog' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'add_visible_flag' => 'setAddVisibleFlag', + 'details_visible_flag' => 'setDetailsVisibleFlag', + 'show_in_add_deal_dialog' => 'setShowInAddDealDialog' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'add_visible_flag' => 'getAddVisibleFlag', + 'details_visible_flag' => 'getDetailsVisibleFlag', + 'show_in_add_deal_dialog' => 'getShowInAddDealDialog' + ]; + + /** + * 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; + $this->container['show_in_add_deal_dialog'] = $data['show_in_add_deal_dialog'] ?? 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; + } + + /** + * Gets show_in_add_deal_dialog + * + * @return \Pipedrive\versions\v2\Model\PersonFieldItemUiVisibilityShowInAddDealDialog|null + */ + public function getShowInAddDealDialog() + { + return $this->container['show_in_add_deal_dialog']; + } + + /** + * Sets show_in_add_deal_dialog + * + * @param \Pipedrive\versions\v2\Model\PersonFieldItemUiVisibilityShowInAddDealDialog|null $show_in_add_deal_dialog show_in_add_deal_dialog + * + * @return self + */ + public function setShowInAddDealDialog($show_in_add_deal_dialog): self + { + $this->container['show_in_add_deal_dialog'] = $show_in_add_deal_dialog; + + 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/PersonFieldItemUiVisibilityShowInAddDealDialog.php b/lib/versions/v2/Model/PersonFieldItemUiVisibilityShowInAddDealDialog.php new file mode 100644 index 0000000..e028623 --- /dev/null +++ b/lib/versions/v2/Model/PersonFieldItemUiVisibilityShowInAddDealDialog.php @@ -0,0 +1,376 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class PersonFieldItemUiVisibilityShowInAddDealDialog implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'PersonFieldItem_ui_visibility_show_in_add_deal_dialog'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'show' => 'bool', + 'order' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'show' => null, + 'order' => 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 = [ + 'show' => 'show', + 'order' => 'order' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'show' => 'setShow', + 'order' => 'setOrder' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'show' => 'getShow', + 'order' => 'getOrder' + ]; + + /** + * 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['show'] = $data['show'] ?? null; + $this->container['order'] = $data['order'] ?? 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 show + * + * @return bool|null + */ + public function getShow() + { + return $this->container['show']; + } + + /** + * Sets show + * + * @param bool|null $show Whether the field is shown in the add deal dialog + * + * @return self + */ + public function setShow($show): self + { + $this->container['show'] = $show; + + return $this; + } + + /** + * Gets order + * + * @return int|null + */ + public function getOrder() + { + return $this->container['order']; + } + + /** + * Sets order + * + * @param int|null $order Display order in the add deal dialog (null if not shown) + * + * @return self + */ + public function setOrder($order): self + { + $this->container['order'] = $order; + + 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/ProductFieldItem.php b/lib/versions/v2/Model/ProductFieldItem.php new file mode 100644 index 0000000..4a69af0 --- /dev/null +++ b/lib/versions/v2/Model/ProductFieldItem.php @@ -0,0 +1,668 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ProductFieldItem implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'ProductFieldItem'; + + /** + * 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\ActivityFieldItemUiVisibility' + ]; + + /** + * 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 + ]; + + /** + * 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' + ]; + + /** + * 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' + ]; + + /** + * 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' + ]; + + /** + * 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; + } + + /** + * 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\ActivityFieldItemUiVisibility|null + */ + public function getUiVisibility() + { + return $this->container['ui_visibility']; + } + + /** + * Sets ui_visibility + * + * @param \Pipedrive\versions\v2\Model\ActivityFieldItemUiVisibility|null $ui_visibility ui_visibility + * + * @return self + */ + public function setUiVisibility($ui_visibility): self + { + $this->container['ui_visibility'] = $ui_visibility; + + 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/UpdateDealFieldRequest.php b/lib/versions/v2/Model/UpdateDealFieldRequest.php new file mode 100644 index 0000000..0784ad1 --- /dev/null +++ b/lib/versions/v2/Model/UpdateDealFieldRequest.php @@ -0,0 +1,480 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class UpdateDealFieldRequest implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'UpdateDealFieldRequest'; + + /** + * 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', + 'description' => 'string' + ]; + + /** + * 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, + 'description' => 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', + 'description' => 'description' + ]; + + /** + * 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', + 'description' => 'setDescription' + ]; + + /** + * 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', + 'description' => 'getDescription' + ]; + + /** + * 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; + $this->container['description'] = $data['description'] ?? 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 UpdateDealFieldRequest., 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 UpdateDealFieldRequest., 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; + } + + /** + * 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. + * + * @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 new file mode 100644 index 0000000..73fdadc --- /dev/null +++ b/lib/versions/v2/Model/UpdateOrganizationFieldRequest.php @@ -0,0 +1,480 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class UpdateOrganizationFieldRequest implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'UpdateOrganizationFieldRequest'; + + /** + * 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', + 'description' => 'string' + ]; + + /** + * 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, + 'description' => 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', + 'description' => 'description' + ]; + + /** + * 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', + 'description' => 'setDescription' + ]; + + /** + * 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', + 'description' => 'getDescription' + ]; + + /** + * 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; + $this->container['description'] = $data['description'] ?? 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 UpdateOrganizationFieldRequest., 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 UpdateOrganizationFieldRequest., 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; + } + + /** + * 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. + * + * @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/UpdatePersonFieldRequest.php b/lib/versions/v2/Model/UpdatePersonFieldRequest.php new file mode 100644 index 0000000..1ac9ecb --- /dev/null +++ b/lib/versions/v2/Model/UpdatePersonFieldRequest.php @@ -0,0 +1,480 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class UpdatePersonFieldRequest implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'UpdatePersonFieldRequest'; + + /** + * 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', + 'description' => 'string' + ]; + + /** + * 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, + 'description' => 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', + 'description' => 'description' + ]; + + /** + * 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', + 'description' => 'setDescription' + ]; + + /** + * 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', + 'description' => 'getDescription' + ]; + + /** + * 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; + $this->container['description'] = $data['description'] ?? 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 UpdatePersonFieldRequest., 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 UpdatePersonFieldRequest., 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; + } + + /** + * 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. + * + * @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/UpdateProductFieldRequest.php b/lib/versions/v2/Model/UpdateProductFieldRequest.php new file mode 100644 index 0000000..b0f96de --- /dev/null +++ b/lib/versions/v2/Model/UpdateProductFieldRequest.php @@ -0,0 +1,420 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class UpdateProductFieldRequest implements ModelInterface, ArrayAccess, JsonSerializable +{ + use RawData; + + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'UpdateProductFieldRequest'; + + /** + * 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', + 'description' => 'string' + ]; + + /** + * 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, + 'description' => 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', + 'description' => 'description' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'field_name' => 'setFieldName', + 'ui_visibility' => 'setUiVisibility', + 'description' => 'setDescription' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'field_name' => 'getFieldName', + 'ui_visibility' => 'getUiVisibility', + 'description' => 'getDescription' + ]; + + /** + * 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['description'] = $data['description'] ?? 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 UpdateProductFieldRequest., 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 UpdateProductFieldRequest., 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. Note that products have a simpler visibility model than other entity types. + * + * @return self + */ + public function setUiVisibility($ui_visibility): self + { + $this->container['ui_visibility'] = $ui_visibility; + + 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. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @throws JsonException + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @throws JsonException + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this), JSON_THROW_ON_ERROR); + } +} + + From c05c48d03aa955daefb63a25505ae9f3cf3a9f1a Mon Sep 17 00:00:00 2001 From: Siiri Mangus Date: Tue, 2 Dec 2025 15:03:59 +0200 Subject: [PATCH 2/2] Release v14.5.0 --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a01e011..170186d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] + +## [14.5.0](https://github.com/pipedrive/client-php/compare/14.4.0...14.5.0) (2025-12-02) + ### Added - Documented the following new v2 endpoints: - `GET /api/v2/activityFields`