phrase 4.26.0 → 4.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +14 -3
- data/docs/CheckIssue.md +33 -0
- data/docs/ChecksApi.md +146 -0
- data/docs/JobCreateParameters.md +1 -1
- data/docs/KeyCreateParameters.md +1 -1
- data/docs/KeyUpdateParameters.md +1 -1
- data/docs/Locale.md +6 -0
- data/docs/LocaleCreateParameters.md +2 -0
- data/docs/LocaleDetails.md +6 -0
- data/docs/LocaleUpdateParameters.md +2 -0
- data/docs/MachineTranslationApi.md +263 -0
- data/docs/MachineTranslationLocaleProviderMapping.md +21 -0
- data/docs/MachineTranslationLocaleProviderMappingsCreateParameters.md +21 -0
- data/docs/MachineTranslationSettings.md +23 -0
- data/docs/MachineTranslationSettingsUpdateParameters.md +17 -0
- data/docs/ProjectCreateParameters.md +8 -2
- data/docs/ProjectDetails.md +3 -1
- data/docs/ProjectUpdateParameters.md +8 -2
- data/docs/ScreenshotUpdateParameters.md +1 -1
- data/docs/Upload.md +3 -1
- data/docs/UploadsApi.md +4 -4
- data/lib/phrase/api/checks_api.rb +174 -0
- data/lib/phrase/api/machine_translation_api.rb +302 -0
- data/lib/phrase/api/uploads_api.rb +6 -6
- data/lib/phrase/models/check_issue.rb +319 -0
- data/lib/phrase/models/job_create_parameters.rb +1 -1
- data/lib/phrase/models/locale.rb +31 -1
- data/lib/phrase/models/locale_create_parameters.rb +11 -1
- data/lib/phrase/models/locale_details.rb +31 -1
- data/lib/phrase/models/locale_update_parameters.rb +11 -1
- data/lib/phrase/models/machine_translation_locale_provider_mapping.rb +217 -0
- data/lib/phrase/models/machine_translation_locale_provider_mappings_create_parameters.rb +232 -0
- data/lib/phrase/models/machine_translation_settings.rb +230 -0
- data/lib/phrase/models/machine_translation_settings_update_parameters.rb +198 -0
- data/lib/phrase/models/project_create_parameters.rb +35 -1
- data/lib/phrase/models/project_details.rb +10 -1
- data/lib/phrase/models/project_update_parameters.rb +35 -1
- data/lib/phrase/models/upload.rb +13 -1
- data/lib/phrase/version.rb +1 -1
- data/lib/phrase.rb +7 -0
- data/spec/api/checks_api_spec.rb +56 -0
- data/spec/api/machine_translation_api_spec.rb +79 -0
- data/spec/models/check_issue_spec.rb +85 -0
- data/spec/models/locale_create_parameters_spec.rb +6 -0
- data/spec/models/locale_details_spec.rb +18 -0
- data/spec/models/locale_spec.rb +18 -0
- data/spec/models/locale_update_parameters_spec.rb +6 -0
- data/spec/models/machine_translation_locale_provider_mapping_spec.rb +41 -0
- data/spec/models/machine_translation_locale_provider_mappings_create_parameters_spec.rb +41 -0
- data/spec/models/machine_translation_settings_spec.rb +47 -0
- data/spec/models/machine_translation_settings_update_parameters_spec.rb +29 -0
- data/spec/models/project_create_parameters_spec.rb +18 -0
- data/spec/models/project_details_spec.rb +6 -0
- data/spec/models/project_update_parameters_spec.rb +18 -0
- data/spec/models/upload_spec.rb +6 -0
- metadata +292 -264
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Phrase::MachineTranslationLocaleProviderMapping
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
Name | Type | Description | Notes
|
|
6
|
+
------------ | ------------- | ------------- | -------------
|
|
7
|
+
**source_locale_code** | **String** | The locale code of the source language for this mapping. | [optional]
|
|
8
|
+
**target_locale_code** | **String** | The locale code of the target language for this mapping. | [optional]
|
|
9
|
+
**service** | **String** | The translation service applied when translating from source to target locale. | [optional]
|
|
10
|
+
|
|
11
|
+
## Code Sample
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
require 'Phrase'
|
|
15
|
+
|
|
16
|
+
instance = Phrase::MachineTranslationLocaleProviderMapping.new(source_locale_code: en,
|
|
17
|
+
target_locale_code: de,
|
|
18
|
+
service: google_translate)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Phrase::MachineTranslationLocaleProviderMappingsCreateParameters
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
Name | Type | Description | Notes
|
|
6
|
+
------------ | ------------- | ------------- | -------------
|
|
7
|
+
**source_locale_code** | **String** | The locale code of the source language (e.g. \"en\"). |
|
|
8
|
+
**target_locale_code** | **String** | The locale code of the target language (e.g. \"de\"). Must differ from source_locale_code. |
|
|
9
|
+
**service** | **String** | The machine translation service to use for this locale pair. Must be a service enabled for the account. |
|
|
10
|
+
|
|
11
|
+
## Code Sample
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
require 'Phrase'
|
|
15
|
+
|
|
16
|
+
instance = Phrase::MachineTranslationLocaleProviderMappingsCreateParameters.new(source_locale_code: en,
|
|
17
|
+
target_locale_code: de,
|
|
18
|
+
service: google_translate)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Phrase::MachineTranslationSettings
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
Name | Type | Description | Notes
|
|
6
|
+
------------ | ------------- | ------------- | -------------
|
|
7
|
+
**default_service** | **String** | The default machine translation engine configured for the account. Returns \"microsoft_translate\" when no service has been explicitly configured. Supported values: language_ai_translate, aita_translate, microsoft_translate, google_translate, amazon_translate, intento_translate, gpt_translate. | [optional]
|
|
8
|
+
**machine_translation_units_used** | **Integer** | Number of machine translation characters consumed in the current billing period. | [optional]
|
|
9
|
+
**machine_translation_units_total** | **Integer** | Total machine translation character quota granted for the current billing period. | [optional]
|
|
10
|
+
**locale_provider_mappings** | [**Array<MachineTranslationLocaleProviderMapping>**](MachineTranslationLocaleProviderMapping.md) | Per-locale-pair provider overrides. When a matching mapping exists for a source/target locale pair, that provider takes precedence over the account default. | [optional]
|
|
11
|
+
|
|
12
|
+
## Code Sample
|
|
13
|
+
|
|
14
|
+
```ruby
|
|
15
|
+
require 'Phrase'
|
|
16
|
+
|
|
17
|
+
instance = Phrase::MachineTranslationSettings.new(default_service: google_translate,
|
|
18
|
+
machine_translation_units_used: 12500,
|
|
19
|
+
machine_translation_units_total: 1000000,
|
|
20
|
+
locale_provider_mappings: null)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Phrase::MachineTranslationSettingsUpdateParameters
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
Name | Type | Description | Notes
|
|
6
|
+
------------ | ------------- | ------------- | -------------
|
|
7
|
+
**default_service** | **String** | The machine translation engine to use as the account default. Supported values: language_ai_translate, aita_translate, microsoft_translate, google_translate, amazon_translate, intento_translate, gpt_translate. Pass null or an empty string to reset to the plan default. | [optional]
|
|
8
|
+
|
|
9
|
+
## Code Sample
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
require 'Phrase'
|
|
13
|
+
|
|
14
|
+
instance = Phrase::MachineTranslationSettingsUpdateParameters.new(default_service: google_translate)
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
|
|
@@ -8,6 +8,8 @@ Name | Type | Description | Notes
|
|
|
8
8
|
**main_format** | **String** | Main file format specified by its API Extension name. Used for locale downloads if no format is specified. For API Extension names of available file formats see [Format Guide](https://support.phrase.com/hc/en-us/sections/6111343326364) or our [Formats API Endpoint](/en/api/strings/formats/list-formats). | [optional]
|
|
9
9
|
**media** | **String** | (Optional) Main technology stack used in the project. It affects for example the suggested placeholder style. Predefined values include: `Ruby`, `JavaScript`, `AngularJS`, `React`, `iOS`, `Android`, `Python`, `PHP`, `Java`, `Go`, `Windows Phone`, `Rails`, `Node.js`, `.NET`, `Django`, `Symfony`, `Yii Framework`, `Zend Framework`, `Apple App Store Description`, `Google Play Description`, but it can also take any other value. | [optional]
|
|
10
10
|
**shares_translation_memory** | **Boolean** | Indicates whether the project should share the account's translation memory | [optional]
|
|
11
|
+
**tm_ids** | **Array<String>** | List of TMS translation memory IDs, used to provide reference translations for the AI translation agent. | [optional]
|
|
12
|
+
**term_base_ids** | **Array<String>** | List of TMS term base IDs, used to ensure consistent terminology for the AI translation agent. | [optional]
|
|
11
13
|
**project_image** | **File** | Image to identify the project | [optional]
|
|
12
14
|
**remove_project_image** | **Boolean** | Indicates whether the project image should be deleted. | [optional]
|
|
13
15
|
**account_id** | **String** | Account ID to specify the actual account the project should be created in. Required if the requesting user is a member of multiple accounts. | [optional]
|
|
@@ -28,6 +30,7 @@ Name | Type | Description | Notes
|
|
|
28
30
|
**autotranslate_use_machine_translation** | **Boolean** | (Optional) Requires autotranslate_enabled to be true | [optional]
|
|
29
31
|
**autotranslate_use_translation_memory** | **Boolean** | (Optional) Requires autotranslate_enabled to be true | [optional]
|
|
30
32
|
**autotranslate_overwrite_unverified_translations** | **Boolean** | (Optional) Requires autotranslate_enabled to be true | [optional]
|
|
33
|
+
**fallback_for_unverified_translations** | **Boolean** | (Optional) When enabled, the fallback locale's translation is used on export for unverified translations in addition to empty ones. Requires a fallback locale to be configured on the locale. | [optional]
|
|
31
34
|
**autocomplete_job_enabled** | **Boolean** | (Optional) Enable autocomplete-job behavior so that newly created keys and locales are automatically added to in-progress jobs. | [optional]
|
|
32
35
|
**job_locking_enabled** | **Boolean** | (Optional) When enabled, translations are locked once a job moves into review. | [optional]
|
|
33
36
|
**smart_suggest_enabled** | **Boolean** | (Optional) Enable Smart Suggest for the project. Defaults to `true` when omitted. | [optional]
|
|
@@ -47,7 +50,9 @@ instance = Phrase::ProjectCreateParameters.new(name: My Android Project,
|
|
|
47
50
|
main_format: yml,
|
|
48
51
|
media: Python,
|
|
49
52
|
shares_translation_memory: true,
|
|
50
|
-
|
|
53
|
+
tm_ids: ["abcd1234cdef1234abcd1234cdef1234"],
|
|
54
|
+
term_base_ids: ["abcd1234cdef1234abcd1234cdef1234"],
|
|
55
|
+
project_image: [B@36dada39,
|
|
51
56
|
remove_project_image: null,
|
|
52
57
|
account_id: abcd1234,
|
|
53
58
|
point_of_contact: abcd1234,
|
|
@@ -67,6 +72,7 @@ instance = Phrase::ProjectCreateParameters.new(name: My Android Project,
|
|
|
67
72
|
autotranslate_use_machine_translation: true,
|
|
68
73
|
autotranslate_use_translation_memory: true,
|
|
69
74
|
autotranslate_overwrite_unverified_translations: true,
|
|
75
|
+
fallback_for_unverified_translations: false,
|
|
70
76
|
autocomplete_job_enabled: false,
|
|
71
77
|
job_locking_enabled: false,
|
|
72
78
|
smart_suggest_enabled: true,
|
|
@@ -75,7 +81,7 @@ instance = Phrase::ProjectCreateParameters.new(name: My Android Project,
|
|
|
75
81
|
translation_keys_sort_collation: unicode_ci,
|
|
76
82
|
default_encoding: UTF-8,
|
|
77
83
|
cldr_version: cldr48,
|
|
78
|
-
placeholder_styles: ["
|
|
84
|
+
placeholder_styles: ["rails_i18n","java_properties"])
|
|
79
85
|
```
|
|
80
86
|
|
|
81
87
|
|
data/docs/ProjectDetails.md
CHANGED
|
@@ -30,6 +30,7 @@ Name | Type | Description | Notes
|
|
|
30
30
|
**autotranslate_use_machine_translation** | **Boolean** | | [optional]
|
|
31
31
|
**autotranslate_use_translation_memory** | **Boolean** | | [optional]
|
|
32
32
|
**autotranslate_overwrite_unverified_translations** | **Boolean** | | [optional]
|
|
33
|
+
**fallback_for_unverified_translations** | **Boolean** | | [optional]
|
|
33
34
|
**autocomplete_job_enabled** | **Boolean** | | [optional]
|
|
34
35
|
**default_encoding** | **String** | | [optional]
|
|
35
36
|
**cldr_version** | **String** | | [optional]
|
|
@@ -68,11 +69,12 @@ instance = Phrase::ProjectDetails.new(id: null,
|
|
|
68
69
|
autotranslate_use_machine_translation: false,
|
|
69
70
|
autotranslate_use_translation_memory: true,
|
|
70
71
|
autotranslate_overwrite_unverified_translations: false,
|
|
72
|
+
fallback_for_unverified_translations: false,
|
|
71
73
|
autocomplete_job_enabled: false,
|
|
72
74
|
default_encoding: UTF-8,
|
|
73
75
|
cldr_version: legacy,
|
|
74
76
|
job_locking_enabled: false,
|
|
75
|
-
placeholder_styles: ["
|
|
77
|
+
placeholder_styles: ["rails_i18n","java_properties"],
|
|
76
78
|
branch: null)
|
|
77
79
|
```
|
|
78
80
|
|
|
@@ -10,6 +10,8 @@ Name | Type | Description | Notes
|
|
|
10
10
|
**main_format** | **String** | (Optional) Main file format specified by its API Extension name. Used for locale downloads if no format is specified. For API Extension names of available file formats see [Format Guide](https://support.phrase.com/hc/en-us/sections/6111343326364) or our [Formats API Endpoint](#formats). | [optional]
|
|
11
11
|
**media** | **String** | (Optional) Main technology stack used in the project. It affects for example the suggested placeholder style. Predefined values include: `Ruby`, `JavaScript`, `AngularJS`, `React`, `iOS`, `Android`, `Python`, `PHP`, `Java`, `Go`, `Windows Phone`, `Rails`, `Node.js`, `.NET`, `Django`, `Symfony`, `Yii Framework`, `Zend Framework`, `Apple App Store Description`, `Google Play Description`, but it can also take any other value. | [optional]
|
|
12
12
|
**shares_translation_memory** | **Boolean** | (Optional) Indicates whether the project should share the account's translation memory | [optional]
|
|
13
|
+
**tm_ids** | **Array<String>** | List of TMS translation memory IDs, used to provide reference translations for the AI translation agent. | [optional]
|
|
14
|
+
**term_base_ids** | **Array<String>** | List of TMS term base IDs, used to ensure consistent terminology for the AI translation agent. | [optional]
|
|
13
15
|
**project_image** | **File** | (Optional) Image to identify the project | [optional]
|
|
14
16
|
**remove_project_image** | **Boolean** | (Optional) Indicates whether the project image should be deleted. | [optional]
|
|
15
17
|
**workflow** | **String** | (Optional) Review Workflow. \"simple\" / \"review\". [Read more](https://support.phrase.com/hc/en-us/articles/5784094755484) | [optional]
|
|
@@ -27,6 +29,7 @@ Name | Type | Description | Notes
|
|
|
27
29
|
**autotranslate_use_machine_translation** | **Boolean** | (Optional) Requires autotranslate_enabled to be true | [optional]
|
|
28
30
|
**autotranslate_use_translation_memory** | **Boolean** | (Optional) Requires autotranslate_enabled to be true | [optional]
|
|
29
31
|
**autotranslate_overwrite_unverified_translations** | **Boolean** | (Optional) Requires autotranslate_enabled to be true | [optional]
|
|
32
|
+
**fallback_for_unverified_translations** | **Boolean** | (Optional) When enabled, the fallback locale's translation is used on export for unverified translations in addition to empty ones. Requires a fallback locale to be configured on the locale. | [optional]
|
|
30
33
|
**default_encoding** | **String** | (Optional) Sets the default encoding for Uploads. If you leave it empty, we will try to guess it automatically for you when you Upload a file. You can still override this value by setting the [`file_encoding`](/en/api/strings/uploads/upload-a-new-file) parameter for Uploads. | [optional]
|
|
31
34
|
**placeholder_styles** | **Array<String>** | (Optional) List of placeholder styles enabled for the project. | [optional]
|
|
32
35
|
**autocomplete_job_enabled** | **Boolean** | (Optional) Enable autocomplete-job behavior so that newly created keys and locales are automatically added to in-progress jobs. | [optional]
|
|
@@ -48,7 +51,9 @@ instance = Phrase::ProjectUpdateParameters.new(account_id: abcd1234,
|
|
|
48
51
|
main_format: yml,
|
|
49
52
|
media: Python,
|
|
50
53
|
shares_translation_memory: true,
|
|
51
|
-
|
|
54
|
+
tm_ids: ["abcd1234cdef1234abcd1234cdef1234"],
|
|
55
|
+
term_base_ids: ["abcd1234cdef1234abcd1234cdef1234"],
|
|
56
|
+
project_image: [B@71fcff54,
|
|
52
57
|
remove_project_image: false,
|
|
53
58
|
workflow: review,
|
|
54
59
|
machine_translation_enabled: true,
|
|
@@ -65,8 +70,9 @@ instance = Phrase::ProjectUpdateParameters.new(account_id: abcd1234,
|
|
|
65
70
|
autotranslate_use_machine_translation: true,
|
|
66
71
|
autotranslate_use_translation_memory: true,
|
|
67
72
|
autotranslate_overwrite_unverified_translations: true,
|
|
73
|
+
fallback_for_unverified_translations: false,
|
|
68
74
|
default_encoding: UTF-8,
|
|
69
|
-
placeholder_styles: ["
|
|
75
|
+
placeholder_styles: ["rails_i18n","java_properties"],
|
|
70
76
|
autocomplete_job_enabled: false,
|
|
71
77
|
job_locking_enabled: false,
|
|
72
78
|
smart_suggest_enabled: true,
|
data/docs/Upload.md
CHANGED
|
@@ -7,7 +7,8 @@ Name | Type | Description | Notes
|
|
|
7
7
|
**id** | **String** | | [optional]
|
|
8
8
|
**filename** | **String** | | [optional]
|
|
9
9
|
**format** | **String** | | [optional]
|
|
10
|
-
**state** | **String** | | [optional]
|
|
10
|
+
**state** | **String** | Processing state of the upload: `initialized`, `processing`, `success`, or `error`. `error` means processing failed — for example the file could not be parsed, or a provided `file_format` didn't match the file's actual content. Poll this field until it leaves `initialized`/`processing` to get the final outcome. | [optional]
|
|
11
|
+
**error_message** | **String** | A user-facing message explaining why the upload failed, or `null` if the upload did not fail. This message is intended for display only. Its wording may change at any time and it should not be parsed or relied upon programmatically. | [optional]
|
|
11
12
|
**tag** | **String** | Unique tag of the upload | [optional]
|
|
12
13
|
**tags** | **Array<String>** | List of tags that were assigned to the uploaded keys | [optional]
|
|
13
14
|
**url** | **String** | The URL to the upload in Phrase Strings app. | [optional]
|
|
@@ -25,6 +26,7 @@ instance = Phrase::Upload.new(id: null,
|
|
|
25
26
|
filename: null,
|
|
26
27
|
format: null,
|
|
27
28
|
state: null,
|
|
29
|
+
error_message: null,
|
|
28
30
|
tag: null,
|
|
29
31
|
tags: null,
|
|
30
32
|
url: null,
|
data/docs/UploadsApi.md
CHANGED
|
@@ -16,7 +16,7 @@ Method | HTTP request | Description
|
|
|
16
16
|
|
|
17
17
|
Upload a new file
|
|
18
18
|
|
|
19
|
-
Upload a new language file. Creates necessary resources in your project. Note: be aware of [upload limits](https://support.phrase.com/hc/en-us/articles/8548271212188-Phrase-Strings-Limits#file-size-upload-limits-0-0).
|
|
19
|
+
Upload a new language file. Creates necessary resources in your project. The upload is processed asynchronously: this endpoint returns `201 Created` once the file has been accepted and enqueued, not once processing has finished. Poll `GET /projects/{project_id}/uploads/{id}` and check the `state` field — `error` means processing failed (for example, an unparseable file or a `file_format` that doesn't match the file's actual content). Note: be aware of [upload limits](https://support.phrase.com/hc/en-us/articles/8548271212188-Phrase-Strings-Limits#file-size-upload-limits-0-0).
|
|
20
20
|
|
|
21
21
|
### Example
|
|
22
22
|
|
|
@@ -37,7 +37,7 @@ end
|
|
|
37
37
|
api_instance = Phrase::UploadsApi.new
|
|
38
38
|
project_id = 'project_id_example' # String | Project ID
|
|
39
39
|
file = File.new('/path/to/some/file') # File | File to be imported
|
|
40
|
-
file_format = 'file_format_example' # String | File format.
|
|
40
|
+
file_format = 'file_format_example' # String | File format of the uploaded file, given as a format's `api_name`. See our [Formats API Endpoint](/en/api/strings/formats/list-formats) for the full list of supported formats. Optional. When omitted, Phrase tries to auto-detect the format from the file's content. This is not always possible for JSON files, since several JSON-based formats (e.g. `json`, `simple_json`, `nested_json`) share the same structure.
|
|
41
41
|
locale_id = 'locale_id_example' # String | Locale of the file's content. Can be the name or id of the locale. Preferred is id.
|
|
42
42
|
opts = {
|
|
43
43
|
x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional)
|
|
@@ -79,7 +79,7 @@ Name | Type | Description | Notes
|
|
|
79
79
|
------------- | ------------- | ------------- | -------------
|
|
80
80
|
**project_id** | **String**| Project ID |
|
|
81
81
|
**file** | **File**| File to be imported |
|
|
82
|
-
**file_format** | **String**| File format.
|
|
82
|
+
**file_format** | **String**| File format of the uploaded file, given as a format's `api_name`. See our [Formats API Endpoint](/en/api/strings/formats/list-formats) for the full list of supported formats. Optional. When omitted, Phrase tries to auto-detect the format from the file's content. This is not always possible for JSON files, since several JSON-based formats (e.g. `json`, `simple_json`, `nested_json`) share the same structure. |
|
|
83
83
|
**locale_id** | **String**| Locale of the file's content. Can be the name or id of the locale. Preferred is id. |
|
|
84
84
|
**x_phrase_app_otp** | **String**| Two-Factor-Authentication token (optional) | [optional]
|
|
85
85
|
**branch** | **String**| specify the branch to use | [optional]
|
|
@@ -123,7 +123,7 @@ Response<([**Upload**](Upload.md))>
|
|
|
123
123
|
|
|
124
124
|
Get a single upload
|
|
125
125
|
|
|
126
|
-
View details and summary for a single upload.
|
|
126
|
+
View details and summary for a single upload. Use this endpoint to poll for the outcome of an upload created via `POST /projects/{project_id}/uploads` — check the `state` field.
|
|
127
127
|
|
|
128
128
|
### Example
|
|
129
129
|
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
require 'cgi'
|
|
2
|
+
|
|
3
|
+
module Phrase
|
|
4
|
+
class ChecksApi
|
|
5
|
+
attr_accessor :api_client
|
|
6
|
+
|
|
7
|
+
def initialize(api_client = ApiClient.default)
|
|
8
|
+
@api_client = api_client
|
|
9
|
+
end
|
|
10
|
+
# Dismiss a check issue
|
|
11
|
+
# **Note:** The Checks API is still in development and might change in subsequent releases. Mark a check issue as dismissed so it no longer appears on the list of active check issues.
|
|
12
|
+
# @param project_id [String] Project ID
|
|
13
|
+
# @param id [String] Check Issue ID
|
|
14
|
+
# @param [Hash] opts the optional parameters
|
|
15
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
|
16
|
+
# @return [CheckIssue]
|
|
17
|
+
def check_issue_dismiss(project_id, id, opts = {})
|
|
18
|
+
data, _status_code, _headers = check_issue_dismiss_with_http_info(project_id, id, opts)
|
|
19
|
+
data
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Dismiss a check issue
|
|
23
|
+
# **Note:** The Checks API is still in development and might change in subsequent releases. Mark a check issue as dismissed so it no longer appears on the list of active check issues.
|
|
24
|
+
# @param project_id [String] Project ID
|
|
25
|
+
# @param id [String] Check Issue ID
|
|
26
|
+
# @param [Hash] opts the optional parameters
|
|
27
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
|
28
|
+
# @return [Array<(Response<(CheckIssue)>, Integer, Hash)>] Response<(CheckIssue)> data, response status code and response headers
|
|
29
|
+
def check_issue_dismiss_with_http_info(project_id, id, opts = {})
|
|
30
|
+
if @api_client.config.debugging
|
|
31
|
+
@api_client.config.logger.debug 'Calling API: ChecksApi.check_issue_dismiss ...'
|
|
32
|
+
end
|
|
33
|
+
# verify the required parameter 'project_id' is set
|
|
34
|
+
if @api_client.config.client_side_validation && project_id.nil?
|
|
35
|
+
fail ArgumentError, "Missing the required parameter 'project_id' when calling ChecksApi.check_issue_dismiss"
|
|
36
|
+
end
|
|
37
|
+
# verify the required parameter 'id' is set
|
|
38
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
39
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ChecksApi.check_issue_dismiss"
|
|
40
|
+
end
|
|
41
|
+
# resource path
|
|
42
|
+
local_var_path = '/projects/{project_id}/checks/issues/{id}/dismiss'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
|
43
|
+
|
|
44
|
+
# query parameters
|
|
45
|
+
query_params = opts[:query_params] || {}
|
|
46
|
+
|
|
47
|
+
# header parameters
|
|
48
|
+
header_params = opts[:header_params] || {}
|
|
49
|
+
# HTTP header 'Accept' (if needed)
|
|
50
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
51
|
+
header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
|
|
52
|
+
|
|
53
|
+
# form parameters
|
|
54
|
+
form_params = opts[:form_params] || {}
|
|
55
|
+
|
|
56
|
+
# http body (model)
|
|
57
|
+
post_body = opts[:body]
|
|
58
|
+
|
|
59
|
+
# return_type
|
|
60
|
+
return_type = opts[:return_type] || 'CheckIssue'
|
|
61
|
+
|
|
62
|
+
# auth_names
|
|
63
|
+
auth_names = opts[:auth_names] || ['Basic', 'Token']
|
|
64
|
+
|
|
65
|
+
new_options = opts.merge(
|
|
66
|
+
:header_params => header_params,
|
|
67
|
+
:query_params => query_params,
|
|
68
|
+
:form_params => form_params,
|
|
69
|
+
:body => post_body,
|
|
70
|
+
:auth_names => auth_names,
|
|
71
|
+
:return_type => return_type
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
|
|
75
|
+
if @api_client.config.debugging
|
|
76
|
+
@api_client.config.logger.debug "API called: ChecksApi#check_issue_dismiss\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
77
|
+
end
|
|
78
|
+
response = ::Phrase::Response.new(data, headers)
|
|
79
|
+
return response, status_code, headers
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# List check issues
|
|
83
|
+
# **Note:** The Checks API is still in development and might change in subsequent releases. List check issues for the given project. Results can be filtered by locale, check name, and state.
|
|
84
|
+
# @param project_id [String] Project ID
|
|
85
|
+
# @param [Hash] opts the optional parameters
|
|
86
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
|
87
|
+
# @option opts [Integer] :page Page number
|
|
88
|
+
# @option opts [Integer] :per_page Limit on the number of objects to be returned, between 1 and 100. 25 by default
|
|
89
|
+
# @option opts [String] :state Filter by state of the check issue. Can be one of: `active`, `solved`, `dismissed`, `all`. Defaults to `active`. (default to 'active')
|
|
90
|
+
# @option opts [Array<String>] :locale_ids Filter by one or more locale IDs.
|
|
91
|
+
# @option opts [Array<String>] :check_names Filter by one or more check names. Valid values are: - `translation_content_length` — the translation exceeds the maximum character limit configured for the key. - `translation_placeholder_usage` — the translation is missing placeholders present in the source, or contains unexpected ones. - `translation_glossary_usage` — the translation does not follow the glossary term translations.
|
|
92
|
+
# @option opts [String] :created_since Return only check issues created on or after this ISO 8601 datetime. Returns 400 if the value is not a valid date-time.
|
|
93
|
+
# @return [Array<CheckIssue>]
|
|
94
|
+
def check_issues_list(project_id, opts = {})
|
|
95
|
+
data, _status_code, _headers = check_issues_list_with_http_info(project_id, opts)
|
|
96
|
+
data
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# List check issues
|
|
100
|
+
# **Note:** The Checks API is still in development and might change in subsequent releases. List check issues for the given project. Results can be filtered by locale, check name, and state.
|
|
101
|
+
# @param project_id [String] Project ID
|
|
102
|
+
# @param [Hash] opts the optional parameters
|
|
103
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
|
104
|
+
# @option opts [Integer] :page Page number
|
|
105
|
+
# @option opts [Integer] :per_page Limit on the number of objects to be returned, between 1 and 100. 25 by default
|
|
106
|
+
# @option opts [String] :state Filter by state of the check issue. Can be one of: `active`, `solved`, `dismissed`, `all`. Defaults to `active`.
|
|
107
|
+
# @option opts [Array<String>] :locale_ids Filter by one or more locale IDs.
|
|
108
|
+
# @option opts [Array<String>] :check_names Filter by one or more check names. Valid values are: - `translation_content_length` — the translation exceeds the maximum character limit configured for the key. - `translation_placeholder_usage` — the translation is missing placeholders present in the source, or contains unexpected ones. - `translation_glossary_usage` — the translation does not follow the glossary term translations.
|
|
109
|
+
# @option opts [String] :created_since Return only check issues created on or after this ISO 8601 datetime. Returns 400 if the value is not a valid date-time.
|
|
110
|
+
# @return [Array<(Response<(Array<CheckIssue>)>, Integer, Hash)>] Response<(Array<CheckIssue>)> data, response status code and response headers
|
|
111
|
+
def check_issues_list_with_http_info(project_id, opts = {})
|
|
112
|
+
if @api_client.config.debugging
|
|
113
|
+
@api_client.config.logger.debug 'Calling API: ChecksApi.check_issues_list ...'
|
|
114
|
+
end
|
|
115
|
+
# verify the required parameter 'project_id' is set
|
|
116
|
+
if @api_client.config.client_side_validation && project_id.nil?
|
|
117
|
+
fail ArgumentError, "Missing the required parameter 'project_id' when calling ChecksApi.check_issues_list"
|
|
118
|
+
end
|
|
119
|
+
allowable_values = ["active", "solved", "dismissed", "all"]
|
|
120
|
+
if @api_client.config.client_side_validation && opts[:'state'] && !allowable_values.include?(opts[:'state'])
|
|
121
|
+
fail ArgumentError, "invalid value for \"state\", must be one of #{allowable_values}"
|
|
122
|
+
end
|
|
123
|
+
allowable_values = ["translation_content_length", "translation_placeholder_usage", "translation_glossary_usage"]
|
|
124
|
+
if @api_client.config.client_side_validation && opts[:'check_names'] && !opts[:'check_names'].all? { |item| allowable_values.include?(item) }
|
|
125
|
+
fail ArgumentError, "invalid value for \"check_names\", must include one of #{allowable_values}"
|
|
126
|
+
end
|
|
127
|
+
# resource path
|
|
128
|
+
local_var_path = '/projects/{project_id}/checks/issues'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s))
|
|
129
|
+
|
|
130
|
+
# query parameters
|
|
131
|
+
query_params = opts[:query_params] || {}
|
|
132
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
|
133
|
+
query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
|
|
134
|
+
query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil?
|
|
135
|
+
query_params[:'locale_ids'] = @api_client.build_collection_param(opts[:'locale_ids'], :multi) if !opts[:'locale_ids'].nil?
|
|
136
|
+
query_params[:'check_names'] = @api_client.build_collection_param(opts[:'check_names'], :multi) if !opts[:'check_names'].nil?
|
|
137
|
+
query_params[:'created_since'] = opts[:'created_since'] if !opts[:'created_since'].nil?
|
|
138
|
+
|
|
139
|
+
# header parameters
|
|
140
|
+
header_params = opts[:header_params] || {}
|
|
141
|
+
# HTTP header 'Accept' (if needed)
|
|
142
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
143
|
+
header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
|
|
144
|
+
|
|
145
|
+
# form parameters
|
|
146
|
+
form_params = opts[:form_params] || {}
|
|
147
|
+
|
|
148
|
+
# http body (model)
|
|
149
|
+
post_body = opts[:body]
|
|
150
|
+
|
|
151
|
+
# return_type
|
|
152
|
+
return_type = opts[:return_type] || 'Array<CheckIssue>'
|
|
153
|
+
|
|
154
|
+
# auth_names
|
|
155
|
+
auth_names = opts[:auth_names] || ['Basic', 'Token']
|
|
156
|
+
|
|
157
|
+
new_options = opts.merge(
|
|
158
|
+
:header_params => header_params,
|
|
159
|
+
:query_params => query_params,
|
|
160
|
+
:form_params => form_params,
|
|
161
|
+
:body => post_body,
|
|
162
|
+
:auth_names => auth_names,
|
|
163
|
+
:return_type => return_type
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
167
|
+
if @api_client.config.debugging
|
|
168
|
+
@api_client.config.logger.debug "API called: ChecksApi#check_issues_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
169
|
+
end
|
|
170
|
+
response = ::Phrase::Response.new(data, headers)
|
|
171
|
+
return response, status_code, headers
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
end
|