dyspatch_client 3.0.0 → 6.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 (109) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -1
  3. data/README.md +45 -53
  4. data/Rakefile +2 -0
  5. data/docs/APIError.md +13 -2
  6. data/docs/CompiledRead.md +15 -0
  7. data/docs/Cursor.md +11 -1
  8. data/docs/DraftMetaRead.md +14 -1
  9. data/docs/DraftRead.md +17 -1
  10. data/docs/DraftsApi.md +140 -131
  11. data/docs/DraftsRead.md +12 -2
  12. data/docs/{Body.md → InlineObject.md} +10 -1
  13. data/docs/LocalizationKeyRead.md +10 -0
  14. data/docs/LocalizationMetaRead.md +15 -2
  15. data/docs/LocalizationRead.md +19 -1
  16. data/docs/LocalizationsApi.md +75 -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 -20
  23. data/lib/dyspatch_client/api/drafts_api.rb +375 -234
  24. data/lib/dyspatch_client/api/localizations_api.rb +135 -31
  25. data/lib/dyspatch_client/api/templates_api.rb +99 -65
  26. data/lib/dyspatch_client/api_client.rb +46 -47
  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 +56 -67
  31. data/lib/dyspatch_client/models/cursor.rb +43 -20
  32. data/lib/dyspatch_client/models/draft_meta_read.rb +49 -35
  33. data/lib/dyspatch_client/models/draft_read.rb +49 -25
  34. data/lib/dyspatch_client/models/drafts_read.rb +42 -19
  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 +62 -36
  38. data/lib/dyspatch_client/models/localization_read.rb +71 -35
  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 +26 -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 +4 -4
  48. data/spec/spec_helper.rb +4 -4
  49. metadata +11 -219
  50. data/LICENSE +0 -202
  51. data/docs/Body1.md +0 -8
  52. data/docs/CreatedAt.md +0 -7
  53. data/docs/DraftDescription.md +0 -7
  54. data/docs/DraftId.md +0 -7
  55. data/docs/DraftName.md +0 -7
  56. data/docs/DraftUrl.md +0 -7
  57. data/docs/LanguageId.md +0 -7
  58. data/docs/LocalizationId.md +0 -7
  59. data/docs/LocalizationName.md +0 -7
  60. data/docs/LocalizationUrl.md +0 -7
  61. data/docs/TemplateDescription.md +0 -7
  62. data/docs/TemplateId.md +0 -7
  63. data/docs/TemplateName.md +0 -7
  64. data/docs/TemplateUrl.md +0 -7
  65. data/docs/UpdatedAt.md +0 -7
  66. data/git_push.sh +0 -55
  67. data/lib/dyspatch_client/models/body_1.rb +0 -183
  68. data/lib/dyspatch_client/models/created_at.rb +0 -175
  69. data/lib/dyspatch_client/models/draft_description.rb +0 -175
  70. data/lib/dyspatch_client/models/draft_id.rb +0 -175
  71. data/lib/dyspatch_client/models/draft_name.rb +0 -175
  72. data/lib/dyspatch_client/models/draft_url.rb +0 -175
  73. data/lib/dyspatch_client/models/language_id.rb +0 -175
  74. data/lib/dyspatch_client/models/localization_id.rb +0 -175
  75. data/lib/dyspatch_client/models/localization_name.rb +0 -175
  76. data/lib/dyspatch_client/models/localization_url.rb +0 -175
  77. data/lib/dyspatch_client/models/template_description.rb +0 -175
  78. data/lib/dyspatch_client/models/template_id.rb +0 -175
  79. data/lib/dyspatch_client/models/template_name.rb +0 -175
  80. data/lib/dyspatch_client/models/template_url.rb +0 -175
  81. data/lib/dyspatch_client/models/updated_at.rb +0 -175
  82. data/spec/models/api_error_spec.rb +0 -57
  83. data/spec/models/body_1_spec.rb +0 -41
  84. data/spec/models/body_spec.rb +0 -41
  85. data/spec/models/compiled_read_spec.rb +0 -65
  86. data/spec/models/created_at_spec.rb +0 -35
  87. data/spec/models/cursor_spec.rb +0 -47
  88. data/spec/models/draft_description_spec.rb +0 -35
  89. data/spec/models/draft_id_spec.rb +0 -35
  90. data/spec/models/draft_meta_read_spec.rb +0 -77
  91. data/spec/models/draft_name_spec.rb +0 -35
  92. data/spec/models/draft_read_spec.rb +0 -83
  93. data/spec/models/draft_url_spec.rb +0 -35
  94. data/spec/models/drafts_read_spec.rb +0 -47
  95. data/spec/models/language_id_spec.rb +0 -35
  96. data/spec/models/localization_id_spec.rb +0 -35
  97. data/spec/models/localization_key_read_spec.rb +0 -47
  98. data/spec/models/localization_meta_read_spec.rb +0 -65
  99. data/spec/models/localization_name_spec.rb +0 -35
  100. data/spec/models/localization_read_spec.rb +0 -83
  101. data/spec/models/localization_url_spec.rb +0 -35
  102. data/spec/models/template_description_spec.rb +0 -35
  103. data/spec/models/template_id_spec.rb +0 -35
  104. data/spec/models/template_meta_read_spec.rb +0 -77
  105. data/spec/models/template_name_spec.rb +0 -35
  106. data/spec/models/template_read_spec.rb +0 -83
  107. data/spec/models/template_url_spec.rb +0 -35
  108. data/spec/models/templates_read_spec.rb +0 -47
  109. data/spec/models/updated_at_spec.rb +0 -35
