Skip to content

Commit c245a34

Browse files
author
Phrase
committed
1 parent fb58fdf commit c245a34

17 files changed

Lines changed: 228 additions & 34 deletions

.openapi-generator/FILES

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ docs/GlossaryTermsApi.md
8282
docs/GlossaryUpdateParameters.md
8383
docs/ICUApi.md
8484
docs/Icu.md
85+
docs/IcuSkeletonError.md
8586
docs/IcuSkeletonParameters.md
8687
docs/Invitation.md
8788
docs/InvitationCreateParameters.md
@@ -418,6 +419,7 @@ phrase_api/models/glossary_term_translation_update_parameters.py
418419
phrase_api/models/glossary_term_update_parameters.py
419420
phrase_api/models/glossary_update_parameters.py
420421
phrase_api/models/icu.py
422+
phrase_api/models/icu_skeleton_error.py
421423
phrase_api/models/icu_skeleton_parameters.py
422424
phrase_api/models/invitation.py
423425
phrase_api/models/invitation_create_parameters.py
@@ -674,6 +676,7 @@ test/test_glossary_terms_api.py
674676
test/test_glossary_update_parameters.py
675677
test/test_icu.py
676678
test/test_icu_api.py
679+
test/test_icu_skeleton_error.py
677680
test/test_icu_skeleton_parameters.py
678681
test/test_invitation.py
679682
test/test_invitation_create_parameters.py

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ Class | Method | HTTP request | Description
497497
- [GlossaryTermUpdateParameters](docs/GlossaryTermUpdateParameters.md)
498498
- [GlossaryUpdateParameters](docs/GlossaryUpdateParameters.md)
499499
- [Icu](docs/Icu.md)
500+
- [IcuSkeletonError](docs/IcuSkeletonError.md)
500501
- [IcuSkeletonParameters](docs/IcuSkeletonParameters.md)
501502
- [Invitation](docs/Invitation.md)
502503
- [InvitationCreateParameters](docs/InvitationCreateParameters.md)

docs/ICUApi.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Method | HTTP request | Description
1212
1313
Build ICU skeletons
1414

15-
Returns ICU skeletons for multiple locale codes based on a source content.
15+
Generates ICU (International Components for Unicode) message format skeletons for a given source string across one or more locales. An ICU skeleton strips the literal text from a pluralized or select message while preserving its structural rules — argument names, plural categories, select cases, and ordinal forms — adjusted to the pluralization rules of each requested locale. Use this endpoint to normalize translation templates before importing them into locale files, or to validate that a source string carries the plural forms required by a target language. Either `content` or `id` must be provided — supplying both or neither returns 400. When `id` is used and the referenced translation does not exist, the endpoint returns 404. When the source string is not valid ICU message format syntax, the endpoint returns 422 with an `error` field describing the parse failure.
1616

1717
### Example
1818

@@ -71,6 +71,7 @@ Name | Type | Description | Notes
7171
**401** | Unauthorized. Authentication failed because the access token is missing, expired, or invalid. Supply a valid access token and retry. | - |
7272
**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> |
7373
**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> |
74+
**422** | Unprocessable entity. Returned when the source string is not valid ICU message format syntax. The response body contains an &#x60;error&#x60; field with a human-readable description of the parse failure. Correct the ICU syntax in the source string and retry. | - |
7475
**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> |
7576

