phrase 4.25.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.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -0
  3. data/README.md +26 -4
  4. data/docs/AutomationEvent.md +33 -0
  5. data/docs/AutomationEventProject.md +19 -0
  6. data/docs/AutomationEventsApi.md +168 -0
  7. data/docs/AutomationsCreateParameters.md +1 -1
  8. data/docs/AutomationsCreateParameters1.md +1 -1
  9. data/docs/CheckIssue.md +33 -0
  10. data/docs/ChecksApi.md +146 -0
  11. data/docs/DocumentsApi.md +4 -4
  12. data/docs/ICUApi.md +1 -1
  13. data/docs/IcuSkeletonError.md +17 -0
  14. data/docs/IcuSkeletonParameters.md +11 -11
  15. data/docs/JobCreateParameters.md +1 -1
  16. data/docs/JobsApi.md +2 -2
  17. data/docs/KeyCreateParameters.md +1 -1
  18. data/docs/KeyFormatAnnotationsApi.md +74 -0
  19. data/docs/KeyFormatAnnotationsList200ResponseInner.md +19 -0
  20. data/docs/KeyLinksBatchDestroyParameters.md +6 -4
  21. data/docs/KeyLinksCreateParameters.md +2 -2
  22. data/docs/KeyUpdateParameters.md +1 -1
  23. data/docs/LinkedKeysApi.md +14 -13
  24. data/docs/Locale.md +6 -0
  25. data/docs/LocaleCreateParameters.md +2 -0
  26. data/docs/LocaleDetails.md +6 -0
  27. data/docs/LocaleUpdateParameters.md +2 -0
  28. data/docs/MachineTranslationApi.md +263 -0
  29. data/docs/MachineTranslationLocaleProviderMapping.md +21 -0
  30. data/docs/MachineTranslationLocaleProviderMappingsCreateParameters.md +21 -0
  31. data/docs/MachineTranslationSettings.md +23 -0
  32. data/docs/MachineTranslationSettingsUpdateParameters.md +17 -0
  33. data/docs/PreTranslation.md +29 -0
  34. data/docs/PreTranslationCreateParameters.md +19 -0
  35. data/docs/PreTranslationsApi.md +210 -0
  36. data/docs/ProjectCreateParameters.md +8 -2
  37. data/docs/ProjectDetails.md +3 -1
  38. data/docs/ProjectUpdateParameters.md +8 -2
  39. data/docs/ScreenshotUpdateParameters.md +1 -1
  40. data/docs/ScreenshotsApi.md +2 -2
  41. data/docs/Upload.md +3 -1
  42. data/docs/UploadsApi.md +4 -4
  43. data/lib/phrase/api/automation_events_api.rb +215 -0
  44. data/lib/phrase/api/checks_api.rb +174 -0
  45. data/lib/phrase/api/documents_api.rb +6 -6
  46. data/lib/phrase/api/icu_api.rb +2 -6
  47. data/lib/phrase/api/key_format_annotations_api.rb +85 -0
  48. data/lib/phrase/api/linked_keys_api.rb +19 -23
  49. data/lib/phrase/api/machine_translation_api.rb +302 -0
  50. data/lib/phrase/api/pre_translations_api.rb +240 -0
  51. data/lib/phrase/api/screenshots_api.rb +4 -4
  52. data/lib/phrase/api/uploads_api.rb +6 -6
  53. data/lib/phrase/models/automation_event.rb +325 -0
  54. data/lib/phrase/models/automation_event_project.rb +208 -0
  55. data/lib/phrase/models/automations_create_parameters.rb +1 -1
  56. data/lib/phrase/models/automations_create_parameters1.rb +1 -1
  57. data/lib/phrase/models/check_issue.rb +319 -0
  58. data/lib/phrase/models/{key_links_index400_response.rb → icu_skeleton_error.rb} +11 -10
  59. data/lib/phrase/models/icu_skeleton_parameters.rb +6 -6
  60. data/lib/phrase/models/job_create_parameters.rb +1 -1
  61. data/lib/phrase/models/key_format_annotations_list200_response_inner.rb +207 -0
  62. data/lib/phrase/models/key_links_batch_destroy_parameters.rb +52 -6
  63. data/lib/phrase/models/key_links_create_parameters.rb +1 -1
  64. data/lib/phrase/models/locale.rb +31 -1
  65. data/lib/phrase/models/locale_create_parameters.rb +11 -1
  66. data/lib/phrase/models/locale_details.rb +31 -1
  67. data/lib/phrase/models/locale_update_parameters.rb +11 -1
  68. data/lib/phrase/models/machine_translation_locale_provider_mapping.rb +217 -0
  69. data/lib/phrase/models/machine_translation_locale_provider_mappings_create_parameters.rb +232 -0
  70. data/lib/phrase/models/machine_translation_settings.rb +230 -0
  71. data/lib/phrase/models/machine_translation_settings_update_parameters.rb +198 -0
  72. data/lib/phrase/models/pre_translation.rb +301 -0
  73. data/lib/phrase/models/pre_translation_create_parameters.rb +241 -0
  74. data/lib/phrase/models/project_create_parameters.rb +35 -1
  75. data/lib/phrase/models/project_details.rb +10 -1
  76. data/lib/phrase/models/project_update_parameters.rb +35 -1
  77. data/lib/phrase/models/upload.rb +13 -1
  78. data/lib/phrase/response.rb +2 -2
  79. data/lib/phrase/version.rb +1 -1
  80. data/lib/phrase.rb +16 -1
  81. data/phrase.gemspec +1 -1
  82. data/spec/api/automation_events_api_spec.rb +67 -0
  83. data/spec/api/checks_api_spec.rb +56 -0
  84. data/spec/api/documents_api_spec.rb +3 -3
  85. data/spec/api/icu_api_spec.rb +1 -1
  86. data/spec/api/key_format_annotations_api_spec.rb +38 -0
  87. data/spec/api/linked_keys_api_spec.rb +7 -7
  88. data/spec/api/machine_translation_api_spec.rb +79 -0
  89. data/spec/api/pre_translations_api_spec.rb +70 -0
  90. data/spec/api/screenshots_api_spec.rb +2 -2
  91. data/spec/models/automation_event_project_spec.rb +35 -0
  92. data/spec/models/automation_event_spec.rb +85 -0
  93. data/spec/models/check_issue_spec.rb +85 -0
  94. data/spec/models/{key_links_index400_response_spec.rb → icu_skeleton_error_spec.rb} +7 -7
  95. data/spec/models/key_format_annotations_list200_response_inner_spec.rb +35 -0
  96. data/spec/models/key_links_batch_destroy_parameters_spec.rb +10 -0
  97. data/spec/models/locale_create_parameters_spec.rb +6 -0
  98. data/spec/models/locale_details_spec.rb +18 -0
  99. data/spec/models/locale_spec.rb +18 -0
  100. data/spec/models/locale_update_parameters_spec.rb +6 -0
  101. data/spec/models/machine_translation_locale_provider_mapping_spec.rb +41 -0
  102. data/spec/models/machine_translation_locale_provider_mappings_create_parameters_spec.rb +41 -0
  103. data/spec/models/machine_translation_settings_spec.rb +47 -0
  104. data/spec/models/machine_translation_settings_update_parameters_spec.rb +29 -0
  105. data/spec/models/pre_translation_create_parameters_spec.rb +39 -0
  106. data/spec/models/pre_translation_spec.rb +73 -0
  107. data/spec/models/project_create_parameters_spec.rb +18 -0
  108. data/spec/models/project_details_spec.rb +6 -0
  109. data/spec/models/project_update_parameters_spec.rb +18 -0
  110. data/spec/models/upload_spec.rb +6 -0
  111. data/spec/response_spec.rb +53 -0
  112. metadata +313 -251
  113. data/docs/KeyLinksIndex400Response.md +0 -17