@@ -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: 2020.11
7
7
  Contact: support@dyspatch.io
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.9
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
13
- require 'uri'
13
+ require 'cgi'
14
14
 
15
15
  module DyspatchClient
16
16
  class LocalizationsApi
@@ -19,68 +19,172 @@ module DyspatchClient
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
+ # Get Draft Localization Object by ID
23
+ # Returns a specific localization object of the matching draft with a matching localization ID
24
+ # @param draft_id [String] A draft ID
25
+ # @param localization_id [String] A localization ID
26
+ # @param target_language [String] The type of templating language to compile as. Should only be used for visual templates.
27
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \"2020.11\", set the value to \"application/vnd.dyspatch.2020.11+json\"
28
+ # @param [Hash] opts the optional parameters
29
+ # @return [LocalizationRead]
30
+ def get_draft_localization_by_id(draft_id, localization_id, target_language, accept, opts = {})
31
+ data, _status_code, _headers = get_draft_localization_by_id_with_http_info(draft_id, localization_id, target_language, accept, opts)
32
+ data
33
+ end
34
+
35
+ # Get Draft Localization Object by ID
36
+ # Returns a specific localization object of the matching draft with a matching localization ID
37
+ # @param draft_id [String] A draft ID
38
+ # @param localization_id [String] A localization ID
39
+ # @param target_language [String] The type of templating language to compile as. Should only be used for visual templates.
40
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \"2020.11\", set the value to \"application/vnd.dyspatch.2020.11+json\"
41
+ # @param [Hash] opts the optional parameters
42
+ # @return [Array<(LocalizationRead, Integer, Hash)>] LocalizationRead data, response status code and response headers
43
+ def get_draft_localization_by_id_with_http_info(draft_id, localization_id, target_language, accept, opts = {})
44
+ if @api_client.config.debugging
45
+ @api_client.config.logger.debug 'Calling API: LocalizationsApi.get_draft_localization_by_id ...'
46
+ end
47
+ # verify the required parameter 'draft_id' is set
48
+ if @api_client.config.client_side_validation && draft_id.nil?
49
+ fail ArgumentError, "Missing the required parameter 'draft_id' when calling LocalizationsApi.get_draft_localization_by_id"
50
+ end
51
+ # verify the required parameter 'localization_id' is set
52
+ if @api_client.config.client_side_validation && localization_id.nil?
53
+ fail ArgumentError, "Missing the required parameter 'localization_id' when calling LocalizationsApi.get_draft_localization_by_id"
54
+ end
55
+ # verify the required parameter 'target_language' is set
56
+ if @api_client.config.client_side_validation && target_language.nil?
57
+ fail ArgumentError, "Missing the required parameter 'target_language' when calling LocalizationsApi.get_draft_localization_by_id"
58
+ end
59
+ # verify enum value
60
+ allowable_values = ["html", "handlebars", "ampscript", "freemarker", "cheetah", "jinja", "liquid"]
61
+ if @api_client.config.client_side_validation && !allowable_values.include?(target_language)
62
+ fail ArgumentError, "invalid value for \"target_language\", must be one of #{allowable_values}"
63
+ end
64
+ # verify the required parameter 'accept' is set
65
+ if @api_client.config.client_side_validation && accept.nil?
66
+ fail ArgumentError, "Missing the required parameter 'accept' when calling LocalizationsApi.get_draft_localization_by_id"
67
+ end
68
+ # resource path
69
+ local_var_path = '/localizations/{localizationId}/drafts/{draftId}'.sub('{' + 'draftId' + '}', CGI.escape(draft_id.to_s)).sub('{' + 'localizationId' + '}', CGI.escape(localization_id.to_s))
70
+
71
+ # query parameters
72
+ query_params = opts[:query_params] || {}
73
+ query_params[:'targetLanguage'] = target_language
74
+
75
+ # header parameters
76
+ header_params = opts[:header_params] || {}
77
+ # HTTP header 'Accept' (if needed)
78
+ header_params['Accept'] = @api_client.select_header_accept(['application/vnd.dyspatch.2020.11+json', '*/*'])
79
+ header_params[:'Accept'] = accept
80
+
81
+ # form parameters
82
+ form_params = opts[:form_params] || {}
83
+
84
+ # http body (model)
85
+ post_body = opts[:body]
86
+
87
+ # return_type
88
+ return_type = opts[:return_type] || 'LocalizationRead'
89
+
90
+ # auth_names
91
+ auth_names = opts[:auth_names] || ['Bearer']
92
+
93
+ new_options = opts.merge(
94
+ :header_params => header_params,
95
+ :query_params => query_params,
96
+ :form_params => form_params,
97
+ :body => post_body,
98
+ :auth_names => auth_names,
99
+ :return_type => return_type
100
+ )
101
+
102
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
103
+ if @api_client.config.debugging
104
+ @api_client.config.logger.debug "API called: LocalizationsApi#get_draft_localization_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
105
+ end
106
+ return data, status_code, headers
107
+ end
108
+
22
109
  # Get Localization Object by ID