7677
[[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)

docs/IcuSkeletonError.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# IcuSkeletonError
2+
3+
## Properties
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
6+
**error** | **str** | Human-readable description of the ICU message format parse failure. | [optional]
7+
8+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
9+
10+

docs/IcuSkeletonParameters.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
## Properties
44
Name | Type | Description | Notes
55
------------ | ------------- | ------------- | -------------
6-
**content** | **str** | Source content to derive skeletons from. Mutually exclusive with &#x60;id&#x60;; exactly one of the two must be provided. | [optional]
7-
**id** | **str** | Translation code to source content from. Mutually exclusive with &#x60;content&#x60;; exactly one of the two must be provided. | [optional]
8-
**locale_codes** | **List[str]** | Locale codes | [optional]
9-
**keep_content** | **bool** | Keep the content and add missing plural forms for each locale | [optional]
10-
**zero_form_enabled** | **bool** | Indicates whether the zero form should be included or excluded in the returned skeletons | [optional]
11-
**cldr_version** | **str** | Strings supports two CLDR variants, when it comes to pluralization rules. \\ You can choose which one you want to use when constructing the skeletons. Possible values \\ are &#x60;legacy&#x60; and &#x60;cldr_41&#x60;. Default value is &#x60;legacy&#x60;. | [optional]
6+
**content** | **str** | Source ICU message string to derive skeletons from. Mutually exclusive with &#x60;id&#x60;; exactly one of the two must be provided. | [optional]
7+
**id** | **str** | Code of an existing translation to source content from. Mutually exclusive with &#x60;content&#x60;; exactly one of the two must be provided. Returns 404 when the translation does not exist. | [optional]
8+
**locale_codes** | **List[str]** | Locale codes for which to generate skeletons. The pluralization rules of each locale determine which plural forms appear in the output. | [optional]
9+
**keep_content** | **bool** | When true, preserves the existing translation text in each plural form and adds any missing forms for the locale rather than stripping all literal content. | [optional]
10+
**zero_form_enabled** | **bool** | When true, includes the zero plural form in the generated skeleton for locales that support it. | [optional]
11+
**cldr_version** | **str** | Pluralization rule set to apply when constructing skeletons. Accepted values are &#x60;legacy&#x60; and &#x60;cldr_41&#x60;. Defaults to &#x60;legacy&#x60; when omitted. | [optional]
1212

1313
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1414

phrase_api/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@
144144
from phrase_api.models.glossary_term_update_parameters import GlossaryTermUpdateParameters
145145
from phrase_api.models.glossary_update_parameters import GlossaryUpdateParameters
146146
from phrase_api.models.icu import Icu
147+
from phrase_api.models.icu_skeleton_error import IcuSkeletonError
147148
from phrase_api.models.icu_skeleton_parameters import IcuSkeletonParameters
148149
from phrase_api.models.invitation import Invitation
149150
from phrase_api.models.invitation_create_parameters import InvitationCreateParameters

phrase_api/api/icu_api.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def __init__(self, api_client=None):
3838
def icu_skeleton(self, icu_skeleton_parameters, **kwargs): # noqa: E501
3939
"""Build ICU skeletons # noqa: E501
4040
41-
Returns ICU skeletons for multiple locale codes based on a source content. # noqa: E501
41+
Generates ICU (International Components for Unicode) message format skeletons for a given source string across one or more locales. An ICU skeleton strips the literal text from a pluralized or select message while preserving its structural rules — argument names, plural categories, select cases, and ordinal forms — adjusted to the pluralization rules of each requested locale. Use this endpoint to normalize translation templates before importing them into locale files, or to validate that a source string carries the plural forms required by a target language. Either `content` or `id` must be provided — supplying both or neither returns 400. When `id` is used and the referenced translation does not exist, the endpoint returns 404. When the source string is not valid ICU message format syntax, the endpoint returns 422 with an `error` field describing the parse failure. # noqa: E501
4242
This method makes a synchronous HTTP request by default. To make an
4343
asynchronous HTTP request, please pass async_req=True
4444
>>> thread = api.icu_skeleton(icu_skeleton_parameters, async_req=True)
@@ -64,7 +64,7 @@ def icu_skeleton(self, icu_skeleton_parameters, **kwargs): # noqa: E501
6464
def icu_skeleton_with_http_info(self, icu_skeleton_parameters, **kwargs): # noqa: E501
6565
"""Build ICU skeletons # noqa: E501
6666
67-
Returns ICU skeletons for multiple locale codes based on a source content. # noqa: E501
67+
Generates ICU (International Components for Unicode) message format skeletons for a given source string across one or more locales. An ICU skeleton strips the literal text from a pluralized or select message while preserving its structural rules — argument names, plural categories, select cases, and ordinal forms — adjusted to the pluralization rules of each requested locale. Use this endpoint to normalize translation templates before importing them into locale files, or to validate that a source string carries the plural forms required by a target language. Either `content` or `id` must be provided — supplying both or neither returns 400. When `id` is used and the referenced translation does not exist, the endpoint returns 404. When the source string is not valid ICU message format syntax, the endpoint returns 422 with an `error` field describing the parse failure. # noqa: E501
6868
This method makes a synchronous HTTP request by default. To make an
6969
asynchronous HTTP request, please pass async_req=True
7070
>>> thread = api.icu_skeleton_with_http_info(icu_skeleton_parameters, async_req=True)
@@ -110,10 +110,6 @@ def icu_skeleton_with_http_info(self, icu_skeleton_parameters, **kwargs): # noq
110110
)
111111
local_var_params[key] = val
112112
del local_var_params['kwargs']
113-
# verify the required parameter 'icu_skeleton_parameters' is set
114-
if self.api_client.client_side_validation and ('icu_skeleton_parameters' not in local_var_params or # noqa: E501
115-
local_var_params['icu_skeleton_parameters'] is None): # noqa: E501
116-
raise ApiValueError("Missing the required parameter `icu_skeleton_parameters` when calling `icu_skeleton`") # noqa: E501
117113