@@ -0,0 +1,85 @@
1
+ require 'cgi'
2
+
3
+ module Phrase
4
+ class KeyFormatAnnotationsApi
5
+ attr_accessor :api_client
6
+
7
+ def initialize(api_client = ApiClient.default)
8
+ @api_client = api_client
9
+ end
10
+ # List format annotations for a key
11
+ # Returns the format annotations stored on a translation key. Format annotations capture file-format data recorded when the key was imported — for example, an ARB placeholder block or an XLIFF note. Results are limited to 1,000 entries.
12
+ # @param project_id [String] Project ID
13
+ # @param id [String] ID
14
+ # @param [Hash] opts the optional parameters
15
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
16
+ # @option opts [String] :branch Branch to use
17
+ # @return [Array<KeyFormatAnnotationsList200ResponseInner>]
18
+ def key_format_annotations_list(project_id, id, opts = {})
19
+ data, _status_code, _headers = key_format_annotations_list_with_http_info(project_id, id, opts)
20
+ data
21
+ end
22
+
23
+ # List format annotations for a key
24
+ # Returns the format annotations stored on a translation key. Format annotations capture file-format data recorded when the key was imported — for example, an ARB placeholder block or an XLIFF note. Results are limited to 1,000 entries.
25
+ # @param project_id [String] Project ID
26
+ # @param id [String] ID
27
+ # @param [Hash] opts the optional parameters
28
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
29
+ # @option opts [String] :branch Branch to use
30
+ # @return [Array<(Response<(Array<KeyFormatAnnotationsList200ResponseInner>)>, Integer, Hash)>] Response<(Array<KeyFormatAnnotationsList200ResponseInner>)> data, response status code and response headers
31
+ def key_format_annotations_list_with_http_info(project_id, id, opts = {})
32
+ if @api_client.config.debugging
33
+ @api_client.config.logger.debug 'Calling API: KeyFormatAnnotationsApi.key_format_annotations_list ...'
34
+ end
35
+ # verify the required parameter 'project_id' is set
36
+ if @api_client.config.client_side_validation && project_id.nil?
37
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling KeyFormatAnnotationsApi.key_format_annotations_list"
38
+ end
39
+ # verify the required parameter 'id' is set
40
+ if @api_client.config.client_side_validation && id.nil?
41
+ fail ArgumentError, "Missing the required parameter 'id' when calling KeyFormatAnnotationsApi.key_format_annotations_list"
42
+ end
43
+ # resource path
44
+ local_var_path = '/projects/{project_id}/keys/{id}/format_annotations'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
45
+
46
+ # query parameters
47
+ query_params = opts[:query_params] || {}
48
+ query_params[:'branch'] = opts[:'branch'] if !opts[:'branch'].nil?
49
+
50
+ # header parameters
51
+ header_params = opts[:header_params] || {}
52
+ # HTTP header 'Accept' (if needed)
53
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
54
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
55
+
56
+ # form parameters
57
+ form_params = opts[:form_params] || {}
58
+
59
+ # http body (model)
60
+ post_body = opts[:body]
61
+
62
+ # return_type
63
+ return_type = opts[:return_type] || 'Array<KeyFormatAnnotationsList200ResponseInner>'
64
+
65
+ # auth_names
66
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
67
+
68
+ new_options = opts.merge(
69
+ :header_params => header_params,
70
+ :query_params => query_params,
71
+ :form_params => form_params,
72
+ :body => post_body,
73
+ :auth_names => auth_names,
74
+ :return_type => return_type
75
+ )
76
+
77
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
78
+ if @api_client.config.debugging
79
+ @api_client.config.logger.debug "API called: KeyFormatAnnotationsApi#key_format_annotations_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
80
+ end
81
+ response = ::Phrase::Response.new(data, headers)
82
+ return response, status_code, headers
83
+ end
84
+ end
85
+ end
@@ -8,27 +8,27 @@ module Phrase
8
8
  @api_client = api_client
