diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 34d9bde6..7da0c9ed 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -1,4 +1,5 @@ .gitignore +.openapi-generator-ignore .php_cs .travis.yml MIGRATION-5.x.md @@ -405,6 +406,8 @@ docs/Model/GoalType.md docs/Model/GoalsResponseComponent.md docs/Model/IconKey.md docs/Model/InlineResponse200.md +docs/Model/InlineResponse2001.md +docs/Model/InlineResponse2002.md docs/Model/InlineResponse400.md docs/Model/InlineResponse4001.md docs/Model/InlineResponse4001AdditionalData.md @@ -577,6 +580,8 @@ docs/Model/OrganizationSearchResponseAllOf.md docs/Model/OrganizationSearchResponseAllOfData.md docs/Model/OrganizationUpdateResponse.md docs/Model/OrganizationUpdateResponseAllOf.md +docs/Model/OrganizationsCollectionResponseObject.md +docs/Model/OrganizationsCollectionResponseObjectAllOf.md docs/Model/OrganizationsDeleteResponse.md docs/Model/OrganizationsDeleteResponseData.md docs/Model/OrganizationsMergeResponse.md @@ -617,6 +622,7 @@ docs/Model/PersonSearchItemItemOwner.md docs/Model/PersonSearchResponse.md docs/Model/PersonSearchResponseAllOf.md docs/Model/PersonSearchResponseAllOfData.md +docs/Model/PersonsCollectionResponseObject.md docs/Model/PictureData.md docs/Model/PictureDataPictures.md docs/Model/PictureDataWithID.md @@ -1181,6 +1187,8 @@ lib/Model/GoalType.php lib/Model/GoalsResponseComponent.php lib/Model/IconKey.php lib/Model/InlineResponse200.php +lib/Model/InlineResponse2001.php +lib/Model/InlineResponse2002.php lib/Model/InlineResponse400.php lib/Model/InlineResponse4001.php lib/Model/InlineResponse4001AdditionalData.php @@ -1354,6 +1362,8 @@ lib/Model/OrganizationSearchResponseAllOf.php lib/Model/OrganizationSearchResponseAllOfData.php lib/Model/OrganizationUpdateResponse.php lib/Model/OrganizationUpdateResponseAllOf.php +lib/Model/OrganizationsCollectionResponseObject.php +lib/Model/OrganizationsCollectionResponseObjectAllOf.php lib/Model/OrganizationsDeleteResponse.php lib/Model/OrganizationsDeleteResponseData.php lib/Model/OrganizationsMergeResponse.php @@ -1394,6 +1404,7 @@ lib/Model/PersonSearchItemItemOwner.php lib/Model/PersonSearchResponse.php lib/Model/PersonSearchResponseAllOf.php lib/Model/PersonSearchResponseAllOfData.php +lib/Model/PersonsCollectionResponseObject.php lib/Model/PictureData.php lib/Model/PictureDataPictures.php lib/Model/PictureDataWithID.php diff --git a/.php_cs b/.php_cs new file mode 100644 index 00000000..4fbe53ec --- /dev/null +++ b/.php_cs @@ -0,0 +1,23 @@ +setUsingCache(true) + ->setRules([ + '@PSR2' => true, + 'ordered_imports' => true, + 'phpdoc_order' => true, + 'array_syntax' => [ 'syntax' => 'short' ], + 'strict_comparison' => true, + 'strict_param' => true, + 'no_trailing_whitespace' => false, + 'no_trailing_whitespace_in_comment' => false, + 'braces' => false, + 'single_blank_line_at_eof' => false, + 'blank_line_after_namespace' => false, + ]) + ->setFinder( + PhpCsFixer\Finder::create() + ->exclude('test') + ->exclude('tests') + ->in(__DIR__) + ); diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..714772ee --- /dev/null +++ b/.travis.yml @@ -0,0 +1,9 @@ +language: php +# Bionic environment has preinstalled PHP from 7.1 to 7.4 +# https://docs.travis-ci.com/user/reference/bionic/#php-support +dist: bionic +php: + - 7.3 + - 7.4 +before_install: "composer install" +script: "vendor/bin/phpunit" diff --git a/README.md b/README.md index 17f47966..c302f75b 100644 --- a/README.md +++ b/README.md @@ -459,6 +459,7 @@ Class | Method | HTTP request | Description *OrganizationsApi* | [**getOrganizationUpdates**](docs/Api/OrganizationsApi.md#getorganizationupdates) | **GET** /organizations/{id}/flow | List updates about an organization *OrganizationsApi* | [**getOrganizationUsers**](docs/Api/OrganizationsApi.md#getorganizationusers) | **GET** /organizations/{id}/permittedUsers | List permitted users *OrganizationsApi* | [**getOrganizations**](docs/Api/OrganizationsApi.md#getorganizations) | **GET** /organizations | Get all organizations +*OrganizationsApi* | [**getOrganizationsCollection**](docs/Api/OrganizationsApi.md#getorganizationscollection) | **GET** /organizations/collection | Get all organizations (BETA) *OrganizationsApi* | [**mergeOrganizations**](docs/Api/OrganizationsApi.md#mergeorganizations) | **PUT** /organizations/{id}/merge | Merge two organizations *OrganizationsApi* | [**searchOrganization**](docs/Api/OrganizationsApi.md#searchorganization) | **GET** /organizations/search | Search organizations *OrganizationsApi* | [**updateOrganization**](docs/Api/OrganizationsApi.md#updateorganization) | **PUT** /organizations/{id} | Update an organization @@ -488,6 +489,7 @@ Class | Method | HTTP request | Description *PersonsApi* | [**getPersonUpdates**](docs/Api/PersonsApi.md#getpersonupdates) | **GET** /persons/{id}/flow | List updates about a person *PersonsApi* | [**getPersonUsers**](docs/Api/PersonsApi.md#getpersonusers) | **GET** /persons/{id}/permittedUsers | List permitted users *PersonsApi* | [**getPersons**](docs/Api/PersonsApi.md#getpersons) | **GET** /persons | Get all persons +*PersonsApi* | [**getPersonsCollection**](docs/Api/PersonsApi.md#getpersonscollection) | **GET** /persons/collection | Get all persons (BETA) *PersonsApi* | [**mergePersons**](docs/Api/PersonsApi.md#mergepersons) | **PUT** /persons/{id}/merge | Merge two persons *PersonsApi* | [**searchPersons**](docs/Api/PersonsApi.md#searchpersons) | **GET** /persons/search | Search persons *PersonsApi* | [**updatePerson**](docs/Api/PersonsApi.md#updateperson) | **PUT** /persons/{id} | Update a person @@ -929,6 +931,8 @@ Class | Method | HTTP request | Description - [GoalsResponseComponent](docs/Model/GoalsResponseComponent.md) - [IconKey](docs/Model/IconKey.md) - [InlineResponse200](docs/Model/InlineResponse200.md) + - [InlineResponse2001](docs/Model/InlineResponse2001.md) + - [InlineResponse2002](docs/Model/InlineResponse2002.md) - [InlineResponse400](docs/Model/InlineResponse400.md) - [InlineResponse4001](docs/Model/InlineResponse4001.md) - [InlineResponse4001AdditionalData](docs/Model/InlineResponse4001AdditionalData.md) @@ -1101,6 +1105,8 @@ Class | Method | HTTP request | Description - [OrganizationSearchResponseAllOfData](docs/Model/OrganizationSearchResponseAllOfData.md) - [OrganizationUpdateResponse](docs/Model/OrganizationUpdateResponse.md) - [OrganizationUpdateResponseAllOf](docs/Model/OrganizationUpdateResponseAllOf.md) + - [OrganizationsCollectionResponseObject](docs/Model/OrganizationsCollectionResponseObject.md) + - [OrganizationsCollectionResponseObjectAllOf](docs/Model/OrganizationsCollectionResponseObjectAllOf.md) - [OrganizationsDeleteResponse](docs/Model/OrganizationsDeleteResponse.md) - [OrganizationsDeleteResponseData](docs/Model/OrganizationsDeleteResponseData.md) - [OrganizationsMergeResponse](docs/Model/OrganizationsMergeResponse.md) @@ -1141,6 +1147,7 @@ Class | Method | HTTP request | Description - [PersonSearchResponse](docs/Model/PersonSearchResponse.md) - [PersonSearchResponseAllOf](docs/Model/PersonSearchResponseAllOf.md) - [PersonSearchResponseAllOfData](docs/Model/PersonSearchResponseAllOfData.md) + - [PersonsCollectionResponseObject](docs/Model/PersonsCollectionResponseObject.md) - [PictureData](docs/Model/PictureData.md) - [PictureDataPictures](docs/Model/PictureDataPictures.md) - [PictureDataWithID](docs/Model/PictureDataWithID.md) diff --git a/docs/Api/ActivitiesApi.md b/docs/Api/ActivitiesApi.md index 272bd3c1..5479b02c 100644 --- a/docs/Api/ActivitiesApi.md +++ b/docs/Api/ActivitiesApi.md @@ -324,7 +324,7 @@ $limit = 100; // int | For pagination, the limit of entries to be returned. If n $since = 'since_example'; // string | The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. $until = 'until_example'; // string | The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. $user_id = 56; // int | The ID of the user whose activities will be fetched. If omitted, all activities are returned. -$done = new \Pipedrive\Model\\Pipedrive\Model\NumberBoolean(); // \Pipedrive\Model\NumberBoolean | Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted, returns both done and not done activities. +$done = True; // bool | Whether the activity is done or not. `false` = Not done, `true` = Done. If omitted, returns both done and not done activities. $type = 'type_example'; // string | The type of the activity, can be one type or multiple types separated by a comma. This is in correlation with the `key_string` parameter of ActivityTypes. try { @@ -344,7 +344,7 @@ Name | Type | Description | Notes **since** | **string**| The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. | [optional] **until** | **string**| The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. | [optional] **user_id** | **int**| The ID of the user whose activities will be fetched. If omitted, all activities are returned. | [optional] - **done** | [**\Pipedrive\Model\NumberBoolean**](../Model/.md)| Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted, returns both done and not done activities. | [optional] + **done** | **bool**| Whether the activity is done or not. `false` = Not done, `true` = Done. If omitted, returns both done and not done activities. | [optional] **type** | **string**| The type of the activity, can be one type or multiple types separated by a comma. This is in correlation with the `key_string` parameter of ActivityTypes. | [optional] ### Return type diff --git a/docs/Api/OrganizationsApi.md b/docs/Api/OrganizationsApi.md index e18c2c1c..ce6b6e01 100644 --- a/docs/Api/OrganizationsApi.md +++ b/docs/Api/OrganizationsApi.md @@ -19,6 +19,7 @@ Method | HTTP request | Description [**getOrganizationUpdates()**](OrganizationsApi.md#getOrganizationUpdates) | **GET** /organizations/{id}/flow | List updates about an organization [**getOrganizationUsers()**](OrganizationsApi.md#getOrganizationUsers) | **GET** /organizations/{id}/permittedUsers | List permitted users [**getOrganizations()**](OrganizationsApi.md#getOrganizations) | **GET** /organizations | Get all organizations +[**getOrganizationsCollection()**](OrganizationsApi.md#getOrganizationsCollection) | **GET** /organizations/collection | Get all organizations (BETA) [**mergeOrganizations()**](OrganizationsApi.md#mergeOrganizations) | **PUT** /organizations/{id}/merge | Merge two organizations [**searchOrganization()**](OrganizationsApi.md#searchOrganization) | **GET** /organizations/search | Search organizations [**updateOrganization()**](OrganizationsApi.md#updateOrganization) | **PUT** /organizations/{id} | Update an organization @@ -1006,7 +1007,7 @@ $apiInstance = new Pipedrive\Api\OrganizationsApi( ); $user_id = 56; // int | If supplied, only organizations owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. $filter_id = 56; // int | The ID of the filter to use -$first_char = 'first_char_example'; // string | If supplied, only organizations whose name starts with the specified letter will be returned (case insensitive) +$first_char = 'first_char_example'; // string | If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) $start = 0; // int | Pagination start $limit = 56; // int | Items shown per page $sort = 'sort_example'; // string | The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). @@ -1025,7 +1026,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **user_id** | **int**| If supplied, only organizations owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. | [optional] **filter_id** | **int**| The ID of the filter to use | [optional] - **first_char** | **string**| If supplied, only organizations whose name starts with the specified letter will be returned (case insensitive) | [optional] + **first_char** | **string**| If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) | [optional] **start** | **int**| Pagination start | [optional] [default to 0] **limit** | **int**| Items shown per page | [optional] **sort** | **string**| The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). | [optional] @@ -1047,6 +1048,81 @@ Name | Type | Description | Notes [[Back to Model list]](../../README.md#models) [[Back to README]](../../README.md) +## `getOrganizationsCollection()` + +```php +getOrganizationsCollection($cursor, $limit, $since, $until, $owner_id, $first_char): \Pipedrive\Model\InlineResponse2001 +``` + +Get all organizations (BETA) + +Returns all organizations. This is a cursor-paginated endpoint that is currently in BETA. For more information, please refer to our documentation on pagination. Please note that only global admins (those with global permissions) can access these endpoints. Users with regular permissions will receive a 403 response. Read more about global permissions here. + +### Example + +```php +setApiKey('api_token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = (new Pipedrive\Configuration())->setApiKeyPrefix('api_token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\Api\OrganizationsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page +$limit = 100; // int | For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. +$since = 'since_example'; // string | The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. +$until = 'until_example'; // string | The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. +$owner_id = 56; // int | If supplied, only organizations owned by the given user will be returned +$first_char = 'first_char_example'; // string | If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) + +try { + $result = $apiInstance->getOrganizationsCollection($cursor, $limit, $since, $until, $owner_id, $first_char); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OrganizationsApi->getOrganizationsCollection: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] + **limit** | **int**| For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. | [optional] + **since** | **string**| The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. | [optional] + **until** | **string**| The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. | [optional] + **owner_id** | **int**| If supplied, only organizations owned by the given user will be returned | [optional] + **first_char** | **string**| If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) | [optional] + +### Return type + +[**\Pipedrive\Model\InlineResponse2001**](../Model/InlineResponse2001.md) + +### Authorization + +[api_key](../../README.md#api_key), [oauth2](../../README.md#oauth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + ## `mergeOrganizations()` ```php diff --git a/docs/Api/PersonsApi.md b/docs/Api/PersonsApi.md index eef6cc73..27bd0fc3 100644 --- a/docs/Api/PersonsApi.md +++ b/docs/Api/PersonsApi.md @@ -21,6 +21,7 @@ Method | HTTP request | Description [**getPersonUpdates()**](PersonsApi.md#getPersonUpdates) | **GET** /persons/{id}/flow | List updates about a person [**getPersonUsers()**](PersonsApi.md#getPersonUsers) | **GET** /persons/{id}/permittedUsers | List permitted users [**getPersons()**](PersonsApi.md#getPersons) | **GET** /persons | Get all persons +[**getPersonsCollection()**](PersonsApi.md#getPersonsCollection) | **GET** /persons/collection | Get all persons (BETA) [**mergePersons()**](PersonsApi.md#mergePersons) | **PUT** /persons/{id}/merge | Merge two persons [**searchPersons()**](PersonsApi.md#searchPersons) | **GET** /persons/search | Search persons [**updatePerson()**](PersonsApi.md#updatePerson) | **PUT** /persons/{id} | Update a person @@ -1143,7 +1144,7 @@ $apiInstance = new Pipedrive\Api\PersonsApi( ); $user_id = 56; // int | If supplied, only persons owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. $filter_id = 56; // int | The ID of the filter to use -$first_char = 'first_char_example'; // string | If supplied, only persons whose name starts with the specified letter will be returned (case insensitive) +$first_char = 'first_char_example'; // string | If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) $start = 0; // int | Pagination start $limit = 56; // int | Items shown per page $sort = 'sort_example'; // string | The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). @@ -1162,7 +1163,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **user_id** | **int**| If supplied, only persons owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. | [optional] **filter_id** | **int**| The ID of the filter to use | [optional] - **first_char** | **string**| If supplied, only persons whose name starts with the specified letter will be returned (case insensitive) | [optional] + **first_char** | **string**| If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) | [optional] **start** | **int**| Pagination start | [optional] [default to 0] **limit** | **int**| Items shown per page | [optional] **sort** | **string**| The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). | [optional] @@ -1184,6 +1185,81 @@ Name | Type | Description | Notes [[Back to Model list]](../../README.md#models) [[Back to README]](../../README.md) +## `getPersonsCollection()` + +```php +getPersonsCollection($cursor, $limit, $since, $until, $owner_id, $first_char): \Pipedrive\Model\InlineResponse2002 +``` + +Get all persons (BETA) + +Returns all persons. This is a cursor-paginated endpoint that is currently in BETA. For more information, please refer to our documentation on pagination. Please note that only global admins (those with global permissions) can access these endpoints. Users with regular permissions will receive a 403 response. Read more about global permissions here. + +### Example + +```php +setApiKey('api_token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = (new Pipedrive\Configuration())->setApiKeyPrefix('api_token', 'Bearer'); + +// Configure OAuth2 access token for authorization: oauth2 +$config = (new Pipedrive\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Pipedrive\Api\PersonsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$cursor = 'cursor_example'; // string | For pagination, the marker (an opaque string value) representing the first item on the next page +$limit = 100; // int | For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. +$since = 'since_example'; // string | The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. +$until = 'until_example'; // string | The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. +$owner_id = 56; // int | If supplied, only persons owned by the given user will be returned +$first_char = 'first_char_example'; // string | If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) + +try { + $result = $apiInstance->getPersonsCollection($cursor, $limit, $since, $until, $owner_id, $first_char); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PersonsApi->getPersonsCollection: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **cursor** | **string**| For pagination, the marker (an opaque string value) representing the first item on the next page | [optional] + **limit** | **int**| For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. | [optional] + **since** | **string**| The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. | [optional] + **until** | **string**| The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. | [optional] + **owner_id** | **int**| If supplied, only persons owned by the given user will be returned | [optional] + **first_char** | **string**| If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) | [optional] + +### Return type + +[**\Pipedrive\Model\InlineResponse2002**](../Model/InlineResponse2002.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#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + ## `mergePersons()` ```php diff --git a/docs/Api/ProductsApi.md b/docs/Api/ProductsApi.md index dca6e314..9092f825 100644 --- a/docs/Api/ProductsApi.md +++ b/docs/Api/ProductsApi.md @@ -658,7 +658,7 @@ $apiInstance = new Pipedrive\Api\ProductsApi( $user_id = 56; // int | If supplied, only products owned by the given user will be returned $filter_id = 56; // int | The ID of the filter to use $ids = array(56); // int[] | An array of integers with the IDs of the products that should be returned in the response -$first_char = 'first_char_example'; // string | If supplied, only products whose name starts with the specified letter will be returned (case insensitive) +$first_char = 'first_char_example'; // string | If supplied, only products whose name starts with the specified letter will be returned (case-insensitive) $get_summary = True; // bool | If supplied, the response will return the total numbers of products in the `additional_data.summary.total_count` property $start = 0; // int | Pagination start $limit = 56; // int | Items shown per page @@ -678,7 +678,7 @@ Name | Type | Description | Notes **user_id** | **int**| If supplied, only products owned by the given user will be returned | [optional] **filter_id** | **int**| The ID of the filter to use | [optional] **ids** | [**int[]**](../Model/int.md)| An array of integers with the IDs of the products that should be returned in the response | [optional] - **first_char** | **string**| If supplied, only products whose name starts with the specified letter will be returned (case insensitive) | [optional] + **first_char** | **string**| If supplied, only products whose name starts with the specified letter will be returned (case-insensitive) | [optional] **get_summary** | **bool**| If supplied, the response will return the total numbers of products in the `additional_data.summary.total_count` property | [optional] **start** | **int**| Pagination start | [optional] [default to 0] **limit** | **int**| Items shown per page | [optional] diff --git a/docs/Model/AddProductAttachmentDetails.md b/docs/Model/AddProductAttachmentDetails.md index cf3f1c51..942a153e 100644 --- a/docs/Model/AddProductAttachmentDetails.md +++ b/docs/Model/AddProductAttachmentDetails.md @@ -7,12 +7,14 @@ Name | Type | Description | Notes **product_id** | **int** | The ID of the product | **item_price** | **float** | The price at which this product will be added to the deal | **quantity** | **int** | Quantity – e.g. how many items of this product will be added to the deal | -**discount_percentage** | **float** | The discount %. If omitted, will be set to 0. | [optional] [default to 0] +**discount** | **float** | The value of the discount. The `discount_type` field can be used to specify whether the value is an amount or a percentage. | [optional] [default to 0] +**discount_type** | **string** | The type of the discount's value. | [optional] [default to 'percentage'] **duration** | **float** | The duration of the product. If omitted, will be set to 1. | [optional] [default to 1] **duration_unit** | **string** | The type of the duration. (For example hourly, daily, etc.) | [optional] **product_variation_id** | **int** | The ID of the product variation to use. When omitted, no variation will be used. | [optional] **comments** | **string** | A textual comment associated with this product-deal attachment | [optional] **tax** | **float** | The product tax | [optional] +**tax_method** | **string** | The tax option to be applied to the products. When using `inclusive`, the tax percentage will already be included in the price. When using `exclusive`, the tax will not be included in the price. When using `none`, no tax will be added. Use the `tax` field for defining the tax percentage amount. By default, the user setting value for tax options will be used. Changing this in one product affects the rest of the products attached to the deal. | [optional] **enabled_flag** | **bool** | Whether the product is enabled for a deal or not. This makes it possible to add products to a deal with a specific price and discount criteria, but keep them disabled, which refrains them from being included in the deal value calculation. When omitted, the product will be marked as enabled by default. | [optional] [default to true] **id** | **int** | The ID of the deal-product (the ID of the product attached to the deal) | [optional] **company_id** | **int** | The ID of the company | [optional] diff --git a/docs/Model/BaseOrganizationItem.md b/docs/Model/BaseOrganizationItem.md index 45c19ff2..3e547136 100644 --- a/docs/Model/BaseOrganizationItem.md +++ b/docs/Model/BaseOrganizationItem.md @@ -15,9 +15,9 @@ Name | Type | Description | Notes **add_time** | **string** | The creation date and time of the organization | [optional] **update_time** | **string** | The last updated date and time of the organization | [optional] **visible_to** | **string** | The visibility group ID of who can see the organization | [optional] -**label** | **int** | The ID of the label | [optional] +**label** | **int** | The label assigned to the organization | [optional] **owner_name** | **string** | The name of the organization owner | [optional] -**cc_email** | **string** | The BCC email of the organization | [optional] +**cc_email** | **string** | The BCC email associated with the organization | [optional] **email_messages_count** | **int** | The count of email messages related to the organization | [optional] **people_count** | **int** | The count of persons related to the organization | [optional] **activities_count** | **int** | The count of activities related to the organization | [optional] diff --git a/docs/Model/BaseOrganizationItemFields.md b/docs/Model/BaseOrganizationItemFields.md index 8a445362..c463aaa0 100644 --- a/docs/Model/BaseOrganizationItemFields.md +++ b/docs/Model/BaseOrganizationItemFields.md @@ -15,8 +15,8 @@ Name | Type | Description | Notes **add_time** | **string** | The creation date and time of the organization | [optional] **update_time** | **string** | The last updated date and time of the organization | [optional] **visible_to** | **string** | The visibility group ID of who can see the organization | [optional] -**label** | **int** | The ID of the label | [optional] +**label** | **int** | The label assigned to the organization | [optional] **owner_name** | **string** | The name of the organization owner | [optional] -**cc_email** | **string** | The BCC email of the organization | [optional] +**cc_email** | **string** | The BCC email associated with the organization | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/BaseOrganizationItemWithEditNameFlag.md b/docs/Model/BaseOrganizationItemWithEditNameFlag.md index 243ef918..e8ec202b 100644 --- a/docs/Model/BaseOrganizationItemWithEditNameFlag.md +++ b/docs/Model/BaseOrganizationItemWithEditNameFlag.md @@ -15,9 +15,9 @@ Name | Type | Description | Notes **add_time** | **string** | The creation date and time of the organization | [optional] **update_time** | **string** | The last updated date and time of the organization | [optional] **visible_to** | **string** | The visibility group ID of who can see the organization | [optional] -**label** | **int** | The ID of the label | [optional] +**label** | **int** | The label assigned to the organization | [optional] **owner_name** | **string** | The name of the organization owner | [optional] -**cc_email** | **string** | The BCC email of the organization | [optional] +**cc_email** | **string** | The BCC email associated with the organization | [optional] **email_messages_count** | **int** | The count of email messages related to the organization | [optional] **people_count** | **int** | The count of persons related to the organization | [optional] **activities_count** | **int** | The count of activities related to the organization | [optional] diff --git a/docs/Model/BasicDealProduct.md b/docs/Model/BasicDealProduct.md index 8e68f3f6..29caea52 100644 --- a/docs/Model/BasicDealProduct.md +++ b/docs/Model/BasicDealProduct.md @@ -7,12 +7,14 @@ Name | Type | Description | Notes **product_id** | **int** | The ID of the product to use | **item_price** | **float** | The price at which this product will be added to the deal | **quantity** | **int** | Quantity – e.g. how many items of this product will be added to the deal | -**discount_percentage** | **float** | The discount %. If omitted, will be set to 0. | [optional] [default to 0] +**discount** | **float** | The value of the discount. The `discount_type` field can be used to specify whether the value is an amount or a percentage. | [optional] [default to 0] +**discount_type** | **string** | The type of the discount's value. | [optional] [default to 'percentage'] **duration** | **float** | The duration of the product. If omitted, will be set to 1. | [optional] [default to 1] **duration_unit** | [**DealProductUnitDuration**](DealProductUnitDuration.md) | The unit duration of the product | [optional] **product_variation_id** | **int** | The ID of the product variation to use. When omitted, no variation will be used. | [optional] **comments** | **string** | A textual comment associated with this product-deal attachment | [optional] **tax** | **float** | The tax percentage | [optional] [default to 0] +**tax_method** | **string** | The tax option to be applied to the products. When using `inclusive`, the tax percentage will already be included in the price. When using `exclusive`, the tax will not be included in the price. When using `none`, no tax will be added. Use the `tax` field for defining the tax percentage amount. By default, the user setting value for tax options will be used. Changing this in one product affects the rest of the products attached to the deal. | [optional] **enabled_flag** | **bool** | Whether the product is enabled for a deal or not. This makes it possible to add products to a deal with a specific price and discount criteria, but keep them disabled, which refrains them from being included in the deal value calculation. When omitted, the product will be marked as enabled by default. | [optional] [default to true] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/InlineResponse2001.md b/docs/Model/InlineResponse2001.md new file mode 100644 index 00000000..ac9473c2 --- /dev/null +++ b/docs/Model/InlineResponse2001.md @@ -0,0 +1,11 @@ +# # InlineResponse2001 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | | [optional] +**data** | [**\Pipedrive\Model\OrganizationsCollectionResponseObject[]**](OrganizationsCollectionResponseObject.md) | | [optional] +**additional_data** | [**\Pipedrive\Model\AdditionalDataWithCursorPagination**](AdditionalDataWithCursorPagination.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/InlineResponse2002.md b/docs/Model/InlineResponse2002.md new file mode 100644 index 00000000..04c32fbd --- /dev/null +++ b/docs/Model/InlineResponse2002.md @@ -0,0 +1,11 @@ +# # InlineResponse2002 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | | [optional] +**data** | [**\Pipedrive\Model\PersonsCollectionResponseObject[]**](PersonsCollectionResponseObject.md) | | [optional] +**additional_data** | [**\Pipedrive\Model\AdditionalDataWithCursorPagination**](AdditionalDataWithCursorPagination.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/NewDealProduct.md b/docs/Model/NewDealProduct.md index 695f9dea..7b7b9986 100644 --- a/docs/Model/NewDealProduct.md +++ b/docs/Model/NewDealProduct.md @@ -7,12 +7,14 @@ Name | Type | Description | Notes **product_id** | **int** | The ID of the product to use | **item_price** | **float** | The price at which this product will be added to the deal | **quantity** | **int** | Quantity – e.g. how many items of this product will be added to the deal | -**discount_percentage** | **float** | The discount %. If omitted, will be set to 0. | [optional] [default to 0] +**discount** | **float** | The value of the discount. The `discount_type` field can be used to specify whether the value is an amount or a percentage. | [optional] [default to 0] +**discount_type** | **string** | The type of the discount's value. | [optional] [default to 'percentage'] **duration** | **float** | The duration of the product. If omitted, will be set to 1. | [optional] [default to 1] **duration_unit** | [**DealProductUnitDuration**](DealProductUnitDuration.md) | The unit duration of the product | [optional] **product_variation_id** | **int** | The ID of the product variation to use. When omitted, no variation will be used. | [optional] **comments** | **string** | A textual comment associated with this product-deal attachment | [optional] **tax** | **float** | The tax percentage | [optional] [default to 0] +**tax_method** | **string** | The tax option to be applied to the products. When using `inclusive`, the tax percentage will already be included in the price. When using `exclusive`, the tax will not be included in the price. When using `none`, no tax will be added. Use the `tax` field for defining the tax percentage amount. By default, the user setting value for tax options will be used. Changing this in one product affects the rest of the products attached to the deal. | [optional] **enabled_flag** | **bool** | Whether the product is enabled for a deal or not. This makes it possible to add products to a deal with a specific price and discount criteria, but keep them disabled, which refrains them from being included in the deal value calculation. When omitted, the product will be marked as enabled by default. | [optional] [default to true] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrganizationItem.md b/docs/Model/OrganizationItem.md index 1760736c..cc34d22b 100644 --- a/docs/Model/OrganizationItem.md +++ b/docs/Model/OrganizationItem.md @@ -15,9 +15,9 @@ Name | Type | Description | Notes **add_time** | **string** | The creation date and time of the organization | [optional] **update_time** | **string** | The last updated date and time of the organization | [optional] **visible_to** | **string** | The visibility group ID of who can see the organization | [optional] -**label** | **int** | The ID of the label | [optional] +**label** | **int** | The label assigned to the organization | [optional] **owner_name** | **string** | The name of the organization owner | [optional] -**cc_email** | **string** | The BCC email of the organization | [optional] +**cc_email** | **string** | The BCC email associated with the organization | [optional] **email_messages_count** | **int** | The count of email messages related to the organization | [optional] **people_count** | **int** | The count of persons related to the organization | [optional] **activities_count** | **int** | The count of activities related to the organization | [optional] diff --git a/docs/Model/OrganizationsCollectionResponseObject.md b/docs/Model/OrganizationsCollectionResponseObject.md new file mode 100644 index 00000000..91404f9f --- /dev/null +++ b/docs/Model/OrganizationsCollectionResponseObject.md @@ -0,0 +1,29 @@ +# # OrganizationsCollectionResponseObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**address** | **string** | The full address of the organization | [optional] +**address_subpremise** | **string** | The sub-premise of the organization location | [optional] +**address_street_number** | **string** | The street number of the organization location | [optional] +**address_route** | **string** | The route of the organization location | [optional] +**address_sublocality** | **string** | The sub-locality of the organization location | [optional] +**address_locality** | **string** | The locality of the organization location | [optional] +**address_admin_area_level_1** | **string** | The level 1 admin area of the organization location | [optional] +**address_admin_area_level_2** | **string** | The level 2 admin area of the organization location | [optional] +**address_country** | **string** | The country of the organization location | [optional] +**address_postal_code** | **string** | The postal code of the organization location | [optional] +**address_formatted_address** | **string** | The formatted organization location | [optional] +**id** | **int** | The ID of the organization | [optional] +**active_flag** | **bool** | Whether the organization is active or not | [optional] +**owner_id** | **int** | The ID of the owner | [optional] +**name** | **string** | The name of the organization | [optional] +**update_time** | **string** | The last updated date and time of the organization. Format: YYYY-MM-DD HH:MM:SS | [optional] +**delete_time** | **string** | The date and time this organization was deleted. Format: YYYY-MM-DD HH:MM:SS | [optional] +**add_time** | **string** | The date and time when the organization was added/created. Format: YYYY-MM-DD HH:MM:SS | [optional] +**visible_to** | **string** | The visibility group ID of who can see the organization | [optional] +**label** | **int** | The label assigned to the organization | [optional] +**cc_email** | **string** | The BCC email associated with the organization | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OrganizationsCollectionResponseObjectAllOf.md b/docs/Model/OrganizationsCollectionResponseObjectAllOf.md new file mode 100644 index 00000000..12f08e30 --- /dev/null +++ b/docs/Model/OrganizationsCollectionResponseObjectAllOf.md @@ -0,0 +1,18 @@ +# # OrganizationsCollectionResponseObjectAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The ID of the organization | [optional] +**active_flag** | **bool** | Whether the organization is active or not | [optional] +**owner_id** | **int** | The ID of the owner | [optional] +**name** | **string** | The name of the organization | [optional] +**update_time** | **string** | The last updated date and time of the organization. Format: YYYY-MM-DD HH:MM:SS | [optional] +**delete_time** | **string** | The date and time this organization was deleted. Format: YYYY-MM-DD HH:MM:SS | [optional] +**add_time** | **string** | The date and time when the organization was added/created. Format: YYYY-MM-DD HH:MM:SS | [optional] +**visible_to** | **string** | The visibility group ID of who can see the organization | [optional] +**label** | **int** | The label assigned to the organization | [optional] +**cc_email** | **string** | The BCC email associated with the organization | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PersonsCollectionResponseObject.md b/docs/Model/PersonsCollectionResponseObject.md new file mode 100644 index 00000000..d8aa0c51 --- /dev/null +++ b/docs/Model/PersonsCollectionResponseObject.md @@ -0,0 +1,22 @@ +# # PersonsCollectionResponseObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The ID of the person | [optional] +**active_flag** | **bool** | Whether the person is active or not | [optional] +**owner_id** | **int** | The ID of the owner related to the person | [optional] +**org_id** | **int** | The ID of the organization related to the person | [optional] +**name** | **string** | The name of the person | [optional] +**email** | [**\Pipedrive\Model\BasicPersonEmail[]**](BasicPersonEmail.md) | An email address as a string or an array of email objects related to the person. The structure of the array is as follows: `[{ \"value\": \"mail@example.com\", \"primary\": \"true\", \"label\": \"main\" }]`. Please note that only `value` is required. | [optional] +**phone** | [**\Pipedrive\Model\BasePersonItemPhone[]**](BasePersonItemPhone.md) | A phone number supplied as a string or an array of phone objects related to the person. The structure of the array is as follows: `[{ \"value\": \"12345\", \"primary\": \"true\", \"label\": \"mobile\" }]`. Please note that only `value` is required. | [optional] +**update_time** | **string** | The last updated date and time of the person. Format: YYYY-MM-DD HH:MM:SS | [optional] +**delete_time** | **string** | The date and time this person was deleted. Format: YYYY-MM-DD HH:MM:SS | [optional] +**add_time** | **string** | The date and time when the person was added/created. Format: YYYY-MM-DD HH:MM:SS | [optional] +**visible_to** | **string** | The visibility group ID of who can see the person | [optional] +**picture_id** | **int** | The ID of the picture associated with the item | [optional] +**label** | **int** | The label assigned to the person | [optional] +**cc_email** | **string** | The BCC email associated with the person | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ProductAttachmentDetails.md b/docs/Model/ProductAttachmentDetails.md index 1587c0a3..f1af798c 100644 --- a/docs/Model/ProductAttachmentDetails.md +++ b/docs/Model/ProductAttachmentDetails.md @@ -7,12 +7,14 @@ Name | Type | Description | Notes **product_id** | **int** | The ID of the product | **item_price** | **float** | The price at which this product will be added to the deal | **quantity** | **int** | Quantity – e.g. how many items of this product will be added to the deal | -**discount_percentage** | **float** | The discount %. If omitted, will be set to 0. | [optional] [default to 0] +**discount** | **float** | The value of the discount. The `discount_type` field can be used to specify whether the value is an amount or a percentage. | [optional] [default to 0] +**discount_type** | **string** | The type of the discount's value. | [optional] [default to 'percentage'] **duration** | **float** | The duration of the product. If omitted, will be set to 1. | [optional] [default to 1] **duration_unit** | **string** | The type of the duration. (For example hourly, daily, etc.) | [optional] **product_variation_id** | **int** | The ID of the product variation to use. When omitted, no variation will be used. | [optional] **comments** | **string** | A textual comment associated with this product-deal attachment | [optional] **tax** | **float** | The product tax | [optional] +**tax_method** | **string** | The tax option to be applied to the products. When using `inclusive`, the tax percentage will already be included in the price. When using `exclusive`, the tax will not be included in the price. When using `none`, no tax will be added. Use the `tax` field for defining the tax percentage amount. By default, the user setting value for tax options will be used. Changing this in one product affects the rest of the products attached to the deal. | [optional] **enabled_flag** | **bool** | Whether the product is enabled for a deal or not. This makes it possible to add products to a deal with a specific price and discount criteria, but keep them disabled, which refrains them from being included in the deal value calculation. When omitted, the product will be marked as enabled by default. | [optional] [default to true] **id** | **int** | The ID of the deal-product (the ID of the product attached to the deal) | [optional] **company_id** | **int** | The ID of the company | [optional] diff --git a/docs/Model/ProductListItem.md b/docs/Model/ProductListItem.md index 01efb538..6e4091f3 100644 --- a/docs/Model/ProductListItem.md +++ b/docs/Model/ProductListItem.md @@ -10,7 +10,8 @@ Name | Type | Description | Notes **product_id** | **int** | The ID of the product | [optional] **product_variation_id** | **int** | The ID of the product variation | [optional] **item_price** | **int** | The price value of the product | [optional] -**discount_percentage** | **int** | The discount percentage of the product | [optional] +**discount** | **float** | The value of the discount. The `discount_type` field can be used to specify whether the value is an amount or a percentage. | [optional] [default to 0] +**discount_type** | **string** | The type of the discount's value. | [optional] [default to 'percentage'] **duration** | **int** | The duration of the product | [optional] **duration_unit** | **string** | The type of the duration. (For example hourly, daily, etc.) | [optional] **sum_no_discount** | **float** | The product sum without the discount | [optional] @@ -22,6 +23,7 @@ Name | Type | Description | Notes **comments** | **string** | The comments of the product | [optional] **active_flag** | **bool** | Whether the product is active or not | [optional] **tax** | **float** | The product tax | [optional] +**tax_method** | **string** | The tax option to be applied to the products. When using `inclusive`, the tax percentage will already be included in the price. When using `exclusive`, the tax will not be included in the price. When using `none`, no tax will be added. Use the `tax` field for defining the tax percentage amount. By default, the user setting value for tax options will be used. Changing this in one product affects the rest of the products attached to the deal. | [optional] **name** | **string** | The product name | [optional] **sum_formatted** | **string** | The formatted sum of the product | [optional] **quantity_formatted** | **string** | The formatted quantity of the product | [optional] diff --git a/docs/Model/UpdateDealProduct.md b/docs/Model/UpdateDealProduct.md index 534c897c..538d4c96 100644 --- a/docs/Model/UpdateDealProduct.md +++ b/docs/Model/UpdateDealProduct.md @@ -7,12 +7,14 @@ Name | Type | Description | Notes **product_id** | **int** | The ID of the product to use | [optional] **item_price** | **float** | The price at which this product will be added to the deal | [optional] **quantity** | **int** | How many items of this product will be added to the deal | [optional] -**discount_percentage** | **float** | The discount %. If omitted, will be set to 0. | [optional] [default to 0] +**discount** | **float** | The value of the discount. The `discount_type` field can be used to specify whether the value is an amount or a percentage. | [optional] [default to 0] +**discount_type** | **string** | The type of the discount's value. | [optional] [default to 'percentage'] **duration** | **float** | The duration of the product | [optional] [default to 1] **duration_unit** | [**DealProductUnitDuration**](DealProductUnitDuration.md) | The unit duration of the product | [optional] **product_variation_id** | **int** | The ID of the product variation to use. When omitted, no variation will be used. | [optional] **comments** | **string** | A textual comment associated with this product-deal attachment | [optional] **tax** | **float** | The tax percentage | [optional] [default to 0] +**tax_method** | **string** | The tax option to be applied to the products. When using `inclusive`, the tax percentage will already be included in the price. When using `exclusive`, the tax will not be included in the price. When using `none`, no tax will be added. Use the `tax` field for defining the tax percentage amount. | [optional] **enabled_flag** | **bool** | Whether the product is enabled for a deal or not. This makes it possible to add products to a deal with a specific price and discount criteria, but keep them disabled, which refrains them from being included in the deal value calculation. When omitted, the product will be marked as enabled by default. | [optional] [default to true] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/git_push.sh b/git_push.sh new file mode 100644 index 00000000..5e9af16f --- /dev/null +++ b/git_push.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +echo \"Coming soon...\"; \ No newline at end of file diff --git a/lib/Api/ActivitiesApi.php b/lib/Api/ActivitiesApi.php index 8eeda635..628bd4a2 100644 --- a/lib/Api/ActivitiesApi.php +++ b/lib/Api/ActivitiesApi.php @@ -1391,7 +1391,7 @@ public function getActivitiesRequest($user_id = null, $filter_id = null, $type = * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) * @param int|null $user_id The ID of the user whose activities will be fetched. If omitted, all activities are returned. (optional) - * @param \Pipedrive\Model\NumberBoolean|null $done Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted, returns both done and not done activities. (optional) + * @param bool|null $done Whether the activity is done or not. `false` = Not done, `true` = Done. If omitted, returns both done and not done activities. (optional) * @param string|null $type The type of the activity, can be one type or multiple types separated by a comma. This is in correlation with the `key_string` parameter of ActivityTypes. (optional) * * @throws ApiException on non-2xx response @@ -1414,7 +1414,7 @@ public function getActivitiesCollection($cursor = null, $limit = null, $since = * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) * @param int|null $user_id The ID of the user whose activities will be fetched. If omitted, all activities are returned. (optional) - * @param \Pipedrive\Model\NumberBoolean|null $done Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted, returns both done and not done activities. (optional) + * @param bool|null $done Whether the activity is done or not. `false` = Not done, `true` = Done. If omitted, returns both done and not done activities. (optional) * @param string|null $type The type of the activity, can be one type or multiple types separated by a comma. This is in correlation with the `key_string` parameter of ActivityTypes. (optional) * * @throws ApiException on non-2xx response @@ -1542,7 +1542,7 @@ public function getActivitiesCollectionWithHttpInfo($cursor = null, $limit = nul * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) * @param int|null $user_id The ID of the user whose activities will be fetched. If omitted, all activities are returned. (optional) - * @param \Pipedrive\Model\NumberBoolean|null $done Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted, returns both done and not done activities. (optional) + * @param bool|null $done Whether the activity is done or not. `false` = Not done, `true` = Done. If omitted, returns both done and not done activities. (optional) * @param string|null $type The type of the activity, can be one type or multiple types separated by a comma. This is in correlation with the `key_string` parameter of ActivityTypes. (optional) * * @throws InvalidArgumentException|OAuthProviderException @@ -1568,7 +1568,7 @@ function ($response) { * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) * @param int|null $user_id The ID of the user whose activities will be fetched. If omitted, all activities are returned. (optional) - * @param \Pipedrive\Model\NumberBoolean|null $done Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted, returns both done and not done activities. (optional) + * @param bool|null $done Whether the activity is done or not. `false` = Not done, `true` = Done. If omitted, returns both done and not done activities. (optional) * @param string|null $type The type of the activity, can be one type or multiple types separated by a comma. This is in correlation with the `key_string` parameter of ActivityTypes. (optional) * * @throws InvalidArgumentException|OAuthProviderException @@ -1621,7 +1621,7 @@ function ($exception) { * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) * @param int|null $user_id The ID of the user whose activities will be fetched. If omitted, all activities are returned. (optional) - * @param \Pipedrive\Model\NumberBoolean|null $done Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted, returns both done and not done activities. (optional) + * @param bool|null $done Whether the activity is done or not. `false` = Not done, `true` = Done. If omitted, returns both done and not done activities. (optional) * @param string|null $type The type of the activity, can be one type or multiple types separated by a comma. This is in correlation with the `key_string` parameter of ActivityTypes. (optional) * * @throws InvalidArgumentException|OAuthProviderException diff --git a/lib/Api/OrganizationsApi.php b/lib/Api/OrganizationsApi.php index 34bf75ef..b710073a 100644 --- a/lib/Api/OrganizationsApi.php +++ b/lib/Api/OrganizationsApi.php @@ -4539,7 +4539,7 @@ public function getOrganizationUsersRequest($id): Request * * @param int|null $user_id If supplied, only organizations owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. (optional) * @param int|null $filter_id The ID of the filter to use (optional) - * @param string|null $first_char If supplied, only organizations whose name starts with the specified letter will be returned (case insensitive) (optional) + * @param string|null $first_char If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) (optional) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) @@ -4561,7 +4561,7 @@ public function getOrganizations($user_id = null, $filter_id = null, $first_char * * @param int|null $user_id If supplied, only organizations owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. (optional) * @param int|null $filter_id The ID of the filter to use (optional) - * @param string|null $first_char If supplied, only organizations whose name starts with the specified letter will be returned (case insensitive) (optional) + * @param string|null $first_char If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) (optional) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) @@ -4667,7 +4667,7 @@ public function getOrganizationsWithHttpInfo($user_id = null, $filter_id = null, * * @param int|null $user_id If supplied, only organizations owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. (optional) * @param int|null $filter_id The ID of the filter to use (optional) - * @param string|null $first_char If supplied, only organizations whose name starts with the specified letter will be returned (case insensitive) (optional) + * @param string|null $first_char If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) (optional) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) @@ -4692,7 +4692,7 @@ function ($response) { * * @param int|null $user_id If supplied, only organizations owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. (optional) * @param int|null $filter_id The ID of the filter to use (optional) - * @param string|null $first_char If supplied, only organizations whose name starts with the specified letter will be returned (case insensitive) (optional) + * @param string|null $first_char If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) (optional) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) @@ -4744,7 +4744,7 @@ function ($exception) { * * @param int|null $user_id If supplied, only organizations owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. (optional) * @param int|null $filter_id The ID of the filter to use (optional) - * @param string|null $first_char If supplied, only organizations whose name starts with the specified letter will be returned (case insensitive) (optional) + * @param string|null $first_char If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) (optional) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) @@ -4814,6 +4814,381 @@ public function getOrganizationsRequest($user_id = null, $filter_id = null, $fir + /* @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('api_token'); + if ($apiKey !== null) { + $queryParams['api_token'] = $apiKey; + } + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + // If access token is expired + if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { + $this->config->refreshToken(); + } + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = Query::build($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getOrganizationsCollection + * + * Get all organizations (BETA) + * + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) + * @param int|null $limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. (optional) + * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) + * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) + * @param int|null $owner_id If supplied, only organizations owned by the given user will be returned (optional) + * @param string|null $first_char If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\Model\InlineResponse2001|\Pipedrive\Model\FailResponse + */ + public function getOrganizationsCollection($cursor = null, $limit = null, $since = null, $until = null, $owner_id = null, $first_char = null) + { + list($response) = $this->getOrganizationsCollectionWithHttpInfo($cursor, $limit, $since, $until, $owner_id, $first_char); + return $response; + } + + /** + * Operation getOrganizationsCollectionWithHttpInfo + * + * Get all organizations (BETA) + * + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) + * @param int|null $limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. (optional) + * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) + * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) + * @param int|null $owner_id If supplied, only organizations owned by the given user will be returned (optional) + * @param string|null $first_char If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\Model\InlineResponse2001|\Pipedrive\Model\FailResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getOrganizationsCollectionWithHttpInfo($cursor = null, $limit = null, $since = null, $until = null, $owner_id = null, $first_char = null) + { + $request = $this->getOrganizationsCollectionRequest($cursor, $limit, $since, $until, $owner_id, $first_char); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { + $this->config->refreshToken(); + $request = $this->getOrganizationsCollectionRequest($cursor, $limit, $since, $until, $owner_id, $first_char); + $response = $this->client->send($request, $options); + } else { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + /* @phpstan-ignore-next-line */ + if ('\Pipedrive\Model\InlineResponse2001' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\Model\InlineResponse2001', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + /* @phpstan-ignore-next-line */ + if ('\Pipedrive\Model\FailResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\Model\FailResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + /* @phpstan-ignore-next-line */ + if ('\Pipedrive\Model\InlineResponse2001' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\Model\InlineResponse2001', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\Model\InlineResponse2001', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\Model\FailResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getOrganizationsCollectionAsync + * + * Get all organizations (BETA) + * + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) + * @param int|null $limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. (optional) + * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) + * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) + * @param int|null $owner_id If supplied, only organizations owned by the given user will be returned (optional) + * @param string|null $first_char If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getOrganizationsCollectionAsync($cursor = null, $limit = null, $since = null, $until = null, $owner_id = null, $first_char = null): PromiseInterface + { + return $this->getOrganizationsCollectionAsyncWithHttpInfo($cursor, $limit, $since, $until, $owner_id, $first_char) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getOrganizationsCollectionAsyncWithHttpInfo + * + * Get all organizations (BETA) + * + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) + * @param int|null $limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. (optional) + * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) + * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) + * @param int|null $owner_id If supplied, only organizations owned by the given user will be returned (optional) + * @param string|null $first_char If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getOrganizationsCollectionAsyncWithHttpInfo($cursor = null, $limit = null, $since = null, $until = null, $owner_id = null, $first_char = null): PromiseInterface + { + $returnType = '\Pipedrive\Model\InlineResponse2001'; + $request = $this->getOrganizationsCollectionRequest($cursor, $limit, $since, $until, $owner_id, $first_char); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + /* @phpstan-ignore-next-line */ + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getOrganizationsCollection' + * + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) + * @param int|null $limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. (optional) + * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) + * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) + * @param int|null $owner_id If supplied, only organizations owned by the given user will be returned (optional) + * @param string|null $first_char If supplied, only organizations whose name starts with the specified letter will be returned (case-insensitive) (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function getOrganizationsCollectionRequest($cursor = null, $limit = null, $since = null, $until = null, $owner_id = null, $first_char = null): Request + { + + $resourcePath = '/organizations/collection'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + /* @phpstan-ignore-next-line */ + if (is_array($cursor)) { + $cursor = ObjectSerializer::serializeCollection($cursor, '', true); + } + if ($cursor !== null) { + $queryParams['cursor'] = $cursor; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($limit)) { + $limit = ObjectSerializer::serializeCollection($limit, '', true); + } + if ($limit !== null) { + $queryParams['limit'] = $limit; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($since)) { + $since = ObjectSerializer::serializeCollection($since, '', true); + } + if ($since !== null) { + $queryParams['since'] = $since; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($until)) { + $until = ObjectSerializer::serializeCollection($until, '', true); + } + if ($until !== null) { + $queryParams['until'] = $until; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($owner_id)) { + $owner_id = ObjectSerializer::serializeCollection($owner_id, '', true); + } + if ($owner_id !== null) { + $queryParams['owner_id'] = $owner_id; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($first_char)) { + $first_char = ObjectSerializer::serializeCollection($first_char, '', true); + } + if ($first_char !== null) { + $queryParams['first_char'] = $first_char; + } + + + + /* @phpstan-ignore-next-line */ if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( diff --git a/lib/Api/PersonsApi.php b/lib/Api/PersonsApi.php index 1b052f95..dd24522e 100644 --- a/lib/Api/PersonsApi.php +++ b/lib/Api/PersonsApi.php @@ -5171,7 +5171,7 @@ public function getPersonUsersRequest($id): Request * * @param int|null $user_id If supplied, only persons owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. (optional) * @param int|null $filter_id The ID of the filter to use (optional) - * @param string|null $first_char If supplied, only persons whose name starts with the specified letter will be returned (case insensitive) (optional) + * @param string|null $first_char If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) (optional) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) @@ -5193,7 +5193,7 @@ public function getPersons($user_id = null, $filter_id = null, $first_char = nul * * @param int|null $user_id If supplied, only persons owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. (optional) * @param int|null $filter_id The ID of the filter to use (optional) - * @param string|null $first_char If supplied, only persons whose name starts with the specified letter will be returned (case insensitive) (optional) + * @param string|null $first_char If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) (optional) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) @@ -5299,7 +5299,7 @@ public function getPersonsWithHttpInfo($user_id = null, $filter_id = null, $firs * * @param int|null $user_id If supplied, only persons owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. (optional) * @param int|null $filter_id The ID of the filter to use (optional) - * @param string|null $first_char If supplied, only persons whose name starts with the specified letter will be returned (case insensitive) (optional) + * @param string|null $first_char If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) (optional) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) @@ -5324,7 +5324,7 @@ function ($response) { * * @param int|null $user_id If supplied, only persons owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. (optional) * @param int|null $filter_id The ID of the filter to use (optional) - * @param string|null $first_char If supplied, only persons whose name starts with the specified letter will be returned (case insensitive) (optional) + * @param string|null $first_char If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) (optional) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) @@ -5376,7 +5376,7 @@ function ($exception) { * * @param int|null $user_id If supplied, only persons owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied. (optional) * @param int|null $filter_id The ID of the filter to use (optional) - * @param string|null $first_char If supplied, only persons whose name starts with the specified letter will be returned (case insensitive) (optional) + * @param string|null $first_char If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) (optional) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) * @param string|null $sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). (optional) @@ -5446,6 +5446,381 @@ public function getPersonsRequest($user_id = null, $filter_id = null, $first_cha + /* @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('api_token'); + if ($apiKey !== null) { + $queryParams['api_token'] = $apiKey; + } + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + // If access token is expired + if ($this->config->isRefreshPossible() && $this->config->getExpiresAt() <= time()) { + $this->config->refreshToken(); + } + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $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 getPersonsCollection + * + * Get all persons (BETA) + * + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) + * @param int|null $limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. (optional) + * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) + * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) + * @param int|null $owner_id If supplied, only persons owned by the given user will be returned (optional) + * @param string|null $first_char If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return \Pipedrive\Model\InlineResponse2002|\Pipedrive\Model\FailResponse + */ + public function getPersonsCollection($cursor = null, $limit = null, $since = null, $until = null, $owner_id = null, $first_char = null) + { + list($response) = $this->getPersonsCollectionWithHttpInfo($cursor, $limit, $since, $until, $owner_id, $first_char); + return $response; + } + + /** + * Operation getPersonsCollectionWithHttpInfo + * + * Get all persons (BETA) + * + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) + * @param int|null $limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. (optional) + * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) + * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) + * @param int|null $owner_id If supplied, only persons owned by the given user will be returned (optional) + * @param string|null $first_char If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) (optional) + * + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException|GuzzleException + * @return array of \Pipedrive\Model\InlineResponse2002|\Pipedrive\Model\FailResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getPersonsCollectionWithHttpInfo($cursor = null, $limit = null, $since = null, $until = null, $owner_id = null, $first_char = null) + { + $request = $this->getPersonsCollectionRequest($cursor, $limit, $since, $until, $owner_id, $first_char); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + if ($e->getCode() === 401 && $this->config->isRefreshPossible()) { + $this->config->refreshToken(); + $request = $this->getPersonsCollectionRequest($cursor, $limit, $since, $until, $owner_id, $first_char); + $response = $this->client->send($request, $options); + } else { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + /* @phpstan-ignore-next-line */ + if ('\Pipedrive\Model\InlineResponse2002' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\Model\InlineResponse2002', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + /* @phpstan-ignore-next-line */ + if ('\Pipedrive\Model\FailResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\Model\FailResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + /* @phpstan-ignore-next-line */ + if ('\Pipedrive\Model\InlineResponse2002' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Pipedrive\Model\InlineResponse2002', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\Model\InlineResponse2002', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Pipedrive\Model\FailResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getPersonsCollectionAsync + * + * Get all persons (BETA) + * + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) + * @param int|null $limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. (optional) + * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) + * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) + * @param int|null $owner_id If supplied, only persons owned by the given user will be returned (optional) + * @param string|null $first_char If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getPersonsCollectionAsync($cursor = null, $limit = null, $since = null, $until = null, $owner_id = null, $first_char = null): PromiseInterface + { + return $this->getPersonsCollectionAsyncWithHttpInfo($cursor, $limit, $since, $until, $owner_id, $first_char) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getPersonsCollectionAsyncWithHttpInfo + * + * Get all persons (BETA) + * + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) + * @param int|null $limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. (optional) + * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) + * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) + * @param int|null $owner_id If supplied, only persons owned by the given user will be returned (optional) + * @param string|null $first_char If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return PromiseInterface + */ + public function getPersonsCollectionAsyncWithHttpInfo($cursor = null, $limit = null, $since = null, $until = null, $owner_id = null, $first_char = null): PromiseInterface + { + $returnType = '\Pipedrive\Model\InlineResponse2002'; + $request = $this->getPersonsCollectionRequest($cursor, $limit, $since, $until, $owner_id, $first_char); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + /* @phpstan-ignore-next-line */ + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getPersonsCollection' + * + * @param string|null $cursor For pagination, the marker (an opaque string value) representing the first item on the next page (optional) + * @param int|null $limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. (optional) + * @param string|null $since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) + * @param string|null $until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field. (optional) + * @param int|null $owner_id If supplied, only persons owned by the given user will be returned (optional) + * @param string|null $first_char If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive) (optional) + * + * @throws InvalidArgumentException|OAuthProviderException + * @return Request + */ + public function getPersonsCollectionRequest($cursor = null, $limit = null, $since = null, $until = null, $owner_id = null, $first_char = null): Request + { + + $resourcePath = '/persons/collection'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + /* @phpstan-ignore-next-line */ + if (is_array($cursor)) { + $cursor = ObjectSerializer::serializeCollection($cursor, '', true); + } + if ($cursor !== null) { + $queryParams['cursor'] = $cursor; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($limit)) { + $limit = ObjectSerializer::serializeCollection($limit, '', true); + } + if ($limit !== null) { + $queryParams['limit'] = $limit; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($since)) { + $since = ObjectSerializer::serializeCollection($since, '', true); + } + if ($since !== null) { + $queryParams['since'] = $since; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($until)) { + $until = ObjectSerializer::serializeCollection($until, '', true); + } + if ($until !== null) { + $queryParams['until'] = $until; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($owner_id)) { + $owner_id = ObjectSerializer::serializeCollection($owner_id, '', true); + } + if ($owner_id !== null) { + $queryParams['owner_id'] = $owner_id; + } + // query params + /* @phpstan-ignore-next-line */ + if (is_array($first_char)) { + $first_char = ObjectSerializer::serializeCollection($first_char, '', true); + } + if ($first_char !== null) { + $queryParams['first_char'] = $first_char; + } + + + + /* @phpstan-ignore-next-line */ if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( diff --git a/lib/Api/ProductsApi.php b/lib/Api/ProductsApi.php index 1a75e060..b4409ccf 100644 --- a/lib/Api/ProductsApi.php +++ b/lib/Api/ProductsApi.php @@ -2920,7 +2920,7 @@ public function getProductUsersRequest($id): Request * @param int|null $user_id If supplied, only products owned by the given user will be returned (optional) * @param int|null $filter_id The ID of the filter to use (optional) * @param int[]|null $ids An array of integers with the IDs of the products that should be returned in the response (optional) - * @param string|null $first_char If supplied, only products whose name starts with the specified letter will be returned (case insensitive) (optional) + * @param string|null $first_char If supplied, only products whose name starts with the specified letter will be returned (case-insensitive) (optional) * @param bool|null $get_summary If supplied, the response will return the total numbers of products in the `additional_data.summary.total_count` property (optional) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) @@ -2943,7 +2943,7 @@ public function getProducts($user_id = null, $filter_id = null, $ids = null, $fi * @param int|null $user_id If supplied, only products owned by the given user will be returned (optional) * @param int|null $filter_id The ID of the filter to use (optional) * @param int[]|null $ids An array of integers with the IDs of the products that should be returned in the response (optional) - * @param string|null $first_char If supplied, only products whose name starts with the specified letter will be returned (case insensitive) (optional) + * @param string|null $first_char If supplied, only products whose name starts with the specified letter will be returned (case-insensitive) (optional) * @param bool|null $get_summary If supplied, the response will return the total numbers of products in the `additional_data.summary.total_count` property (optional) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) @@ -3050,7 +3050,7 @@ public function getProductsWithHttpInfo($user_id = null, $filter_id = null, $ids * @param int|null $user_id If supplied, only products owned by the given user will be returned (optional) * @param int|null $filter_id The ID of the filter to use (optional) * @param int[]|null $ids An array of integers with the IDs of the products that should be returned in the response (optional) - * @param string|null $first_char If supplied, only products whose name starts with the specified letter will be returned (case insensitive) (optional) + * @param string|null $first_char If supplied, only products whose name starts with the specified letter will be returned (case-insensitive) (optional) * @param bool|null $get_summary If supplied, the response will return the total numbers of products in the `additional_data.summary.total_count` property (optional) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) @@ -3076,7 +3076,7 @@ function ($response) { * @param int|null $user_id If supplied, only products owned by the given user will be returned (optional) * @param int|null $filter_id The ID of the filter to use (optional) * @param int[]|null $ids An array of integers with the IDs of the products that should be returned in the response (optional) - * @param string|null $first_char If supplied, only products whose name starts with the specified letter will be returned (case insensitive) (optional) + * @param string|null $first_char If supplied, only products whose name starts with the specified letter will be returned (case-insensitive) (optional) * @param bool|null $get_summary If supplied, the response will return the total numbers of products in the `additional_data.summary.total_count` property (optional) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) @@ -3129,7 +3129,7 @@ function ($exception) { * @param int|null $user_id If supplied, only products owned by the given user will be returned (optional) * @param int|null $filter_id The ID of the filter to use (optional) * @param int[]|null $ids An array of integers with the IDs of the products that should be returned in the response (optional) - * @param string|null $first_char If supplied, only products whose name starts with the specified letter will be returned (case insensitive) (optional) + * @param string|null $first_char If supplied, only products whose name starts with the specified letter will be returned (case-insensitive) (optional) * @param bool|null $get_summary If supplied, the response will return the total numbers of products in the `additional_data.summary.total_count` property (optional) * @param int|0 $start Pagination start (optional, default to 0) * @param int|null $limit Items shown per page (optional) diff --git a/lib/Model/AddProductAttachmentDetails.php b/lib/Model/AddProductAttachmentDetails.php index 2421d8fe..81256467 100644 --- a/lib/Model/AddProductAttachmentDetails.php +++ b/lib/Model/AddProductAttachmentDetails.php @@ -66,12 +66,14 @@ class AddProductAttachmentDetails implements ModelInterface, ArrayAccess, JsonSe 'product_id' => 'int', 'item_price' => 'float', 'quantity' => 'int', - 'discount_percentage' => 'float', + 'discount' => 'float', + 'discount_type' => 'string', 'duration' => 'float', 'duration_unit' => 'string', 'product_variation_id' => 'int', 'comments' => 'string', 'tax' => 'float', + 'tax_method' => 'string', 'enabled_flag' => 'bool', 'id' => 'int', 'company_id' => 'int', @@ -97,12 +99,14 @@ class AddProductAttachmentDetails implements ModelInterface, ArrayAccess, JsonSe 'product_id' => null, 'item_price' => null, 'quantity' => null, - 'discount_percentage' => null, + 'discount' => null, + 'discount_type' => null, 'duration' => null, 'duration_unit' => null, 'product_variation_id' => null, 'comments' => null, 'tax' => null, + 'tax_method' => null, 'enabled_flag' => null, 'id' => null, 'company_id' => null, @@ -151,12 +155,14 @@ public static function openAPIFormats(): array 'product_id' => 'product_id', 'item_price' => 'item_price', 'quantity' => 'quantity', - 'discount_percentage' => 'discount_percentage', + 'discount' => 'discount', + 'discount_type' => 'discount_type', 'duration' => 'duration', 'duration_unit' => 'duration_unit', 'product_variation_id' => 'product_variation_id', 'comments' => 'comments', 'tax' => 'tax', + 'tax_method' => 'tax_method', 'enabled_flag' => 'enabled_flag', 'id' => 'id', 'company_id' => 'company_id', @@ -180,12 +186,14 @@ public static function openAPIFormats(): array 'product_id' => 'setProductId', 'item_price' => 'setItemPrice', 'quantity' => 'setQuantity', - 'discount_percentage' => 'setDiscountPercentage', + 'discount' => 'setDiscount', + 'discount_type' => 'setDiscountType', 'duration' => 'setDuration', 'duration_unit' => 'setDurationUnit', 'product_variation_id' => 'setProductVariationId', 'comments' => 'setComments', 'tax' => 'setTax', + 'tax_method' => 'setTaxMethod', 'enabled_flag' => 'setEnabledFlag', 'id' => 'setId', 'company_id' => 'setCompanyId', @@ -209,12 +217,14 @@ public static function openAPIFormats(): array 'product_id' => 'getProductId', 'item_price' => 'getItemPrice', 'quantity' => 'getQuantity', - 'discount_percentage' => 'getDiscountPercentage', + 'discount' => 'getDiscount', + 'discount_type' => 'getDiscountType', 'duration' => 'getDuration', 'duration_unit' => 'getDurationUnit', 'product_variation_id' => 'getProductVariationId', 'comments' => 'getComments', 'tax' => 'getTax', + 'tax_method' => 'getTaxMethod', 'enabled_flag' => 'getEnabledFlag', 'id' => 'getId', 'company_id' => 'getCompanyId', @@ -276,6 +286,42 @@ public function getModelName(): string return self::$openAPIModelName; } + const DISCOUNT_TYPE_PERCENTAGE = 'percentage'; + const DISCOUNT_TYPE_AMOUNT = 'amount'; + const TAX_METHOD_EXCLUSIVE = 'exclusive'; + const TAX_METHOD_INCLUSIVE = 'inclusive'; + const TAX_METHOD_NONE = 'none'; + + /** + * Gets allowable values of the enum + * + * @phpstan-return array + * @phpsalm-return array + * @return (string|int)[] + */ + public function getDiscountTypeAllowableValues(): array + { + return [ + self::DISCOUNT_TYPE_PERCENTAGE, + self::DISCOUNT_TYPE_AMOUNT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @phpstan-return array + * @phpsalm-return array + * @return (string|int)[] + */ + public function getTaxMethodAllowableValues(): array + { + return [ + self::TAX_METHOD_EXCLUSIVE, + self::TAX_METHOD_INCLUSIVE, + self::TAX_METHOD_NONE, + ]; + } /** * Associative array for storing property values @@ -299,12 +345,14 @@ public function __construct(array $data = null) $this->container['product_id'] = $data['product_id'] ?? null; $this->container['item_price'] = $data['item_price'] ?? null; $this->container['quantity'] = $data['quantity'] ?? null; - $this->container['discount_percentage'] = $data['discount_percentage'] ?? 0; + $this->container['discount'] = $data['discount'] ?? 0; + $this->container['discount_type'] = $data['discount_type'] ?? 'percentage'; $this->container['duration'] = $data['duration'] ?? 1; $this->container['duration_unit'] = $data['duration_unit'] ?? null; $this->container['product_variation_id'] = $data['product_variation_id'] ?? null; $this->container['comments'] = $data['comments'] ?? null; $this->container['tax'] = $data['tax'] ?? null; + $this->container['tax_method'] = $data['tax_method'] ?? null; $this->container['enabled_flag'] = $data['enabled_flag'] ?? true; $this->container['id'] = $data['id'] ?? null; $this->container['company_id'] = $data['company_id'] ?? null; @@ -339,6 +387,24 @@ public function listInvalidProperties(): array if ($this->container['quantity'] === null) { $invalidProperties[] = "'quantity' can't be null"; } + $allowedValues = $this->getDiscountTypeAllowableValues(); + if (!is_null($this->container['discount_type']) && !in_array($this->container['discount_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'discount_type', must be one of '%s'", + $this->container['discount_type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getTaxMethodAllowableValues(); + if (!is_null($this->container['tax_method']) && !in_array($this->container['tax_method'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'tax_method', must be one of '%s'", + $this->container['tax_method'], + implode("', '", $allowedValues) + ); + } + return $invalidProperties; } @@ -427,25 +493,59 @@ public function setQuantity($quantity): self } /** - * Gets discount_percentage + * Gets discount * * @return float|null */ - public function getDiscountPercentage() + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param float|null $discount The value of the discount. The `discount_type` field can be used to specify whether the value is an amount or a percentage. + * + * @return self + */ + public function setDiscount($discount): self + { + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets discount_type + * + * @return string|null + */ + public function getDiscountType() { - return $this->container['discount_percentage']; + return $this->container['discount_type']; } /** - * Sets discount_percentage + * Sets discount_type * - * @param float|null $discount_percentage The discount %. If omitted, will be set to 0. + * @param string|null $discount_type The type of the discount's value. * * @return self */ - public function setDiscountPercentage($discount_percentage): self + public function setDiscountType($discount_type): self { - $this->container['discount_percentage'] = $discount_percentage; + $allowedValues = $this->getDiscountTypeAllowableValues(); + if (!is_null($discount_type) && !in_array($discount_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'discount_type', must be one of '%s'", + $discount_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['discount_type'] = $discount_type; return $this; } @@ -570,6 +670,40 @@ public function setTax($tax): self return $this; } + /** + * Gets tax_method + * + * @return string|null + */ + public function getTaxMethod() + { + return $this->container['tax_method']; + } + + /** + * Sets tax_method + * + * @param string|null $tax_method The tax option to be applied to the products. When using `inclusive`, the tax percentage will already be included in the price. When using `exclusive`, the tax will not be included in the price. When using `none`, no tax will be added. Use the `tax` field for defining the tax percentage amount. By default, the user setting value for tax options will be used. Changing this in one product affects the rest of the products attached to the deal. + * + * @return self + */ + public function setTaxMethod($tax_method): self + { + $allowedValues = $this->getTaxMethodAllowableValues(); + if (!is_null($tax_method) && !in_array($tax_method, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'tax_method', must be one of '%s'", + $tax_method, + implode("', '", $allowedValues) + ) + ); + } + $this->container['tax_method'] = $tax_method; + + return $this; + } + /** * Gets enabled_flag * diff --git a/lib/Model/BaseOrganizationItem.php b/lib/Model/BaseOrganizationItem.php index 234fe2db..74b0b8c8 100644 --- a/lib/Model/BaseOrganizationItem.php +++ b/lib/Model/BaseOrganizationItem.php @@ -772,7 +772,7 @@ public function getLabel() /** * Sets label * - * @param int|null $label The ID of the label + * @param int|null $label The label assigned to the organization * * @return self */ @@ -820,7 +820,7 @@ public function getCcEmail() /** * Sets cc_email * - * @param string|null $cc_email The BCC email of the organization + * @param string|null $cc_email The BCC email associated with the organization * * @return self */ diff --git a/lib/Model/BaseOrganizationItemFields.php b/lib/Model/BaseOrganizationItemFields.php index c8abf391..6fbdf427 100644 --- a/lib/Model/BaseOrganizationItemFields.php +++ b/lib/Model/BaseOrganizationItemFields.php @@ -580,7 +580,7 @@ public function getLabel() /** * Sets label * - * @param int|null $label The ID of the label + * @param int|null $label The label assigned to the organization * * @return self */ @@ -628,7 +628,7 @@ public function getCcEmail() /** * Sets cc_email * - * @param string|null $cc_email The BCC email of the organization + * @param string|null $cc_email The BCC email associated with the organization * * @return self */ diff --git a/lib/Model/BaseOrganizationItemWithEditNameFlag.php b/lib/Model/BaseOrganizationItemWithEditNameFlag.php index 1655f6a3..989633e5 100644 --- a/lib/Model/BaseOrganizationItemWithEditNameFlag.php +++ b/lib/Model/BaseOrganizationItemWithEditNameFlag.php @@ -778,7 +778,7 @@ public function getLabel() /** * Sets label * - * @param int|null $label The ID of the label + * @param int|null $label The label assigned to the organization * * @return self */ @@ -826,7 +826,7 @@ public function getCcEmail() /** * Sets cc_email * - * @param string|null $cc_email The BCC email of the organization + * @param string|null $cc_email The BCC email associated with the organization * * @return self */ diff --git a/lib/Model/BasicDealProduct.php b/lib/Model/BasicDealProduct.php index b6f47e9c..83c922ad 100644 --- a/lib/Model/BasicDealProduct.php +++ b/lib/Model/BasicDealProduct.php @@ -66,12 +66,14 @@ class BasicDealProduct implements ModelInterface, ArrayAccess, JsonSerializable 'product_id' => 'int', 'item_price' => 'float', 'quantity' => 'int', - 'discount_percentage' => 'float', + 'discount' => 'float', + 'discount_type' => 'string', 'duration' => 'float', 'duration_unit' => 'DealProductUnitDuration', 'product_variation_id' => 'int', 'comments' => 'string', 'tax' => 'float', + 'tax_method' => 'string', 'enabled_flag' => 'bool' ]; @@ -86,12 +88,14 @@ class BasicDealProduct implements ModelInterface, ArrayAccess, JsonSerializable 'product_id' => null, 'item_price' => null, 'quantity' => null, - 'discount_percentage' => null, + 'discount' => null, + 'discount_type' => null, 'duration' => null, 'duration_unit' => null, 'product_variation_id' => null, 'comments' => null, 'tax' => null, + 'tax_method' => null, 'enabled_flag' => null ]; @@ -129,12 +133,14 @@ public static function openAPIFormats(): array 'product_id' => 'product_id', 'item_price' => 'item_price', 'quantity' => 'quantity', - 'discount_percentage' => 'discount_percentage', + 'discount' => 'discount', + 'discount_type' => 'discount_type', 'duration' => 'duration', 'duration_unit' => 'duration_unit', 'product_variation_id' => 'product_variation_id', 'comments' => 'comments', 'tax' => 'tax', + 'tax_method' => 'tax_method', 'enabled_flag' => 'enabled_flag' ]; @@ -147,12 +153,14 @@ public static function openAPIFormats(): array 'product_id' => 'setProductId', 'item_price' => 'setItemPrice', 'quantity' => 'setQuantity', - 'discount_percentage' => 'setDiscountPercentage', + 'discount' => 'setDiscount', + 'discount_type' => 'setDiscountType', 'duration' => 'setDuration', 'duration_unit' => 'setDurationUnit', 'product_variation_id' => 'setProductVariationId', 'comments' => 'setComments', 'tax' => 'setTax', + 'tax_method' => 'setTaxMethod', 'enabled_flag' => 'setEnabledFlag' ]; @@ -165,12 +173,14 @@ public static function openAPIFormats(): array 'product_id' => 'getProductId', 'item_price' => 'getItemPrice', 'quantity' => 'getQuantity', - 'discount_percentage' => 'getDiscountPercentage', + 'discount' => 'getDiscount', + 'discount_type' => 'getDiscountType', 'duration' => 'getDuration', 'duration_unit' => 'getDurationUnit', 'product_variation_id' => 'getProductVariationId', 'comments' => 'getComments', 'tax' => 'getTax', + 'tax_method' => 'getTaxMethod', 'enabled_flag' => 'getEnabledFlag' ]; @@ -221,6 +231,42 @@ public function getModelName(): string return self::$openAPIModelName; } + const DISCOUNT_TYPE_PERCENTAGE = 'percentage'; + const DISCOUNT_TYPE_AMOUNT = 'amount'; + const TAX_METHOD_EXCLUSIVE = 'exclusive'; + const TAX_METHOD_INCLUSIVE = 'inclusive'; + const TAX_METHOD_NONE = 'none'; + + /** + * Gets allowable values of the enum + * + * @phpstan-return array + * @phpsalm-return array + * @return (string|int)[] + */ + public function getDiscountTypeAllowableValues(): array + { + return [ + self::DISCOUNT_TYPE_PERCENTAGE, + self::DISCOUNT_TYPE_AMOUNT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @phpstan-return array + * @phpsalm-return array + * @return (string|int)[] + */ + public function getTaxMethodAllowableValues(): array + { + return [ + self::TAX_METHOD_EXCLUSIVE, + self::TAX_METHOD_INCLUSIVE, + self::TAX_METHOD_NONE, + ]; + } /** * Associative array for storing property values @@ -244,12 +290,14 @@ public function __construct(array $data = null) $this->container['product_id'] = $data['product_id'] ?? null; $this->container['item_price'] = $data['item_price'] ?? null; $this->container['quantity'] = $data['quantity'] ?? null; - $this->container['discount_percentage'] = $data['discount_percentage'] ?? 0; + $this->container['discount'] = $data['discount'] ?? 0; + $this->container['discount_type'] = $data['discount_type'] ?? 'percentage'; $this->container['duration'] = $data['duration'] ?? 1; $this->container['duration_unit'] = $data['duration_unit'] ?? null; $this->container['product_variation_id'] = $data['product_variation_id'] ?? null; $this->container['comments'] = $data['comments'] ?? null; $this->container['tax'] = $data['tax'] ?? 0; + $this->container['tax_method'] = $data['tax_method'] ?? null; $this->container['enabled_flag'] = $data['enabled_flag'] ?? true; } @@ -273,6 +321,24 @@ public function listInvalidProperties(): array if ($this->container['quantity'] === null) { $invalidProperties[] = "'quantity' can't be null"; } + $allowedValues = $this->getDiscountTypeAllowableValues(); + if (!is_null($this->container['discount_type']) && !in_array($this->container['discount_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'discount_type', must be one of '%s'", + $this->container['discount_type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getTaxMethodAllowableValues(); + if (!is_null($this->container['tax_method']) && !in_array($this->container['tax_method'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'tax_method', must be one of '%s'", + $this->container['tax_method'], + implode("', '", $allowedValues) + ); + } + return $invalidProperties; } @@ -361,25 +427,59 @@ public function setQuantity($quantity): self } /** - * Gets discount_percentage + * Gets discount * * @return float|null */ - public function getDiscountPercentage() + public function getDiscount() { - return $this->container['discount_percentage']; + return $this->container['discount']; } /** - * Sets discount_percentage + * Sets discount * - * @param float|null $discount_percentage The discount %. If omitted, will be set to 0. + * @param float|null $discount The value of the discount. The `discount_type` field can be used to specify whether the value is an amount or a percentage. * * @return self */ - public function setDiscountPercentage($discount_percentage): self + public function setDiscount($discount): self + { + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets discount_type + * + * @return string|null + */ + public function getDiscountType() { - $this->container['discount_percentage'] = $discount_percentage; + return $this->container['discount_type']; + } + + /** + * Sets discount_type + * + * @param string|null $discount_type The type of the discount's value. + * + * @return self + */ + public function setDiscountType($discount_type): self + { + $allowedValues = $this->getDiscountTypeAllowableValues(); + if (!is_null($discount_type) && !in_array($discount_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'discount_type', must be one of '%s'", + $discount_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['discount_type'] = $discount_type; return $this; } @@ -504,6 +604,40 @@ public function setTax($tax): self return $this; } + /** + * Gets tax_method + * + * @return string|null + */ + public function getTaxMethod() + { + return $this->container['tax_method']; + } + + /** + * Sets tax_method + * + * @param string|null $tax_method The tax option to be applied to the products. When using `inclusive`, the tax percentage will already be included in the price. When using `exclusive`, the tax will not be included in the price. When using `none`, no tax will be added. Use the `tax` field for defining the tax percentage amount. By default, the user setting value for tax options will be used. Changing this in one product affects the rest of the products attached to the deal. + * + * @return self + */ + public function setTaxMethod($tax_method): self + { + $allowedValues = $this->getTaxMethodAllowableValues(); + if (!is_null($tax_method) && !in_array($tax_method, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'tax_method', must be one of '%s'", + $tax_method, + implode("', '", $allowedValues) + ) + ); + } + $this->container['tax_method'] = $tax_method; + + return $this; + } + /** * Gets enabled_flag * diff --git a/lib/Model/InlineResponse2001.php b/lib/Model/InlineResponse2001.php new file mode 100644 index 00000000..c7545e7a --- /dev/null +++ b/lib/Model/InlineResponse2001.php @@ -0,0 +1,402 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class InlineResponse2001 implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'inline_response_200_1'; + + /** + * 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\Model\OrganizationsCollectionResponseObject[]', + 'additional_data' => '\Pipedrive\Model\AdditionalDataWithCursorPagination' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success' => null, + 'data' => null, + 'additional_data' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'success' => 'success', + 'data' => 'data', + 'additional_data' => 'additional_data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'data' => 'setData', + 'additional_data' => 'setAdditionalData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'data' => 'getData', + 'additional_data' => 'getAdditionalData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + * @phpstan-var array + * @psalm-var array + */ + protected array $container = []; + + /** + * Constructor + * + * @phpstan-param array|null $data + * @psalm-param array|null $data + * @param array|null $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['success'] = $data['success'] ?? null; + $this->container['data'] = $data['data'] ?? null; + $this->container['additional_data'] = $data['additional_data'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + * @phpstan-return array + * @psalm-return array + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets success + * + * @return bool|null + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool|null $success success + * + * @return self + */ + public function setSuccess($success): self + { + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets data + * + * @return \Pipedrive\Model\OrganizationsCollectionResponseObject[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\Model\OrganizationsCollectionResponseObject[]|null $data data + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets additional_data + * + * @return \Pipedrive\Model\AdditionalDataWithCursorPagination|null + */ + public function getAdditionalData() + { + return $this->container['additional_data']; + } + + /** + * Sets additional_data + * + * @param \Pipedrive\Model\AdditionalDataWithCursorPagination|null $additional_data additional_data + * + * @return self + */ + public function setAdditionalData($additional_data): self + { + $this->container['additional_data'] = $additional_data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @throws JsonException + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @throws JsonException + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this), JSON_THROW_ON_ERROR); + } +} + + diff --git a/lib/Model/InlineResponse2002.php b/lib/Model/InlineResponse2002.php new file mode 100644 index 00000000..ff0f0abc --- /dev/null +++ b/lib/Model/InlineResponse2002.php @@ -0,0 +1,402 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class InlineResponse2002 implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'inline_response_200_2'; + + /** + * 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\Model\PersonsCollectionResponseObject[]', + 'additional_data' => '\Pipedrive\Model\AdditionalDataWithCursorPagination' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'success' => null, + 'data' => null, + 'additional_data' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'success' => 'success', + 'data' => 'data', + 'additional_data' => 'additional_data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'success' => 'setSuccess', + 'data' => 'setData', + 'additional_data' => 'setAdditionalData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'success' => 'getSuccess', + 'data' => 'getData', + 'additional_data' => 'getAdditionalData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @phpstan-return array + * @psalm-return array + * @return array + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + * @phpstan-var array + * @psalm-var array + */ + protected array $container = []; + + /** + * Constructor + * + * @phpstan-param array|null $data + * @psalm-param array|null $data + * @param array|null $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['success'] = $data['success'] ?? null; + $this->container['data'] = $data['data'] ?? null; + $this->container['additional_data'] = $data['additional_data'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + * @phpstan-return array + * @psalm-return array + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets success + * + * @return bool|null + */ + public function getSuccess() + { + return $this->container['success']; + } + + /** + * Sets success + * + * @param bool|null $success success + * + * @return self + */ + public function setSuccess($success): self + { + $this->container['success'] = $success; + + return $this; + } + + /** + * Gets data + * + * @return \Pipedrive\Model\PersonsCollectionResponseObject[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Pipedrive\Model\PersonsCollectionResponseObject[]|null $data data + * + * @return self + */ + public function setData($data): self + { + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets additional_data + * + * @return \Pipedrive\Model\AdditionalDataWithCursorPagination|null + */ + public function getAdditionalData() + { + return $this->container['additional_data']; + } + + /** + * Sets additional_data + * + * @param \Pipedrive\Model\AdditionalDataWithCursorPagination|null $additional_data additional_data + * + * @return self + */ + public function setAdditionalData($additional_data): self + { + $this->container['additional_data'] = $additional_data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @throws JsonException + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @throws JsonException + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this), JSON_THROW_ON_ERROR); + } +} + + diff --git a/lib/Model/NewDealProduct.php b/lib/Model/NewDealProduct.php index 0e61dbb6..80b1089a 100644 --- a/lib/Model/NewDealProduct.php +++ b/lib/Model/NewDealProduct.php @@ -66,12 +66,14 @@ class NewDealProduct implements ModelInterface, ArrayAccess, JsonSerializable 'product_id' => 'int', 'item_price' => 'float', 'quantity' => 'int', - 'discount_percentage' => 'float', + 'discount' => 'float', + 'discount_type' => 'string', 'duration' => 'float', 'duration_unit' => 'DealProductUnitDuration', 'product_variation_id' => 'int', 'comments' => 'string', 'tax' => 'float', + 'tax_method' => 'string', 'enabled_flag' => 'bool' ]; @@ -86,12 +88,14 @@ class NewDealProduct implements ModelInterface, ArrayAccess, JsonSerializable 'product_id' => null, 'item_price' => null, 'quantity' => null, - 'discount_percentage' => null, + 'discount' => null, + 'discount_type' => null, 'duration' => null, 'duration_unit' => null, 'product_variation_id' => null, 'comments' => null, 'tax' => null, + 'tax_method' => null, 'enabled_flag' => null ]; @@ -129,12 +133,14 @@ public static function openAPIFormats(): array 'product_id' => 'product_id', 'item_price' => 'item_price', 'quantity' => 'quantity', - 'discount_percentage' => 'discount_percentage', + 'discount' => 'discount', + 'discount_type' => 'discount_type', 'duration' => 'duration', 'duration_unit' => 'duration_unit', 'product_variation_id' => 'product_variation_id', 'comments' => 'comments', 'tax' => 'tax', + 'tax_method' => 'tax_method', 'enabled_flag' => 'enabled_flag' ]; @@ -147,12 +153,14 @@ public static function openAPIFormats(): array 'product_id' => 'setProductId', 'item_price' => 'setItemPrice', 'quantity' => 'setQuantity', - 'discount_percentage' => 'setDiscountPercentage', + 'discount' => 'setDiscount', + 'discount_type' => 'setDiscountType', 'duration' => 'setDuration', 'duration_unit' => 'setDurationUnit', 'product_variation_id' => 'setProductVariationId', 'comments' => 'setComments', 'tax' => 'setTax', + 'tax_method' => 'setTaxMethod', 'enabled_flag' => 'setEnabledFlag' ]; @@ -165,12 +173,14 @@ public static function openAPIFormats(): array 'product_id' => 'getProductId', 'item_price' => 'getItemPrice', 'quantity' => 'getQuantity', - 'discount_percentage' => 'getDiscountPercentage', + 'discount' => 'getDiscount', + 'discount_type' => 'getDiscountType', 'duration' => 'getDuration', 'duration_unit' => 'getDurationUnit', 'product_variation_id' => 'getProductVariationId', 'comments' => 'getComments', 'tax' => 'getTax', + 'tax_method' => 'getTaxMethod', 'enabled_flag' => 'getEnabledFlag' ]; @@ -221,6 +231,42 @@ public function getModelName(): string return self::$openAPIModelName; } + const DISCOUNT_TYPE_PERCENTAGE = 'percentage'; + const DISCOUNT_TYPE_AMOUNT = 'amount'; + const TAX_METHOD_EXCLUSIVE = 'exclusive'; + const TAX_METHOD_INCLUSIVE = 'inclusive'; + const TAX_METHOD_NONE = 'none'; + + /** + * Gets allowable values of the enum + * + * @phpstan-return array + * @phpsalm-return array + * @return (string|int)[] + */ + public function getDiscountTypeAllowableValues(): array + { + return [ + self::DISCOUNT_TYPE_PERCENTAGE, + self::DISCOUNT_TYPE_AMOUNT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @phpstan-return array + * @phpsalm-return array + * @return (string|int)[] + */ + public function getTaxMethodAllowableValues(): array + { + return [ + self::TAX_METHOD_EXCLUSIVE, + self::TAX_METHOD_INCLUSIVE, + self::TAX_METHOD_NONE, + ]; + } /** * Associative array for storing property values @@ -244,12 +290,14 @@ public function __construct(array $data = null) $this->container['product_id'] = $data['product_id'] ?? null; $this->container['item_price'] = $data['item_price'] ?? null; $this->container['quantity'] = $data['quantity'] ?? null; - $this->container['discount_percentage'] = $data['discount_percentage'] ?? 0; + $this->container['discount'] = $data['discount'] ?? 0; + $this->container['discount_type'] = $data['discount_type'] ?? 'percentage'; $this->container['duration'] = $data['duration'] ?? 1; $this->container['duration_unit'] = $data['duration_unit'] ?? null; $this->container['product_variation_id'] = $data['product_variation_id'] ?? null; $this->container['comments'] = $data['comments'] ?? null; $this->container['tax'] = $data['tax'] ?? 0; + $this->container['tax_method'] = $data['tax_method'] ?? null; $this->container['enabled_flag'] = $data['enabled_flag'] ?? true; } @@ -273,6 +321,24 @@ public function listInvalidProperties(): array if ($this->container['quantity'] === null) { $invalidProperties[] = "'quantity' can't be null"; } + $allowedValues = $this->getDiscountTypeAllowableValues(); + if (!is_null($this->container['discount_type']) && !in_array($this->container['discount_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'discount_type', must be one of '%s'", + $this->container['discount_type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getTaxMethodAllowableValues(); + if (!is_null($this->container['tax_method']) && !in_array($this->container['tax_method'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'tax_method', must be one of '%s'", + $this->container['tax_method'], + implode("', '", $allowedValues) + ); + } + return $invalidProperties; } @@ -361,25 +427,59 @@ public function setQuantity($quantity): self } /** - * Gets discount_percentage + * Gets discount * * @return float|null */ - public function getDiscountPercentage() + public function getDiscount() { - return $this->container['discount_percentage']; + return $this->container['discount']; } /** - * Sets discount_percentage + * Sets discount * - * @param float|null $discount_percentage The discount %. If omitted, will be set to 0. + * @param float|null $discount The value of the discount. The `discount_type` field can be used to specify whether the value is an amount or a percentage. * * @return self */ - public function setDiscountPercentage($discount_percentage): self + public function setDiscount($discount): self + { + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets discount_type + * + * @return string|null + */ + public function getDiscountType() { - $this->container['discount_percentage'] = $discount_percentage; + return $this->container['discount_type']; + } + + /** + * Sets discount_type + * + * @param string|null $discount_type The type of the discount's value. + * + * @return self + */ + public function setDiscountType($discount_type): self + { + $allowedValues = $this->getDiscountTypeAllowableValues(); + if (!is_null($discount_type) && !in_array($discount_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'discount_type', must be one of '%s'", + $discount_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['discount_type'] = $discount_type; return $this; } @@ -504,6 +604,40 @@ public function setTax($tax): self return $this; } + /** + * Gets tax_method + * + * @return string|null + */ + public function getTaxMethod() + { + return $this->container['tax_method']; + } + + /** + * Sets tax_method + * + * @param string|null $tax_method The tax option to be applied to the products. When using `inclusive`, the tax percentage will already be included in the price. When using `exclusive`, the tax will not be included in the price. When using `none`, no tax will be added. Use the `tax` field for defining the tax percentage amount. By default, the user setting value for tax options will be used. Changing this in one product affects the rest of the products attached to the deal. + * + * @return self + */ + public function setTaxMethod($tax_method): self + { + $allowedValues = $this->getTaxMethodAllowableValues(); + if (!is_null($tax_method) && !in_array($tax_method, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'tax_method', must be one of '%s'", + $tax_method, + implode("', '", $allowedValues) + ) + ); + } + $this->container['tax_method'] = $tax_method; + + return $this; + } + /** * Gets enabled_flag * diff --git a/lib/Model/OrganizationItem.php b/lib/Model/OrganizationItem.php index 245291b5..a48c3c1e 100644 --- a/lib/Model/OrganizationItem.php +++ b/lib/Model/OrganizationItem.php @@ -790,7 +790,7 @@ public function getLabel() /** * Sets label * - * @param int|null $label The ID of the label + * @param int|null $label The label assigned to the organization * * @return self */ @@ -838,7 +838,7 @@ public function getCcEmail() /** * Sets cc_email * - * @param string|null $cc_email The BCC email of the organization + * @param string|null $cc_email The BCC email associated with the organization * * @return self */ diff --git a/lib/Model/OrganizationsCollectionResponseObject.php b/lib/Model/OrganizationsCollectionResponseObject.php new file mode 100644 index 00000000..29c6fbfc --- /dev/null +++ b/lib/Model/OrganizationsCollectionResponseObject.php @@ -0,0 +1,942 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class OrganizationsCollectionResponseObject implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'OrganizationsCollectionResponseObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'address' => 'string', + 'address_subpremise' => 'string', + 'address_street_number' => 'string', + 'address_route' => 'string', + 'address_sublocality' => 'string', + 'address_locality' => 'string', + 'address_admin_area_level_1' => 'string', + 'address_admin_area_level_2' => 'string', + 'address_country' => 'string', + 'address_postal_code' => 'string', + 'address_formatted_address' => 'string', + 'id' => 'int', + 'active_flag' => 'bool', + 'owner_id' => 'int', + 'name' => 'string', + 'update_time' => 'string', + 'delete_time' => 'string', + 'add_time' => 'string', + 'visible_to' => 'string', + 'label' => 'int', + 'cc_email' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'address' => null, + 'address_subpremise' => null, + 'address_street_number' => null, + 'address_route' => null, + 'address_sublocality' => null, + 'address_locality' => null, + 'address_admin_area_level_1' => null, + 'address_admin_area_level_2' => null, + 'address_country' => null, + 'address_postal_code' => null, + 'address_formatted_address' => null, + 'id' => null, + 'active_flag' => null, + 'owner_id' => null, + 'name' => null, + 'update_time' => null, + 'delete_time' => null, + 'add_time' => null, + 'visible_to' => null, + 'label' => null, + 'cc_email' => 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 = [ + 'address' => 'address', + 'address_subpremise' => 'address_subpremise', + 'address_street_number' => 'address_street_number', + 'address_route' => 'address_route', + 'address_sublocality' => 'address_sublocality', + 'address_locality' => 'address_locality', + 'address_admin_area_level_1' => 'address_admin_area_level_1', + 'address_admin_area_level_2' => 'address_admin_area_level_2', + 'address_country' => 'address_country', + 'address_postal_code' => 'address_postal_code', + 'address_formatted_address' => 'address_formatted_address', + 'id' => 'id', + 'active_flag' => 'active_flag', + 'owner_id' => 'owner_id', + 'name' => 'name', + 'update_time' => 'update_time', + 'delete_time' => 'delete_time', + 'add_time' => 'add_time', + 'visible_to' => 'visible_to', + 'label' => 'label', + 'cc_email' => 'cc_email' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'address' => 'setAddress', + 'address_subpremise' => 'setAddressSubpremise', + 'address_street_number' => 'setAddressStreetNumber', + 'address_route' => 'setAddressRoute', + 'address_sublocality' => 'setAddressSublocality', + 'address_locality' => 'setAddressLocality', + 'address_admin_area_level_1' => 'setAddressAdminAreaLevel1', + 'address_admin_area_level_2' => 'setAddressAdminAreaLevel2', + 'address_country' => 'setAddressCountry', + 'address_postal_code' => 'setAddressPostalCode', + 'address_formatted_address' => 'setAddressFormattedAddress', + 'id' => 'setId', + 'active_flag' => 'setActiveFlag', + 'owner_id' => 'setOwnerId', + 'name' => 'setName', + 'update_time' => 'setUpdateTime', + 'delete_time' => 'setDeleteTime', + 'add_time' => 'setAddTime', + 'visible_to' => 'setVisibleTo', + 'label' => 'setLabel', + 'cc_email' => 'setCcEmail' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'address' => 'getAddress', + 'address_subpremise' => 'getAddressSubpremise', + 'address_street_number' => 'getAddressStreetNumber', + 'address_route' => 'getAddressRoute', + 'address_sublocality' => 'getAddressSublocality', + 'address_locality' => 'getAddressLocality', + 'address_admin_area_level_1' => 'getAddressAdminAreaLevel1', + 'address_admin_area_level_2' => 'getAddressAdminAreaLevel2', + 'address_country' => 'getAddressCountry', + 'address_postal_code' => 'getAddressPostalCode', + 'address_formatted_address' => 'getAddressFormattedAddress', + 'id' => 'getId', + 'active_flag' => 'getActiveFlag', + 'owner_id' => 'getOwnerId', + 'name' => 'getName', + 'update_time' => 'getUpdateTime', + 'delete_time' => 'getDeleteTime', + 'add_time' => 'getAddTime', + 'visible_to' => 'getVisibleTo', + 'label' => 'getLabel', + 'cc_email' => 'getCcEmail' + ]; + + /** + * 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['address'] = $data['address'] ?? null; + $this->container['address_subpremise'] = $data['address_subpremise'] ?? null; + $this->container['address_street_number'] = $data['address_street_number'] ?? null; + $this->container['address_route'] = $data['address_route'] ?? null; + $this->container['address_sublocality'] = $data['address_sublocality'] ?? null; + $this->container['address_locality'] = $data['address_locality'] ?? null; + $this->container['address_admin_area_level_1'] = $data['address_admin_area_level_1'] ?? null; + $this->container['address_admin_area_level_2'] = $data['address_admin_area_level_2'] ?? null; + $this->container['address_country'] = $data['address_country'] ?? null; + $this->container['address_postal_code'] = $data['address_postal_code'] ?? null; + $this->container['address_formatted_address'] = $data['address_formatted_address'] ?? null; + $this->container['id'] = $data['id'] ?? null; + $this->container['active_flag'] = $data['active_flag'] ?? null; + $this->container['owner_id'] = $data['owner_id'] ?? null; + $this->container['name'] = $data['name'] ?? null; + $this->container['update_time'] = $data['update_time'] ?? null; + $this->container['delete_time'] = $data['delete_time'] ?? null; + $this->container['add_time'] = $data['add_time'] ?? null; + $this->container['visible_to'] = $data['visible_to'] ?? null; + $this->container['label'] = $data['label'] ?? null; + $this->container['cc_email'] = $data['cc_email'] ?? 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 address + * + * @return string|null + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param string|null $address The full address of the organization + * + * @return self + */ + public function setAddress($address): self + { + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets address_subpremise + * + * @return string|null + */ + public function getAddressSubpremise() + { + return $this->container['address_subpremise']; + } + + /** + * Sets address_subpremise + * + * @param string|null $address_subpremise The sub-premise of the organization location + * + * @return self + */ + public function setAddressSubpremise($address_subpremise): self + { + $this->container['address_subpremise'] = $address_subpremise; + + return $this; + } + + /** + * Gets address_street_number + * + * @return string|null + */ + public function getAddressStreetNumber() + { + return $this->container['address_street_number']; + } + + /** + * Sets address_street_number + * + * @param string|null $address_street_number The street number of the organization location + * + * @return self + */ + public function setAddressStreetNumber($address_street_number): self + { + $this->container['address_street_number'] = $address_street_number; + + return $this; + } + + /** + * Gets address_route + * + * @return string|null + */ + public function getAddressRoute() + { + return $this->container['address_route']; + } + + /** + * Sets address_route + * + * @param string|null $address_route The route of the organization location + * + * @return self + */ + public function setAddressRoute($address_route): self + { + $this->container['address_route'] = $address_route; + + return $this; + } + + /** + * Gets address_sublocality + * + * @return string|null + */ + public function getAddressSublocality() + { + return $this->container['address_sublocality']; + } + + /** + * Sets address_sublocality + * + * @param string|null $address_sublocality The sub-locality of the organization location + * + * @return self + */ + public function setAddressSublocality($address_sublocality): self + { + $this->container['address_sublocality'] = $address_sublocality; + + return $this; + } + + /** + * Gets address_locality + * + * @return string|null + */ + public function getAddressLocality() + { + return $this->container['address_locality']; + } + + /** + * Sets address_locality + * + * @param string|null $address_locality The locality of the organization location + * + * @return self + */ + public function setAddressLocality($address_locality): self + { + $this->container['address_locality'] = $address_locality; + + return $this; + } + + /** + * Gets address_admin_area_level_1 + * + * @return string|null + */ + public function getAddressAdminAreaLevel1() + { + return $this->container['address_admin_area_level_1']; + } + + /** + * Sets address_admin_area_level_1 + * + * @param string|null $address_admin_area_level_1 The level 1 admin area of the organization location + * + * @return self + */ + public function setAddressAdminAreaLevel1($address_admin_area_level_1): self + { + $this->container['address_admin_area_level_1'] = $address_admin_area_level_1; + + return $this; + } + + /** + * Gets address_admin_area_level_2 + * + * @return string|null + */ + public function getAddressAdminAreaLevel2() + { + return $this->container['address_admin_area_level_2']; + } + + /** + * Sets address_admin_area_level_2 + * + * @param string|null $address_admin_area_level_2 The level 2 admin area of the organization location + * + * @return self + */ + public function setAddressAdminAreaLevel2($address_admin_area_level_2): self + { + $this->container['address_admin_area_level_2'] = $address_admin_area_level_2; + + return $this; + } + + /** + * Gets address_country + * + * @return string|null + */ + public function getAddressCountry() + { + return $this->container['address_country']; + } + + /** + * Sets address_country + * + * @param string|null $address_country The country of the organization location + * + * @return self + */ + public function setAddressCountry($address_country): self + { + $this->container['address_country'] = $address_country; + + return $this; + } + + /** + * Gets address_postal_code + * + * @return string|null + */ + public function getAddressPostalCode() + { + return $this->container['address_postal_code']; + } + + /** + * Sets address_postal_code + * + * @param string|null $address_postal_code The postal code of the organization location + * + * @return self + */ + public function setAddressPostalCode($address_postal_code): self + { + $this->container['address_postal_code'] = $address_postal_code; + + return $this; + } + + /** + * Gets address_formatted_address + * + * @return string|null + */ + public function getAddressFormattedAddress() + { + return $this->container['address_formatted_address']; + } + + /** + * Sets address_formatted_address + * + * @param string|null $address_formatted_address The formatted organization location + * + * @return self + */ + public function setAddressFormattedAddress($address_formatted_address): self + { + $this->container['address_formatted_address'] = $address_formatted_address; + + return $this; + } + + /** + * Gets id + * + * @return int|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int|null $id The ID of the organization + * + * @return self + */ + public function setId($id): self + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets active_flag + * + * @return bool|null + */ + public function getActiveFlag() + { + return $this->container['active_flag']; + } + + /** + * Sets active_flag + * + * @param bool|null $active_flag Whether the organization is active or not + * + * @return self + */ + public function setActiveFlag($active_flag): self + { + $this->container['active_flag'] = $active_flag; + + return $this; + } + + /** + * Gets owner_id + * + * @return int|null + */ + public function getOwnerId() + { + return $this->container['owner_id']; + } + + /** + * Sets owner_id + * + * @param int|null $owner_id The ID of the owner + * + * @return self + */ + public function setOwnerId($owner_id): self + { + $this->container['owner_id'] = $owner_id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The name of the organization + * + * @return self + */ + public function setName($name): self + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets update_time + * + * @return string|null + */ + public function getUpdateTime() + { + return $this->container['update_time']; + } + + /** + * Sets update_time + * + * @param string|null $update_time The last updated date and time of the organization. Format: YYYY-MM-DD HH:MM:SS + * + * @return self + */ + public function setUpdateTime($update_time): self + { + $this->container['update_time'] = $update_time; + + return $this; + } + + /** + * Gets delete_time + * + * @return string|null + */ + public function getDeleteTime() + { + return $this->container['delete_time']; + } + + /** + * Sets delete_time + * + * @param string|null $delete_time The date and time this organization was deleted. Format: YYYY-MM-DD HH:MM:SS + * + * @return self + */ + public function setDeleteTime($delete_time): self + { + $this->container['delete_time'] = $delete_time; + + return $this; + } + + /** + * Gets add_time + * + * @return string|null + */ + public function getAddTime() + { + return $this->container['add_time']; + } + + /** + * Sets add_time + * + * @param string|null $add_time The date and time when the organization was added/created. Format: YYYY-MM-DD HH:MM:SS + * + * @return self + */ + public function setAddTime($add_time): self + { + $this->container['add_time'] = $add_time; + + return $this; + } + + /** + * Gets visible_to + * + * @return string|null + */ + public function getVisibleTo() + { + return $this->container['visible_to']; + } + + /** + * Sets visible_to + * + * @param string|null $visible_to The visibility group ID of who can see the organization + * + * @return self + */ + public function setVisibleTo($visible_to): self + { + $this->container['visible_to'] = $visible_to; + + return $this; + } + + /** + * Gets label + * + * @return int|null + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param int|null $label The label assigned to the organization + * + * @return self + */ + public function setLabel($label): self + { + $this->container['label'] = $label; + + return $this; + } + + /** + * Gets cc_email + * + * @return string|null + */ + public function getCcEmail() + { + return $this->container['cc_email']; + } + + /** + * Sets cc_email + * + * @param string|null $cc_email The BCC email associated with the organization + * + * @return self + */ + public function setCcEmail($cc_email): self + { + $this->container['cc_email'] = $cc_email; + + 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/Model/OrganizationsCollectionResponseObjectAllOf.php b/lib/Model/OrganizationsCollectionResponseObjectAllOf.php new file mode 100644 index 00000000..f76456bb --- /dev/null +++ b/lib/Model/OrganizationsCollectionResponseObjectAllOf.php @@ -0,0 +1,612 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class OrganizationsCollectionResponseObjectAllOf implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'OrganizationsCollectionResponseObject_allOf'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'id' => 'int', + 'active_flag' => 'bool', + 'owner_id' => 'int', + 'name' => 'string', + 'update_time' => 'string', + 'delete_time' => 'string', + 'add_time' => 'string', + 'visible_to' => 'string', + 'label' => 'int', + 'cc_email' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'active_flag' => null, + 'owner_id' => null, + 'name' => null, + 'update_time' => null, + 'delete_time' => null, + 'add_time' => null, + 'visible_to' => null, + 'label' => null, + 'cc_email' => 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', + 'active_flag' => 'active_flag', + 'owner_id' => 'owner_id', + 'name' => 'name', + 'update_time' => 'update_time', + 'delete_time' => 'delete_time', + 'add_time' => 'add_time', + 'visible_to' => 'visible_to', + 'label' => 'label', + 'cc_email' => 'cc_email' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'active_flag' => 'setActiveFlag', + 'owner_id' => 'setOwnerId', + 'name' => 'setName', + 'update_time' => 'setUpdateTime', + 'delete_time' => 'setDeleteTime', + 'add_time' => 'setAddTime', + 'visible_to' => 'setVisibleTo', + 'label' => 'setLabel', + 'cc_email' => 'setCcEmail' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'active_flag' => 'getActiveFlag', + 'owner_id' => 'getOwnerId', + 'name' => 'getName', + 'update_time' => 'getUpdateTime', + 'delete_time' => 'getDeleteTime', + 'add_time' => 'getAddTime', + 'visible_to' => 'getVisibleTo', + 'label' => 'getLabel', + 'cc_email' => 'getCcEmail' + ]; + + /** + * 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['active_flag'] = $data['active_flag'] ?? null; + $this->container['owner_id'] = $data['owner_id'] ?? null; + $this->container['name'] = $data['name'] ?? null; + $this->container['update_time'] = $data['update_time'] ?? null; + $this->container['delete_time'] = $data['delete_time'] ?? null; + $this->container['add_time'] = $data['add_time'] ?? null; + $this->container['visible_to'] = $data['visible_to'] ?? null; + $this->container['label'] = $data['label'] ?? null; + $this->container['cc_email'] = $data['cc_email'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + * @phpstan-return array + * @psalm-return array + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return int|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int|null $id The ID of the organization + * + * @return self + */ + public function setId($id): self + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets active_flag + * + * @return bool|null + */ + public function getActiveFlag() + { + return $this->container['active_flag']; + } + + /** + * Sets active_flag + * + * @param bool|null $active_flag Whether the organization is active or not + * + * @return self + */ + public function setActiveFlag($active_flag): self + { + $this->container['active_flag'] = $active_flag; + + return $this; + } + + /** + * Gets owner_id + * + * @return int|null + */ + public function getOwnerId() + { + return $this->container['owner_id']; + } + + /** + * Sets owner_id + * + * @param int|null $owner_id The ID of the owner + * + * @return self + */ + public function setOwnerId($owner_id): self + { + $this->container['owner_id'] = $owner_id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The name of the organization + * + * @return self + */ + public function setName($name): self + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets update_time + * + * @return string|null + */ + public function getUpdateTime() + { + return $this->container['update_time']; + } + + /** + * Sets update_time + * + * @param string|null $update_time The last updated date and time of the organization. Format: YYYY-MM-DD HH:MM:SS + * + * @return self + */ + public function setUpdateTime($update_time): self + { + $this->container['update_time'] = $update_time; + + return $this; + } + + /** + * Gets delete_time + * + * @return string|null + */ + public function getDeleteTime() + { + return $this->container['delete_time']; + } + + /** + * Sets delete_time + * + * @param string|null $delete_time The date and time this organization was deleted. Format: YYYY-MM-DD HH:MM:SS + * + * @return self + */ + public function setDeleteTime($delete_time): self + { + $this->container['delete_time'] = $delete_time; + + return $this; + } + + /** + * Gets add_time + * + * @return string|null + */ + public function getAddTime() + { + return $this->container['add_time']; + } + + /** + * Sets add_time + * + * @param string|null $add_time The date and time when the organization was added/created. Format: YYYY-MM-DD HH:MM:SS + * + * @return self + */ + public function setAddTime($add_time): self + { + $this->container['add_time'] = $add_time; + + return $this; + } + + /** + * Gets visible_to + * + * @return string|null + */ + public function getVisibleTo() + { + return $this->container['visible_to']; + } + + /** + * Sets visible_to + * + * @param string|null $visible_to The visibility group ID of who can see the organization + * + * @return self + */ + public function setVisibleTo($visible_to): self + { + $this->container['visible_to'] = $visible_to; + + return $this; + } + + /** + * Gets label + * + * @return int|null + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param int|null $label The label assigned to the organization + * + * @return self + */ + public function setLabel($label): self + { + $this->container['label'] = $label; + + return $this; + } + + /** + * Gets cc_email + * + * @return string|null + */ + public function getCcEmail() + { + return $this->container['cc_email']; + } + + /** + * Sets cc_email + * + * @param string|null $cc_email The BCC email associated with the organization + * + * @return self + */ + public function setCcEmail($cc_email): self + { + $this->container['cc_email'] = $cc_email; + + 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/Model/PersonsCollectionResponseObject.php b/lib/Model/PersonsCollectionResponseObject.php new file mode 100644 index 00000000..851b37ee --- /dev/null +++ b/lib/Model/PersonsCollectionResponseObject.php @@ -0,0 +1,732 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class PersonsCollectionResponseObject implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'PersonsCollectionResponseObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @phpsalm-var array + */ + protected static array $openAPITypes = [ + 'id' => 'int', + 'active_flag' => 'bool', + 'owner_id' => 'int', + 'org_id' => 'int', + 'name' => 'string', + 'email' => '\Pipedrive\Model\BasicPersonEmail[]', + 'phone' => '\Pipedrive\Model\BasePersonItemPhone[]', + 'update_time' => 'string', + 'delete_time' => 'string', + 'add_time' => 'string', + 'visible_to' => 'string', + 'picture_id' => 'int', + 'label' => 'int', + 'cc_email' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'active_flag' => null, + 'owner_id' => null, + 'org_id' => null, + 'name' => null, + 'email' => null, + 'phone' => null, + 'update_time' => null, + 'delete_time' => null, + 'add_time' => null, + 'visible_to' => null, + 'picture_id' => null, + 'label' => null, + 'cc_email' => 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', + 'active_flag' => 'active_flag', + 'owner_id' => 'owner_id', + 'org_id' => 'org_id', + 'name' => 'name', + 'email' => 'email', + 'phone' => 'phone', + 'update_time' => 'update_time', + 'delete_time' => 'delete_time', + 'add_time' => 'add_time', + 'visible_to' => 'visible_to', + 'picture_id' => 'picture_id', + 'label' => 'label', + 'cc_email' => 'cc_email' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'active_flag' => 'setActiveFlag', + 'owner_id' => 'setOwnerId', + 'org_id' => 'setOrgId', + 'name' => 'setName', + 'email' => 'setEmail', + 'phone' => 'setPhone', + 'update_time' => 'setUpdateTime', + 'delete_time' => 'setDeleteTime', + 'add_time' => 'setAddTime', + 'visible_to' => 'setVisibleTo', + 'picture_id' => 'setPictureId', + 'label' => 'setLabel', + 'cc_email' => 'setCcEmail' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'active_flag' => 'getActiveFlag', + 'owner_id' => 'getOwnerId', + 'org_id' => 'getOrgId', + 'name' => 'getName', + 'email' => 'getEmail', + 'phone' => 'getPhone', + 'update_time' => 'getUpdateTime', + 'delete_time' => 'getDeleteTime', + 'add_time' => 'getAddTime', + 'visible_to' => 'getVisibleTo', + 'picture_id' => 'getPictureId', + 'label' => 'getLabel', + 'cc_email' => 'getCcEmail' + ]; + + /** + * 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['active_flag'] = $data['active_flag'] ?? null; + $this->container['owner_id'] = $data['owner_id'] ?? null; + $this->container['org_id'] = $data['org_id'] ?? null; + $this->container['name'] = $data['name'] ?? null; + $this->container['email'] = $data['email'] ?? null; + $this->container['phone'] = $data['phone'] ?? null; + $this->container['update_time'] = $data['update_time'] ?? null; + $this->container['delete_time'] = $data['delete_time'] ?? null; + $this->container['add_time'] = $data['add_time'] ?? null; + $this->container['visible_to'] = $data['visible_to'] ?? null; + $this->container['picture_id'] = $data['picture_id'] ?? null; + $this->container['label'] = $data['label'] ?? null; + $this->container['cc_email'] = $data['cc_email'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + * @phpstan-return array + * @psalm-return array + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return int|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int|null $id The ID of the person + * + * @return self + */ + public function setId($id): self + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets active_flag + * + * @return bool|null + */ + public function getActiveFlag() + { + return $this->container['active_flag']; + } + + /** + * Sets active_flag + * + * @param bool|null $active_flag Whether the person is active or not + * + * @return self + */ + public function setActiveFlag($active_flag): self + { + $this->container['active_flag'] = $active_flag; + + return $this; + } + + /** + * Gets owner_id + * + * @return int|null + */ + public function getOwnerId() + { + return $this->container['owner_id']; + } + + /** + * Sets owner_id + * + * @param int|null $owner_id The ID of the owner related to the person + * + * @return self + */ + public function setOwnerId($owner_id): self + { + $this->container['owner_id'] = $owner_id; + + return $this; + } + + /** + * Gets org_id + * + * @return int|null + */ + public function getOrgId() + { + return $this->container['org_id']; + } + + /** + * Sets org_id + * + * @param int|null $org_id The ID of the organization related to the person + * + * @return self + */ + public function setOrgId($org_id): self + { + $this->container['org_id'] = $org_id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The name of the person + * + * @return self + */ + public function setName($name): self + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets email + * + * @return \Pipedrive\Model\BasicPersonEmail[]|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param \Pipedrive\Model\BasicPersonEmail[]|null $email An email address as a string or an array of email objects related to the person. The structure of the array is as follows: `[{ \"value\": \"mail@example.com\", \"primary\": \"true\", \"label\": \"main\" }]`. Please note that only `value` is required. + * + * @return self + */ + public function setEmail($email): self + { + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets phone + * + * @return \Pipedrive\Model\BasePersonItemPhone[]|null + */ + public function getPhone() + { + return $this->container['phone']; + } + + /** + * Sets phone + * + * @param \Pipedrive\Model\BasePersonItemPhone[]|null $phone A phone number supplied as a string or an array of phone objects related to the person. The structure of the array is as follows: `[{ \"value\": \"12345\", \"primary\": \"true\", \"label\": \"mobile\" }]`. Please note that only `value` is required. + * + * @return self + */ + public function setPhone($phone): self + { + $this->container['phone'] = $phone; + + return $this; + } + + /** + * Gets update_time + * + * @return string|null + */ + public function getUpdateTime() + { + return $this->container['update_time']; + } + + /** + * Sets update_time + * + * @param string|null $update_time The last updated date and time of the person. Format: YYYY-MM-DD HH:MM:SS + * + * @return self + */ + public function setUpdateTime($update_time): self + { + $this->container['update_time'] = $update_time; + + return $this; + } + + /** + * Gets delete_time + * + * @return string|null + */ + public function getDeleteTime() + { + return $this->container['delete_time']; + } + + /** + * Sets delete_time + * + * @param string|null $delete_time The date and time this person was deleted. Format: YYYY-MM-DD HH:MM:SS + * + * @return self + */ + public function setDeleteTime($delete_time): self + { + $this->container['delete_time'] = $delete_time; + + return $this; + } + + /** + * Gets add_time + * + * @return string|null + */ + public function getAddTime() + { + return $this->container['add_time']; + } + + /** + * Sets add_time + * + * @param string|null $add_time The date and time when the person was added/created. Format: YYYY-MM-DD HH:MM:SS + * + * @return self + */ + public function setAddTime($add_time): self + { + $this->container['add_time'] = $add_time; + + return $this; + } + + /** + * Gets visible_to + * + * @return string|null + */ + public function getVisibleTo() + { + return $this->container['visible_to']; + } + + /** + * Sets visible_to + * + * @param string|null $visible_to The visibility group ID of who can see the person + * + * @return self + */ + public function setVisibleTo($visible_to): self + { + $this->container['visible_to'] = $visible_to; + + return $this; + } + + /** + * Gets picture_id + * + * @return int|null + */ + public function getPictureId() + { + return $this->container['picture_id']; + } + + /** + * Sets picture_id + * + * @param int|null $picture_id The ID of the picture associated with the item + * + * @return self + */ + public function setPictureId($picture_id): self + { + $this->container['picture_id'] = $picture_id; + + return $this; + } + + /** + * Gets label + * + * @return int|null + */ + public function getLabel() + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param int|null $label The label assigned to the person + * + * @return self + */ + public function setLabel($label): self + { + $this->container['label'] = $label; + + return $this; + } + + /** + * Gets cc_email + * + * @return string|null + */ + public function getCcEmail() + { + return $this->container['cc_email']; + } + + /** + * Sets cc_email + * + * @param string|null $cc_email The BCC email associated with the person + * + * @return self + */ + public function setCcEmail($cc_email): self + { + $this->container['cc_email'] = $cc_email; + + 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/Model/ProductAttachmentDetails.php b/lib/Model/ProductAttachmentDetails.php index b9ce3511..c6104c02 100644 --- a/lib/Model/ProductAttachmentDetails.php +++ b/lib/Model/ProductAttachmentDetails.php @@ -66,12 +66,14 @@ class ProductAttachmentDetails implements ModelInterface, ArrayAccess, JsonSeria 'product_id' => 'int', 'item_price' => 'float', 'quantity' => 'int', - 'discount_percentage' => 'float', + 'discount' => 'float', + 'discount_type' => 'string', 'duration' => 'float', 'duration_unit' => 'string', 'product_variation_id' => 'int', 'comments' => 'string', 'tax' => 'float', + 'tax_method' => 'string', 'enabled_flag' => 'bool', 'id' => 'int', 'company_id' => 'int', @@ -96,12 +98,14 @@ class ProductAttachmentDetails implements ModelInterface, ArrayAccess, JsonSeria 'product_id' => null, 'item_price' => null, 'quantity' => null, - 'discount_percentage' => null, + 'discount' => null, + 'discount_type' => null, 'duration' => null, 'duration_unit' => null, 'product_variation_id' => null, 'comments' => null, 'tax' => null, + 'tax_method' => null, 'enabled_flag' => null, 'id' => null, 'company_id' => null, @@ -149,12 +153,14 @@ public static function openAPIFormats(): array 'product_id' => 'product_id', 'item_price' => 'item_price', 'quantity' => 'quantity', - 'discount_percentage' => 'discount_percentage', + 'discount' => 'discount', + 'discount_type' => 'discount_type', 'duration' => 'duration', 'duration_unit' => 'duration_unit', 'product_variation_id' => 'product_variation_id', 'comments' => 'comments', 'tax' => 'tax', + 'tax_method' => 'tax_method', 'enabled_flag' => 'enabled_flag', 'id' => 'id', 'company_id' => 'company_id', @@ -177,12 +183,14 @@ public static function openAPIFormats(): array 'product_id' => 'setProductId', 'item_price' => 'setItemPrice', 'quantity' => 'setQuantity', - 'discount_percentage' => 'setDiscountPercentage', + 'discount' => 'setDiscount', + 'discount_type' => 'setDiscountType', 'duration' => 'setDuration', 'duration_unit' => 'setDurationUnit', 'product_variation_id' => 'setProductVariationId', 'comments' => 'setComments', 'tax' => 'setTax', + 'tax_method' => 'setTaxMethod', 'enabled_flag' => 'setEnabledFlag', 'id' => 'setId', 'company_id' => 'setCompanyId', @@ -205,12 +213,14 @@ public static function openAPIFormats(): array 'product_id' => 'getProductId', 'item_price' => 'getItemPrice', 'quantity' => 'getQuantity', - 'discount_percentage' => 'getDiscountPercentage', + 'discount' => 'getDiscount', + 'discount_type' => 'getDiscountType', 'duration' => 'getDuration', 'duration_unit' => 'getDurationUnit', 'product_variation_id' => 'getProductVariationId', 'comments' => 'getComments', 'tax' => 'getTax', + 'tax_method' => 'getTaxMethod', 'enabled_flag' => 'getEnabledFlag', 'id' => 'getId', 'company_id' => 'getCompanyId', @@ -271,6 +281,42 @@ public function getModelName(): string return self::$openAPIModelName; } + const DISCOUNT_TYPE_PERCENTAGE = 'percentage'; + const DISCOUNT_TYPE_AMOUNT = 'amount'; + const TAX_METHOD_EXCLUSIVE = 'exclusive'; + const TAX_METHOD_INCLUSIVE = 'inclusive'; + const TAX_METHOD_NONE = 'none'; + + /** + * Gets allowable values of the enum + * + * @phpstan-return array + * @phpsalm-return array + * @return (string|int)[] + */ + public function getDiscountTypeAllowableValues(): array + { + return [ + self::DISCOUNT_TYPE_PERCENTAGE, + self::DISCOUNT_TYPE_AMOUNT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @phpstan-return array + * @phpsalm-return array + * @return (string|int)[] + */ + public function getTaxMethodAllowableValues(): array + { + return [ + self::TAX_METHOD_EXCLUSIVE, + self::TAX_METHOD_INCLUSIVE, + self::TAX_METHOD_NONE, + ]; + } /** * Associative array for storing property values @@ -294,12 +340,14 @@ public function __construct(array $data = null) $this->container['product_id'] = $data['product_id'] ?? null; $this->container['item_price'] = $data['item_price'] ?? null; $this->container['quantity'] = $data['quantity'] ?? null; - $this->container['discount_percentage'] = $data['discount_percentage'] ?? 0; + $this->container['discount'] = $data['discount'] ?? 0; + $this->container['discount_type'] = $data['discount_type'] ?? 'percentage'; $this->container['duration'] = $data['duration'] ?? 1; $this->container['duration_unit'] = $data['duration_unit'] ?? null; $this->container['product_variation_id'] = $data['product_variation_id'] ?? null; $this->container['comments'] = $data['comments'] ?? null; $this->container['tax'] = $data['tax'] ?? null; + $this->container['tax_method'] = $data['tax_method'] ?? null; $this->container['enabled_flag'] = $data['enabled_flag'] ?? true; $this->container['id'] = $data['id'] ?? null; $this->container['company_id'] = $data['company_id'] ?? null; @@ -333,6 +381,24 @@ public function listInvalidProperties(): array if ($this->container['quantity'] === null) { $invalidProperties[] = "'quantity' can't be null"; } + $allowedValues = $this->getDiscountTypeAllowableValues(); + if (!is_null($this->container['discount_type']) && !in_array($this->container['discount_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'discount_type', must be one of '%s'", + $this->container['discount_type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getTaxMethodAllowableValues(); + if (!is_null($this->container['tax_method']) && !in_array($this->container['tax_method'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'tax_method', must be one of '%s'", + $this->container['tax_method'], + implode("', '", $allowedValues) + ); + } + return $invalidProperties; } @@ -421,25 +487,59 @@ public function setQuantity($quantity): self } /** - * Gets discount_percentage + * Gets discount * * @return float|null */ - public function getDiscountPercentage() + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param float|null $discount The value of the discount. The `discount_type` field can be used to specify whether the value is an amount or a percentage. + * + * @return self + */ + public function setDiscount($discount): self + { + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets discount_type + * + * @return string|null + */ + public function getDiscountType() { - return $this->container['discount_percentage']; + return $this->container['discount_type']; } /** - * Sets discount_percentage + * Sets discount_type * - * @param float|null $discount_percentage The discount %. If omitted, will be set to 0. + * @param string|null $discount_type The type of the discount's value. * * @return self */ - public function setDiscountPercentage($discount_percentage): self + public function setDiscountType($discount_type): self { - $this->container['discount_percentage'] = $discount_percentage; + $allowedValues = $this->getDiscountTypeAllowableValues(); + if (!is_null($discount_type) && !in_array($discount_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'discount_type', must be one of '%s'", + $discount_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['discount_type'] = $discount_type; return $this; } @@ -564,6 +664,40 @@ public function setTax($tax): self return $this; } + /** + * Gets tax_method + * + * @return string|null + */ + public function getTaxMethod() + { + return $this->container['tax_method']; + } + + /** + * Sets tax_method + * + * @param string|null $tax_method The tax option to be applied to the products. When using `inclusive`, the tax percentage will already be included in the price. When using `exclusive`, the tax will not be included in the price. When using `none`, no tax will be added. Use the `tax` field for defining the tax percentage amount. By default, the user setting value for tax options will be used. Changing this in one product affects the rest of the products attached to the deal. + * + * @return self + */ + public function setTaxMethod($tax_method): self + { + $allowedValues = $this->getTaxMethodAllowableValues(); + if (!is_null($tax_method) && !in_array($tax_method, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'tax_method', must be one of '%s'", + $tax_method, + implode("', '", $allowedValues) + ) + ); + } + $this->container['tax_method'] = $tax_method; + + return $this; + } + /** * Gets enabled_flag * diff --git a/lib/Model/ProductListItem.php b/lib/Model/ProductListItem.php index 791f4531..6bc8cb1b 100644 --- a/lib/Model/ProductListItem.php +++ b/lib/Model/ProductListItem.php @@ -69,7 +69,8 @@ class ProductListItem implements ModelInterface, ArrayAccess, JsonSerializable 'product_id' => 'int', 'product_variation_id' => 'int', 'item_price' => 'int', - 'discount_percentage' => 'int', + 'discount' => 'float', + 'discount_type' => 'string', 'duration' => 'int', 'duration_unit' => 'string', 'sum_no_discount' => 'float', @@ -81,6 +82,7 @@ class ProductListItem implements ModelInterface, ArrayAccess, JsonSerializable 'comments' => 'string', 'active_flag' => 'bool', 'tax' => 'float', + 'tax_method' => 'string', 'name' => 'string', 'sum_formatted' => 'string', 'quantity_formatted' => 'string', @@ -102,7 +104,8 @@ class ProductListItem implements ModelInterface, ArrayAccess, JsonSerializable 'product_id' => null, 'product_variation_id' => null, 'item_price' => null, - 'discount_percentage' => null, + 'discount' => null, + 'discount_type' => null, 'duration' => null, 'duration_unit' => null, 'sum_no_discount' => null, @@ -114,6 +117,7 @@ class ProductListItem implements ModelInterface, ArrayAccess, JsonSerializable 'comments' => null, 'active_flag' => null, 'tax' => null, + 'tax_method' => null, 'name' => null, 'sum_formatted' => null, 'quantity_formatted' => null, @@ -158,7 +162,8 @@ public static function openAPIFormats(): array 'product_id' => 'product_id', 'product_variation_id' => 'product_variation_id', 'item_price' => 'item_price', - 'discount_percentage' => 'discount_percentage', + 'discount' => 'discount', + 'discount_type' => 'discount_type', 'duration' => 'duration', 'duration_unit' => 'duration_unit', 'sum_no_discount' => 'sum_no_discount', @@ -170,6 +175,7 @@ public static function openAPIFormats(): array 'comments' => 'comments', 'active_flag' => 'active_flag', 'tax' => 'tax', + 'tax_method' => 'tax_method', 'name' => 'name', 'sum_formatted' => 'sum_formatted', 'quantity_formatted' => 'quantity_formatted', @@ -189,7 +195,8 @@ public static function openAPIFormats(): array 'product_id' => 'setProductId', 'product_variation_id' => 'setProductVariationId', 'item_price' => 'setItemPrice', - 'discount_percentage' => 'setDiscountPercentage', + 'discount' => 'setDiscount', + 'discount_type' => 'setDiscountType', 'duration' => 'setDuration', 'duration_unit' => 'setDurationUnit', 'sum_no_discount' => 'setSumNoDiscount', @@ -201,6 +208,7 @@ public static function openAPIFormats(): array 'comments' => 'setComments', 'active_flag' => 'setActiveFlag', 'tax' => 'setTax', + 'tax_method' => 'setTaxMethod', 'name' => 'setName', 'sum_formatted' => 'setSumFormatted', 'quantity_formatted' => 'setQuantityFormatted', @@ -220,7 +228,8 @@ public static function openAPIFormats(): array 'product_id' => 'getProductId', 'product_variation_id' => 'getProductVariationId', 'item_price' => 'getItemPrice', - 'discount_percentage' => 'getDiscountPercentage', + 'discount' => 'getDiscount', + 'discount_type' => 'getDiscountType', 'duration' => 'getDuration', 'duration_unit' => 'getDurationUnit', 'sum_no_discount' => 'getSumNoDiscount', @@ -232,6 +241,7 @@ public static function openAPIFormats(): array 'comments' => 'getComments', 'active_flag' => 'getActiveFlag', 'tax' => 'getTax', + 'tax_method' => 'getTaxMethod', 'name' => 'getName', 'sum_formatted' => 'getSumFormatted', 'quantity_formatted' => 'getQuantityFormatted', @@ -286,6 +296,42 @@ public function getModelName(): string return self::$openAPIModelName; } + const DISCOUNT_TYPE_PERCENTAGE = 'percentage'; + const DISCOUNT_TYPE_AMOUNT = 'amount'; + const TAX_METHOD_EXCLUSIVE = 'exclusive'; + const TAX_METHOD_INCLUSIVE = 'inclusive'; + const TAX_METHOD_NONE = 'none'; + + /** + * Gets allowable values of the enum + * + * @phpstan-return array + * @phpsalm-return array + * @return (string|int)[] + */ + public function getDiscountTypeAllowableValues(): array + { + return [ + self::DISCOUNT_TYPE_PERCENTAGE, + self::DISCOUNT_TYPE_AMOUNT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @phpstan-return array + * @phpsalm-return array + * @return (string|int)[] + */ + public function getTaxMethodAllowableValues(): array + { + return [ + self::TAX_METHOD_EXCLUSIVE, + self::TAX_METHOD_INCLUSIVE, + self::TAX_METHOD_NONE, + ]; + } /** * Associative array for storing property values @@ -312,7 +358,8 @@ public function __construct(array $data = null) $this->container['product_id'] = $data['product_id'] ?? null; $this->container['product_variation_id'] = $data['product_variation_id'] ?? null; $this->container['item_price'] = $data['item_price'] ?? null; - $this->container['discount_percentage'] = $data['discount_percentage'] ?? null; + $this->container['discount'] = $data['discount'] ?? 0; + $this->container['discount_type'] = $data['discount_type'] ?? 'percentage'; $this->container['duration'] = $data['duration'] ?? null; $this->container['duration_unit'] = $data['duration_unit'] ?? null; $this->container['sum_no_discount'] = $data['sum_no_discount'] ?? null; @@ -324,6 +371,7 @@ public function __construct(array $data = null) $this->container['comments'] = $data['comments'] ?? null; $this->container['active_flag'] = $data['active_flag'] ?? null; $this->container['tax'] = $data['tax'] ?? null; + $this->container['tax_method'] = $data['tax_method'] ?? null; $this->container['name'] = $data['name'] ?? null; $this->container['sum_formatted'] = $data['sum_formatted'] ?? null; $this->container['quantity_formatted'] = $data['quantity_formatted'] ?? null; @@ -342,6 +390,24 @@ public function listInvalidProperties(): array { $invalidProperties = []; + $allowedValues = $this->getDiscountTypeAllowableValues(); + if (!is_null($this->container['discount_type']) && !in_array($this->container['discount_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'discount_type', must be one of '%s'", + $this->container['discount_type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getTaxMethodAllowableValues(); + if (!is_null($this->container['tax_method']) && !in_array($this->container['tax_method'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'tax_method', must be one of '%s'", + $this->container['tax_method'], + implode("', '", $allowedValues) + ); + } + return $invalidProperties; } @@ -502,25 +568,59 @@ public function setItemPrice($item_price): self } /** - * Gets discount_percentage + * Gets discount * - * @return int|null + * @return float|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param float|null $discount The value of the discount. The `discount_type` field can be used to specify whether the value is an amount or a percentage. + * + * @return self + */ + public function setDiscount($discount): self + { + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets discount_type + * + * @return string|null */ - public function getDiscountPercentage() + public function getDiscountType() { - return $this->container['discount_percentage']; + return $this->container['discount_type']; } /** - * Sets discount_percentage + * Sets discount_type * - * @param int|null $discount_percentage The discount percentage of the product + * @param string|null $discount_type The type of the discount's value. * * @return self */ - public function setDiscountPercentage($discount_percentage): self + public function setDiscountType($discount_type): self { - $this->container['discount_percentage'] = $discount_percentage; + $allowedValues = $this->getDiscountTypeAllowableValues(); + if (!is_null($discount_type) && !in_array($discount_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'discount_type', must be one of '%s'", + $discount_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['discount_type'] = $discount_type; return $this; } @@ -789,6 +889,40 @@ public function setTax($tax): self return $this; } + /** + * Gets tax_method + * + * @return string|null + */ + public function getTaxMethod() + { + return $this->container['tax_method']; + } + + /** + * Sets tax_method + * + * @param string|null $tax_method The tax option to be applied to the products. When using `inclusive`, the tax percentage will already be included in the price. When using `exclusive`, the tax will not be included in the price. When using `none`, no tax will be added. Use the `tax` field for defining the tax percentage amount. By default, the user setting value for tax options will be used. Changing this in one product affects the rest of the products attached to the deal. + * + * @return self + */ + public function setTaxMethod($tax_method): self + { + $allowedValues = $this->getTaxMethodAllowableValues(); + if (!is_null($tax_method) && !in_array($tax_method, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'tax_method', must be one of '%s'", + $tax_method, + implode("', '", $allowedValues) + ) + ); + } + $this->container['tax_method'] = $tax_method; + + return $this; + } + /** * Gets name * diff --git a/lib/Model/UpdateDealProduct.php b/lib/Model/UpdateDealProduct.php index 66e23b7a..5ac735f7 100644 --- a/lib/Model/UpdateDealProduct.php +++ b/lib/Model/UpdateDealProduct.php @@ -66,12 +66,14 @@ class UpdateDealProduct implements ModelInterface, ArrayAccess, JsonSerializable 'product_id' => 'int', 'item_price' => 'float', 'quantity' => 'int', - 'discount_percentage' => 'float', + 'discount' => 'float', + 'discount_type' => 'string', 'duration' => 'float', 'duration_unit' => 'DealProductUnitDuration', 'product_variation_id' => 'int', 'comments' => 'string', 'tax' => 'float', + 'tax_method' => 'string', 'enabled_flag' => 'bool' ]; @@ -86,12 +88,14 @@ class UpdateDealProduct implements ModelInterface, ArrayAccess, JsonSerializable 'product_id' => null, 'item_price' => null, 'quantity' => null, - 'discount_percentage' => null, + 'discount' => null, + 'discount_type' => null, 'duration' => null, 'duration_unit' => null, 'product_variation_id' => null, 'comments' => null, 'tax' => null, + 'tax_method' => null, 'enabled_flag' => null ]; @@ -129,12 +133,14 @@ public static function openAPIFormats(): array 'product_id' => 'product_id', 'item_price' => 'item_price', 'quantity' => 'quantity', - 'discount_percentage' => 'discount_percentage', + 'discount' => 'discount', + 'discount_type' => 'discount_type', 'duration' => 'duration', 'duration_unit' => 'duration_unit', 'product_variation_id' => 'product_variation_id', 'comments' => 'comments', 'tax' => 'tax', + 'tax_method' => 'tax_method', 'enabled_flag' => 'enabled_flag' ]; @@ -147,12 +153,14 @@ public static function openAPIFormats(): array 'product_id' => 'setProductId', 'item_price' => 'setItemPrice', 'quantity' => 'setQuantity', - 'discount_percentage' => 'setDiscountPercentage', + 'discount' => 'setDiscount', + 'discount_type' => 'setDiscountType', 'duration' => 'setDuration', 'duration_unit' => 'setDurationUnit', 'product_variation_id' => 'setProductVariationId', 'comments' => 'setComments', 'tax' => 'setTax', + 'tax_method' => 'setTaxMethod', 'enabled_flag' => 'setEnabledFlag' ]; @@ -165,12 +173,14 @@ public static function openAPIFormats(): array 'product_id' => 'getProductId', 'item_price' => 'getItemPrice', 'quantity' => 'getQuantity', - 'discount_percentage' => 'getDiscountPercentage', + 'discount' => 'getDiscount', + 'discount_type' => 'getDiscountType', 'duration' => 'getDuration', 'duration_unit' => 'getDurationUnit', 'product_variation_id' => 'getProductVariationId', 'comments' => 'getComments', 'tax' => 'getTax', + 'tax_method' => 'getTaxMethod', 'enabled_flag' => 'getEnabledFlag' ]; @@ -221,6 +231,42 @@ public function getModelName(): string return self::$openAPIModelName; } + const DISCOUNT_TYPE_PERCENTAGE = 'percentage'; + const DISCOUNT_TYPE_AMOUNT = 'amount'; + const TAX_METHOD_EXCLUSIVE = 'exclusive'; + const TAX_METHOD_INCLUSIVE = 'inclusive'; + const TAX_METHOD_NONE = 'none'; + + /** + * Gets allowable values of the enum + * + * @phpstan-return array + * @phpsalm-return array + * @return (string|int)[] + */ + public function getDiscountTypeAllowableValues(): array + { + return [ + self::DISCOUNT_TYPE_PERCENTAGE, + self::DISCOUNT_TYPE_AMOUNT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @phpstan-return array + * @phpsalm-return array + * @return (string|int)[] + */ + public function getTaxMethodAllowableValues(): array + { + return [ + self::TAX_METHOD_EXCLUSIVE, + self::TAX_METHOD_INCLUSIVE, + self::TAX_METHOD_NONE, + ]; + } /** * Associative array for storing property values @@ -244,12 +290,14 @@ public function __construct(array $data = null) $this->container['product_id'] = $data['product_id'] ?? null; $this->container['item_price'] = $data['item_price'] ?? null; $this->container['quantity'] = $data['quantity'] ?? null; - $this->container['discount_percentage'] = $data['discount_percentage'] ?? 0; + $this->container['discount'] = $data['discount'] ?? 0; + $this->container['discount_type'] = $data['discount_type'] ?? 'percentage'; $this->container['duration'] = $data['duration'] ?? 1; $this->container['duration_unit'] = $data['duration_unit'] ?? null; $this->container['product_variation_id'] = $data['product_variation_id'] ?? null; $this->container['comments'] = $data['comments'] ?? null; $this->container['tax'] = $data['tax'] ?? 0; + $this->container['tax_method'] = $data['tax_method'] ?? null; $this->container['enabled_flag'] = $data['enabled_flag'] ?? true; } @@ -264,6 +312,24 @@ public function listInvalidProperties(): array { $invalidProperties = []; + $allowedValues = $this->getDiscountTypeAllowableValues(); + if (!is_null($this->container['discount_type']) && !in_array($this->container['discount_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'discount_type', must be one of '%s'", + $this->container['discount_type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getTaxMethodAllowableValues(); + if (!is_null($this->container['tax_method']) && !in_array($this->container['tax_method'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'tax_method', must be one of '%s'", + $this->container['tax_method'], + implode("', '", $allowedValues) + ); + } + return $invalidProperties; } @@ -352,25 +418,59 @@ public function setQuantity($quantity): self } /** - * Gets discount_percentage + * Gets discount * * @return float|null */ - public function getDiscountPercentage() + public function getDiscount() { - return $this->container['discount_percentage']; + return $this->container['discount']; } /** - * Sets discount_percentage + * Sets discount * - * @param float|null $discount_percentage The discount %. If omitted, will be set to 0. + * @param float|null $discount The value of the discount. The `discount_type` field can be used to specify whether the value is an amount or a percentage. * * @return self */ - public function setDiscountPercentage($discount_percentage): self + public function setDiscount($discount): self + { + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets discount_type + * + * @return string|null + */ + public function getDiscountType() { - $this->container['discount_percentage'] = $discount_percentage; + return $this->container['discount_type']; + } + + /** + * Sets discount_type + * + * @param string|null $discount_type The type of the discount's value. + * + * @return self + */ + public function setDiscountType($discount_type): self + { + $allowedValues = $this->getDiscountTypeAllowableValues(); + if (!is_null($discount_type) && !in_array($discount_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'discount_type', must be one of '%s'", + $discount_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['discount_type'] = $discount_type; return $this; } @@ -495,6 +595,40 @@ public function setTax($tax): self return $this; } + /** + * Gets tax_method + * + * @return string|null + */ + public function getTaxMethod() + { + return $this->container['tax_method']; + } + + /** + * Sets tax_method + * + * @param string|null $tax_method The tax option to be applied to the products. When using `inclusive`, the tax percentage will already be included in the price. When using `exclusive`, the tax will not be included in the price. When using `none`, no tax will be added. Use the `tax` field for defining the tax percentage amount. + * + * @return self + */ + public function setTaxMethod($tax_method): self + { + $allowedValues = $this->getTaxMethodAllowableValues(); + if (!is_null($tax_method) && !in_array($tax_method, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'tax_method', must be one of '%s'", + $tax_method, + implode("', '", $allowedValues) + ) + ); + } + $this->container['tax_method'] = $tax_method; + + return $this; + } + /** * Gets enabled_flag *