phrase 4.25.0 → 4.26.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 (66) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -0
  3. data/README.md +15 -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/DocumentsApi.md +4 -4
  10. data/docs/ICUApi.md +1 -1
  11. data/docs/IcuSkeletonError.md +17 -0
  12. data/docs/IcuSkeletonParameters.md +11 -11
  13. data/docs/JobsApi.md +2 -2
  14. data/docs/KeyCreateParameters.md +1 -1
  15. data/docs/KeyFormatAnnotationsApi.md +74 -0
  16. data/docs/KeyFormatAnnotationsList200ResponseInner.md +19 -0
  17. data/docs/KeyLinksBatchDestroyParameters.md +6 -4
  18. data/docs/KeyLinksCreateParameters.md +2 -2
  19. data/docs/KeyUpdateParameters.md +1 -1
  20. data/docs/LinkedKeysApi.md +14 -13
  21. data/docs/PreTranslation.md +29 -0
  22. data/docs/PreTranslationCreateParameters.md +19 -0
  23. data/docs/PreTranslationsApi.md +210 -0
  24. data/docs/ProjectCreateParameters.md +1 -1
  25. data/docs/ProjectUpdateParameters.md +1 -1
  26. data/docs/ScreenshotUpdateParameters.md +1 -1
  27. data/docs/ScreenshotsApi.md +2 -2
  28. data/lib/phrase/api/automation_events_api.rb +215 -0
  29. data/lib/phrase/api/documents_api.rb +6 -6
  30. data/lib/phrase/api/icu_api.rb +2 -6
  31. data/lib/phrase/api/key_format_annotations_api.rb +85 -0
  32. data/lib/phrase/api/linked_keys_api.rb +19 -23
  33. data/lib/phrase/api/pre_translations_api.rb +240 -0
  34. data/lib/phrase/api/screenshots_api.rb +4 -4
  35. data/lib/phrase/models/automation_event.rb +325 -0
  36. data/lib/phrase/models/automation_event_project.rb +208 -0
  37. data/lib/phrase/models/automations_create_parameters.rb +1 -1
  38. data/lib/phrase/models/automations_create_parameters1.rb +1 -1
  39. data/lib/phrase/models/{key_links_index400_response.rb → icu_skeleton_error.rb} +11 -10
  40. data/lib/phrase/models/icu_skeleton_parameters.rb +6 -6
  41. data/lib/phrase/models/key_format_annotations_list200_response_inner.rb +207 -0
  42. data/lib/phrase/models/key_links_batch_destroy_parameters.rb +52 -6
  43. data/lib/phrase/models/key_links_create_parameters.rb +1 -1
  44. data/lib/phrase/models/pre_translation.rb +301 -0
  45. data/lib/phrase/models/pre_translation_create_parameters.rb +241 -0
  46. data/lib/phrase/response.rb +2 -2
  47. data/lib/phrase/version.rb +1 -1
  48. data/lib/phrase.rb +9 -1
  49. data/phrase.gemspec +1 -1
  50. data/spec/api/automation_events_api_spec.rb +67 -0
  51. data/spec/api/documents_api_spec.rb +3 -3
  52. data/spec/api/icu_api_spec.rb +1 -1
  53. data/spec/api/key_format_annotations_api_spec.rb +38 -0
  54. data/spec/api/linked_keys_api_spec.rb +7 -7
  55. data/spec/api/pre_translations_api_spec.rb +70 -0
  56. data/spec/api/screenshots_api_spec.rb +2 -2
  57. data/spec/models/automation_event_project_spec.rb +35 -0
  58. data/spec/models/automation_event_spec.rb +85 -0
  59. data/spec/models/{key_links_index400_response_spec.rb → icu_skeleton_error_spec.rb} +7 -7
  60. data/spec/models/key_format_annotations_list200_response_inner_spec.rb +35 -0
  61. data/spec/models/key_links_batch_destroy_parameters_spec.rb +10 -0
  62. data/spec/models/pre_translation_create_parameters_spec.rb +39 -0
  63. data/spec/models/pre_translation_spec.rb +73 -0
  64. data/spec/response_spec.rb +53 -0
  65. metadata +291 -257
  66. data/docs/KeyLinksIndex400Response.md +0 -17
@@ -8,7 +8,7 @@ module Phrase
8
8
  @api_client = api_client