9
9
  end
10
10
  # Batch unlink child keys from a parent key
11
- # Unlinks multiple child keys from a given parent key in a single operation.
11
+ # Removes one or more child keys from a parent key's linked-key group, or dissolves the entire group by setting unlink_parent to true. Use this when you need to detach specific child keys from a shared translation source, or to fully break apart a linked-key group so each key manages its own translations independently. When child keys are unlinked, their translations are updated with a copy of the parent's current content (strategy keep_content, the default) or cleared (strategy remove_content). This operation is only available on main projects. It returns 422 when a child key in `child_key_ids` is not currently linked to the parent, or when a translation update fails while unlinking.
12
12
  # @param project_id [String] Project ID
13
13
  # @param id [String] Parent Translation Key ID
14
- # @param key_links_batch_destroy_parameters [KeyLinksBatchDestroyParameters]
15
14
  # @param [Hash] opts the optional parameters
16
15
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
17
- # @return [nil]
18
- def key_links_batch_destroy(project_id, id, key_links_batch_destroy_parameters, opts = {})
19
- data, _status_code, _headers = key_links_batch_destroy_with_http_info(project_id, id, key_links_batch_destroy_parameters, opts)
16
+ # @option opts [KeyLinksBatchDestroyParameters] :key_links_batch_destroy_parameters
17
+ # @return [KeyLink]
18
+ def key_links_batch_destroy(project_id, id, opts = {})
19
+ data, _status_code, _headers = key_links_batch_destroy_with_http_info(project_id, id, opts)
20
20
  data
21
21
  end
22
22
 
23
23
  # Batch unlink child keys from a parent key
24
- # Unlinks multiple child keys from a given parent key in a single operation.
24
+ # Removes one or more child keys from a parent key&#39;s linked-key group, or dissolves the entire group by setting unlink_parent to true. Use this when you need to detach specific child keys from a shared translation source, or to fully break apart a linked-key group so each key manages its own translations independently. When child keys are unlinked, their translations are updated with a copy of the parent&#39;s current content (strategy keep_content, the default) or cleared (strategy remove_content). This operation is only available on main projects. It returns 422 when a child key in &#x60;child_key_ids&#x60; is not currently linked to the parent, or when a translation update fails while unlinking.
25
25
  # @param project_id [String] Project ID
