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