23
- # Returns a specific localization object with a matching ID.
24
- # @param localization_id A localization ID
25
- # @param target_language The type of templating language to compile as. Should only be used for visual templates.
110
+ # Returns the published content associated with the localization of the matching ID
111
+ # @param localization_id [String] A localization ID
112
+ # @param target_language [String] The type of templating language to compile as. Should only be used for visual templates.
113
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \&quot;2020.11\&quot;, set the value to \&quot;application/vnd.dyspatch.2020.11+json\&quot;
26
114
  # @param [Hash] opts the optional parameters
27
115
  # @return [LocalizationRead]
28
- def localizations_localization_id_get(localization_id, target_language, opts = {})
29
- data, _status_code, _headers = localizations_localization_id_get_with_http_info(localization_id, target_language, opts)
116
+ def get_published_localization_by_id(localization_id, target_language, accept, opts = {})
117
+ data, _status_code, _headers = get_published_localization_by_id_with_http_info(localization_id, target_language, accept, opts)
30
118
  data
31
119
  end
32
120
 
33
121
  # Get Localization Object by ID
34
- # Returns a specific localization object with a matching ID.
35
- # @param localization_id A localization ID
36
- # @param target_language The type of templating language to compile as. Should only be used for visual templates.
122
+ # Returns the published content associated with the localization of the matching ID
123
+ # @param localization_id [String] A localization ID
124
+ # @param target_language [String] The type of templating language to compile as. Should only be used for visual templates.
125
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \&quot;2020.11\&quot;, set the value to \&quot;application/vnd.dyspatch.2020.11+json\&quot;
37
126
  # @param [Hash] opts the optional parameters
