dyspatch_client 2.0.0 → 5.0.1

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/Gemfile +3 -1
  3. data/README.md +50 -34
  4. data/Rakefile +2 -0
  5. data/docs/APIError.md +12 -1
  6. data/docs/CompiledRead.md +13 -0
  7. data/docs/Cursor.md +11 -1
  8. data/docs/DraftMetaRead.md +27 -0
  9. data/docs/DraftRead.md +31 -0
  10. data/docs/DraftsApi.md +476 -0
  11. data/docs/DraftsRead.md +19 -0
  12. data/docs/InlineObject.md +17 -0
  13. data/docs/LocalizationKeyRead.md +19 -0
  14. data/docs/LocalizationMetaRead.md +15 -1
  15. data/docs/LocalizationRead.md +19 -1
  16. data/docs/LocalizationsApi.md +16 -18
  17. data/docs/TemplateMetaRead.md +15 -0
  18. data/docs/TemplateRead.md +16 -0
  19. data/docs/TemplatesApi.md +39 -40
  20. data/docs/TemplatesRead.md +10 -0
  21. data/dyspatch_client.gemspec +10 -16
  22. data/lib/dyspatch_client.rb +10 -4
  23. data/lib/dyspatch_client/api/drafts_api.rb +620 -0
  24. data/lib/dyspatch_client/api/localizations_api.rb +52 -34
  25. data/lib/dyspatch_client/api/templates_api.rb +100 -69
  26. data/lib/dyspatch_client/api_client.rb +54 -55
  27. data/lib/dyspatch_client/api_error.rb +23 -4
  28. data/lib/dyspatch_client/configuration.rb +49 -10
  29. data/lib/dyspatch_client/models/api_error.rb +50 -30
  30. data/lib/dyspatch_client/models/compiled_read.rb +49 -78
  31. data/lib/dyspatch_client/models/cursor.rb +47 -28
  32. data/lib/dyspatch_client/models/draft_meta_read.rb +258 -0
  33. data/lib/dyspatch_client/models/draft_read.rb +279 -0
  34. data/lib/dyspatch_client/models/drafts_read.rb +219 -0
  35. data/lib/dyspatch_client/models/inline_object.rb +206 -0
  36. data/lib/dyspatch_client/models/localization_key_read.rb +216 -0
  37. data/lib/dyspatch_client/models/localization_meta_read.rb +70 -39
  38. data/lib/dyspatch_client/models/localization_read.rb +73 -42
  39. data/lib/dyspatch_client/models/template_meta_read.rb +52 -33
  40. data/lib/dyspatch_client/models/template_read.rb +53 -34
  41. data/lib/dyspatch_client/models/templates_read.rb +45 -26
  42. data/lib/dyspatch_client/version.rb +5 -5
  43. data/pkg/dyspatch_client-5.0.0.gem +0 -0
  44. data/pkg/dyspatch_client-5.0.1.gem +0 -0
  45. data/spec/api/drafts_api_spec.rb +146 -0
  46. data/spec/api/localizations_api_spec.rb +12 -12
  47. data/spec/api/templates_api_spec.rb +24 -24
  48. data/spec/api_client_spec.rb +39 -39
  49. data/spec/configuration_spec.rb +12 -12
  50. data/spec/integration_spec.rb +41 -0
  51. data/spec/models/api_error_spec.rb +12 -13
  52. data/spec/models/compiled_read_spec.rb +10 -11
  53. data/spec/models/cursor_spec.rb +7 -8
  54. data/spec/models/draft_meta_read_spec.rb +77 -0
  55. data/spec/models/draft_read_spec.rb +83 -0
  56. data/spec/models/drafts_read_spec.rb +47 -0
  57. data/spec/models/inline_object_spec.rb +41 -0
  58. data/spec/models/localization_key_read_spec.rb +47 -0
  59. data/spec/models/localization_meta_read_spec.rb +18 -13
  60. data/spec/models/localization_read_spec.rb +20 -15
  61. data/spec/models/template_meta_read_spec.rb +12 -13
  62. data/spec/models/template_read_spec.rb +13 -14
  63. data/spec/models/templates_read_spec.rb +7 -8
  64. data/spec/spec_helper.rb +4 -4
  65. metadata +34 -128
  66. data/git_push.sh +0 -55
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #Dyspatch API
3
3
 
