Skip to content

Commit 8eef2de

Browse files
author
Phrase
committed
1 parent cbeea95 commit 8eef2de

19 files changed

Lines changed: 1346 additions & 5 deletions

.openapi-generator/FILES

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ docs/OrganizationJobTemplateLocalesApi.md
180180
docs/OrganizationJobTemplateLocalesCreateParameters.md
181181
docs/OrganizationJobTemplateUpdateParameters.md
182182
docs/OrganizationJobTemplatesApi.md
183+
docs/PreTranslation.md
184+
docs/PreTranslationCreateParameters.md
185+
docs/PreTranslationsApi.md
183186
docs/Project.md
184187
docs/ProjectCreateParameters.md
185188
docs/ProjectDetails.md
@@ -333,6 +336,7 @@ phrase_api/api/notifications_api.py
333336
phrase_api/api/orders_api.py
334337
phrase_api/api/organization_job_template_locales_api.py
335338
phrase_api/api/organization_job_templates_api.py
339+
phrase_api/api/pre_translations_api.py
336340
phrase_api/api/projects_api.py
337341
phrase_api/api/quality_performance_score_api.py
338342
phrase_api/api/release_triggers_api.py
@@ -500,6 +504,8 @@ phrase_api/models/organization_job_template_details.py
500504
phrase_api/models/organization_job_template_locale_update_parameters.py
501505
phrase_api/models/organization_job_template_locales_create_parameters.py
502506
phrase_api/models/organization_job_template_update_parameters.py
507+
phrase_api/models/pre_translation.py
508+
phrase_api/models/pre_translation_create_parameters.py
503509
phrase_api/models/project.py
504510
phrase_api/models/project_create_parameters.py
505511
phrase_api/models/project_details.py
@@ -775,6 +781,9 @@ test/test_organization_job_template_locales_api.py
775781
test/test_organization_job_template_locales_create_parameters.py
776782
test/test_organization_job_template_update_parameters.py
777783
test/test_organization_job_templates_api.py
784+
test/test_pre_translation.py
785+
test/test_pre_translation_create_parameters.py
786+
test/test_pre_translations_api.py
778787
test/test_project.py
779788
test/test_project_create_parameters.py
780789
test/test_project_details.py

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,9 @@ Class | Method | HTTP request | Description
326326
*OrganizationJobTemplatesApi* | [**organization_job_template_update**](docs/OrganizationJobTemplatesApi.md#organization_job_template_update) | **PATCH** /accounts/{account_id}/job_templates/{id} | Update an organization job template
327327
*OrganizationJobTemplatesApi* | [**organization_job_templates_list**](docs/OrganizationJobTemplatesApi.md#organization_job_templates_list) | **GET** /accounts/{account_id}/job_templates | List organization job templates
328328
*OrganizationJobTemplatesApi* | [**organization_job_templates_show**](docs/OrganizationJobTemplatesApi.md#organization_job_templates_show) | **GET** /accounts/{account_id}/job_templates/{id} | Get a single organization job template
329+
*PreTranslationsApi* | [**pre_translation_create**](docs/PreTranslationsApi.md#pre_translation_create) | **POST** /projects/{project_id}/pre_translations | Create a pre-translation job
330+
*PreTranslationsApi* | [**pre_translation_show**](docs/PreTranslationsApi.md#pre_translation_show) | **GET** /projects/{project_id}/pre_translations/{id} | Get a single pre-translation job
331+
*PreTranslationsApi* | [**pre_translations_list**](docs/PreTranslationsApi.md#pre_translations_list) | **GET** /projects/{project_id}/pre_translations | List pre-translation jobs
329332
*ProjectsApi* | [**project_create**](docs/ProjectsApi.md#project_create) | **POST** /projects | Create a project
330333
*ProjectsApi* | [**project_delete**](docs/ProjectsApi.md#project_delete) | **DELETE** /projects/{id} | Delete a project
331334
*ProjectsApi* | [**project_show**](docs/ProjectsApi.md#project_show) | **GET** /projects/{id} | Get a single project
@@ -577,6 +580,8 @@ Class | Method | HTTP request | Description
577580
- [OrganizationJobTemplateLocaleUpdateParameters](docs/OrganizationJobTemplateLocaleUpdateParameters.md)
578581
- [OrganizationJobTemplateLocalesCreateParameters](docs/OrganizationJobTemplateLocalesCreateParameters.md)
579582
- [OrganizationJobTemplateUpdateParameters](docs/OrganizationJobTemplateUpdateParameters.md)
583+
- [PreTranslation](docs/PreTranslation.md)
584+
- [PreTranslationCreateParameters](docs/PreTranslationCreateParameters.md)
580585
- [Project](docs/Project.md)
581586
- [ProjectCreateParameters](docs/ProjectCreateParameters.md)
582587
- [ProjectDetails](docs/ProjectDetails.md)

docs/PreTranslation.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# PreTranslation
2+
3+
## Properties
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
6+
**id** | **str** | | [optional]
7+
**status** | **str** | Current execution state of the pre-translation job. Jobs start as `pending` while queued, transition to `running` while executing, and settle to `success` or `error`. | [optional]
8+
**translatable_type** | **str** | Resource type that was pre-translated. | [optional]
9+
**translatable_id** | **str** | ID of the targeted resource (locale ID, job ID, key ID, or upload ID). | [optional]
10+
**error** | **str** | Error message. `null` unless the job's status is `error`. | [optional]
11+
**created_at** | **datetime** | | [optional]
12+
**updated_at** | **datetime** | | [optional]
13+
14+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
15+
16+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# PreTranslationCreateParameters
2+
3+
## Properties
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
6+
**translatable_type** | **str** | Resource type to pre-translate. | [optional]
7+
**translatable_id** | **str** | ID of the targeted resource: locale ID for `locale`, job ID for `job`, key ID for `translation_key`, upload ID for `upload`. | [optional]
8+
9+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
10+
11+

docs/PreTranslationsApi.md

Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
1+
# phrase_api.PreTranslationsApi
2+
3+
All URIs are relative to *https://api.phrase.com/v2*
4+
5+
Method | HTTP request | Description
6+
------------- | ------------- | -------------
7+
[**pre_translation_create**](PreTranslationsApi.md#pre_translation_create) | **POST** /projects/{project_id}/pre_translations | Create a pre-translation job
8+
[**pre_translation_show**](PreTranslationsApi.md#pre_translation_show) | **GET** /projects/{project_id}/pre_translations/{id} | Get a single pre-translation job
9+
[**pre_translations_list**](PreTranslationsApi.md#pre_translations_list) | **GET** /projects/{project_id}/pre_translations | List pre-translation jobs
10+
11+
12+
# **pre_translation_create**
13+
> PreTranslation pre_translation_create(project_id, pre_translation_create_parameters, x_phrase_app_otp=x_phrase_app_otp)
14+
15+
Create a pre-translation job
16+
17+
Triggers a pre-translation job for a resource within a project, addressed by `translatable_type` (`locale`, `job`, `translation_key`, or `upload`) and `translatable_id` (its ID). Enqueues machine translation using the project's configured MT engine.
18+
19+
### Example
20+
21+
```python
22+
from __future__ import print_function
23+
import time
24+
import phrase_api
25+
from phrase_api.rest import ApiException
26+
from pprint import pprint
27+
28+
configuration = phrase_api.Configuration()
29+
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
30+
configuration.api_key_prefix['Authorization'] = 'token'
31+
32+
# Enter a context with an instance of the API client
33+
with phrase_api.ApiClient(configuration) as api_client:
34+
# Create an instance of the API class
35+
api_instance = phrase_api.PreTranslationsApi(api_client)
36+
project_id = 'project_id_example' # str | Project ID (required)
37+
pre_translation_create_parameters = phrase_api.PreTranslationCreateParameters() # PreTranslationCreateParameters | (required)
38+
x_phrase_app_otp = 'x_phrase_app_otp_example' # str | Two-Factor-Authentication token (optional)
39+
40+
try:
41+
# Create a pre-translation job
42+
api_response = api_instance.pre_translation_create(project_id, pre_translation_create_parameters, x_phrase_app_otp=x_phrase_app_otp)
43+
pprint(api_response)
44+
except ApiException as e:
45+
print("Exception when calling PreTranslationsApi->pre_translation_create: %s\n" % e)
46+
```
47+
48+
49+
### Parameters
50+
51+
Name | Type | Description | Notes
52+
------------- | ------------- | ------------- | -------------
53+
**project_id** | **str**| Project ID |
54+
**pre_translation_create_parameters** | [**PreTranslationCreateParameters**](PreTranslationCreateParameters.md)| |
55+
**x_phrase_app_otp** | **str**| Two-Factor-Authentication token (optional) | [optional]
56+
57+
### Return type
58+
59+
[**PreTranslation**](PreTranslation.md)
60+
61+
### Authorization
62+
63+
[Basic](../README.md#Basic), [Token](../README.md#Token)
64+
65+
### HTTP request headers
66+
67+
- **Content-Type**: application/json
68+
- **Accept**: application/json
69+
70+
### HTTP response details
71+
| Status code | Description | Response headers |
72+
|-------------|-------------|------------------|
73+
**202** | Accepted | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
74+
**400** | Bad request. The request could not be parsed or a parameter failed validation. Verify the request body, the content type, and the parameter types, then retry. | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
75+
**401** | Unauthorized. Authentication failed because the access token is missing, expired, or invalid. Supply a valid access token and retry. | - |
76+
**403** | Forbidden. The credentials are valid but not permitted for this request: the access token may lack the required scope, the user may lack permission on the resource, or the account plan may not include the feature. Use a token with the required scope on an account and user that hold the necessary permissions. | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
77+
**404** | Not found. The requested resource does not exist or is not visible to the authenticated user. Verify the identifiers in the request path and that the token has access to them, then retry. | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
78+
**422** | Unprocessable entity. The request was well-formed but failed validation. The response body lists each offending field in the &#x60;errors&#x60; array, with its resource, field, and a human-readable message. Correct the listed fields and retry. | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
79+
**429** | Too many requests. The rate limit has been exceeded. Wait until the time indicated by the &#x60;X-Rate-Limit-Reset&#x60; response header before retrying. | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
80+
81+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
82+
83+
# **pre_translation_show**
84+
> PreTranslation pre_translation_show(project_id, id, x_phrase_app_otp=x_phrase_app_otp, if_modified_since=if_modified_since, if_none_match=if_none_match)
85+
86+
Get a single pre-translation job
87+
88+
Returns a single pre-translation job identified by its ID.
89+
90+
### Example
91+
92+
```python
93+
from __future__ import print_function
94+
import time
95+
import phrase_api
96+
from phrase_api.rest import ApiException
97+
from pprint import pprint
98+
99+
configuration = phrase_api.Configuration()
100+
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
101+
configuration.api_key_prefix['Authorization'] = 'token'
102+
103+
# Enter a context with an instance of the API client
104+
with phrase_api.ApiClient(configuration) as api_client:
105+
# Create an instance of the API class
106+
api_instance = phrase_api.PreTranslationsApi(api_client)
107+
project_id = 'project_id_example' # str | Project ID (required)
108+
id = 'id_example' # str | ID (required)
109+
x_phrase_app_otp = 'x_phrase_app_otp_example' # str | Two-Factor-Authentication token (optional)
110+
if_modified_since = 'if_modified_since_example' # str | Last modified condition, see [Conditional GET requests / HTTP Caching](/en/api/strings/pagination#conditional-get-requests-%2F-http-caching) (optional)
111+
if_none_match = 'if_none_match_example' # str | ETag condition, see [Conditional GET requests / HTTP Caching](/en/api/strings/pagination#conditional-get-requests-%2F-http-caching) (optional)
112+
113+
try:
114+
# Get a single pre-translation job
115+
api_response = api_instance.pre_translation_show(project_id, id, x_phrase_app_otp=x_phrase_app_otp, if_modified_since=if_modified_since, if_none_match=if_none_match)
116+
pprint(api_response)
117+
except ApiException as e:
118+
print("Exception when calling PreTranslationsApi->pre_translation_show: %s\n" % e)
119+
```
120+
121+
122+
### Parameters
123+
124+
Name | Type | Description | Notes
125+
------------- | ------------- | ------------- | -------------
126+
**project_id** | **str**| Project ID |
127+
**id** | **str**| ID |
128+
**x_phrase_app_otp** | **str**| Two-Factor-Authentication token (optional) | [optional]
129+
**if_modified_since** | **str**| Last modified condition, see [Conditional GET requests / HTTP Caching](/en/api/strings/pagination#conditional-get-requests-%2F-http-caching) (optional) | [optional]
130+
**if_none_match** | **str**| ETag condition, see [Conditional GET requests / HTTP Caching](/en/api/strings/pagination#conditional-get-requests-%2F-http-caching) (optional) | [optional]
131+
132+
### Return type
133+
134+
[**PreTranslation**](PreTranslation.md)
135+
136+
### Authorization
137+
138+
[Basic](../README.md#Basic), [Token](../README.md#Token)
139+
140+
### HTTP request headers
141+
142+
- **Content-Type**: Not defined
143+
- **Accept**: application/json
144+
145+
### HTTP response details
146+
| Status code | Description | Response headers |
147+
|-------------|-------------|------------------|
148+
**200** | OK | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
149+
**400** | Bad request. The request could not be parsed or a parameter failed validation. Verify the request body, the content type, and the parameter types, then retry. | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
150+
**401** | Unauthorized. Authentication failed because the access token is missing, expired, or invalid. Supply a valid access token and retry. | - |
151+
**403** | Forbidden. The credentials are valid but not permitted for this request: the access token may lack the required scope, the user may lack permission on the resource, or the account plan may not include the feature. Use a token with the required scope on an account and user that hold the necessary permissions. | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
152+
**404** | Not found. The requested resource does not exist or is not visible to the authenticated user. Verify the identifiers in the request path and that the token has access to them, then retry. | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
153+
**429** | Too many requests. The rate limit has been exceeded. Wait until the time indicated by the &#x60;X-Rate-Limit-Reset&#x60; response header before retrying. | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
154+
155+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
156+
157+
# **pre_translations_list**
158+
> List[PreTranslation] pre_translations_list(project_id, x_phrase_app_otp=x_phrase_app_otp, if_modified_since=if_modified_since, if_none_match=if_none_match, page=page, per_page=per_page)
159+
160+
List pre-translation jobs
161+
162+
Returns all pre-translation jobs scoped to a project, ordered by creation date descending.
163+
164+
### Example
165+
166+
```python
167+
from __future__ import print_function
168+
import time
169+
import phrase_api
170+
from phrase_api.rest import ApiException
171+
from pprint import pprint
172+
173+
configuration = phrase_api.Configuration()
174+
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
175+
configuration.api_key_prefix['Authorization'] = 'token'
176+
177+
# Enter a context with an instance of the API client
178+
with phrase_api.ApiClient(configuration) as api_client:
179+
# Create an instance of the API class
180+
api_instance = phrase_api.PreTranslationsApi(api_client)
181+
project_id = 'project_id_example' # str | Project ID (required)
182+
x_phrase_app_otp = 'x_phrase_app_otp_example' # str | Two-Factor-Authentication token (optional)
183+
if_modified_since = 'if_modified_since_example' # str | Last modified condition, see [Conditional GET requests / HTTP Caching](/en/api/strings/pagination#conditional-get-requests-%2F-http-caching) (optional)
184+
if_none_match = 'if_none_match_example' # str | ETag condition, see [Conditional GET requests / HTTP Caching](/en/api/strings/pagination#conditional-get-requests-%2F-http-caching) (optional)
185+
page = 1 # int | Page number
186+
per_page = 25 # int | Limit on the number of objects to be returned, between 1 and 100. 25 by default
187+
188+
try:
189+
# List pre-translation jobs
190+
api_response = api_instance.pre_translations_list(project_id, x_phrase_app_otp=x_phrase_app_otp, if_modified_since=if_modified_since, if_none_match=if_none_match, page=page, per_page=per_page)
191+
pprint(api_response)
192+
except ApiException as e:
193+
print("Exception when calling PreTranslationsApi->pre_translations_list: %s\n" % e)
194+
```
195+
196+
197+
### Parameters
198+
199+
Name | Type | Description | Notes
200+
------------- | ------------- | ------------- | -------------
201+
**project_id** | **str**| Project ID |
202+
**x_phrase_app_otp** | **str**| Two-Factor-Authentication token (optional) | [optional]
203+
**if_modified_since** | **str**| Last modified condition, see [Conditional GET requests / HTTP Caching](/en/api/strings/pagination#conditional-get-requests-%2F-http-caching) (optional) | [optional]
204+
**if_none_match** | **str**| ETag condition, see [Conditional GET requests / HTTP Caching](/en/api/strings/pagination#conditional-get-requests-%2F-http-caching) (optional) | [optional]
205+
**page** | **int**| Page number | [optional]
206+
**per_page** | **int**| Limit on the number of objects to be returned, between 1 and 100. 25 by default | [optional]
207+
208+
### Return type
209+
210+
[**List[PreTranslation]**](PreTranslation.md)
211+
212+
### Authorization
213+
214+
[Basic](../README.md#Basic), [Token](../README.md#Token)
215+
216+
### HTTP request headers
217+
218+
- **Content-Type**: Not defined
219+
- **Accept**: application/json
220+
221+
### HTTP response details
222+
| Status code | Description | Response headers |
223+
|-------------|-------------|------------------|
224+
**200** | OK | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> * Link - <br> * Pagination - <br> |
225+
**400** | Bad request. The request could not be parsed or a parameter failed validation. Verify the request body, the content type, and the parameter types, then retry. | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
226+
**401** | Unauthorized. Authentication failed because the access token is missing, expired, or invalid. Supply a valid access token and retry. | - |
227+
**403** | Forbidden. The credentials are valid but not permitted for this request: the access token may lack the required scope, the user may lack permission on the resource, or the account plan may not include the feature. Use a token with the required scope on an account and user that hold the necessary permissions. | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
228+
**404** | Not found. The requested resource does not exist or is not visible to the authenticated user. Verify the identifiers in the request path and that the token has access to them, then retry. | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
229+
**429** | Too many requests. The rate limit has been exceeded. Wait until the time indicated by the &#x60;X-Rate-Limit-Reset&#x60; response header before retrying. | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> |
230+
231+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
232+

0 commit comments

Comments
 (0)