38
- # @return [Array<(LocalizationRead, Fixnum, Hash)>] LocalizationRead data, response status code and response headers
39
- def localizations_localization_id_get_with_http_info(localization_id, target_language, opts = {})
127
+ # @return [Array<(LocalizationRead, Integer, Hash)>] LocalizationRead data, response status code and response headers
128
+ def get_published_localization_by_id_with_http_info(localization_id, target_language, accept, opts = {})
40
129
  if @api_client.config.debugging
41
- @api_client.config.logger.debug 'Calling API: LocalizationsApi.localizations_localization_id_get ...'
130
+ @api_client.config.logger.debug 'Calling API: LocalizationsApi.get_published_localization_by_id ...'
42
131
  end
43
132
  # verify the required parameter 'localization_id' is set
44
133
  if @api_client.config.client_side_validation && localization_id.nil?
45
- fail ArgumentError, "Missing the required parameter 'localization_id' when calling LocalizationsApi.localizations_localization_id_get"
134
+ fail ArgumentError, "Missing the required parameter 'localization_id' when calling LocalizationsApi.get_published_localization_by_id"
46
135
  end
47
136
  # verify the required parameter 'target_language' is set
48
137
  if @api_client.config.client_side_validation && target_language.nil?
49
- fail ArgumentError, "Missing the required parameter 'target_language' when calling LocalizationsApi.localizations_localization_id_get"
138
+ fail ArgumentError, "Missing the required parameter 'target_language' when calling LocalizationsApi.get_published_localization_by_id"
50
139
  end
51
140
  # 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"
141
+ allowable_values = ["html", "handlebars", "ampscript", "freemarker", "cheetah", "jinja", "liquid"]
142
+ if @api_client.config.client_side_validation && !allowable_values.include?(target_language)
143
+ fail ArgumentError, "invalid value for \"target_language\", must be one of #{allowable_values}"
144
+ end
145
+ # verify the required parameter 'accept' is set
146
+ if @api_client.config.client_side_validation && accept.nil?
147
+ fail ArgumentError, "Missing the required parameter 'accept' when calling LocalizationsApi.get_published_localization_by_id"
54
148
  end
55
149
  # resource path
56
- local_var_path = '/localizations/{localizationId}'.sub('{' + 'localizationId' + '}', localization_id.to_s)
150
+ local_var_path = '/localizations/{localizationId}'.sub('{' + 'localizationId' + '}', CGI.escape(localization_id.to_s))
57
151
 
58
152
  # query parameters
59
- query_params = {}
153
+ query_params = opts[:query_params] || {}
60
154
  query_params[:'targetLanguage'] = target_language
61
155
 
62
156
  # header parameters
63
- header_params = {}
157
+ header_params = opts[:header_params] || {}
64
158
  # HTTP header 'Accept' (if needed)
65
- header_params['Accept'] = @api_client.select_header_accept(['application/vnd.dyspatch.2019.10+json'])
159
+ header_params['Accept'] = @api_client.select_header_accept(['application/vnd.dyspatch.2020.11+json', '*/*'])
160
+ header_params[:'Accept'] = accept
66
161
 
67
162
  # form parameters
68
- form_params = {}
163
+ form_params = opts[:form_params] || {}
69
164
 
70
165
  # http body (model)