9
9
  end
10
10
  # Delete document
11
- # Delete an existing document.
11
+ # Permanently deletes a document and all of its associated translation segments from the project. Use this when you want to remove a document that is no longer needed; the deletion cannot be reversed and all associated segments will be lost.
12
12
  # @param project_id [String] Project ID
13
13
  # @param id [String] ID
14
14
  # @param [Hash] opts the optional parameters
@@ -20,7 +20,7 @@ module Phrase
20
20
  end
21
21
 
22
22
  # Delete document
23
- # Delete an existing document.
23
+ # Permanently deletes a document and all of its associated translation segments from the project. Use this when you want to remove a document that is no longer needed; the deletion cannot be reversed and all associated segments will be lost.
24
24
  # @param project_id [String] Project ID
25
25
  # @param id [String] ID
26
26
  # @param [Hash] opts the optional parameters
@@ -80,13 +80,13 @@ module Phrase
80
80
  end
81
81
 
82
82
  # List documents
83
- # List all documents the current user has access to.
83
+ # Returns all documents in a project that the authenticated user has read access to. A Document is a source file — an HTML or DOCX file — that has been uploaded to Phrase Strings and whose content is segmented into translation keys for localization. Use this endpoint to enumerate documents before downloading, previewing, or triggering translation workflows for individual files. The q parameter performs a prefix match on the document name (case-insensitive). For example, passing q=invoice returns documents whose names begin with \"invoice\" but not documents containing \"invoice\" elsewhere in the name.
84
84
  # @param project_id [String] Project ID
85
85
  # @param [Hash] opts the optional parameters
86
86
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
87
87
  # @option opts [Integer] :page Page number
88
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] :q Search query. Filters documents by name (case-insensitive substring match).
89
+ # @option opts [String] :q Filter documents by name prefix. Returns documents whose name starts with the given value (case-insensitive).
90
90
  # @return [Array<Document>]
91
91
  def documents_list(project_id, opts = {})
92
92
  data, _status_code, _headers = documents_list_with_http_info(project_id, opts)
@@ -94,13 +94,13 @@ module Phrase
94
94
  end
95
95
 
96
96
  # List documents
97
- # List all documents the current user has access to.
97
+ # Returns all documents in a project that the authenticated user has read access to. A Document is a source file — an HTML or DOCX file — that has been uploaded to Phrase Strings and whose content is segmented into translation keys for localization. Use this endpoint to enumerate documents before downloading, previewing, or triggering translation workflows for individual files. The q parameter performs a prefix match on the document name (case-insensitive). For example, passing q&#x3D;invoice returns documents whose names begin with \&quot;invoice\&quot; but not documents containing \&quot;invoice\&quot; elsewhere in the name.
98
98
  # @param project_id [String] Project ID
99
99
  # @param [Hash] opts the optional parameters
100
100
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
101
101
  # @option opts [Integer] :page Page number
102
102
  # @option opts [Integer] :per_page Limit on the number of objects to be returned, between 1 and 100. 25 by default
103
- # @option opts [String] :q Search query. Filters documents by name (case-insensitive substring match).
103
+ # @option opts [String] :q Filter documents by name prefix. Returns documents whose name starts with the given value (case-insensitive).
104
104
  # @return [Array<(Response<(Array<Document>)>, Integer, Hash)>] Response<(Array<Document>)> data, response status code and response headers
105
105
  def documents_list_with_http_info(project_id, opts = {})
106
106
  if @api_client.config.debugging
@@ -8,7 +8,7 @@ module Phrase
8
8
  @api_client = api_client
9
9
  end
10
10
  # Build ICU skeletons
11
- # Returns ICU skeletons for multiple locale codes based on a source content.
11
+ # 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.
12
12
  # @param icu_skeleton_parameters [IcuSkeletonParameters]
13
13
  # @param [Hash] opts the optional parameters
14
14
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
@@ -19,7 +19,7 @@ module Phrase
19
19
  end
20
20
 
21
21
  # Build ICU skeletons
22
- # Returns ICU skeletons for multiple locale codes based on a source content.
22
+ # 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 &#x60;content&#x60; or &#x60;id&#x60; must be provided — supplying both or neither returns 400. When &#x60;id&#x60; 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 &#x60;error&#x60; field describing the parse failure.
23
23
  # @param icu_skeleton_parameters [IcuSkeletonParameters]