4
- ## Introduction The Dyspatch API is based on the REST paradigm, and features resource based URLs with standard HTTP response codes to indicate errors. We use standard HTTP authentication and request verbs, and all responses are JSON formatted. See our [Implementation Guide](https://docs.dyspatch.io/development/implementing_dyspatch/) for more details on how to implement Dyspatch. ## API Client Libraries Dyspatch provides API Clients for popular languages and web frameworks. - [Java](https://github.com/getdyspatch/dyspatch-java) - [Javascript](https://github.com/getdyspatch/dyspatch-javascript) - [Python](https://github.com/getdyspatch/dyspatch-python) - [C#](https://github.com/getdyspatch/dyspatch-dotnet) - [Go](https://github.com/getdyspatch/dyspatch-golang) - [Ruby](https://github.com/getdyspatch/dyspatch-ruby)
4
+ ## Introduction The Dyspatch API is based on the REST paradigm, and features resource based URLs with standard HTTP response codes to indicate errors. We use standard HTTP authentication and request verbs, and all responses are JSON formatted. See our [Implementation Guide](https://docs.dyspatch.io/development/implementing_dyspatch/) for more details on how to implement Dyspatch. ## API Client Libraries Dyspatch provides API Clients for popular languages and web frameworks. - [Java](https://github.com/getdyspatch/dyspatch-java) - [Javascript](https://github.com/getdyspatch/dyspatch-javascript) - [Python](https://github.com/getdyspatch/dyspatch-python) - [C#](https://github.com/getdyspatch/dyspatch-dotnet) - [Go](https://github.com/getdyspatch/dyspatch-golang) - [Ruby](https://github.com/getdyspatch/dyspatch-ruby)
5
5
 
6
- OpenAPI spec version: 2019.03
6
+ The version of the OpenAPI document: 2020.04
7
7
  Contact: support@dyspatch.io
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -20,6 +20,11 @@ require 'dyspatch_client/configuration'
20
20
  require 'dyspatch_client/models/api_error'
21
21
  require 'dyspatch_client/models/compiled_read'
22
22
  require 'dyspatch_client/models/cursor'
23
+ require 'dyspatch_client/models/draft_meta_read'
24
+ require 'dyspatch_client/models/draft_read'
25
+ require 'dyspatch_client/models/drafts_read'
26
+ require 'dyspatch_client/models/inline_object'
27
+ require 'dyspatch_client/models/localization_key_read'
23
28
  require 'dyspatch_client/models/localization_meta_read'
24
29
  require 'dyspatch_client/models/localization_read'
25
30
  require 'dyspatch_client/models/template_meta_read'
@@ -27,6 +32,7 @@ require 'dyspatch_client/models/template_read'
27
32
  require 'dyspatch_client/models/templates_read'
28
33
 
29
34
  # APIs
35
+ require 'dyspatch_client/api/drafts_api'
30
36
  require 'dyspatch_client/api/localizations_api'
31
37
  require 'dyspatch_client/api/templates_api'
32
38
 