71
- post_body = nil
72
- auth_names = ['Bearer']
73
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
166
+ post_body = opts[:body]
167
+
168
+ # return_type
169
+ return_type = opts[:return_type] || 'LocalizationRead'
170
+
171
+ # auth_names
172
+ auth_names = opts[:auth_names] || ['Bearer']
173
+
174
+ new_options = opts.merge(
74
175
  :header_params => header_params,
75
176
  :query_params => query_params,
76
177
  :form_params => form_params,
77
178
  :body => post_body,
78
179
  :auth_names => auth_names,
79
- :return_type => 'LocalizationRead')
180
+ :return_type => return_type
181
+ )
182
+
183
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
80
184
  if @api_client.config.debugging
81
- @api_client.config.logger.debug "API called: LocalizationsApi#localizations_localization_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
185
+ @api_client.config.logger.debug "API called: LocalizationsApi#get_published_localization_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
82
186
  end
83
187
  return data, status_code, headers
84
188
  end
85
189
  end
86
- end
190
+ end
@@ -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: 2020.11
7
7
  Contact: support@dyspatch.io
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.9
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
13
- require 'uri'
13
+ require 'cgi'
14
14
 
15
15
  module DyspatchClient
16
16
  class TemplatesApi
@@ -19,117 +19,151 @@ module DyspatchClient
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
- # List Templates
23
- # Gets a list of Template Metadata objects for all templates. Up to 25 results returned before results are paginated.
22
+ # Get Template by ID
23
+ # Gets a template object with the matching ID. If the template has published content the \"compiled\" field will contain the template .
24
+ # @param template_id [String] A template ID
25
+ # @param target_language [String] The type of templating language to compile as. Should only be used for visual templates.
26
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \&quot;2020.11\&quot;, set the value to \&quot;application/vnd.dyspatch.2020.11+json\&quot;
24
27
  # @param [Hash] opts the optional parameters
25
- # @option opts [String] :cursor A cursor value used to retrieve a specific page from a paginated result set.
26
- # @return [TemplatesRead]
27
- def templates_get(opts = {})
28
- data, _status_code, _headers = templates_get_with_http_info(opts)
28
+ # @return [TemplateRead]
29
+ def get_template_by_id(template_id, target_language, accept, opts = {})
30
+ data, _status_code, _headers = get_template_by_id_with_http_info(template_id, target_language, accept, opts)
29
31
  data
30
32
  end
31
33
 
32
- # List Templates
33
- # Gets a list of Template Metadata objects for all templates. Up to 25 results returned before results are paginated.
34
+ # Get Template by ID
35
+ # Gets a template object with the matching ID. If the template has published content the \&quot;compiled\&quot; field will contain the template .
36
+ # @param template_id [String] A template ID
37
+ # @param target_language [String] The type of templating language to compile as. Should only be used for visual templates.
38
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \&quot;2020.11\&quot;, set the value to \&quot;application/vnd.dyspatch.2020.11+json\&quot;
34
39
  # @param [Hash] opts the optional parameters
35
- # @option opts [String] :cursor A cursor value used to retrieve a specific page from a paginated result set.
36
- # @return [Array<(TemplatesRead, Fixnum, Hash)>] TemplatesRead data, response status code and response headers
37
- def templates_get_with_http_info(opts = {})
40
+ # @return [Array<(TemplateRead, Integer, Hash)>] TemplateRead data, response status code and response headers
41
+ def get_template_by_id_with_http_info(template_id, target_language, accept, opts = {})
38
42
  if @api_client.config.debugging
39
- @api_client.config.logger.debug 'Calling API: TemplatesApi.templates_get ...'
43
+ @api_client.config.logger.debug 'Calling API: TemplatesApi.get_template_by_id ...'
44
+ end
45
+ # verify the required parameter 'template_id' is set
46
+ if @api_client.config.client_side_validation && template_id.nil?
47
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling TemplatesApi.get_template_by_id"
48
+ end
49
+ # verify the required parameter 'target_language' is set
50
+ if @api_client.config.client_side_validation && target_language.nil?
51
+ fail ArgumentError, "Missing the required parameter 'target_language' when calling TemplatesApi.get_template_by_id"
52
+ end
53
+ # verify enum value
54
+ allowable_values = ["html", "handlebars", "ampscript", "freemarker", "cheetah", "jinja", "liquid"]
55
+ if @api_client.config.client_side_validation && !allowable_values.include?(target_language)
56
+ fail ArgumentError, "invalid value for \"target_language\", must be one of #{allowable_values}"
57
+ end
58
+ # verify the required parameter 'accept' is set
59
+ if @api_client.config.client_side_validation && accept.nil?
60
+ fail ArgumentError, "Missing the required parameter 'accept' when calling TemplatesApi.get_template_by_id"
40
61
  end