118114
collection_formats = {}
119115

phrase_api/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
from phrase_api.models.glossary_term_update_parameters import GlossaryTermUpdateParameters
7575
from phrase_api.models.glossary_update_parameters import GlossaryUpdateParameters
7676
from phrase_api.models.icu import Icu
77+
from phrase_api.models.icu_skeleton_error import IcuSkeletonError
7778
from phrase_api.models.icu_skeleton_parameters import IcuSkeletonParameters
7879
from phrase_api.models.invitation import Invitation
7980
from phrase_api.models.invitation_create_parameters import InvitationCreateParameters
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# coding: utf-8
2+
3+
"""
4+
Phrase Strings API Reference
5+
6+
The version of the OpenAPI document: 2.0.0
7+
Contact: support@phrase.com
8+
Generated by: https://openapi-generator.tech
9+
"""
10+
11+
12+
import pprint
13+
import re # noqa: F401
14+
15+
import six
16+
17+
from phrase_api.configuration import Configuration
18+
19+
20+
class IcuSkeletonError(object):
21+
"""NOTE: This class is auto generated by OpenAPI Generator.
22+
Ref: https://openapi-generator.tech
23+
24+
Do not edit the class manually.
25+
"""
26+
27+
"""
28+
Attributes:
29+
openapi_types (dict): The key is attribute name
30+
and the value is attribute type.
31+
attribute_map (dict): The key is attribute name
32+
and the value is json key in definition.
33+
"""
34+
openapi_types = {
35+
'error': 'str'
36+
}
37+
38+
attribute_map = {
39+
'error': 'error'
40+
}
41+
42+
def __init__(self, error=None, local_vars_configuration=None): # noqa: E501
43+
"""IcuSkeletonError - a model defined in OpenAPI""" # noqa: E501
44+
if local_vars_configuration is None:
45+
local_vars_configuration = Configuration()
46+
self.local_vars_configuration = local_vars_configuration
47+
48+
self._error = None
49+
self.discriminator = None
50+
51+
if error is not None:
52+
self.error = error
53+
54+
@property
55+
def error(self):
56+
"""Gets the error of this IcuSkeletonError. # noqa: E501
57+
58+
Human-readable description of the ICU message format parse failure. # noqa: E501
59+
60+
:return: The error of this IcuSkeletonError. # noqa: E501
61+
:rtype: str
62+
"""
63+
return self._error
64+
65+
@error.setter
66+
def error(self, error):
67+
"""Sets the error of this IcuSkeletonError.
68+
69+
Human-readable description of the ICU message format parse failure. # noqa: E501
70+
71+
:param error: The error of this IcuSkeletonError. # noqa: E501
72+
:type: str
73+
"""
74+
75+
self._error = error
76+
77+
def to_dict(self):
78+
"""Returns the model properties as a dict"""
79+
result = {}
80+
81+
for attr, _ in six.iteritems(self.openapi_types):
82+
value = getattr(self, attr)
83+
if isinstance(value, list):
84+
result[attr] = list(map(
85+
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
86+
value
87+
))
88+
elif hasattr(value, "to_dict"):
89+
result[attr] = value.to_dict()
90+
elif isinstance(value, dict):
91+
result[attr] = dict(map(
92+
lambda item: (item[0], item[1].to_dict())
93+
if hasattr(item[1], "to_dict") else item,
94+
value.items()
95+
))
96+
else:
97+
result[attr] = value
98+
99+
return result
100+
101+
def to_str(self):
102+
"""Returns the string representation of the model"""
103+
return pprint.pformat(self.to_dict())
104+
105+
def __repr__(self):
106+
"""For `print` and `pprint`"""
107+
return self.to_str()
108+
109+
def __eq__(self, other):
110+
"""Returns true if both objects are equal"""
111+
if not isinstance(other, IcuSkeletonError):
112+
return False
113+
114+
return self.to_dict() == other.to_dict()
115+
116+
def __ne__(self, other):
117+
"""Returns true if both objects are not equal"""
118+
if not isinstance(other, IcuSkeletonError):
119+
return True
120+
121+
return self.to_dict() != other.to_dict()

0 commit comments

Comments
 (0)