24
24
  # @param [Hash] opts the optional parameters
25
25
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
@@ -28,10 +28,6 @@ module Phrase
28
28
  if @api_client.config.debugging
29
29
  @api_client.config.logger.debug 'Calling API: ICUApi.icu_skeleton ...'
30
30
  end
31
- # verify the required parameter 'icu_skeleton_parameters' is set
32
- if @api_client.config.client_side_validation && icu_skeleton_parameters.nil?
33
- fail ArgumentError, "Missing the required parameter 'icu_skeleton_parameters' when calling ICUApi.icu_skeleton"
34
- end
35
31
  # resource path
36
32
  local_var_path = '/icu/skeleton'
37
33
 
@@ -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,240 @@
1
+ require 'cgi'
2
+
3
+ module Phrase
4
+ class PreTranslationsApi
5
+ attr_accessor :api_client
6
+
7
+ def initialize(api_client = ApiClient.default)
8
+ @api_client = api_client
9
+ end
10
+ # Create a pre-translation job
11
+ # 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.
12
+ # @param project_id [String] Project ID
13
+ # @param pre_translation_create_parameters [PreTranslationCreateParameters]
14
+ # @param [Hash] opts the optional parameters
15
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
16
+ # @return [PreTranslation]
17
+ def pre_translation_create(project_id, pre_translation_create_parameters, opts = {})
18
+ data, _status_code, _headers = pre_translation_create_with_http_info(project_id, pre_translation_create_parameters, opts)
19
+ data
20
+ end
21
+
22
+ # Create a pre-translation job
23
+ # Triggers a pre-translation job for a resource within a project, addressed by &#x60;translatable_type&#x60; (&#x60;locale&#x60;, &#x60;job&#x60;, &#x60;translation_key&#x60;, or &#x60;upload&#x60;) and &#x60;translatable_id&#x60; (its ID). Enqueues machine translation using the project&#39;s configured MT engine.
24
+ # @param project_id [String] Project ID
25
+ # @param pre_translation_create_parameters [PreTranslationCreateParameters]
26
+ # @param [Hash] opts the optional parameters
27
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
28
+ # @return [Array<(Response<(PreTranslation)>, Integer, Hash)>] Response<(PreTranslation)> data, response status code and response headers
29
+ def pre_translation_create_with_http_info(project_id, pre_translation_create_parameters, opts = {})
30
+ if @api_client.config.debugging
31
+ @api_client.config.logger.debug 'Calling API: PreTranslationsApi.pre_translation_create ...'
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 PreTranslationsApi.pre_translation_create"
36
+ end
37
+ # verify the required parameter 'pre_translation_create_parameters' is set
38
+ if @api_client.config.client_side_validation && pre_translation_create_parameters.nil?
39
+ fail ArgumentError, "Missing the required parameter 'pre_translation_create_parameters' when calling PreTranslationsApi.pre_translation_create"
40
+ end
41
+ # resource path
42
+ local_var_path = '/projects/{project_id}/pre_translations'.sub('{' + 'project_id' + '}', CGI.escape(project_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(pre_translation_create_parameters)
60
+
61
+ # return_type
62
+ return_type = opts[:return_type] || 'PreTranslation'
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: PreTranslationsApi#pre_translation_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
+ # Get a single pre-translation job
85
+ # Returns a single pre-translation job identified by its ID.
86
+ # @param project_id [String] Project ID
87
+ # @param id [String] ID
88
+ # @param [Hash] opts the optional parameters
89
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
90
+ # @option opts [String] :if_modified_since Last modified condition, see [Conditional GET requests / HTTP Caching](/en/api/strings/pagination#conditional-get-requests-%2F-http-caching) (optional)
91
+ # @option opts [String] :if_none_match ETag condition, see [Conditional GET requests / HTTP Caching](/en/api/strings/pagination#conditional-get-requests-%2F-http-caching) (optional)
92
+ # @return [PreTranslation]
93
+ def pre_translation_show(project_id, id, opts = {})
94
+ data, _status_code, _headers = pre_translation_show_with_http_info(project_id, id, opts)
95
+ data
96
+ end
97
+
98
+ # Get a single pre-translation job
99
+ # Returns a single pre-translation job identified by its ID.
100
+ # @param project_id [String] Project ID
101
+ # @param id [String] ID
102
+ # @param [Hash] opts the optional parameters
103
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
104
+ # @option opts [String] :if_modified_since Last modified condition, see [Conditional GET requests / HTTP Caching](/en/api/strings/pagination#conditional-get-requests-%2F-http-caching) (optional)
105
+ # @option opts [String] :if_none_match ETag condition, see [Conditional GET requests / HTTP Caching](/en/api/strings/pagination#conditional-get-requests-%2F-http-caching) (optional)
106
+ # @return [Array<(Response<(PreTranslation)>, Integer, Hash)>] Response<(PreTranslation)> data, response status code and response headers
107
+ def pre_translation_show_with_http_info(project_id, id, opts = {})
108
+ if @api_client.config.debugging
109
+ @api_client.config.logger.debug 'Calling API: PreTranslationsApi.pre_translation_show ...'
110
+ end
111
+ # verify the required parameter 'project_id' is set
112
+ if @api_client.config.client_side_validation && project_id.nil?
113
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling PreTranslationsApi.pre_translation_show"
114
+ end
115
+ # verify the required parameter 'id' is set
116
+ if @api_client.config.client_side_validation && id.nil?
117
+ fail ArgumentError, "Missing the required parameter 'id' when calling PreTranslationsApi.pre_translation_show"
118
+ end
119
+ # resource path
120
+ local_var_path = '/projects/{project_id}/pre_translations/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
121
+
122
+ # query parameters
123
+ query_params = opts[:query_params] || {}
124
+
125
+ # header parameters
126
+ header_params = opts[:header_params] || {}
127
+ # HTTP header 'Accept' (if needed)
128
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
129
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
130
+ header_params[:'If-Modified-Since'] = opts[:'if_modified_since'] if !opts[:'if_modified_since'].nil?
131
+ header_params[:'If-None-Match'] = opts[:'if_none_match'] if !opts[:'if_none_match'].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] || 'PreTranslation'
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(:GET, local_var_path, new_options)
155
+ if @api_client.config.debugging
156
+ @api_client.config.logger.debug "API called: PreTranslationsApi#pre_translation_show\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
+ # List pre-translation jobs
163
+ # Returns all pre-translation jobs scoped to a project, ordered by creation date descending.
164
+ # @param project_id [String] Project ID
165
+ # @param [Hash] opts the optional parameters
166
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
167
+ # @option opts [String] :if_modified_since Last modified condition, see [Conditional GET requests / HTTP Caching](/en/api/strings/pagination#conditional-get-requests-%2F-http-caching) (optional)
168
+ # @option opts [String] :if_none_match ETag condition, see [Conditional GET requests / HTTP Caching](/en/api/strings/pagination#conditional-get-requests-%2F-http-caching) (optional)
169
+ # @option opts [Integer] :page Page number
170
+ # @option opts [Integer] :per_page Limit on the number of objects to be returned, between 1 and 100. 25 by default
171
+ # @return [Array<PreTranslation>]
172
+ def pre_translations_list(project_id, opts = {})
173
+ data, _status_code, _headers = pre_translations_list_with_http_info(project_id, opts)
174
+ data
175
+ end
176
+
177
+ # List pre-translation jobs
178
+ # Returns all pre-translation jobs scoped to a project, ordered by creation date descending.
179
+ # @param project_id [String] Project ID
180
+ # @param [Hash] opts the optional parameters
181
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
182
+ # @option opts [String] :if_modified_since Last modified condition, see [Conditional GET requests / HTTP Caching](/en/api/strings/pagination#conditional-get-requests-%2F-http-caching) (optional)
183
+ # @option opts [String] :if_none_match ETag condition, see [Conditional GET requests / HTTP Caching](/en/api/strings/pagination#conditional-get-requests-%2F-http-caching) (optional)
184
+ # @option opts [Integer] :page Page number
185
+ # @option opts [Integer] :per_page Limit on the number of objects to be returned, between 1 and 100. 25 by default
186
+ # @return [Array<(Response<(Array<PreTranslation>)>, Integer, Hash)>] Response<(Array<PreTranslation>)> data, response status code and response headers
187
+ def pre_translations_list_with_http_info(project_id, opts = {})
188
+ if @api_client.config.debugging
189
+ @api_client.config.logger.debug 'Calling API: PreTranslationsApi.pre_translations_list ...'
190
+ end
191
+ # verify the required parameter 'project_id' is set
192
+ if @api_client.config.client_side_validation && project_id.nil?
193
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling PreTranslationsApi.pre_translations_list"
194
+ end
195
+ # resource path
196
+ local_var_path = '/projects/{project_id}/pre_translations'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s))
197
+
198
+ # query parameters
199
+ query_params = opts[:query_params] || {}
200
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
201
+ query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
202
+
203
+ # header parameters
204
+ header_params = opts[:header_params] || {}
205
+ # HTTP header 'Accept' (if needed)
206
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
207
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
208
+ header_params[:'If-Modified-Since'] = opts[:'if_modified_since'] if !opts[:'if_modified_since'].nil?
209
+ header_params[:'If-None-Match'] = opts[:'if_none_match'] if !opts[:'if_none_match'].nil?
210
+
211
+ # form parameters
212
+ form_params = opts[:form_params] || {}
213
+
214
+ # http body (model)
215
+ post_body = opts[:body]
216
+
217
+ # return_type
218
+ return_type = opts[:return_type] || 'Array<PreTranslation>'
219
+
220
+ # auth_names
221
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
222
+
223
+ new_options = opts.merge(
224
+ :header_params => header_params,
225
+ :query_params => query_params,
226
+ :form_params => form_params,
227
+ :body => post_body,
228
+ :auth_names => auth_names,
229
+ :return_type => return_type
230
+ )
231
+
232
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
233
+ if @api_client.config.debugging
234
+ @api_client.config.logger.debug "API called: PreTranslationsApi#pre_translations_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
235
+ end
236
+ response = ::Phrase::Response.new(data, headers)
237
+ return response, status_code, headers
238
+ end
239
+ end
240
+ end
@@ -92,7 +92,7 @@ module Phrase
92
92
  end