41
62
  # resource path
42
- local_var_path = '/templates'
63
+ local_var_path = '/templates/{templateId}'.sub('{' + 'templateId' + '}', CGI.escape(template_id.to_s))
43
64
 
44
65
  # query parameters
45
- query_params = {}
46
- query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
66
+ query_params = opts[:query_params] || {}
67
+ query_params[:'targetLanguage'] = target_language
47
68
 
48
69
  # header parameters
49
- header_params = {}
70
+ header_params = opts[:header_params] || {}
50
71
  # HTTP header 'Accept' (if needed)
51
- header_params['Accept'] = @api_client.select_header_accept(['application/vnd.dyspatch.2019.10+json'])
72
+ header_params['Accept'] = @api_client.select_header_accept(['application/vnd.dyspatch.2020.11+json', '*/*'])
73
+ header_params[:'Accept'] = accept
52
74
 
53
75
  # form parameters
54
- form_params = {}
76
+ form_params = opts[:form_params] || {}
55
77
 
56
78
  # http body (model)
57
- post_body = nil
58
- auth_names = ['Bearer']
59
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
79
+ post_body = opts[:body]
80
+
81
+ # return_type
82
+ return_type = opts[:return_type] || 'TemplateRead'
83
+
84
+ # auth_names
85
+ auth_names = opts[:auth_names] || ['Bearer']
86
+
87
+ new_options = opts.merge(
60
88
  :header_params => header_params,
61
89
  :query_params => query_params,
62
90
  :form_params => form_params,
63
91
  :body => post_body,
64
92
  :auth_names => auth_names,
65
- :return_type => 'TemplatesRead')
93
+ :return_type => return_type
94
+ )
95
+
96
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
66
97
  if @api_client.config.debugging
67
- @api_client.config.logger.debug "API called: TemplatesApi#templates_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
98
+ @api_client.config.logger.debug "API called: TemplatesApi#get_template_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
68
99
  end
69
100
  return data, status_code, headers
70
101
  end
71
- # Get Template by ID
72
- # Gets a template object with the matching ID. If the template has published content the "compiled" field will contain the template .
73
- # @param template_id A template ID
74
- # @param target_language The type of templating language to compile as. Should only be used for visual templates.
102
+
103
+ # List Templates
104
+ # Gets a list of Template Metadata objects for all templates. Up to 25 results returned before results are paginated.
105
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \&quot;2020.11\&quot;, set the value to \&quot;application/vnd.dyspatch.2020.11+json\&quot;
75
106
  # @param [Hash] opts the optional parameters
76
- # @return [TemplateRead]
77
- def templates_template_id_get(template_id, target_language, opts = {})
78
- data, _status_code, _headers = templates_template_id_get_with_http_info(template_id, target_language, opts)
107
+ # @option opts [String] :cursor A cursor value used to retrieve a specific page from a paginated result set.
108
+ # @return [TemplatesRead]
109
+ def get_templates(accept, opts = {})
110
+ data, _status_code, _headers = get_templates_with_http_info(accept, opts)
79
111
  data
80
112
  end
81
113
 
82
- # Get Template by ID
83
- # Gets a template object with the matching ID. If the template has published content the "compiled" field will contain the template .
84
- # @param template_id A template ID
85
- # @param target_language The type of templating language to compile as. Should only be used for visual templates.
114
+ # List Templates
115
+ # Gets a list of Template Metadata objects for all templates. Up to 25 results returned before results are paginated.
116
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \&quot;2020.11\&quot;, set the value to \&quot;application/vnd.dyspatch.2020.11+json\&quot;
86
117
  # @param [Hash] opts the optional parameters