26
26
  # @param id [String] Parent Translation Key ID
27
- # @param key_links_batch_destroy_parameters [KeyLinksBatchDestroyParameters]
28
27
  # @param [Hash] opts the optional parameters
29
28
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
30
- # @return [Array<(Response, Integer, Hash)>] Response<(nil, response status code and response headers
31
- def key_links_batch_destroy_with_http_info(project_id, id, key_links_batch_destroy_parameters, opts = {})
29
+ # @option opts [KeyLinksBatchDestroyParameters] :key_links_batch_destroy_parameters
30
+ # @return [Array<(Response<(KeyLink)>, Integer, Hash)>] Response<(KeyLink)> data, response status code and response headers
31
+ def key_links_batch_destroy_with_http_info(project_id, id, opts = {})
32
32
  if @api_client.config.debugging
33
33
  @api_client.config.logger.debug 'Calling API: LinkedKeysApi.key_links_batch_destroy ...'
34
34
  end
@@ -40,10 +40,6 @@ module Phrase
40
40
  if @api_client.config.client_side_validation && id.nil?
41
41
  fail ArgumentError, "Missing the required parameter 'id' when calling LinkedKeysApi.key_links_batch_destroy"
42
42
  end
43
- # verify the required parameter 'key_links_batch_destroy_parameters' is set
44
- if @api_client.config.client_side_validation && key_links_batch_destroy_parameters.nil?
45
- fail ArgumentError, "Missing the required parameter 'key_links_batch_destroy_parameters' when calling LinkedKeysApi.key_links_batch_destroy"
46
- end
47
43
  # resource path
48
44
  local_var_path = '/projects/{project_id}/keys/{id}/key_links'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
49
45
 
@@ -62,10 +58,10 @@ module Phrase
62
58
  form_params = opts[:form_params] || {}
63
59
 
64
60
  # http body (model)
65
- post_body = opts[:body] || @api_client.object_to_http_body(key_links_batch_destroy_parameters)
61
+ post_body = opts[:body] || @api_client.object_to_http_body(opts[:'key_links_batch_destroy_parameters'])
66
62
 
67
63
  # return_type
68
- return_type = opts[:return_type]
64
+ return_type = opts[:return_type] || 'KeyLink'
69
65
 
70
66
  # auth_names
71
67
  auth_names = opts[:auth_names] || ['Basic', 'Token']
@@ -88,7 +84,7 @@ module Phrase
88
84
  end
89
85
 
90
86
  # Link child keys to a parent key
91
- # Creates links between a given parent key and one or more child keys.
87
+ # Designates a translation key as a parent and links one or more child keys to it. Once linked, child keys receive a special reference marker as their translation content, signalling that their translations are derived from the parent. Use this when you want to group related keys — for example, a short label and its long-form variant — so translators see them in context together. Pass an empty child_key_ids array to mark the key as a parent without linking any children yet. Both the parent key and every child key must belong to the main project; branch keys cannot participate in key links. A child key can have at most one parent at a time; attempting to link a child that already has a parent returns a 422 error with code CHILD_IS_ALREADY_LINKED. Parent and child key plurality must match — linking a plural child to a non-plural parent (or vice versa) also returns a 422.
92
88
  # @param project_id [String] Project ID
93
89
  # @param id [String] Parent Translation Key ID
94
90
  # @param key_links_create_parameters [KeyLinksCreateParameters]
@@ -101,7 +97,7 @@ module Phrase
101
97
  end
102
98
 
103
99
  # Link child keys to a parent key
104
- # Creates links between a given parent key and one or more child keys.
100
+ # Designates a translation key as a parent and links one or more child keys to it. Once linked, child keys receive a special reference marker as their translation content, signalling that their translations are derived from the parent. Use this when you want to group related keys — for example, a short label and its long-form variant — so translators see them in context together. Pass an empty child_key_ids array to mark the key as a parent without linking any children yet. Both the parent key and every child key must belong to the main project; branch keys cannot participate in key links. A child key can have at most one parent at a time; attempting to link a child that already has a parent returns a 422 error with code CHILD_IS_ALREADY_LINKED. Parent and child key plurality must match — linking a plural child to a non-plural parent (or vice versa) also returns a 422.
105
101
  # @param project_id [String] Project ID
106
102
  # @param id [String] Parent Translation Key ID