93
93
 
94
94
  # Delete a screenshot
95
- # Delete an existing screenshot.
95
+ # Permanently removes a screenshot and all its associated markers from the project. Use this when you need to fully remove a screenshot that is no longer relevant — for example, after a UI redesign renders the captured screen obsolete. This is a hard delete: the screenshot record and every key-to-region marker linked to it are destroyed together and cannot be recovered.
96
96
  # @param project_id [String] Project ID
97
97
  # @param id [String] ID
98
98
  # @param [Hash] opts the optional parameters
@@ -105,7 +105,7 @@ module Phrase
105
105
  end
106
106
 
107
107
  # Delete a screenshot
108
- # Delete an existing screenshot.
108
+ # Permanently removes a screenshot and all its associated markers from the project. Use this when you need to fully remove a screenshot that is no longer relevant — for example, after a UI redesign renders the captured screen obsolete. This is a hard delete: the screenshot record and every key-to-region marker linked to it are destroyed together and cannot be recovered.
109
109
  # @param project_id [String] Project ID
110
110
  # @param id [String] ID
111
111
  # @param [Hash] opts the optional parameters
@@ -167,7 +167,7 @@ module Phrase
167
167
  end
168
168
 
169
169
  # Get a single screenshot
170
- # Get details on a single screenshot for a given project.
170
+ # Returns a single screenshot belonging to the specified project. Use this to retrieve the screenshot's name, description, hosted image URL, and marker count after uploading, or before creating, updating, or inspecting its markers. The response is a synchronous, idempotent read — repeated calls return the same record without side effects. The Attachable Screenshots feature must be enabled on the account.
171
171
  # @param project_id [String] Project ID
172
172
  # @param id [String] ID
173
173
  # @param [Hash] opts the optional parameters
@@ -180,7 +180,7 @@ module Phrase
180
180
  end
181
181
 
182
182
  # Get a single screenshot
183
- # Get details on a single screenshot for a given project.
183
+ # Returns a single screenshot belonging to the specified project. Use this to retrieve the screenshot&#39;s name, description, hosted image URL, and marker count after uploading, or before creating, updating, or inspecting its markers. The response is a synchronous, idempotent read — repeated calls return the same record without side effects. The Attachable Screenshots feature must be enabled on the account.
184
184
  # @param project_id [String] Project ID
185
185
  # @param id [String] ID
186
186
  # @param [Hash] opts the optional parameters