@@ -0,0 +1,620 @@
1
+ =begin
2
+ #Dyspatch API
3
+
4
+ ## Introduction The Dyspatch API is based on the REST paradigm, and features resource based URLs with standard HTTP response codes to indicate errors. We use standard HTTP authentication and request verbs, and all responses are JSON formatted. See our [Implementation Guide](https://docs.dyspatch.io/development/implementing_dyspatch/) for more details on how to implement Dyspatch. ## API Client Libraries Dyspatch provides API Clients for popular languages and web frameworks. - [Java](https://github.com/getdyspatch/dyspatch-java) - [Javascript](https://github.com/getdyspatch/dyspatch-javascript) - [Python](https://github.com/getdyspatch/dyspatch-python) - [C#](https://github.com/getdyspatch/dyspatch-dotnet) - [Go](https://github.com/getdyspatch/dyspatch-golang) - [Ruby](https://github.com/getdyspatch/dyspatch-ruby)
5
+
6
+ The version of the OpenAPI document: 2020.04
7
+ Contact: support@dyspatch.io
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module DyspatchClient
16
+ class DraftsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Remove a localization
23
+ # Deletes the localization with the given language ID if it exists
24
+ # @param draft_id [String] A draft ID
25
+ # @param language_id [String] A language ID (eg: en-US)
26
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \"2020.04\", set the value to \"application/vnd.dyspatch.2020.04+json\"
27
+ # @param [Hash] opts the optional parameters
28
+ # @return [nil]
29
+ def delete_localization(draft_id, language_id, accept, opts = {})
30
+ delete_localization_with_http_info(draft_id, language_id, accept, opts)
31
+ nil
32
+ end
33
+
34
+ # Remove a localization
35
+ # Deletes the localization with the given language ID if it exists
36
+ # @param draft_id [String] A draft ID
37
+ # @param language_id [String] A language ID (eg: en-US)
38
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \"2020.04\", set the value to \"application/vnd.dyspatch.2020.04+json\"
39
+ # @param [Hash] opts the optional parameters
40
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
41
+ def delete_localization_with_http_info(draft_id, language_id, accept, opts = {})
42
+ if @api_client.config.debugging
43
+ @api_client.config.logger.debug 'Calling API: DraftsApi.delete_localization ...'
44
+ end
45
+ # verify the required parameter 'draft_id' is set
46
+ if @api_client.config.client_side_validation && draft_id.nil?
47
+ fail ArgumentError, "Missing the required parameter 'draft_id' when calling DraftsApi.delete_localization"
48
+ end
49
+ # verify the required parameter 'language_id' is set
50
+ if @api_client.config.client_side_validation && language_id.nil?
51
+ fail ArgumentError, "Missing the required parameter 'language_id' when calling DraftsApi.delete_localization"
52
+ end
53
+ # verify the required parameter 'accept' is set
54
+ if @api_client.config.client_side_validation && accept.nil?
55
+ fail ArgumentError, "Missing the required parameter 'accept' when calling DraftsApi.delete_localization"
56
+ end
57
+ # resource path
58
+ local_var_path = '/drafts/{draftId}/localizations/{languageId}'.sub('{' + 'draftId' + '}', CGI.escape(draft_id.to_s)).sub('{' + 'languageId' + '}', CGI.escape(language_id.to_s))
59
+
60
+ # query parameters
61
+ query_params = opts[:query_params] || {}
62
+
63
+ # header parameters
64
+ header_params = opts[:header_params] || {}
65
+ header_params[:'Accept'] = accept
66
+
67
+ # form parameters
68
+ form_params = opts[:form_params] || {}
69
+
70
+ # http body (model)
71
+ post_body = opts[:body]
72
+
73
+ # return_type
74
+ return_type = opts[:return_type]
75
+
76
+ # auth_names
77
+ auth_names = opts[:auth_names] || ['Bearer']
78
+
79
+ new_options = opts.merge(
80
+ :header_params => header_params,
81
+ :query_params => query_params,
82
+ :form_params => form_params,
83
+ :body => post_body,
84
+ :auth_names => auth_names,
85
+ :return_type => return_type
86
+ )
87
+
88
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
89
+ if @api_client.config.debugging
90
+ @api_client.config.logger.debug "API called: DraftsApi#delete_localization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
91
+ end
92
+ return data, status_code, headers
93
+ end
94
+
95
+ # Get Draft by ID
96
+ # Gets a draft object with the matching ID. The \"compiled\" field will contain the template in the default, unlocalized form.
97
+ # @param draft_id [String] A draft ID
98
+ # @param target_language [String] The type of templating language to compile as. Should only be used for visual templates.
99
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \&quot;2020.04\&quot;, set the value to \&quot;application/vnd.dyspatch.2020.04+json\&quot;
100
+ # @param [Hash] opts the optional parameters
101
+ # @return [DraftRead]
102
+ def get_draft_by_id(draft_id, target_language, accept, opts = {})
103
+ data, _status_code, _headers = get_draft_by_id_with_http_info(draft_id, target_language, accept, opts)
104
+ data
105
+ end
106
+
107
+ # Get Draft by ID
108
+ # Gets a draft object with the matching ID. The \&quot;compiled\&quot; field will contain the template in the default, unlocalized form.
109
+ # @param draft_id [String] A draft ID
110
+ # @param target_language [String] The type of templating language to compile as. Should only be used for visual templates.
111
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \&quot;2020.04\&quot;, set the value to \&quot;application/vnd.dyspatch.2020.04+json\&quot;
112
+ # @param [Hash] opts the optional parameters
113
+ # @return [Array<(DraftRead, Integer, Hash)>] DraftRead data, response status code and response headers
114
+ def get_draft_by_id_with_http_info(draft_id, target_language, accept, opts = {})
115
+ if @api_client.config.debugging
116
+ @api_client.config.logger.debug 'Calling API: DraftsApi.get_draft_by_id ...'
117
+ end
118
+ # verify the required parameter 'draft_id' is set
119
+ if @api_client.config.client_side_validation && draft_id.nil?
120
+ fail ArgumentError, "Missing the required parameter 'draft_id' when calling DraftsApi.get_draft_by_id"
121
+ end
122
+ # verify the required parameter 'target_language' is set
123
+ if @api_client.config.client_side_validation && target_language.nil?
124
+ fail ArgumentError, "Missing the required parameter 'target_language' when calling DraftsApi.get_draft_by_id"
125
+ end
126
+ # verify enum value
127
+ allowable_values = ["html", "handlebars", "ampscript", "freemarker", "cheetah", "jinja"]
128
+ if @api_client.config.client_side_validation && !allowable_values.include?(target_language)
129
+ fail ArgumentError, "invalid value for \"target_language\", must be one of #{allowable_values}"
130
+ end
131
+ # verify the required parameter 'accept' is set
132
+ if @api_client.config.client_side_validation && accept.nil?
133
+ fail ArgumentError, "Missing the required parameter 'accept' when calling DraftsApi.get_draft_by_id"
134
+ end
135
+ # resource path
136
+ local_var_path = '/drafts/{draftId}'.sub('{' + 'draftId' + '}', CGI.escape(draft_id.to_s))
137
+
138
+ # query parameters
139
+ query_params = opts[:query_params] || {}
140
+ query_params[:'targetLanguage'] = target_language
141
+
142
+ # header parameters
143
+ header_params = opts[:header_params] || {}
144
+ # HTTP header 'Accept' (if needed)
145
+ header_params['Accept'] = @api_client.select_header_accept(['application/vnd.dyspatch.2020.04+json', '*/*'])
146
+ header_params[:'Accept'] = accept
147
+
148
+ # form parameters
149
+ form_params = opts[:form_params] || {}
150
+
151
+ # http body (model)
152
+ post_body = opts[:body]
153
+
154
+ # return_type
155
+ return_type = opts[:return_type] || 'DraftRead'
156
+
157
+ # auth_names
158
+ auth_names = opts[:auth_names] || ['Bearer']
159
+
160
+ new_options = opts.merge(
161
+ :header_params => header_params,
162
+ :query_params => query_params,
163
+ :form_params => form_params,
164
+ :body => post_body,
165
+ :auth_names => auth_names,
166
+ :return_type => return_type
167
+ )
168
+
169
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
170
+ if @api_client.config.debugging
171
+ @api_client.config.logger.debug "API called: DraftsApi#get_draft_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
172
+ end
173
+ return data, status_code, headers
174
+ end
175
+
176
+ # Get localization keys
177
+ # Returns the list of values that need to be translated for the draft. Set the `Accept` header to `application/vnd.dyspatch.2020.04+json` to get a JSON object, or `text/vnd.dyspatch.2020.04+x-gettext-translation` to get the POT file.
178
+ # @param draft_id [String] A draft ID
179
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \&quot;2020.04\&quot;, set the value to \&quot;application/vnd.dyspatch.2020.04+json\&quot;
180
+ # @param [Hash] opts the optional parameters
181
+ # @return [Array<LocalizationKeyRead>]
182
+ def get_draft_localization_keys(draft_id, accept, opts = {})
183
+ data, _status_code, _headers = get_draft_localization_keys_with_http_info(draft_id, accept, opts)
184
+ data
185
+ end
186
+
187
+ # Get localization keys
188
+ # Returns the list of values that need to be translated for the draft. Set the &#x60;Accept&#x60; header to &#x60;application/vnd.dyspatch.2020.04+json&#x60; to get a JSON object, or &#x60;text/vnd.dyspatch.2020.04+x-gettext-translation&#x60; to get the POT file.
189
+ # @param draft_id [String] A draft ID
190
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \&quot;2020.04\&quot;, set the value to \&quot;application/vnd.dyspatch.2020.04+json\&quot;
191
+ # @param [Hash] opts the optional parameters
192
+ # @return [Array<(Array<LocalizationKeyRead>, Integer, Hash)>] Array<LocalizationKeyRead> data, response status code and response headers
193
+ def get_draft_localization_keys_with_http_info(draft_id, accept, opts = {})
194
+ if @api_client.config.debugging
195
+ @api_client.config.logger.debug 'Calling API: DraftsApi.get_draft_localization_keys ...'
196
+ end
197
+ # verify the required parameter 'draft_id' is set
198
+ if @api_client.config.client_side_validation && draft_id.nil?
199
+ fail ArgumentError, "Missing the required parameter 'draft_id' when calling DraftsApi.get_draft_localization_keys"
200
+ end
201
+ # verify the required parameter 'accept' is set
202
+ if @api_client.config.client_side_validation && accept.nil?
203
+ fail ArgumentError, "Missing the required parameter 'accept' when calling DraftsApi.get_draft_localization_keys"
204
+ end
205
+ # resource path
206
+ local_var_path = '/drafts/{draftId}/localizationKeys'.sub('{' + 'draftId' + '}', CGI.escape(draft_id.to_s))
207
+
208
+ # query parameters
209
+ query_params = opts[:query_params] || {}
210
+
211
+ # header parameters
212
+ header_params = opts[:header_params] || {}
213
+ # HTTP header 'Accept' (if needed)
214
+ header_params['Accept'] = @api_client.select_header_accept(['application/vnd.dyspatch.2020.04+json', '*/*'])
215
+ header_params[:'Accept'] = accept
216
+
217
+ # form parameters
218
+ form_params = opts[:form_params] || {}
219
+
220
+ # http body (model)
221
+ post_body = opts[:body]
222
+
223
+ # return_type
224
+ return_type = opts[:return_type] || 'Array<LocalizationKeyRead>'
225
+
226
+ # auth_names
227
+ auth_names = opts[:auth_names] || ['Bearer']
228
+
229
+ new_options = opts.merge(
230
+ :header_params => header_params,
231
+ :query_params => query_params,
232
+ :form_params => form_params,
233
+ :body => post_body,
234
+ :auth_names => auth_names,
235
+ :return_type => return_type
236
+ )
237
+
238
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
239
+ if @api_client.config.debugging
240
+ @api_client.config.logger.debug "API called: DraftsApi#get_draft_localization_keys\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
241
+ end
242
+ return data, status_code, headers
243
+ end
244
+
245
+ # List Drafts
246
+ # Returns all drafts for your organization.
247
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \&quot;2020.04\&quot;, set the value to \&quot;application/vnd.dyspatch.2020.04+json\&quot;
248
+ # @param [Hash] opts the optional parameters
249
+ # @option opts [String] :cursor A cursor value used to retrieve a specific page from a paginated result set.
250
+ # @option opts [String] :status Filter the list of drafts by a particular status
251
+ # @return [DraftsRead]
252
+ def get_drafts(accept, opts = {})
253
+ data, _status_code, _headers = get_drafts_with_http_info(accept, opts)
254
+ data
255
+ end
256
+
257
+ # List Drafts
258
+ # Returns all drafts for your organization.
259
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \&quot;2020.04\&quot;, set the value to \&quot;application/vnd.dyspatch.2020.04+json\&quot;
260
+ # @param [Hash] opts the optional parameters
261
+ # @option opts [String] :cursor A cursor value used to retrieve a specific page from a paginated result set.
262
+ # @option opts [String] :status Filter the list of drafts by a particular status
263
+ # @return [Array<(DraftsRead, Integer, Hash)>] DraftsRead data, response status code and response headers
264
+ def get_drafts_with_http_info(accept, opts = {})
265
+ if @api_client.config.debugging
266
+ @api_client.config.logger.debug 'Calling API: DraftsApi.get_drafts ...'
267
+ end
268
+ # verify the required parameter 'accept' is set
269
+ if @api_client.config.client_side_validation && accept.nil?
270
+ fail ArgumentError, "Missing the required parameter 'accept' when calling DraftsApi.get_drafts"
271
+ end
272
+ allowable_values = ["awaitingTranslation"]
273
+ if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
274
+ fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
275
+ end
276
+ # resource path
277
+ local_var_path = '/drafts'
278
+
279
+ # query parameters
280
+ query_params = opts[:query_params] || {}
281
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
282
+ query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
283
+
284
+ # header parameters
285
+ header_params = opts[:header_params] || {}
286
+ # HTTP header 'Accept' (if needed)
287
+ header_params['Accept'] = @api_client.select_header_accept(['application/vnd.dyspatch.2020.04+json', '*/*'])
288
+ header_params[:'Accept'] = accept
289
+
290
+ # form parameters
291
+ form_params = opts[:form_params] || {}
292
+
293
+ # http body (model)
294
+ post_body = opts[:body]
295
+
296
+ # return_type
297
+ return_type = opts[:return_type] || 'DraftsRead'
298
+
299
+ # auth_names
300
+ auth_names = opts[:auth_names] || ['Bearer']
301
+
302
+ new_options = opts.merge(
303
+ :header_params => header_params,
304
+ :query_params => query_params,
305
+ :form_params => form_params,
306
+ :body => post_body,
307
+ :auth_names => auth_names,
308
+ :return_type => return_type
309
+ )
310
+
311
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
312
+ if @api_client.config.debugging
313
+ @api_client.config.logger.debug "API called: DraftsApi#get_drafts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
314
+ end
315
+ return data, status_code, headers
316
+ end
317
+
318
+ # Get localizations on a draft
319
+ # Returns localization metadata for the draft
320
+ # @param draft_id [String] A draft ID
321
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \&quot;2020.04\&quot;, set the value to \&quot;application/vnd.dyspatch.2020.04+json\&quot;
322
+ # @param [Hash] opts the optional parameters
323
+ # @return [Array<LocalizationMetaRead>]
324
+ def get_localization_for_draft(draft_id, accept, opts = {})
325
+ data, _status_code, _headers = get_localization_for_draft_with_http_info(draft_id, accept, opts)
326
+ data
327
+ end
328
+
329
+ # Get localizations on a draft
330
+ # Returns localization metadata for the draft
331
+ # @param draft_id [String] A draft ID
332
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \&quot;2020.04\&quot;, set the value to \&quot;application/vnd.dyspatch.2020.04+json\&quot;
333
+ # @param [Hash] opts the optional parameters
334
+ # @return [Array<(Array<LocalizationMetaRead>, Integer, Hash)>] Array<LocalizationMetaRead> data, response status code and response headers
335
+ def get_localization_for_draft_with_http_info(draft_id, accept, opts = {})
336
+ if @api_client.config.debugging
337
+ @api_client.config.logger.debug 'Calling API: DraftsApi.get_localization_for_draft ...'
338
+ end
339
+ # verify the required parameter 'draft_id' is set
340
+ if @api_client.config.client_side_validation && draft_id.nil?
341
+ fail ArgumentError, "Missing the required parameter 'draft_id' when calling DraftsApi.get_localization_for_draft"
342
+ end
343
+ # verify the required parameter 'accept' is set
344
+ if @api_client.config.client_side_validation && accept.nil?
345
+ fail ArgumentError, "Missing the required parameter 'accept' when calling DraftsApi.get_localization_for_draft"
346
+ end
347
+ # resource path
348
+ local_var_path = '/drafts/{draftId}/localizations'.sub('{' + 'draftId' + '}', CGI.escape(draft_id.to_s))
349
+
350
+ # query parameters
351
+ query_params = opts[:query_params] || {}
352
+
353
+ # header parameters
354
+ header_params = opts[:header_params] || {}
355
+ # HTTP header 'Accept' (if needed)
356
+ header_params['Accept'] = @api_client.select_header_accept(['application/vnd.dyspatch.2020.04+json', '*/*'])
357
+ header_params[:'Accept'] = accept
358
+
359
+ # form parameters
360
+ form_params = opts[:form_params] || {}
361
+
362
+ # http body (model)
363
+ post_body = opts[:body]
364
+
365
+ # return_type
366
+ return_type = opts[:return_type] || 'Array<LocalizationMetaRead>'
367
+
368
+ # auth_names
369
+ auth_names = opts[:auth_names] || ['Bearer']
370
+
371
+ new_options = opts.merge(
372
+ :header_params => header_params,
373
+ :query_params => query_params,
374
+ :form_params => form_params,
375
+ :body => post_body,
376
+ :auth_names => auth_names,
377
+ :return_type => return_type
378
+ )
379
+
380
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
381
+ if @api_client.config.debugging
382
+ @api_client.config.logger.debug "API called: DraftsApi#get_localization_for_draft\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
383
+ end
384
+ return data, status_code, headers
385
+ end
386
+
387
+ # Create or update a localization
388
+ # Inserts a localization or sets the name on an existing localization that already uses the languageId
389
+ # @param draft_id [String] A draft ID
390
+ # @param language_id [String] A language ID (eg: en-US)
391
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \&quot;2020.04\&quot;, set the value to \&quot;application/vnd.dyspatch.2020.04+json\&quot;
392
+ # @param inline_object [InlineObject]
393
+ # @param [Hash] opts the optional parameters
394
+ # @return [nil]
395
+ def save_localization(draft_id, language_id, accept, inline_object, opts = {})
396
+ save_localization_with_http_info(draft_id, language_id, accept, inline_object, opts)
397
+ nil
398
+ end
399
+
400
+ # Create or update a localization
401
+ # Inserts a localization or sets the name on an existing localization that already uses the languageId
402
+ # @param draft_id [String] A draft ID
403
+ # @param language_id [String] A language ID (eg: en-US)
404
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \&quot;2020.04\&quot;, set the value to \&quot;application/vnd.dyspatch.2020.04+json\&quot;
405
+ # @param inline_object [InlineObject]
406
+ # @param [Hash] opts the optional parameters
407
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
408
+ def save_localization_with_http_info(draft_id, language_id, accept, inline_object, opts = {})
409
+ if @api_client.config.debugging
410
+ @api_client.config.logger.debug 'Calling API: DraftsApi.save_localization ...'
411
+ end
412
+ # verify the required parameter 'draft_id' is set
413
+ if @api_client.config.client_side_validation && draft_id.nil?
414
+ fail ArgumentError, "Missing the required parameter 'draft_id' when calling DraftsApi.save_localization"
415
+ end
416
+ # verify the required parameter 'language_id' is set
417
+ if @api_client.config.client_side_validation && language_id.nil?
418
+ fail ArgumentError, "Missing the required parameter 'language_id' when calling DraftsApi.save_localization"
419
+ end
420
+ # verify the required parameter 'accept' is set
421
+ if @api_client.config.client_side_validation && accept.nil?
422
+ fail ArgumentError, "Missing the required parameter 'accept' when calling DraftsApi.save_localization"
423
+ end
424
+ # verify the required parameter 'inline_object' is set
425
+ if @api_client.config.client_side_validation && inline_object.nil?
426
+ fail ArgumentError, "Missing the required parameter 'inline_object' when calling DraftsApi.save_localization"
427
+ end
428
+ # resource path
429
+ local_var_path = '/drafts/{draftId}/localizations/{languageId}'.sub('{' + 'draftId' + '}', CGI.escape(draft_id.to_s)).sub('{' + 'languageId' + '}', CGI.escape(language_id.to_s))
430
+
431
+ # query parameters
432
+ query_params = opts[:query_params] || {}
433
+
434
+ # header parameters
435
+ header_params = opts[:header_params] || {}
436
+ # HTTP header 'Content-Type'
437
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
438
+ header_params[:'Accept'] = accept
439
+
440
+ # form parameters
441
+ form_params = opts[:form_params] || {}
442
+
443
+ # http body (model)
444
+ post_body = opts[:body] || @api_client.object_to_http_body(inline_object)
445
+
446
+ # return_type
447
+ return_type = opts[:return_type]
448
+
449
+ # auth_names
450
+ auth_names = opts[:auth_names] || ['Bearer']
451
+
452
+ new_options = opts.merge(
453
+ :header_params => header_params,
454
+ :query_params => query_params,
455
+ :form_params => form_params,
456
+ :body => post_body,
457
+ :auth_names => auth_names,
458
+ :return_type => return_type
459
+ )
460
+
461
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
462
+ if @api_client.config.debugging
463
+ @api_client.config.logger.debug "API called: DraftsApi#save_localization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
464
+ end
465
+ return data, status_code, headers
466
+ end
467
+
468
+ # Set translations for language
469
+ # Completely replaces any existing translations for the given language with those provided in request body. Variables embedded in keys or values are expected to be in the format `%(my_variable)s` and will automatically convert to the correct Dyspatch format depending on the type of template. Accepts key/value pairs in JSON format or in gettext PO file format. For JSON set `Content-Type` header to `application/json`. For gettext PO format set `Content-Type` header to `text/x-gettext-translation`.
470
+ # @param draft_id [String] A draft ID
471
+ # @param language_id [String] A language ID (eg: en-US)
472
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \&quot;2020.04\&quot;, set the value to \&quot;application/vnd.dyspatch.2020.04+json\&quot;
473
+ # @param request_body [Hash<String, String>]
474
+ # @param [Hash] opts the optional parameters
475
+ # @return [nil]
476
+ def set_translation(draft_id, language_id, accept, request_body, opts = {})
477
+ set_translation_with_http_info(draft_id, language_id, accept, request_body, opts)
478
+ nil
479
+ end
480
+
481
+ # Set translations for language
482
+ # Completely replaces any existing translations for the given language with those provided in request body. Variables embedded in keys or values are expected to be in the format &#x60;%(my_variable)s&#x60; and will automatically convert to the correct Dyspatch format depending on the type of template. Accepts key/value pairs in JSON format or in gettext PO file format. For JSON set &#x60;Content-Type&#x60; header to &#x60;application/json&#x60;. For gettext PO format set &#x60;Content-Type&#x60; header to &#x60;text/x-gettext-translation&#x60;.
483
+ # @param draft_id [String] A draft ID
484
+ # @param language_id [String] A language ID (eg: en-US)
485
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \&quot;2020.04\&quot;, set the value to \&quot;application/vnd.dyspatch.2020.04+json\&quot;
486
+ # @param request_body [Hash<String, String>]
487
+ # @param [Hash] opts the optional parameters
488
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
489
+ def set_translation_with_http_info(draft_id, language_id, accept, request_body, opts = {})
490
+ if @api_client.config.debugging
491
+ @api_client.config.logger.debug 'Calling API: DraftsApi.set_translation ...'
492
+ end
493
+ # verify the required parameter 'draft_id' is set
494
+ if @api_client.config.client_side_validation && draft_id.nil?
495
+ fail ArgumentError, "Missing the required parameter 'draft_id' when calling DraftsApi.set_translation"
496
+ end
497
+ # verify the required parameter 'language_id' is set
498
+ if @api_client.config.client_side_validation && language_id.nil?
499
+ fail ArgumentError, "Missing the required parameter 'language_id' when calling DraftsApi.set_translation"
500
+ end
501
+ # verify the required parameter 'accept' is set
502
+ if @api_client.config.client_side_validation && accept.nil?
503
+ fail ArgumentError, "Missing the required parameter 'accept' when calling DraftsApi.set_translation"
504
+ end
505
+ # verify the required parameter 'request_body' is set
506
+ if @api_client.config.client_side_validation && request_body.nil?
507
+ fail ArgumentError, "Missing the required parameter 'request_body' when calling DraftsApi.set_translation"
508
+ end
509
+ # resource path
510
+ local_var_path = '/drafts/{draftId}/localizations/{languageId}/translations'.sub('{' + 'draftId' + '}', CGI.escape(draft_id.to_s)).sub('{' + 'languageId' + '}', CGI.escape(language_id.to_s))
511
+
512
+ # query parameters
513
+ query_params = opts[:query_params] || {}
514
+
515
+ # header parameters
516
+ header_params = opts[:header_params] || {}
517
+ # HTTP header 'Accept' (if needed)
518
+ header_params['Accept'] = @api_client.select_header_accept(['application/vnd.dyspatch.2020.04+json', '*/*'])
519
+ # HTTP header 'Content-Type'
520
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
521
+ header_params[:'Accept'] = accept
522
+
523
+ # form parameters
524
+ form_params = opts[:form_params] || {}
525
+
526
+ # http body (model)
527
+ post_body = opts[:body] || @api_client.object_to_http_body(request_body)
528
+
529
+ # return_type
530
+ return_type = opts[:return_type]
531
+
532
+ # auth_names
533
+ auth_names = opts[:auth_names] || ['Bearer']
534
+
535
+ new_options = opts.merge(
536
+ :header_params => header_params,
537
+ :query_params => query_params,
538
+ :form_params => form_params,
539
+ :body => post_body,
540
+ :auth_names => auth_names,
541
+ :return_type => return_type
542
+ )
543
+
544
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
545
+ if @api_client.config.debugging
546
+ @api_client.config.logger.debug "API called: DraftsApi#set_translation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
547
+ end
548
+ return data, status_code, headers
549
+ end
550
+
551
+ # Submit the draft for approval
552
+ # Moves the draft into submitted state.
553
+ # @param draft_id [String] A draft ID
554
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \&quot;2020.04\&quot;, set the value to \&quot;application/vnd.dyspatch.2020.04+json\&quot;
555
+ # @param [Hash] opts the optional parameters
556
+ # @return [nil]
557
+ def submit_draft_for_approval(draft_id, accept, opts = {})
558
+ submit_draft_for_approval_with_http_info(draft_id, accept, opts)
559
+ nil
560
+ end
561
+
562
+ # Submit the draft for approval
563
+ # Moves the draft into submitted state.
564
+ # @param draft_id [String] A draft ID
565
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \&quot;2020.04\&quot;, set the value to \&quot;application/vnd.dyspatch.2020.04+json\&quot;
566
+ # @param [Hash] opts the optional parameters
567
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
568
+ def submit_draft_for_approval_with_http_info(draft_id, accept, opts = {})
569
+ if @api_client.config.debugging
570
+ @api_client.config.logger.debug 'Calling API: DraftsApi.submit_draft_for_approval ...'
571
+ end
572
+ # verify the required parameter 'draft_id' is set
573
+ if @api_client.config.client_side_validation && draft_id.nil?
574
+ fail ArgumentError, "Missing the required parameter 'draft_id' when calling DraftsApi.submit_draft_for_approval"
575
+ end
576
+ # verify the required parameter 'accept' is set
577
+ if @api_client.config.client_side_validation && accept.nil?
578
+ fail ArgumentError, "Missing the required parameter 'accept' when calling DraftsApi.submit_draft_for_approval"
579
+ end
580
+ # resource path
581
+ local_var_path = '/drafts/{draftId}/publishRequest'.sub('{' + 'draftId' + '}', CGI.escape(draft_id.to_s))
582
+
583
+ # query parameters
584
+ query_params = opts[:query_params] || {}
585
+
586
+ # header parameters
587
+ header_params = opts[:header_params] || {}
588
+ # HTTP header 'Accept' (if needed)
589
+ header_params['Accept'] = @api_client.select_header_accept(['application/vnd.dyspatch.2020.04+json', '*/*'])
590
+ header_params[:'Accept'] = accept
591
+
592
+ # form parameters
593
+ form_params = opts[:form_params] || {}
594
+
595
+ # http body (model)
596
+ post_body = opts[:body]
597
+
598
+ # return_type
599
+ return_type = opts[:return_type]
600
+
601
+ # auth_names
602
+ auth_names = opts[:auth_names] || ['Bearer']
603
+
604
+ new_options = opts.merge(
605
+ :header_params => header_params,
606
+ :query_params => query_params,
607
+ :form_params => form_params,
608
+ :body => post_body,
609
+ :auth_names => auth_names,
610
+ :return_type => return_type
611
+ )
612
+
613
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
614
+ if @api_client.config.debugging
615
+ @api_client.config.logger.debug "API called: DraftsApi#submit_draft_for_approval\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
616
+ end
617
+ return data, status_code, headers
618
+ end
619
+ end
620
+ end