107
103
  # @param key_links_create_parameters [KeyLinksCreateParameters]
@@ -168,10 +164,10 @@ module Phrase
168
164
  end
169
165
 
170
166
  # Unlink a child key from a parent key
171
- # Unlinks a single child key from a given parent key.
167
+ # Removes a single child key from a parent key's link group. A link group is the relationship model that keeps child keys synchronized with a parent: while linked, a child key's translations are derived from the parent's content. When you call this endpoint, the child key leaves the group and becomes independent — its existing translations are updated with the parent's current content and then marked unverified, signalling that reviewers should confirm the content is still appropriate for the child's context. Use this endpoint when you need to detach one specific child key while keeping other children linked. To detach multiple children at once, use the batch unlink endpoint. This operation is only available on main projects. It returns 422 when the child key is not currently linked to the specified parent key, or when a translation update fails during the unlink process.
172
168
  # @param project_id [String] Project ID
173
169
  # @param id [String] Parent Translation Key ID
174
- # @param child_key_id [String] The ID of the child key to unlink.
170
+ # @param child_key_id [String] The ID of the child translation key to unlink from the parent.
175
171
  # @param [Hash] opts the optional parameters
176
172
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
177
173
  # @return [nil]
@@ -181,10 +177,10 @@ module Phrase
181
177
  end
182
178
 
183
179
  # Unlink a child key from a parent key
184
- # Unlinks a single child key from a given parent key.
180
+ # Removes a single child key from a parent key&#39;s link group. A link group is the relationship model that keeps child keys synchronized with a parent: while linked, a child key&#39;s translations are derived from the parent&#39;s content. When you call this endpoint, the child key leaves the group and becomes independent — its existing translations are updated with the parent&#39;s current content and then marked unverified, signalling that reviewers should confirm the content is still appropriate for the child&#39;s context. Use this endpoint when you need to detach one specific child key while keeping other children linked. To detach multiple children at once, use the batch unlink endpoint. This operation is only available on main projects. It returns 422 when the child key is not currently linked to the specified parent key, or when a translation update fails during the unlink process.
185
181
  # @param project_id [String] Project ID
186
182
  # @param id [String] Parent Translation Key ID
187
- # @param child_key_id [String] The ID of the child key to unlink.
183
+ # @param child_key_id [String] The ID of the child translation key to unlink from the parent.
188
184
  # @param [Hash] opts the optional parameters
189
185
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
190
186
  # @return [Array<(Response, Integer, Hash)>] Response<(nil, response status code and response headers
@@ -246,7 +242,7 @@ module Phrase
246
242
  end
247
243
 
248
244
  # List child keys of a parent key
249
- # Returns detailed information about a parent key, including its linked child keys.
245
+ # Returns the key link record for a parent key, including all child keys associated with it. Key linking lets translation keys share translations — a child key inherits content from its designated parent. Use this endpoint to inspect which keys are linked under a given parent before unlinking them or auditing translation consistency across related keys. The key identified by `id` must be designated as a parent key (it must have at least one child key linked to it). Listing the links of a key that is not a parent returns 400.
250
246
  # @param project_id [String] Project ID
251
247
  # @param id [String] Parent Translation Key ID
252
248
  # @param [Hash] opts the optional parameters
@@ -258,7 +254,7 @@ module Phrase
258
254
  end
259
255
 
260
256
  # List child keys of a parent key
261
- # Returns detailed information about a parent key, including its linked child keys.
257
+ # Returns the key link record for a parent key, including all child keys associated with it. Key linking lets translation keys share translations — a child key inherits content from its designated parent. Use this endpoint to inspect which keys are linked under a given parent before unlinking them or auditing translation consistency across related keys. The key identified by &#x60;id&#x60; must be designated as a parent key (it must have at least one child key linked to it). Listing the links of a key that is not a parent returns 400.
262
258
  # @param project_id [String] Project ID
263
259
  # @param id [String] Parent Translation Key ID
264
260
  # @param [Hash] opts the optional parameters
