phrase 4.24.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +35 -0
- data/README.md +19 -4
- data/docs/AutomationEvent.md +33 -0
- data/docs/AutomationEventProject.md +19 -0
- data/docs/AutomationEventsApi.md +168 -0
- data/docs/AutomationsCreateParameters.md +1 -1
- data/docs/AutomationsCreateParameters1.md +1 -1
- data/docs/BranchComparison.md +23 -0
- data/docs/BranchComparisonChange.md +19 -0
- data/docs/BranchComparisonDiff.md +21 -0
- data/docs/BranchComparisonDiffConflictsValue.md +19 -0
- data/docs/BranchesApi.md +5 -4
- data/docs/DocumentsApi.md +4 -4
- data/docs/Format.md +20 -20
- data/docs/FormatsApi.md +1 -1
- data/docs/ICUApi.md +1 -1
- data/docs/IcuSkeletonError.md +17 -0
- data/docs/IcuSkeletonParameters.md +11 -11
- data/docs/Job.md +3 -1
- data/docs/JobDetails.md +2 -0
- data/docs/JobsApi.md +2 -2
- data/docs/KeyCreateParameters.md +1 -1
- data/docs/KeyFormatAnnotationsApi.md +74 -0
- data/docs/KeyFormatAnnotationsList200ResponseInner.md +19 -0
- data/docs/KeyLinksBatchDestroyParameters.md +6 -4
- data/docs/KeyLinksCreateParameters.md +2 -2
- data/docs/KeyUpdateParameters.md +1 -1
- data/docs/LinkedKeysApi.md +14 -13
- data/docs/Locale.md +2 -0
- data/docs/LocaleCreateParameters.md +3 -1
- data/docs/LocaleDetails.md +2 -0
- data/docs/LocaleDownloadCreateParameters.md +4 -0
- data/docs/LocaleUpdateParameters.md +3 -1
- data/docs/LocalesApi.md +2 -2
- data/docs/PreTranslation.md +29 -0
- data/docs/PreTranslationCreateParameters.md +19 -0
- data/docs/PreTranslationsApi.md +210 -0
- data/docs/ProjectCreateParameters.md +1 -1
- data/docs/ProjectUpdateParameters.md +1 -1
- data/docs/RepoSync.md +2 -0
- data/docs/RepoSyncCreateParameters.md +2 -0
- data/docs/ScreenshotUpdateParameters.md +1 -1
- data/docs/ScreenshotsApi.md +11 -11
- data/lib/phrase/api/automation_events_api.rb +215 -0
- data/lib/phrase/api/branches_api.rb +5 -3
- data/lib/phrase/api/documents_api.rb +6 -6
- data/lib/phrase/api/formats_api.rb +2 -2
- data/lib/phrase/api/icu_api.rb +2 -6
- data/lib/phrase/api/key_format_annotations_api.rb +85 -0
- data/lib/phrase/api/linked_keys_api.rb +19 -23
- data/lib/phrase/api/locales_api.rb +2 -2
- data/lib/phrase/api/pre_translations_api.rb +240 -0
- data/lib/phrase/api/screenshots_api.rb +20 -16
- data/lib/phrase/models/automation_event.rb +325 -0
- data/lib/phrase/models/automation_event_project.rb +208 -0
- data/lib/phrase/models/automations_create_parameters.rb +1 -1
- data/lib/phrase/models/automations_create_parameters1.rb +1 -1
- data/lib/phrase/models/branch_comparison.rb +224 -0
- data/lib/phrase/models/branch_comparison_change.rb +212 -0
- data/lib/phrase/models/branch_comparison_diff.rb +223 -0
- data/lib/phrase/models/branch_comparison_diff_conflicts_value.rb +209 -0
- data/lib/phrase/models/format.rb +60 -0
- data/lib/phrase/models/{key_links_index400_response.rb → icu_skeleton_error.rb} +11 -10
- data/lib/phrase/models/icu_skeleton_parameters.rb +6 -6
- data/lib/phrase/models/job.rb +16 -5
- data/lib/phrase/models/job_details.rb +12 -1
- data/lib/phrase/models/key_format_annotations_list200_response_inner.rb +207 -0
- data/lib/phrase/models/key_links_batch_destroy_parameters.rb +52 -6
- data/lib/phrase/models/key_links_create_parameters.rb +1 -1
- data/lib/phrase/models/locale.rb +10 -1
- data/lib/phrase/models/locale_create_parameters.rb +14 -4
- data/lib/phrase/models/locale_details.rb +10 -1
- data/lib/phrase/models/locale_download_create_parameters.rb +21 -1
- data/lib/phrase/models/locale_update_parameters.rb +14 -4
- data/lib/phrase/models/pre_translation.rb +301 -0
- data/lib/phrase/models/pre_translation_create_parameters.rb +241 -0
- data/lib/phrase/models/repo_sync.rb +29 -1
- data/lib/phrase/models/repo_sync_create_parameters.rb +27 -1
- data/lib/phrase/response.rb +2 -2
- data/lib/phrase/version.rb +1 -1
- data/lib/phrase.rb +13 -1
- data/phrase.gemspec +1 -1
- data/spec/api/automation_events_api_spec.rb +67 -0
- data/spec/api/branches_api_spec.rb +1 -1
- data/spec/api/documents_api_spec.rb +3 -3
- data/spec/api/formats_api_spec.rb +1 -1
- data/spec/api/icu_api_spec.rb +1 -1
- data/spec/api/key_format_annotations_api_spec.rb +38 -0
- data/spec/api/linked_keys_api_spec.rb +7 -7
- data/spec/api/pre_translations_api_spec.rb +70 -0
- data/spec/api/screenshots_api_spec.rb +6 -6
- data/spec/models/automation_event_project_spec.rb +35 -0
- data/spec/models/automation_event_spec.rb +85 -0
- data/spec/models/branch_comparison_change_spec.rb +35 -0
- data/spec/models/branch_comparison_diff_conflicts_value_spec.rb +35 -0
- data/spec/models/branch_comparison_diff_spec.rb +41 -0
- data/spec/models/branch_comparison_spec.rb +47 -0
- data/spec/models/{key_links_index400_response_spec.rb → icu_skeleton_error_spec.rb} +7 -7
- data/spec/models/job_details_spec.rb +6 -0
- data/spec/models/job_spec.rb +6 -0
- data/spec/models/key_format_annotations_list200_response_inner_spec.rb +35 -0
- data/spec/models/key_links_batch_destroy_parameters_spec.rb +10 -0
- data/spec/models/locale_create_parameters_spec.rb +6 -0
- data/spec/models/locale_details_spec.rb +6 -0
- data/spec/models/locale_download_create_parameters_spec.rb +12 -0
- data/spec/models/locale_spec.rb +6 -0
- data/spec/models/locale_update_parameters_spec.rb +6 -0
- data/spec/models/pre_translation_create_parameters_spec.rb +39 -0
- data/spec/models/pre_translation_spec.rb +73 -0
- data/spec/models/repo_sync_create_parameters_spec.rb +6 -0
- data/spec/models/repo_sync_spec.rb +6 -0
- data/spec/response_spec.rb +53 -0
- metadata +304 -254
- data/docs/KeyLinksIndex400Response.md +0 -17
|
@@ -8,7 +8,7 @@ module Phrase
|
|
|
8
8
|
@api_client = api_client
|
|
9
9
|
end
|
|
10
10
|
# List formats
|
|
11
|
-
#
|
|
11
|
+
# Returns all file formats that Phrase Strings supports. Use the api_name value from each format as the file_format parameter when uploading or downloading locale files. Not every format supports both directions: check the importable and exportable fields before using a format in a workflow. This endpoint does not require authentication and is not subject to rate limiting.
|
|
12
12
|
# @param [Hash] opts the optional parameters
|
|
13
13
|
# @return [Array<Format>]
|
|
14
14
|
def formats_list(opts = {})
|
|
@@ -17,7 +17,7 @@ module Phrase
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
# List formats
|
|
20
|
-
#
|
|
20
|
+
# Returns all file formats that Phrase Strings supports. Use the api_name value from each format as the file_format parameter when uploading or downloading locale files. Not every format supports both directions: check the importable and exportable fields before using a format in a workflow. This endpoint does not require authentication and is not subject to rate limiting.
|
|
21
21
|
# @param [Hash] opts the optional parameters
|
|
22
22
|
# @return [Array<(Response<(Array<Format>)>, Integer, Hash)>] Response<(Array<Format>)> data, response status code and response headers
|
|
23
23
|
def formats_list_with_http_info(opts = {})
|
data/lib/phrase/api/icu_api.rb
CHANGED
|
@@ -8,7 +8,7 @@ module Phrase
|
|
|
8
8
|
@api_client = api_client
|
|
9
9
|
end
|
|
10
10
|
# Build ICU skeletons
|
|
11
|
-
#
|
|
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
|
-
#
|
|
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 `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.
|
|
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
|
-
#
|
|
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
|
-
# @
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
#
|
|
24
|
+
# 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.
|
|
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
|
-
# @
|
|
31
|
-
|
|
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
|
-
#
|
|
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
|
-
#
|
|
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
|
-
#
|
|
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
|
-
#
|
|
180
|
+
# 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.
|
|
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
|
|
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
|
|
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 `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.
|
|
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
|
|
@@ -255,7 +255,7 @@ module Phrase
|
|
|
255
255
|
# @option opts [Boolean] :fallback_for_unverified_translations If set to `true`, translations in a non-final state are replaced by the fallback locale's translation at export time. In the simple workflow, \"non-final\" means `unverified`. In the review workflow, it additionally includes `translated` (awaiting review). No stored translations are modified. Requires `fallback_locale_id` or `use_locale_fallback` to be set; a `422` validation error is returned otherwise.
|
|
256
256
|
# @option opts [String] :source_locale_id Provides the source language of a corresponding job as the source language of the generated locale file. This parameter will be ignored unless used in combination with a `tag` parameter indicating a specific job.
|
|
257
257
|
# @option opts [String] :translation_key_prefix Download all translation keys, and remove the specified prefix where possible. Warning: this may create duplicate key names if other keys share the same name after the prefix is removed.
|
|
258
|
-
# @option opts [Boolean] :filter_by_prefix Only download translation keys containing the specified
|
|
258
|
+
# @option opts [Boolean] :filter_by_prefix Only download translation keys containing the prefix specified by `translation_key_prefix`, and remove that prefix from the generated file. Requires `translation_key_prefix` to be set.
|
|
259
259
|
# @option opts [Object] :custom_metadata_filters Custom metadata filters. Provide the name of the metadata field and the value to filter by. Only keys with matching metadata will be included in the download.
|
|
260
260
|
# @option opts [Array<String>] :locale_ids Locale IDs or locale names
|
|
261
261
|
# @option opts [String] :updated_since Only include translations and keys that have been updated since the given date. The date must be in ISO 8601 format (e.g., `2023-01-01T00:00:00Z`).
|
|
@@ -292,7 +292,7 @@ module Phrase
|
|
|
292
292
|
# @option opts [Boolean] :fallback_for_unverified_translations If set to `true`, translations in a non-final state are replaced by the fallback locale's translation at export time. In the simple workflow, \"non-final\" means `unverified`. In the review workflow, it additionally includes `translated` (awaiting review). No stored translations are modified. Requires `fallback_locale_id` or `use_locale_fallback` to be set; a `422` validation error is returned otherwise.
|
|
293
293
|
# @option opts [String] :source_locale_id Provides the source language of a corresponding job as the source language of the generated locale file. This parameter will be ignored unless used in combination with a `tag` parameter indicating a specific job.
|
|
294
294
|
# @option opts [String] :translation_key_prefix Download all translation keys, and remove the specified prefix where possible. Warning: this may create duplicate key names if other keys share the same name after the prefix is removed.
|
|
295
|
-
# @option opts [Boolean] :filter_by_prefix Only download translation keys containing the specified
|
|
295
|
+
# @option opts [Boolean] :filter_by_prefix Only download translation keys containing the prefix specified by `translation_key_prefix`, and remove that prefix from the generated file. Requires `translation_key_prefix` to be set.
|
|
296
296
|
# @option opts [Object] :custom_metadata_filters Custom metadata filters. Provide the name of the metadata field and the value to filter by. Only keys with matching metadata will be included in the download.
|
|
297
297
|
# @option opts [Array<String>] :locale_ids Locale IDs or locale names
|
|
298
298
|
# @option opts [String] :updated_since Only include translations and keys that have been updated since the given date. The date must be in ISO 8601 format (e.g., `2023-01-01T00:00:00Z`).
|
|
@@ -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 `translatable_type` (`locale`, `job`, `translation_key`, or `upload`) and `translatable_id` (its ID). Enqueues machine translation using the project'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
|
|
@@ -8,31 +8,31 @@ module Phrase
|
|
|
8
8
|
@api_client = api_client
|
|
9
9
|
end
|
|
10
10
|
# Create a screenshot
|
|
11
|
-
#
|
|
11
|
+
# Creates a screenshot in a project to provide visual context for in-context translation. Attach translation keys to regions of the uploaded image so translators can see where each string appears in your UI. This endpoint accepts a multipart/form-data request with a binary file upload, unlike most Phrase API endpoints that use JSON. Use a multipart form client or the -F flag in curl rather than a JSON body. The screenshot name must be unique within the project (case-insensitive). When name is omitted, it is derived from the uploaded filename. The account must have the Screenshots feature enabled; requests to projects on accounts without it return 403. Creating a screenshot requires a token with the write scope and manage access to the project.
|
|
12
12
|
# @param project_id [String] Project ID
|
|
13
|
+
# @param filename [File] Image file to upload. Accepted formats are JPEG (jpg/jpeg), GIF, and PNG. Maximum file size is 10 MB. Submitting an unsupported format or a file exceeding the size limit returns 422.
|
|
13
14
|
# @param [Hash] opts the optional parameters
|
|
14
15
|
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
|
15
16
|
# @option opts [String] :branch specify the branch to use
|
|
16
|
-
# @option opts [String] :name
|
|
17
|
-
# @option opts [String] :description
|
|
18
|
-
# @option opts [File] :filename Screenshot file
|
|
17
|
+
# @option opts [String] :name Display name for the screenshot. Must be unique within the project (case-insensitive). When omitted, the name is derived from the uploaded filename.
|
|
18
|
+
# @option opts [String] :description Optional free-text description of the screenshot.
|
|
19
19
|
# @return [Screenshot]
|
|
20
|
-
def screenshot_create(project_id, opts = {})
|
|
21
|
-
data, _status_code, _headers = screenshot_create_with_http_info(project_id, opts)
|
|
20
|
+
def screenshot_create(project_id, filename, opts = {})
|
|
21
|
+
data, _status_code, _headers = screenshot_create_with_http_info(project_id, filename, opts)
|
|
22
22
|
data
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
# Create a screenshot
|
|
26
|
-
#
|
|
26
|
+
# Creates a screenshot in a project to provide visual context for in-context translation. Attach translation keys to regions of the uploaded image so translators can see where each string appears in your UI. This endpoint accepts a multipart/form-data request with a binary file upload, unlike most Phrase API endpoints that use JSON. Use a multipart form client or the -F flag in curl rather than a JSON body. The screenshot name must be unique within the project (case-insensitive). When name is omitted, it is derived from the uploaded filename. The account must have the Screenshots feature enabled; requests to projects on accounts without it return 403. Creating a screenshot requires a token with the write scope and manage access to the project.
|
|
27
27
|
# @param project_id [String] Project ID
|
|
28
|
+
# @param filename [File] Image file to upload. Accepted formats are JPEG (jpg/jpeg), GIF, and PNG. Maximum file size is 10 MB. Submitting an unsupported format or a file exceeding the size limit returns 422.
|
|
28
29
|
# @param [Hash] opts the optional parameters
|
|
29
30
|
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
|
30
31
|
# @option opts [String] :branch specify the branch to use
|
|
31
|
-
# @option opts [String] :name
|
|
32
|
-
# @option opts [String] :description
|
|
33
|
-
# @option opts [File] :filename Screenshot file
|
|
32
|
+
# @option opts [String] :name Display name for the screenshot. Must be unique within the project (case-insensitive). When omitted, the name is derived from the uploaded filename.
|
|
33
|
+
# @option opts [String] :description Optional free-text description of the screenshot.
|
|
34
34
|
# @return [Array<(Response<(Screenshot)>, Integer, Hash)>] Response<(Screenshot)> data, response status code and response headers
|
|
35
|
-
def screenshot_create_with_http_info(project_id, opts = {})
|
|
35
|
+
def screenshot_create_with_http_info(project_id, filename, opts = {})
|
|
36
36
|
if @api_client.config.debugging
|
|
37
37
|
@api_client.config.logger.debug 'Calling API: ScreenshotsApi.screenshot_create ...'
|
|
38
38
|
end
|
|
@@ -40,6 +40,10 @@ module Phrase
|
|
|
40
40
|
if @api_client.config.client_side_validation && project_id.nil?
|
|
41
41
|
fail ArgumentError, "Missing the required parameter 'project_id' when calling ScreenshotsApi.screenshot_create"
|
|
42
42
|
end
|
|
43
|
+
# verify the required parameter 'filename' is set
|
|
44
|
+
if @api_client.config.client_side_validation && filename.nil?
|
|
45
|
+
fail ArgumentError, "Missing the required parameter 'filename' when calling ScreenshotsApi.screenshot_create"
|
|
46
|
+
end
|
|
43
47
|
# resource path
|
|
44
48
|
local_var_path = '/projects/{project_id}/screenshots'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s))
|
|
45
49
|
|
|
@@ -56,10 +60,10 @@ module Phrase
|
|
|
56
60
|
|
|
57
61
|
# form parameters
|
|
58
62
|
form_params = opts[:form_params] || {}
|
|
63
|
+
form_params['filename'] = filename
|
|
59
64
|
form_params['branch'] = opts[:'branch'] if !opts[:'branch'].nil?
|
|
60
65
|
form_params['name'] = opts[:'name'] if !opts[:'name'].nil?
|
|
61
66
|
form_params['description'] = opts[:'description'] if !opts[:'description'].nil?
|
|
62
|
-
form_params['filename'] = opts[:'filename'] if !opts[:'filename'].nil?
|
|
63
67
|
|
|
64
68
|
# http body (model)
|
|
65
69
|
post_body = opts[:body]
|
|
@@ -88,7 +92,7 @@ module Phrase
|
|
|
88
92
|
end
|
|
89
93
|
|
|
90
94
|
# Delete a screenshot
|
|
91
|
-
#
|
|
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.
|
|
92
96
|
# @param project_id [String] Project ID
|
|
93
97
|
# @param id [String] ID
|
|
94
98
|
# @param [Hash] opts the optional parameters
|
|
@@ -101,7 +105,7 @@ module Phrase
|
|
|
101
105
|
end
|
|
102
106
|
|
|
103
107
|
# Delete a screenshot
|
|
104
|
-
#
|
|
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.
|
|
105
109
|
# @param project_id [String] Project ID
|
|
106
110
|
# @param id [String] ID
|
|
107
111
|
# @param [Hash] opts the optional parameters
|
|
@@ -163,7 +167,7 @@ module Phrase
|
|
|
163
167
|
end
|
|
164
168
|
|
|
165
169
|
# Get a single screenshot
|
|
166
|
-
#
|
|
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.
|
|
167
171
|
# @param project_id [String] Project ID
|
|
168
172
|
# @param id [String] ID
|
|
169
173
|
# @param [Hash] opts the optional parameters
|
|
@@ -176,7 +180,7 @@ module Phrase
|
|
|
176
180
|
end
|
|
177
181
|
|
|
178
182
|
# Get a single screenshot
|
|
179
|
-
#
|
|
183
|
+
# 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.
|
|
180
184
|
# @param project_id [String] Project ID
|
|
181
185
|
# @param id [String] ID
|
|
182
186
|
# @param [Hash] opts the optional parameters
|