87
- # @return [Array<(TemplateRead, Fixnum, Hash)>] TemplateRead data, response status code and response headers
88
- def templates_template_id_get_with_http_info(template_id, target_language, opts = {})
118
+ # @option opts [String] :cursor A cursor value used to retrieve a specific page from a paginated result set.
119
+ # @return [Array<(TemplatesRead, Integer, Hash)>] TemplatesRead data, response status code and response headers
120
+ def get_templates_with_http_info(accept, opts = {})
89
121
  if @api_client.config.debugging
90
- @api_client.config.logger.debug 'Calling API: TemplatesApi.templates_template_id_get ...'
122
+ @api_client.config.logger.debug 'Calling API: TemplatesApi.get_templates ...'
91
123
  end
92
- # verify the required parameter 'template_id' is set
93
- if @api_client.config.client_side_validation && template_id.nil?
94
- fail ArgumentError, "Missing the required parameter 'template_id' when calling TemplatesApi.templates_template_id_get"
95
- end
96
- # verify the required parameter 'target_language' is set
97
- if @api_client.config.client_side_validation && target_language.nil?
98
- fail ArgumentError, "Missing the required parameter 'target_language' when calling TemplatesApi.templates_template_id_get"
99
- end
100
- # verify enum value
101
- if @api_client.config.client_side_validation && !['html', 'jinja', 'handlebars', 'ampscript', 'freemarker', 'cheetah'].include?(target_language)
102
- fail ArgumentError, "invalid value for 'target_language', must be one of html, jinja, handlebars, ampscript, freemarker, cheetah"
124
+ # verify the required parameter 'accept' is set
125
+ if @api_client.config.client_side_validation && accept.nil?
126
+ fail ArgumentError, "Missing the required parameter 'accept' when calling TemplatesApi.get_templates"
103
127
  end
104
128
  # resource path
105
- local_var_path = '/templates/{templateId}'.sub('{' + 'templateId' + '}', template_id.to_s)
129
+ local_var_path = '/templates'
106
130
 
107
131
  # query parameters
108
- query_params = {}
109
- query_params[:'targetLanguage'] = target_language
132
+ query_params = opts[:query_params] || {}
133
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
110
134
 
111
135
  # header parameters
112
- header_params = {}
136
+ header_params = opts[:header_params] || {}
113
137
  # HTTP header 'Accept' (if needed)
114
- header_params['Accept'] = @api_client.select_header_accept(['application/vnd.dyspatch.2019.10+json'])
138
+ header_params['Accept'] = @api_client.select_header_accept(['application/vnd.dyspatch.2020.11+json', '*/*'])
139
+ header_params[:'Accept'] = accept
115
140
 
116
141
  # form parameters
117
- form_params = {}
142
+ form_params = opts[:form_params] || {}
118
143
 
119
144
  # http body (model)
120
- post_body = nil
121
- auth_names = ['Bearer']
122
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
145
+ post_body = opts[:body]
146
+
147
+ # return_type
148
+ return_type = opts[:return_type] || 'TemplatesRead'
149
+
150
+ # auth_names
151
+ auth_names = opts[:auth_names] || ['Bearer']
152
+
153
+ new_options = opts.merge(
123
154
  :header_params => header_params,
124
155
  :query_params => query_params,
125
156
  :form_params => form_params,
126
157
  :body => post_body,
127
158
  :auth_names => auth_names,
128
- :return_type => 'TemplateRead')
159
+ :return_type => return_type
160
+ )
161
+
162
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
129
163
  if @api_client.config.debugging
130
- @api_client.config.logger.debug "API called: TemplatesApi#templates_template_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
164
+ @api_client.config.logger.debug "API called: TemplatesApi#get_templates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
131
165
  end
132
166
  return data, status_code, headers
133
167
  end
134
168
  end
135
- end
169
+ end