@@ -0,0 +1,302 @@
1
+ require 'cgi'
2
+
3
+ module Phrase
4
+ class MachineTranslationApi
5
+ attr_accessor :api_client
6
+
7
+ def initialize(api_client = ApiClient.default)
8
+ @api_client = api_client
9
+ end
10
+ # Create a locale provider mapping
11
+ # Creates a locale-pair-specific machine translation provider override for the account. When a mapping exists for a given source/target locale pair, that provider is used instead of the account default. Only one mapping may exist per source/target locale pair; attempting to create a duplicate returns a validation error. The source and target locale codes must differ.
12
+ # @param account_id [String] Account ID
13
+ # @param machine_translation_locale_provider_mappings_create_parameters [MachineTranslationLocaleProviderMappingsCreateParameters]
14
+ # @param [Hash] opts the optional parameters
15
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
16
+ # @return [MachineTranslationLocaleProviderMapping]
17
+ def machine_translation_locale_provider_mappings_create(account_id, machine_translation_locale_provider_mappings_create_parameters, opts = {})
18
+ data, _status_code, _headers = machine_translation_locale_provider_mappings_create_with_http_info(account_id, machine_translation_locale_provider_mappings_create_parameters, opts)
19
+ data
20
+ end
21
+
22
+ # Create a locale provider mapping
23
+ # Creates a locale-pair-specific machine translation provider override for the account. When a mapping exists for a given source/target locale pair, that provider is used instead of the account default. Only one mapping may exist per source/target locale pair; attempting to create a duplicate returns a validation error. The source and target locale codes must differ.
24
+ # @param account_id [String] Account ID
25
+ # @param machine_translation_locale_provider_mappings_create_parameters [MachineTranslationLocaleProviderMappingsCreateParameters]
26
+ # @param [Hash] opts the optional parameters
27
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
28
+ # @return [Array<(Response<(MachineTranslationLocaleProviderMapping)>, Integer, Hash)>] Response<(MachineTranslationLocaleProviderMapping)> data, response status code and response headers
29
+ def machine_translation_locale_provider_mappings_create_with_http_info(account_id, machine_translation_locale_provider_mappings_create_parameters, opts = {})
30
+ if @api_client.config.debugging
31
+ @api_client.config.logger.debug 'Calling API: MachineTranslationApi.machine_translation_locale_provider_mappings_create ...'
32
+ end
33
+ # verify the required parameter 'account_id' is set
34
+ if @api_client.config.client_side_validation && account_id.nil?
35
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling MachineTranslationApi.machine_translation_locale_provider_mappings_create"
36
+ end
37
+ # verify the required parameter 'machine_translation_locale_provider_mappings_create_parameters' is set
38
+ if @api_client.config.client_side_validation && machine_translation_locale_provider_mappings_create_parameters.nil?
39
+ fail ArgumentError, "Missing the required parameter 'machine_translation_locale_provider_mappings_create_parameters' when calling MachineTranslationApi.machine_translation_locale_provider_mappings_create"
40
+ end
41
+ # resource path
42
+ local_var_path = '/accounts/{account_id}/machine_translation_locale_provider_mappings'.sub('{' + 'account_id' + '}', CGI.escape(account_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
+ # HTTP header 'Content-Type'
52
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
53
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
54
+
55
+ # form parameters
56
+ form_params = opts[:form_params] || {}
57
+
58
+ # http body (model)
59
+ post_body = opts[:body] || @api_client.object_to_http_body(machine_translation_locale_provider_mappings_create_parameters)
60
+
61
+ # return_type
62
+ return_type = opts[:return_type] || 'MachineTranslationLocaleProviderMapping'
63
+
64
+ # auth_names
65
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
66
+
67
+ new_options = opts.merge(
68
+ :header_params => header_params,
69
+ :query_params => query_params,
70
+ :form_params => form_params,
71
+ :body => post_body,
72
+ :auth_names => auth_names,
73
+ :return_type => return_type
74
+ )
75
+
76
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
77
+ if @api_client.config.debugging
78
+ @api_client.config.logger.debug "API called: MachineTranslationApi#machine_translation_locale_provider_mappings_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
79
+ end
80
+ response = ::Phrase::Response.new(data, headers)
81
+ return response, status_code, headers
82
+ end
83
+
84
+ # Delete a locale provider mapping
85
+ # Removes the machine translation provider override for the specified source and target locale pair. The mapping is identified by locale codes supplied as query parameters rather than a path ID.
86
+ # @param account_id [String] Account ID
87
+ # @param source_locale_code [String] The locale code of the source language of the mapping to delete.
88
+ # @param target_locale_code [String] The locale code of the target language of the mapping to delete.
89
+ # @param [Hash] opts the optional parameters
90
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
91
+ # @return [nil]
92
+ def machine_translation_locale_provider_mappings_destroy(account_id, source_locale_code, target_locale_code, opts = {})
93
+ data, _status_code, _headers = machine_translation_locale_provider_mappings_destroy_with_http_info(account_id, source_locale_code, target_locale_code, opts)
94
+ data
95
+ end
96
+
97
+ # Delete a locale provider mapping
98
+ # Removes the machine translation provider override for the specified source and target locale pair. The mapping is identified by locale codes supplied as query parameters rather than a path ID.
99
+ # @param account_id [String] Account ID
100
+ # @param source_locale_code [String] The locale code of the source language of the mapping to delete.
101
+ # @param target_locale_code [String] The locale code of the target language of the mapping to delete.
102
+ # @param [Hash] opts the optional parameters
103
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
104
+ # @return [Array<(Response, Integer, Hash)>] Response<(nil, response status code and response headers
105
+ def machine_translation_locale_provider_mappings_destroy_with_http_info(account_id, source_locale_code, target_locale_code, opts = {})
106
+ if @api_client.config.debugging
107
+ @api_client.config.logger.debug 'Calling API: MachineTranslationApi.machine_translation_locale_provider_mappings_destroy ...'
108
+ end
109
+ # verify the required parameter 'account_id' is set
110
+ if @api_client.config.client_side_validation && account_id.nil?
111
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling MachineTranslationApi.machine_translation_locale_provider_mappings_destroy"
112
+ end
113
+ # verify the required parameter 'source_locale_code' is set
114
+ if @api_client.config.client_side_validation && source_locale_code.nil?
115
+ fail ArgumentError, "Missing the required parameter 'source_locale_code' when calling MachineTranslationApi.machine_translation_locale_provider_mappings_destroy"
116
+ end
117
+ # verify the required parameter 'target_locale_code' is set
118
+ if @api_client.config.client_side_validation && target_locale_code.nil?
119
+ fail ArgumentError, "Missing the required parameter 'target_locale_code' when calling MachineTranslationApi.machine_translation_locale_provider_mappings_destroy"
120
+ end
121
+ # resource path
122
+ local_var_path = '/accounts/{account_id}/machine_translation_locale_provider_mappings'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s))
123
+
124
+ # query parameters
125
+ query_params = opts[:query_params] || {}
126
+ query_params[:'source_locale_code'] = source_locale_code
127
+ query_params[:'target_locale_code'] = target_locale_code
128
+
129
+ # header parameters
130
+ header_params = opts[:header_params] || {}
131
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
132
+
133
+ # form parameters
134
+ form_params = opts[:form_params] || {}
135
+
136
+ # http body (model)
137
+ post_body = opts[:body]
138
+
139
+ # return_type
140
+ return_type = opts[:return_type]
141
+
142
+ # auth_names
143
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
144
+
145
+ new_options = opts.merge(
146
+ :header_params => header_params,
147
+ :query_params => query_params,
148
+ :form_params => form_params,
149
+ :body => post_body,
150
+ :auth_names => auth_names,
151
+ :return_type => return_type
152
+ )
153
+
154
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
155
+ if @api_client.config.debugging
156
+ @api_client.config.logger.debug "API called: MachineTranslationApi#machine_translation_locale_provider_mappings_destroy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
157
+ end
158
+ response = ::Phrase::Response.new(data, headers)
159
+ return response, status_code, headers
160
+ end
161
+
162
+ # Get machine translation settings
163
+ # Returns the machine translation configuration for the account, including the default translation service, current machine translation unit usage, and any locale-pair-specific provider mappings.
164
+ # @param account_id [String] Account ID
165
+ # @param [Hash] opts the optional parameters
166
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
167
+ # @return [MachineTranslationSettings]
168
+ def machine_translation_settings_show(account_id, opts = {})
169
+ data, _status_code, _headers = machine_translation_settings_show_with_http_info(account_id, opts)
170
+ data
171
+ end
172
+
173
+ # Get machine translation settings
174
+ # Returns the machine translation configuration for the account, including the default translation service, current machine translation unit usage, and any locale-pair-specific provider mappings.
175
+ # @param account_id [String] Account ID
176
+ # @param [Hash] opts the optional parameters
177
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
178
+ # @return [Array<(Response<(MachineTranslationSettings)>, Integer, Hash)>] Response<(MachineTranslationSettings)> data, response status code and response headers
179
+ def machine_translation_settings_show_with_http_info(account_id, opts = {})
180
+ if @api_client.config.debugging
181
+ @api_client.config.logger.debug 'Calling API: MachineTranslationApi.machine_translation_settings_show ...'
182
+ end
183
+ # verify the required parameter 'account_id' is set
184
+ if @api_client.config.client_side_validation && account_id.nil?
185
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling MachineTranslationApi.machine_translation_settings_show"
186
+ end
187
+ # resource path
188
+ local_var_path = '/accounts/{account_id}/machine_translation_settings'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s))
189
+
190
+ # query parameters
191
+ query_params = opts[:query_params] || {}
192
+
193
+ # header parameters
194
+ header_params = opts[:header_params] || {}
195
+ # HTTP header 'Accept' (if needed)
196
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
197
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
198
+
199
+ # form parameters
200
+ form_params = opts[:form_params] || {}
201
+
202
+ # http body (model)
203
+ post_body = opts[:body]
204
+
205
+ # return_type
206
+ return_type = opts[:return_type] || 'MachineTranslationSettings'
207
+
208
+ # auth_names
209
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
210
+
211
+ new_options = opts.merge(
212
+ :header_params => header_params,
213
+ :query_params => query_params,
214
+ :form_params => form_params,
215
+ :body => post_body,
216
+ :auth_names => auth_names,
217
+ :return_type => return_type
218
+ )
219
+
220
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
221
+ if @api_client.config.debugging
222
+ @api_client.config.logger.debug "API called: MachineTranslationApi#machine_translation_settings_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
223
+ end
224
+ response = ::Phrase::Response.new(data, headers)
225
+ return response, status_code, headers
226
+ end
227
+
228
+ # Update machine translation settings
229
+ # Sets the default machine translation service for the account. Requires write access to the account's machine translation settings. Passing an empty or absent value for `default_service` resets the account to its plan default (Microsoft Translate).
230
+ # @param account_id [String] Account ID
231
+ # @param machine_translation_settings_update_parameters [MachineTranslationSettingsUpdateParameters]
232
+ # @param [Hash] opts the optional parameters
233
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
234
+ # @return [MachineTranslationSettings]
235
+ def machine_translation_settings_update(account_id, machine_translation_settings_update_parameters, opts = {})
236
+ data, _status_code, _headers = machine_translation_settings_update_with_http_info(account_id, machine_translation_settings_update_parameters, opts)
237
+ data
238
+ end
239
+
240
+ # Update machine translation settings
241
+ # Sets the default machine translation service for the account. Requires write access to the account&#39;s machine translation settings. Passing an empty or absent value for &#x60;default_service&#x60; resets the account to its plan default (Microsoft Translate).
242
+ # @param account_id [String] Account ID
243
+ # @param machine_translation_settings_update_parameters [MachineTranslationSettingsUpdateParameters]
244
+ # @param [Hash] opts the optional parameters
245
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
246
+ # @return [Array<(Response<(MachineTranslationSettings)>, Integer, Hash)>] Response<(MachineTranslationSettings)> data, response status code and response headers
247
+ def machine_translation_settings_update_with_http_info(account_id, machine_translation_settings_update_parameters, opts = {})
248
+ if @api_client.config.debugging
249
+ @api_client.config.logger.debug 'Calling API: MachineTranslationApi.machine_translation_settings_update ...'
250
+ end
251
+ # verify the required parameter 'account_id' is set
252
+ if @api_client.config.client_side_validation && account_id.nil?
253
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling MachineTranslationApi.machine_translation_settings_update"
254
+ end
255
+ # verify the required parameter 'machine_translation_settings_update_parameters' is set
256
+ if @api_client.config.client_side_validation && machine_translation_settings_update_parameters.nil?
257
+ fail ArgumentError, "Missing the required parameter 'machine_translation_settings_update_parameters' when calling MachineTranslationApi.machine_translation_settings_update"
258
+ end
259
+ # resource path
260
+ local_var_path = '/accounts/{account_id}/machine_translation_settings'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s))
261
+
262
+ # query parameters
263
+ query_params = opts[:query_params] || {}
264
+
265
+ # header parameters
266
+ header_params = opts[:header_params] || {}
267
+ # HTTP header 'Accept' (if needed)
268
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
269
+ # HTTP header 'Content-Type'
270
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
271
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
272
+
273
+ # form parameters
274
+ form_params = opts[:form_params] || {}
275
+
276
+ # http body (model)
277
+ post_body = opts[:body] || @api_client.object_to_http_body(machine_translation_settings_update_parameters)
278
+
279
+ # return_type
280
+ return_type = opts[:return_type] || 'MachineTranslationSettings'
281
+
282
+ # auth_names
283
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
284
+
285
+ new_options = opts.merge(
286
+ :header_params => header_params,
287
+ :query_params => query_params,
288
+ :form_params => form_params,
289
+ :body => post_body,
290
+ :auth_names => auth_names,
291
+ :return_type => return_type
292
+ )
293
+
294
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
295
+ if @api_client.config.debugging
296
+ @api_client.config.logger.debug "API called: MachineTranslationApi#machine_translation_settings_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
297
+ end
298
+ response = ::Phrase::Response.new(data, headers)
299
+ return response, status_code, headers
300
+ end
301
+ end
302
+ end