From 8b8ef86169de78222cdb23d17e18406bcc5c5d5f Mon Sep 17 00:00:00 2001 From: Phrase Date: Tue, 2 Apr 2024 15:28:53 +0000 Subject: [PATCH] Deploying from phrase/openapi@4935dac5 --- .openapi-generator/FILES | 15 + README.md | 8 + docs/KeyLink.md | 16 + docs/KeyLinksBatchDestroyParameters.md | 10 + docs/KeyLinksCreateParameters.md | 10 + docs/KeyLinksIndex400Response.md | 10 + docs/LinkedKeysApi.md | 274 +++++++++ phrase_api/__init__.py | 5 + phrase_api/api/__init__.py | 1 + phrase_api/api/linked_keys_api.py | 552 ++++++++++++++++++ phrase_api/models/__init__.py | 4 + phrase_api/models/key_link.py | 288 +++++++++ .../key_links_batch_destroy_parameters.py | 122 ++++ .../models/key_links_create_parameters.py | 122 ++++ .../models/key_links_index400_response.py | 119 ++++ test/test_key_create_parameters.py | 2 +- test/test_key_link.py | 99 ++++ ...test_key_links_batch_destroy_parameters.py | 55 ++ test/test_key_links_create_parameters.py | 55 ++ test/test_key_links_index400_response.py | 54 ++ test/test_key_update_parameters.py | 2 +- test/test_linked_keys_api.py | 60 ++ test/test_project_create_parameters.py | 2 +- test/test_project_update_parameters.py | 2 +- test/test_screenshot_update_parameters.py | 2 +- 25 files changed, 1884 insertions(+), 5 deletions(-) create mode 100644 docs/KeyLink.md create mode 100644 docs/KeyLinksBatchDestroyParameters.md create mode 100644 docs/KeyLinksCreateParameters.md create mode 100644 docs/KeyLinksIndex400Response.md create mode 100644 docs/LinkedKeysApi.md create mode 100644 phrase_api/api/linked_keys_api.py create mode 100644 phrase_api/models/key_link.py create mode 100644 phrase_api/models/key_links_batch_destroy_parameters.py create mode 100644 phrase_api/models/key_links_create_parameters.py create mode 100644 phrase_api/models/key_links_index400_response.py create mode 100644 test/test_key_link.py create mode 100644 test/test_key_links_batch_destroy_parameters.py create mode 100644 test/test_key_links_create_parameters.py create mode 100644 test/test_key_links_index400_response.py create mode 100644 test/test_linked_keys_api.py diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 0a0f605..c535db9 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -124,6 +124,10 @@ docs/JobTemplatesApi.md docs/JobUpdateParameters.md docs/JobsApi.md docs/KeyCreateParameters.md +docs/KeyLink.md +docs/KeyLinksBatchDestroyParameters.md +docs/KeyLinksCreateParameters.md +docs/KeyLinksIndex400Response.md docs/KeyPreview.md docs/KeyUpdateParameters.md docs/KeysApi.md @@ -133,6 +137,7 @@ docs/KeysIncludeParameters.md docs/KeysSearchParameters.md docs/KeysTagParameters.md docs/KeysUntagParameters.md +docs/LinkedKeysApi.md docs/Locale.md docs/LocaleCreateParameters.md docs/LocaleDetails.md @@ -294,6 +299,7 @@ phrase_api/api/job_templates_api.py phrase_api/api/jobs_api.py phrase_api/api/keys_api.py phrase_api/api/keys_figma_attachments_api.py +phrase_api/api/linked_keys_api.py phrase_api/api/locales_api.py phrase_api/api/members_api.py phrase_api/api/notification_groups_api.py @@ -419,6 +425,10 @@ phrase_api/models/job_template_preview.py phrase_api/models/job_template_update_parameters.py phrase_api/models/job_update_parameters.py phrase_api/models/key_create_parameters.py +phrase_api/models/key_link.py +phrase_api/models/key_links_batch_destroy_parameters.py +phrase_api/models/key_links_create_parameters.py +phrase_api/models/key_links_index400_response.py phrase_api/models/key_preview.py phrase_api/models/key_update_parameters.py phrase_api/models/keys_exclude_parameters.py @@ -660,6 +670,10 @@ test/test_job_templates_api.py test/test_job_update_parameters.py test/test_jobs_api.py test/test_key_create_parameters.py +test/test_key_link.py +test/test_key_links_batch_destroy_parameters.py +test/test_key_links_create_parameters.py +test/test_key_links_index400_response.py test/test_key_preview.py test/test_key_update_parameters.py test/test_keys_api.py @@ -669,6 +683,7 @@ test/test_keys_include_parameters.py test/test_keys_search_parameters.py test/test_keys_tag_parameters.py test/test_keys_untag_parameters.py +test/test_linked_keys_api.py test/test_locale.py test/test_locale_create_parameters.py test/test_locale_details.py diff --git a/README.md b/README.md index f8c5e5b..6972c7d 100644 --- a/README.md +++ b/README.md @@ -282,6 +282,10 @@ Class | Method | HTTP request | Description *KeysApi* | [**keys_untag**](docs/KeysApi.md#keys_untag) | **PATCH** /projects/{project_id}/keys/untag | Remove tags from collection of keys *KeysFigmaAttachmentsApi* | [**figma_attachment_attach_to_key**](docs/KeysFigmaAttachmentsApi.md#figma_attachment_attach_to_key) | **POST** /projects/{project_id}/figma_attachments/{figma_attachment_id}/keys | Attach the Figma attachment to a key *KeysFigmaAttachmentsApi* | [**figma_attachment_detach_from_key**](docs/KeysFigmaAttachmentsApi.md#figma_attachment_detach_from_key) | **DELETE** /projects/{project_id}/figma_attachments/{figma_attachment_id}/keys/{id} | Detach the Figma attachment from a key +*LinkedKeysApi* | [**key_links_batch_destroy**](docs/LinkedKeysApi.md#key_links_batch_destroy) | **DELETE** /projects/{project_id}/keys/{id}/key_links | Batch unlink child keys from a parent key +*LinkedKeysApi* | [**key_links_create**](docs/LinkedKeysApi.md#key_links_create) | **POST** /projects/{project_id}/keys/{id}/key_links | Link child keys to a parent key +*LinkedKeysApi* | [**key_links_destroy**](docs/LinkedKeysApi.md#key_links_destroy) | **DELETE** /projects/{project_id}/keys/{id}/key_links/{child_key_id} | Unlink a child key from a parent key +*LinkedKeysApi* | [**key_links_index**](docs/LinkedKeysApi.md#key_links_index) | **GET** /projects/{project_id}/keys/{id}/key_links | Retrieve all child keys linked to a specific parent key *LocalesApi* | [**account_locales**](docs/LocalesApi.md#account_locales) | **GET** /accounts/{id}/locales | List locales used in account *LocalesApi* | [**locale_create**](docs/LocalesApi.md#locale_create) | **POST** /projects/{project_id}/locales | Create a locale *LocalesApi* | [**locale_delete**](docs/LocalesApi.md#locale_delete) | **DELETE** /projects/{project_id}/locales/{id} | Delete a locale @@ -504,6 +508,10 @@ Class | Method | HTTP request | Description - [JobTemplateUpdateParameters](docs/JobTemplateUpdateParameters.md) - [JobUpdateParameters](docs/JobUpdateParameters.md) - [KeyCreateParameters](docs/KeyCreateParameters.md) + - [KeyLink](docs/KeyLink.md) + - [KeyLinksBatchDestroyParameters](docs/KeyLinksBatchDestroyParameters.md) + - [KeyLinksCreateParameters](docs/KeyLinksCreateParameters.md) + - [KeyLinksIndex400Response](docs/KeyLinksIndex400Response.md) - [KeyPreview](docs/KeyPreview.md) - [KeyUpdateParameters](docs/KeyUpdateParameters.md) - [KeysExcludeParameters](docs/KeysExcludeParameters.md) diff --git a/docs/KeyLink.md b/docs/KeyLink.md new file mode 100644 index 0000000..1f068d1 --- /dev/null +++ b/docs/KeyLink.md @@ -0,0 +1,16 @@ +# KeyLink + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**created_at** | **datetime** | The timestamp when the link was created. | +**updated_at** | **datetime** | The timestamp when the link was last updated. | +**created_by** | [**UserPreview**](UserPreview.md) | | +**updated_by** | [**UserPreview**](UserPreview.md) | | +**account** | [**Account**](Account.md) | | +**parent** | [**KeyPreview**](KeyPreview.md) | | +**children** | [**List[KeyPreview]**](KeyPreview.md) | The child translation keys linked to the parent. | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/KeyLinksBatchDestroyParameters.md b/docs/KeyLinksBatchDestroyParameters.md new file mode 100644 index 0000000..658c146 --- /dev/null +++ b/docs/KeyLinksBatchDestroyParameters.md @@ -0,0 +1,10 @@ +# KeyLinksBatchDestroyParameters + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**child_key_ids** | **List[str]** | The IDs of the child keys to unlink from the parent key. | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/KeyLinksCreateParameters.md b/docs/KeyLinksCreateParameters.md new file mode 100644 index 0000000..324f130 --- /dev/null +++ b/docs/KeyLinksCreateParameters.md @@ -0,0 +1,10 @@ +# KeyLinksCreateParameters + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**child_key_ids** | **List[str]** | The IDs of the child keys to link to the parent key. Can be left empty, to only mark the given translation-key as parent | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/KeyLinksIndex400Response.md b/docs/KeyLinksIndex400Response.md new file mode 100644 index 0000000..d09980e --- /dev/null +++ b/docs/KeyLinksIndex400Response.md @@ -0,0 +1,10 @@ +# KeyLinksIndex400Response + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **str** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/LinkedKeysApi.md b/docs/LinkedKeysApi.md new file mode 100644 index 0000000..60f19e4 --- /dev/null +++ b/docs/LinkedKeysApi.md @@ -0,0 +1,274 @@ +# phrase_api.LinkedKeysApi + +All URIs are relative to *https://api.phrase.com/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**key_links_batch_destroy**](LinkedKeysApi.md#key_links_batch_destroy) | **DELETE** /projects/{project_id}/keys/{id}/key_links | Batch unlink child keys from a parent key +[**key_links_create**](LinkedKeysApi.md#key_links_create) | **POST** /projects/{project_id}/keys/{id}/key_links | Link child keys to a parent key +[**key_links_destroy**](LinkedKeysApi.md#key_links_destroy) | **DELETE** /projects/{project_id}/keys/{id}/key_links/{child_key_id} | Unlink a child key from a parent key +[**key_links_index**](LinkedKeysApi.md#key_links_index) | **GET** /projects/{project_id}/keys/{id}/key_links | Retrieve all child keys linked to a specific parent key + + +# **key_links_batch_destroy** +> key_links_batch_destroy(account_id, key_links_batch_destroy_parameters, x_phrase_app_otp=x_phrase_app_otp, unlink_parent=unlink_parent) + +Batch unlink child keys from a parent key + +Unlinks multiple child keys from a given parent key in a single operation. + +### Example + +```python +from __future__ import print_function +import time +import phrase_api +from phrase_api.rest import ApiException +from pprint import pprint + +configuration = phrase_api.Configuration() +configuration.api_key['Authorization'] = 'YOUR_API_KEY' +configuration.api_key_prefix['Authorization'] = 'token' + +# Enter a context with an instance of the API client +with phrase_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = phrase_api.LinkedKeysApi(api_client) + account_id = 'account_id_example' # str | Account ID (required) + key_links_batch_destroy_parameters = phrase_api.KeyLinksBatchDestroyParameters() # KeyLinksBatchDestroyParameters | (required) + x_phrase_app_otp = 'x_phrase_app_otp_example' # str | Two-Factor-Authentication token (optional) + unlink_parent = True # bool | Whether to unlink the parent key as well and unmark it as linked-key. + + try: + # Batch unlink child keys from a parent key + api_instance.key_links_batch_destroy(account_id, key_links_batch_destroy_parameters, x_phrase_app_otp=x_phrase_app_otp, unlink_parent=unlink_parent) + except ApiException as e: + print("Exception when calling LinkedKeysApi->key_links_batch_destroy: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **str**| Account ID | + **key_links_batch_destroy_parameters** | [**KeyLinksBatchDestroyParameters**](KeyLinksBatchDestroyParameters.md)| | + **x_phrase_app_otp** | **str**| Two-Factor-Authentication token (optional) | [optional] + **unlink_parent** | **bool**| Whether to unlink the parent key as well and unmark it as linked-key. | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**422** | Unprocessable entity | * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
| + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **key_links_create** +> KeyLink key_links_create(account_id, key_links_create_parameters, x_phrase_app_otp=x_phrase_app_otp) + +Link child keys to a parent key + +Creates links between a given parent key and one or more child keys. + +### Example + +```python +from __future__ import print_function +import time +import phrase_api +from phrase_api.rest import ApiException +from pprint import pprint + +configuration = phrase_api.Configuration() +configuration.api_key['Authorization'] = 'YOUR_API_KEY' +configuration.api_key_prefix['Authorization'] = 'token' + +# Enter a context with an instance of the API client +with phrase_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = phrase_api.LinkedKeysApi(api_client) + account_id = 'account_id_example' # str | Account ID (required) + key_links_create_parameters = phrase_api.KeyLinksCreateParameters() # KeyLinksCreateParameters | (required) + x_phrase_app_otp = 'x_phrase_app_otp_example' # str | Two-Factor-Authentication token (optional) + + try: + # Link child keys to a parent key + api_response = api_instance.key_links_create(account_id, key_links_create_parameters, x_phrase_app_otp=x_phrase_app_otp) + pprint(api_response) + except ApiException as e: + print("Exception when calling LinkedKeysApi->key_links_create: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **str**| Account ID | + **key_links_create_parameters** | [**KeyLinksCreateParameters**](KeyLinksCreateParameters.md)| | + **x_phrase_app_otp** | **str**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +[**KeyLink**](KeyLink.md) + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**201** | Created | - | +**422** | Unprocessable entity | * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
| + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **key_links_destroy** +> key_links_destroy(account_id, child_key_id, x_phrase_app_otp=x_phrase_app_otp) + +Unlink a child key from a parent key + +Unlinks a single child key from a given parent key. + +### Example + +```python +from __future__ import print_function +import time +import phrase_api +from phrase_api.rest import ApiException +from pprint import pprint + +configuration = phrase_api.Configuration() +configuration.api_key['Authorization'] = 'YOUR_API_KEY' +configuration.api_key_prefix['Authorization'] = 'token' + +# Enter a context with an instance of the API client +with phrase_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = phrase_api.LinkedKeysApi(api_client) + account_id = 'account_id_example' # str | Account ID (required) + child_key_id = 'child_key_id_example' # str | The ID of the child key to unlink. (required) + x_phrase_app_otp = 'x_phrase_app_otp_example' # str | Two-Factor-Authentication token (optional) + + try: + # Unlink a child key from a parent key + api_instance.key_links_destroy(account_id, child_key_id, x_phrase_app_otp=x_phrase_app_otp) + except ApiException as e: + print("Exception when calling LinkedKeysApi->key_links_destroy: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **str**| Account ID | + **child_key_id** | **str**| The ID of the child key to unlink. | + **x_phrase_app_otp** | **str**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**422** | Unprocessable entity | * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
| + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **key_links_index** +> KeyLink key_links_index(account_id, x_phrase_app_otp=x_phrase_app_otp) + +Retrieve all child keys linked to a specific parent key + +Returns detailed information about a parent key, including its linked child keys. + +### Example + +```python +from __future__ import print_function +import time +import phrase_api +from phrase_api.rest import ApiException +from pprint import pprint + +configuration = phrase_api.Configuration() +configuration.api_key['Authorization'] = 'YOUR_API_KEY' +configuration.api_key_prefix['Authorization'] = 'token' + +# Enter a context with an instance of the API client +with phrase_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = phrase_api.LinkedKeysApi(api_client) + account_id = 'account_id_example' # str | Account ID (required) + x_phrase_app_otp = 'x_phrase_app_otp_example' # str | Two-Factor-Authentication token (optional) + + try: + # Retrieve all child keys linked to a specific parent key + api_response = api_instance.key_links_index(account_id, x_phrase_app_otp=x_phrase_app_otp) + pprint(api_response) + except ApiException as e: + print("Exception when calling LinkedKeysApi->key_links_index: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **str**| Account ID | + **x_phrase_app_otp** | **str**| Two-Factor-Authentication token (optional) | [optional] + +### Return type + +[**KeyLink**](KeyLink.md) + +### Authorization + +[Basic](../README.md#Basic), [Token](../README.md#Token) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**400** | Bad Request | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/phrase_api/__init__.py b/phrase_api/__init__.py index 57b6137..f57896b 100644 --- a/phrase_api/__init__.py +++ b/phrase_api/__init__.py @@ -43,6 +43,7 @@ from phrase_api.api.jobs_api import JobsApi from phrase_api.api.keys_api import KeysApi from phrase_api.api.keys_figma_attachments_api import KeysFigmaAttachmentsApi +from phrase_api.api.linked_keys_api import LinkedKeysApi from phrase_api.api.locales_api import LocalesApi from phrase_api.api.members_api import MembersApi from phrase_api.api.notification_groups_api import NotificationGroupsApi @@ -173,6 +174,10 @@ from phrase_api.models.job_template_update_parameters import JobTemplateUpdateParameters from phrase_api.models.job_update_parameters import JobUpdateParameters from phrase_api.models.key_create_parameters import KeyCreateParameters +from phrase_api.models.key_link import KeyLink +from phrase_api.models.key_links_batch_destroy_parameters import KeyLinksBatchDestroyParameters +from phrase_api.models.key_links_create_parameters import KeyLinksCreateParameters +from phrase_api.models.key_links_index400_response import KeyLinksIndex400Response from phrase_api.models.key_preview import KeyPreview from phrase_api.models.key_update_parameters import KeyUpdateParameters from phrase_api.models.keys_exclude_parameters import KeysExcludeParameters diff --git a/phrase_api/api/__init__.py b/phrase_api/api/__init__.py index 5f28531..db767a4 100644 --- a/phrase_api/api/__init__.py +++ b/phrase_api/api/__init__.py @@ -30,6 +30,7 @@ from phrase_api.api.jobs_api import JobsApi from phrase_api.api.keys_api import KeysApi from phrase_api.api.keys_figma_attachments_api import KeysFigmaAttachmentsApi +from phrase_api.api.linked_keys_api import LinkedKeysApi from phrase_api.api.locales_api import LocalesApi from phrase_api.api.members_api import MembersApi from phrase_api.api.notification_groups_api import NotificationGroupsApi diff --git a/phrase_api/api/linked_keys_api.py b/phrase_api/api/linked_keys_api.py new file mode 100644 index 0000000..d92bef7 --- /dev/null +++ b/phrase_api/api/linked_keys_api.py @@ -0,0 +1,552 @@ +# coding: utf-8 + +""" + Phrase Strings API Reference + + The version of the OpenAPI document: 2.0.0 + Contact: support@phrase.com + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from phrase_api.api_client import ApiClient +from phrase_api.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +class LinkedKeysApi(object): + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def key_links_batch_destroy(self, account_id, key_links_batch_destroy_parameters, **kwargs): # noqa: E501 + """Batch unlink child keys from a parent key # noqa: E501 + + Unlinks multiple child keys from a given parent key in a single operation. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.key_links_batch_destroy(account_id, key_links_batch_destroy_parameters, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str account_id: Account ID (required) + :param KeyLinksBatchDestroyParameters key_links_batch_destroy_parameters: (required) + :param str x_phrase_app_otp: Two-Factor-Authentication token (optional) + :param bool unlink_parent: Whether to unlink the parent key as well and unmark it as linked-key. + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.key_links_batch_destroy_with_http_info(account_id, key_links_batch_destroy_parameters, **kwargs) # noqa: E501 + + def key_links_batch_destroy_with_http_info(self, account_id, key_links_batch_destroy_parameters, **kwargs): # noqa: E501 + """Batch unlink child keys from a parent key # noqa: E501 + + Unlinks multiple child keys from a given parent key in a single operation. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.key_links_batch_destroy_with_http_info(account_id, key_links_batch_destroy_parameters, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str account_id: Account ID (required) + :param KeyLinksBatchDestroyParameters key_links_batch_destroy_parameters: (required) + :param str x_phrase_app_otp: Two-Factor-Authentication token (optional) + :param bool unlink_parent: Whether to unlink the parent key as well and unmark it as linked-key. + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = [ + 'account_id', + 'key_links_batch_destroy_parameters', + 'x_phrase_app_otp', + 'unlink_parent' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method key_links_batch_destroy" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'account_id' is set + if self.api_client.client_side_validation and ('account_id' not in local_var_params or # noqa: E501 + local_var_params['account_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `account_id` when calling `key_links_batch_destroy`") # noqa: E501 + # verify the required parameter 'key_links_batch_destroy_parameters' is set + if self.api_client.client_side_validation and ('key_links_batch_destroy_parameters' not in local_var_params or # noqa: E501 + local_var_params['key_links_batch_destroy_parameters'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `key_links_batch_destroy_parameters` when calling `key_links_batch_destroy`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'account_id' in local_var_params: + path_params['account_id'] = local_var_params['account_id'] # noqa: E501 + + query_params = [] + if 'unlink_parent' in local_var_params and local_var_params['unlink_parent'] is not None: # noqa: E501 + query_params.append(('unlink_parent', local_var_params['unlink_parent'])) # noqa: E501 + + header_params = {} + if 'x_phrase_app_otp' in local_var_params: + header_params['X-PhraseApp-OTP'] = local_var_params['x_phrase_app_otp'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'key_links_batch_destroy_parameters' in local_var_params: + body_params = local_var_params['key_links_batch_destroy_parameters'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['Basic', 'Token'] # noqa: E501 + + return self.api_client.call_api( + '/projects/{project_id}/keys/{id}/key_links', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats) + + def key_links_create(self, account_id, key_links_create_parameters, **kwargs): # noqa: E501 + """Link child keys to a parent key # noqa: E501 + + Creates links between a given parent key and one or more child keys. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.key_links_create(account_id, key_links_create_parameters, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str account_id: Account ID (required) + :param KeyLinksCreateParameters key_links_create_parameters: (required) + :param str x_phrase_app_otp: Two-Factor-Authentication token (optional) + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: KeyLink + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.key_links_create_with_http_info(account_id, key_links_create_parameters, **kwargs) # noqa: E501 + + def key_links_create_with_http_info(self, account_id, key_links_create_parameters, **kwargs): # noqa: E501 + """Link child keys to a parent key # noqa: E501 + + Creates links between a given parent key and one or more child keys. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.key_links_create_with_http_info(account_id, key_links_create_parameters, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str account_id: Account ID (required) + :param KeyLinksCreateParameters key_links_create_parameters: (required) + :param str x_phrase_app_otp: Two-Factor-Authentication token (optional) + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: tuple(KeyLink, status_code(int), headers(HTTPHeaderDict)) + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = [ + 'account_id', + 'key_links_create_parameters', + 'x_phrase_app_otp' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method key_links_create" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'account_id' is set + if self.api_client.client_side_validation and ('account_id' not in local_var_params or # noqa: E501 + local_var_params['account_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `account_id` when calling `key_links_create`") # noqa: E501 + # verify the required parameter 'key_links_create_parameters' is set + if self.api_client.client_side_validation and ('key_links_create_parameters' not in local_var_params or # noqa: E501 + local_var_params['key_links_create_parameters'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `key_links_create_parameters` when calling `key_links_create`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'account_id' in local_var_params: + path_params['account_id'] = local_var_params['account_id'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'x_phrase_app_otp' in local_var_params: + header_params['X-PhraseApp-OTP'] = local_var_params['x_phrase_app_otp'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'key_links_create_parameters' in local_var_params: + body_params = local_var_params['key_links_create_parameters'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['Basic', 'Token'] # noqa: E501 + + return self.api_client.call_api( + '/projects/{project_id}/keys/{id}/key_links', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='KeyLink', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats) + + def key_links_destroy(self, account_id, child_key_id, **kwargs): # noqa: E501 + """Unlink a child key from a parent key # noqa: E501 + + Unlinks a single child key from a given parent key. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.key_links_destroy(account_id, child_key_id, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str account_id: Account ID (required) + :param str child_key_id: The ID of the child key to unlink. (required) + :param str x_phrase_app_otp: Two-Factor-Authentication token (optional) + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.key_links_destroy_with_http_info(account_id, child_key_id, **kwargs) # noqa: E501 + + def key_links_destroy_with_http_info(self, account_id, child_key_id, **kwargs): # noqa: E501 + """Unlink a child key from a parent key # noqa: E501 + + Unlinks a single child key from a given parent key. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.key_links_destroy_with_http_info(account_id, child_key_id, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str account_id: Account ID (required) + :param str child_key_id: The ID of the child key to unlink. (required) + :param str x_phrase_app_otp: Two-Factor-Authentication token (optional) + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = [ + 'account_id', + 'child_key_id', + 'x_phrase_app_otp' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method key_links_destroy" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'account_id' is set + if self.api_client.client_side_validation and ('account_id' not in local_var_params or # noqa: E501 + local_var_params['account_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `account_id` when calling `key_links_destroy`") # noqa: E501 + # verify the required parameter 'child_key_id' is set + if self.api_client.client_side_validation and ('child_key_id' not in local_var_params or # noqa: E501 + local_var_params['child_key_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `child_key_id` when calling `key_links_destroy`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'account_id' in local_var_params: + path_params['account_id'] = local_var_params['account_id'] # noqa: E501 + if 'child_key_id' in local_var_params: + path_params['child_key_id'] = local_var_params['child_key_id'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'x_phrase_app_otp' in local_var_params: + header_params['X-PhraseApp-OTP'] = local_var_params['x_phrase_app_otp'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['Basic', 'Token'] # noqa: E501 + + return self.api_client.call_api( + '/projects/{project_id}/keys/{id}/key_links/{child_key_id}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats) + + def key_links_index(self, account_id, **kwargs): # noqa: E501 + """Retrieve all child keys linked to a specific parent key # noqa: E501 + + Returns detailed information about a parent key, including its linked child keys. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.key_links_index(account_id, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str account_id: Account ID (required) + :param str x_phrase_app_otp: Two-Factor-Authentication token (optional) + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: KeyLink + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.key_links_index_with_http_info(account_id, **kwargs) # noqa: E501 + + def key_links_index_with_http_info(self, account_id, **kwargs): # noqa: E501 + """Retrieve all child keys linked to a specific parent key # noqa: E501 + + Returns detailed information about a parent key, including its linked child keys. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.key_links_index_with_http_info(account_id, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str account_id: Account ID (required) + :param str x_phrase_app_otp: Two-Factor-Authentication token (optional) + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: tuple(KeyLink, status_code(int), headers(HTTPHeaderDict)) + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = [ + 'account_id', + 'x_phrase_app_otp' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method key_links_index" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'account_id' is set + if self.api_client.client_side_validation and ('account_id' not in local_var_params or # noqa: E501 + local_var_params['account_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `account_id` when calling `key_links_index`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'account_id' in local_var_params: + path_params['account_id'] = local_var_params['account_id'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'x_phrase_app_otp' in local_var_params: + header_params['X-PhraseApp-OTP'] = local_var_params['x_phrase_app_otp'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['Basic', 'Token'] # noqa: E501 + + return self.api_client.call_api( + '/projects/{project_id}/keys/{id}/key_links', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='KeyLink', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/phrase_api/models/__init__.py b/phrase_api/models/__init__.py index 016024e..4384f6a 100644 --- a/phrase_api/models/__init__.py +++ b/phrase_api/models/__init__.py @@ -108,6 +108,10 @@ from phrase_api.models.job_template_update_parameters import JobTemplateUpdateParameters from phrase_api.models.job_update_parameters import JobUpdateParameters from phrase_api.models.key_create_parameters import KeyCreateParameters +from phrase_api.models.key_link import KeyLink +from phrase_api.models.key_links_batch_destroy_parameters import KeyLinksBatchDestroyParameters +from phrase_api.models.key_links_create_parameters import KeyLinksCreateParameters +from phrase_api.models.key_links_index400_response import KeyLinksIndex400Response from phrase_api.models.key_preview import KeyPreview from phrase_api.models.key_update_parameters import KeyUpdateParameters from phrase_api.models.keys_exclude_parameters import KeysExcludeParameters diff --git a/phrase_api/models/key_link.py b/phrase_api/models/key_link.py new file mode 100644 index 0000000..eb51266 --- /dev/null +++ b/phrase_api/models/key_link.py @@ -0,0 +1,288 @@ +# coding: utf-8 + +""" + Phrase Strings API Reference + + The version of the OpenAPI document: 2.0.0 + Contact: support@phrase.com + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + +from phrase_api.configuration import Configuration + + +class KeyLink(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'created_at': 'datetime', + 'updated_at': 'datetime', + 'created_by': 'UserPreview', + 'updated_by': 'UserPreview', + 'account': 'Account', + 'parent': 'KeyPreview', + 'children': 'List[KeyPreview]' + } + + attribute_map = { + 'created_at': 'created_at', + 'updated_at': 'updated_at', + 'created_by': 'created_by', + 'updated_by': 'updated_by', + 'account': 'account', + 'parent': 'parent', + 'children': 'children' + } + + def __init__(self, created_at=None, updated_at=None, created_by=None, updated_by=None, account=None, parent=None, children=None, local_vars_configuration=None): # noqa: E501 + """KeyLink - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration() + self.local_vars_configuration = local_vars_configuration + + self._created_at = None + self._updated_at = None + self._created_by = None + self._updated_by = None + self._account = None + self._parent = None + self._children = None + self.discriminator = None + + self.created_at = created_at + self.updated_at = updated_at + self.created_by = created_by + self.updated_by = updated_by + self.account = account + self.parent = parent + self.children = children + + @property + def created_at(self): + """Gets the created_at of this KeyLink. # noqa: E501 + + The timestamp when the link was created. # noqa: E501 + + :return: The created_at of this KeyLink. # noqa: E501 + :rtype: datetime + """ + return self._created_at + + @created_at.setter + def created_at(self, created_at): + """Sets the created_at of this KeyLink. + + The timestamp when the link was created. # noqa: E501 + + :param created_at: The created_at of this KeyLink. # noqa: E501 + :type: datetime + """ + if self.local_vars_configuration.client_side_validation and created_at is None: # noqa: E501 + raise ValueError("Invalid value for `created_at`, must not be `None`") # noqa: E501 + + self._created_at = created_at + + @property + def updated_at(self): + """Gets the updated_at of this KeyLink. # noqa: E501 + + The timestamp when the link was last updated. # noqa: E501 + + :return: The updated_at of this KeyLink. # noqa: E501 + :rtype: datetime + """ + return self._updated_at + + @updated_at.setter + def updated_at(self, updated_at): + """Sets the updated_at of this KeyLink. + + The timestamp when the link was last updated. # noqa: E501 + + :param updated_at: The updated_at of this KeyLink. # noqa: E501 + :type: datetime + """ + if self.local_vars_configuration.client_side_validation and updated_at is None: # noqa: E501 + raise ValueError("Invalid value for `updated_at`, must not be `None`") # noqa: E501 + + self._updated_at = updated_at + + @property + def created_by(self): + """Gets the created_by of this KeyLink. # noqa: E501 + + + :return: The created_by of this KeyLink. # noqa: E501 + :rtype: UserPreview + """ + return self._created_by + + @created_by.setter + def created_by(self, created_by): + """Sets the created_by of this KeyLink. + + + :param created_by: The created_by of this KeyLink. # noqa: E501 + :type: UserPreview + """ + if self.local_vars_configuration.client_side_validation and created_by is None: # noqa: E501 + raise ValueError("Invalid value for `created_by`, must not be `None`") # noqa: E501 + + self._created_by = created_by + + @property + def updated_by(self): + """Gets the updated_by of this KeyLink. # noqa: E501 + + + :return: The updated_by of this KeyLink. # noqa: E501 + :rtype: UserPreview + """ + return self._updated_by + + @updated_by.setter + def updated_by(self, updated_by): + """Sets the updated_by of this KeyLink. + + + :param updated_by: The updated_by of this KeyLink. # noqa: E501 + :type: UserPreview + """ + if self.local_vars_configuration.client_side_validation and updated_by is None: # noqa: E501 + raise ValueError("Invalid value for `updated_by`, must not be `None`") # noqa: E501 + + self._updated_by = updated_by + + @property + def account(self): + """Gets the account of this KeyLink. # noqa: E501 + + + :return: The account of this KeyLink. # noqa: E501 + :rtype: Account + """ + return self._account + + @account.setter + def account(self, account): + """Sets the account of this KeyLink. + + + :param account: The account of this KeyLink. # noqa: E501 + :type: Account + """ + if self.local_vars_configuration.client_side_validation and account is None: # noqa: E501 + raise ValueError("Invalid value for `account`, must not be `None`") # noqa: E501 + + self._account = account + + @property + def parent(self): + """Gets the parent of this KeyLink. # noqa: E501 + + + :return: The parent of this KeyLink. # noqa: E501 + :rtype: KeyPreview + """ + return self._parent + + @parent.setter + def parent(self, parent): + """Sets the parent of this KeyLink. + + + :param parent: The parent of this KeyLink. # noqa: E501 + :type: KeyPreview + """ + if self.local_vars_configuration.client_side_validation and parent is None: # noqa: E501 + raise ValueError("Invalid value for `parent`, must not be `None`") # noqa: E501 + + self._parent = parent + + @property + def children(self): + """Gets the children of this KeyLink. # noqa: E501 + + The child translation keys linked to the parent. # noqa: E501 + + :return: The children of this KeyLink. # noqa: E501 + :rtype: List[KeyPreview] + """ + return self._children + + @children.setter + def children(self, children): + """Sets the children of this KeyLink. + + The child translation keys linked to the parent. # noqa: E501 + + :param children: The children of this KeyLink. # noqa: E501 + :type: List[KeyPreview] + """ + if self.local_vars_configuration.client_side_validation and children is None: # noqa: E501 + raise ValueError("Invalid value for `children`, must not be `None`") # noqa: E501 + + self._children = children + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, KeyLink): + return False + + return self.to_dict() == other.to_dict() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + if not isinstance(other, KeyLink): + return True + + return self.to_dict() != other.to_dict() diff --git a/phrase_api/models/key_links_batch_destroy_parameters.py b/phrase_api/models/key_links_batch_destroy_parameters.py new file mode 100644 index 0000000..910bfe7 --- /dev/null +++ b/phrase_api/models/key_links_batch_destroy_parameters.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Phrase Strings API Reference + + The version of the OpenAPI document: 2.0.0 + Contact: support@phrase.com + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + +from phrase_api.configuration import Configuration + + +class KeyLinksBatchDestroyParameters(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'child_key_ids': 'List[str]' + } + + attribute_map = { + 'child_key_ids': 'child_key_ids' + } + + def __init__(self, child_key_ids=None, local_vars_configuration=None): # noqa: E501 + """KeyLinksBatchDestroyParameters - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration() + self.local_vars_configuration = local_vars_configuration + + self._child_key_ids = None + self.discriminator = None + + self.child_key_ids = child_key_ids + + @property + def child_key_ids(self): + """Gets the child_key_ids of this KeyLinksBatchDestroyParameters. # noqa: E501 + + The IDs of the child keys to unlink from the parent key. # noqa: E501 + + :return: The child_key_ids of this KeyLinksBatchDestroyParameters. # noqa: E501 + :rtype: List[str] + """ + return self._child_key_ids + + @child_key_ids.setter + def child_key_ids(self, child_key_ids): + """Sets the child_key_ids of this KeyLinksBatchDestroyParameters. + + The IDs of the child keys to unlink from the parent key. # noqa: E501 + + :param child_key_ids: The child_key_ids of this KeyLinksBatchDestroyParameters. # noqa: E501 + :type: List[str] + """ + if self.local_vars_configuration.client_side_validation and child_key_ids is None: # noqa: E501 + raise ValueError("Invalid value for `child_key_ids`, must not be `None`") # noqa: E501 + + self._child_key_ids = child_key_ids + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, KeyLinksBatchDestroyParameters): + return False + + return self.to_dict() == other.to_dict() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + if not isinstance(other, KeyLinksBatchDestroyParameters): + return True + + return self.to_dict() != other.to_dict() diff --git a/phrase_api/models/key_links_create_parameters.py b/phrase_api/models/key_links_create_parameters.py new file mode 100644 index 0000000..70e9300 --- /dev/null +++ b/phrase_api/models/key_links_create_parameters.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + Phrase Strings API Reference + + The version of the OpenAPI document: 2.0.0 + Contact: support@phrase.com + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + +from phrase_api.configuration import Configuration + + +class KeyLinksCreateParameters(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'child_key_ids': 'List[str]' + } + + attribute_map = { + 'child_key_ids': 'child_key_ids' + } + + def __init__(self, child_key_ids=None, local_vars_configuration=None): # noqa: E501 + """KeyLinksCreateParameters - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration() + self.local_vars_configuration = local_vars_configuration + + self._child_key_ids = None + self.discriminator = None + + self.child_key_ids = child_key_ids + + @property + def child_key_ids(self): + """Gets the child_key_ids of this KeyLinksCreateParameters. # noqa: E501 + + The IDs of the child keys to link to the parent key. Can be left empty, to only mark the given translation-key as parent # noqa: E501 + + :return: The child_key_ids of this KeyLinksCreateParameters. # noqa: E501 + :rtype: List[str] + """ + return self._child_key_ids + + @child_key_ids.setter + def child_key_ids(self, child_key_ids): + """Sets the child_key_ids of this KeyLinksCreateParameters. + + The IDs of the child keys to link to the parent key. Can be left empty, to only mark the given translation-key as parent # noqa: E501 + + :param child_key_ids: The child_key_ids of this KeyLinksCreateParameters. # noqa: E501 + :type: List[str] + """ + if self.local_vars_configuration.client_side_validation and child_key_ids is None: # noqa: E501 + raise ValueError("Invalid value for `child_key_ids`, must not be `None`") # noqa: E501 + + self._child_key_ids = child_key_ids + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, KeyLinksCreateParameters): + return False + + return self.to_dict() == other.to_dict() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + if not isinstance(other, KeyLinksCreateParameters): + return True + + return self.to_dict() != other.to_dict() diff --git a/phrase_api/models/key_links_index400_response.py b/phrase_api/models/key_links_index400_response.py new file mode 100644 index 0000000..8338015 --- /dev/null +++ b/phrase_api/models/key_links_index400_response.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Phrase Strings API Reference + + The version of the OpenAPI document: 2.0.0 + Contact: support@phrase.com + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + +from phrase_api.configuration import Configuration + + +class KeyLinksIndex400Response(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'message': 'str' + } + + attribute_map = { + 'message': 'message' + } + + def __init__(self, message=None, local_vars_configuration=None): # noqa: E501 + """KeyLinksIndex400Response - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration() + self.local_vars_configuration = local_vars_configuration + + self._message = None + self.discriminator = None + + if message is not None: + self.message = message + + @property + def message(self): + """Gets the message of this KeyLinksIndex400Response. # noqa: E501 + + + :return: The message of this KeyLinksIndex400Response. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this KeyLinksIndex400Response. + + + :param message: The message of this KeyLinksIndex400Response. # noqa: E501 + :type: str + """ + + self._message = message + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, KeyLinksIndex400Response): + return False + + return self.to_dict() == other.to_dict() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + if not isinstance(other, KeyLinksIndex400Response): + return True + + return self.to_dict() != other.to_dict() diff --git a/test/test_key_create_parameters.py b/test/test_key_create_parameters.py index 661cae4..63e8b5e 100644 --- a/test/test_key_create_parameters.py +++ b/test/test_key_create_parameters.py @@ -45,7 +45,7 @@ def make_instance(self, include_optional): data_type = 'number', tags = 'awesome-feature,needs-proofreading', max_characters_allowed = 140, - screenshot = '[B@53b52f30', + screenshot = '[B@40b4a59c', remove_screenshot = True, unformatted = True, default_translation_content = 'Default translation content', diff --git a/test/test_key_link.py b/test/test_key_link.py new file mode 100644 index 0000000..cc93582 --- /dev/null +++ b/test/test_key_link.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + Phrase Strings API Reference + + The version of the OpenAPI document: 2.0.0 + Contact: support@phrase.com + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import phrase_api +from phrase_api.models.key_link import KeyLink # noqa: E501 +from phrase_api.rest import ApiException + +class TestKeyLink(unittest.TestCase): + """KeyLink unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test KeyLink + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = phrase_api.models.key_link.KeyLink() # noqa: E501 + + """ + if include_optional : + return KeyLink( + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + created_by = phrase_api.models.user_preview.user_preview( + id = '', + username = '', + name = '', + gravatar_uid = '', ), + updated_by = phrase_api.models.user_preview.user_preview( + id = '', + username = '', + name = '', + gravatar_uid = '', ), + account = {"id":"abcd1234","name":"Company Account","slug":"company_account","company":"My Awesome Company","created_at":"2015-01-28T09:52:53Z","updated_at":"2015-01-28T09:52:53Z","company_logo_url":"http://assets.example.com/company_logo.png"}, + parent = phrase_api.models.key_preview.key_preview( + id = '', + name = '', + plural = True, ), + children = [ + phrase_api.models.key_preview.key_preview( + id = '', + name = '', + plural = True, ) + ] + ) + else : + return KeyLink( + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + updated_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + created_by = phrase_api.models.user_preview.user_preview( + id = '', + username = '', + name = '', + gravatar_uid = '', ), + updated_by = phrase_api.models.user_preview.user_preview( + id = '', + username = '', + name = '', + gravatar_uid = '', ), + account = {"id":"abcd1234","name":"Company Account","slug":"company_account","company":"My Awesome Company","created_at":"2015-01-28T09:52:53Z","updated_at":"2015-01-28T09:52:53Z","company_logo_url":"http://assets.example.com/company_logo.png"}, + parent = phrase_api.models.key_preview.key_preview( + id = '', + name = '', + plural = True, ), + children = [ + phrase_api.models.key_preview.key_preview( + id = '', + name = '', + plural = True, ) + ], + ) + """ + + def testKeyLink(self): + """Test KeyLink""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_key_links_batch_destroy_parameters.py b/test/test_key_links_batch_destroy_parameters.py new file mode 100644 index 0000000..5aa78c7 --- /dev/null +++ b/test/test_key_links_batch_destroy_parameters.py @@ -0,0 +1,55 @@ +# coding: utf-8 + +""" + Phrase Strings API Reference + + The version of the OpenAPI document: 2.0.0 + Contact: support@phrase.com + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import phrase_api +from phrase_api.models.key_links_batch_destroy_parameters import KeyLinksBatchDestroyParameters # noqa: E501 +from phrase_api.rest import ApiException + +class TestKeyLinksBatchDestroyParameters(unittest.TestCase): + """KeyLinksBatchDestroyParameters unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test KeyLinksBatchDestroyParameters + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = phrase_api.models.key_links_batch_destroy_parameters.KeyLinksBatchDestroyParameters() # noqa: E501 + + """ + if include_optional : + return KeyLinksBatchDestroyParameters( + child_key_ids = ["child_key_id1","child_key_id2"] + ) + else : + return KeyLinksBatchDestroyParameters( + child_key_ids = ["child_key_id1","child_key_id2"], + ) + """ + + def testKeyLinksBatchDestroyParameters(self): + """Test KeyLinksBatchDestroyParameters""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_key_links_create_parameters.py b/test/test_key_links_create_parameters.py new file mode 100644 index 0000000..163da6f --- /dev/null +++ b/test/test_key_links_create_parameters.py @@ -0,0 +1,55 @@ +# coding: utf-8 + +""" + Phrase Strings API Reference + + The version of the OpenAPI document: 2.0.0 + Contact: support@phrase.com + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import phrase_api +from phrase_api.models.key_links_create_parameters import KeyLinksCreateParameters # noqa: E501 +from phrase_api.rest import ApiException + +class TestKeyLinksCreateParameters(unittest.TestCase): + """KeyLinksCreateParameters unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test KeyLinksCreateParameters + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = phrase_api.models.key_links_create_parameters.KeyLinksCreateParameters() # noqa: E501 + + """ + if include_optional : + return KeyLinksCreateParameters( + child_key_ids = ["child_key_id1","child_key_id2"] + ) + else : + return KeyLinksCreateParameters( + child_key_ids = ["child_key_id1","child_key_id2"], + ) + """ + + def testKeyLinksCreateParameters(self): + """Test KeyLinksCreateParameters""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_key_links_index400_response.py b/test/test_key_links_index400_response.py new file mode 100644 index 0000000..676007d --- /dev/null +++ b/test/test_key_links_index400_response.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + Phrase Strings API Reference + + The version of the OpenAPI document: 2.0.0 + Contact: support@phrase.com + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import phrase_api +from phrase_api.models.key_links_index400_response import KeyLinksIndex400Response # noqa: E501 +from phrase_api.rest import ApiException + +class TestKeyLinksIndex400Response(unittest.TestCase): + """KeyLinksIndex400Response unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test KeyLinksIndex400Response + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = phrase_api.models.key_links_index400_response.KeyLinksIndex400Response() # noqa: E501 + + """ + if include_optional : + return KeyLinksIndex400Response( + message = '' + ) + else : + return KeyLinksIndex400Response( + ) + """ + + def testKeyLinksIndex400Response(self): + """Test KeyLinksIndex400Response""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_key_update_parameters.py b/test/test_key_update_parameters.py index f5f59d2..29a9ced 100644 --- a/test/test_key_update_parameters.py +++ b/test/test_key_update_parameters.py @@ -45,7 +45,7 @@ def make_instance(self, include_optional): data_type = 'number', tags = 'awesome-feature,needs-proofreading', max_characters_allowed = 140, - screenshot = '[B@1b250e51', + screenshot = '[B@456c528c', remove_screenshot = True, unformatted = True, xml_space_preserve = True, diff --git a/test/test_linked_keys_api.py b/test/test_linked_keys_api.py new file mode 100644 index 0000000..955d6ae --- /dev/null +++ b/test/test_linked_keys_api.py @@ -0,0 +1,60 @@ +# coding: utf-8 + +""" + Phrase Strings API Reference + + The version of the OpenAPI document: 2.0.0 + Contact: support@phrase.com + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import phrase_api +from phrase_api.api.linked_keys_api import LinkedKeysApi # noqa: E501 +from phrase_api.rest import ApiException + + +class TestLinkedKeysApi(unittest.TestCase): + """LinkedKeysApi unit test stubs""" + + def setUp(self): + self.api = phrase_api.api.linked_keys_api.LinkedKeysApi() # noqa: E501 + + def tearDown(self): + pass + + def test_key_links_batch_destroy(self): + """Test case for key_links_batch_destroy + + Batch unlink child keys from a parent key # noqa: E501 + """ + pass + + def test_key_links_create(self): + """Test case for key_links_create + + Link child keys to a parent key # noqa: E501 + """ + pass + + def test_key_links_destroy(self): + """Test case for key_links_destroy + + Unlink a child key from a parent key # noqa: E501 + """ + pass + + def test_key_links_index(self): + """Test case for key_links_index + + Retrieve all child keys linked to a specific parent key # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_project_create_parameters.py b/test/test_project_create_parameters.py index 6414ba3..16b20bd 100644 --- a/test/test_project_create_parameters.py +++ b/test/test_project_create_parameters.py @@ -41,7 +41,7 @@ def make_instance(self, include_optional): main_format = 'yml', media = 'Python', shares_translation_memory = True, - project_image = '[B@56653a4d', + project_image = '[B@7e389cd6', remove_project_image = True, account_id = 'abcd1234', point_of_contact = 'abcd1234', diff --git a/test/test_project_update_parameters.py b/test/test_project_update_parameters.py index e0dd278..c94aeaa 100644 --- a/test/test_project_update_parameters.py +++ b/test/test_project_update_parameters.py @@ -43,7 +43,7 @@ def make_instance(self, include_optional): main_format = 'yml', media = 'Python', shares_translation_memory = True, - project_image = '[B@72c743f4', + project_image = '[B@45c812b4', remove_project_image = False, workflow = 'review', machine_translation_enabled = True, diff --git a/test/test_screenshot_update_parameters.py b/test/test_screenshot_update_parameters.py index 3ac95ba..74ce2b6 100644 --- a/test/test_screenshot_update_parameters.py +++ b/test/test_screenshot_update_parameters.py @@ -40,7 +40,7 @@ def make_instance(self, include_optional): branch = 'my-feature-branch', name = 'A screenshot name', description = 'A screenshot description', - filename = '[B@2c7ddfa0' + filename = '[B@7a50482c' ) else : return ScreenshotUpdateParameters(