Class: Klaviyo::TemplatesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/klaviyo_sdk/api/templates_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ TemplatesApi

Returns a new instance of TemplatesApi.



19
20
21
# File 'lib/klaviyo_sdk/api/templates_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/klaviyo_sdk/api/templates_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#clone_template(template_id, name, opts = {}) ⇒ Template

Clone Template Creates a copy of a given template with a new name.

Parameters:

  • template_id (String)
  • name (String)

    The new name of the email template.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



28
29
30
31
# File 'lib/klaviyo_sdk/api/templates_api.rb', line 28

def clone_template(template_id, name, opts = {})
  data, _status_code, _headers = clone_template_with_http_info(template_id, name, opts)
  data
end

#clone_template_with_http_info(template_id, name, opts = {}) ⇒ Array<(Template, Integer, Hash)>

Clone Template Creates a copy of a given template with a new name.

Parameters:

  • template_id (String)
  • name (String)

    The new name of the email template.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Template, Integer, Hash)>)

    Template data, response status code and response headers



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/klaviyo_sdk/api/templates_api.rb', line 39

def clone_template_with_http_info(template_id, name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TemplatesApi.clone_template ...'
  end
  # verify the required parameter 'template_id' is set
  if @api_client.config.client_side_validation && template_id.nil?
    fail ArgumentError, "Missing the required parameter 'template_id' when calling TemplatesApi.clone_template"
  end
  # verify the required parameter 'name' is set
  if @api_client.config.client_side_validation && name.nil?
    fail ArgumentError, "Missing the required parameter 'name' when calling TemplatesApi.clone_template"
  end
  # resource path
  local_var_path = '/v1/email-template/{template_id}/clone'.sub('{' + 'template_id' + '}', CGI.escape(template_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['name'] = name

  # http body (model)
  post_body = opts[:body]

  # return_type
  return_type = opts[:debug_return_type] || 'Template'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"TemplatesApi.clone_template",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TemplatesApi#clone_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_template(name, html, opts = {}) ⇒ Template

Create New Template Creates a new email template.

Parameters:

  • name (String)

    The name of the email template.

  • html (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



103
104
105
106
# File 'lib/klaviyo_sdk/api/templates_api.rb', line 103

def create_template(name, html, opts = {})
  data, _status_code, _headers = create_template_with_http_info(name, html, opts)
  data
end

#create_template_with_http_info(name, html, opts = {}) ⇒ Array<(Template, Integer, Hash)>

Create New Template Creates a new email template.

Parameters:

  • name (String)

    The name of the email template.

  • html (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Template, Integer, Hash)>)

    Template data, response status code and response headers



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/klaviyo_sdk/api/templates_api.rb', line 114

def create_template_with_http_info(name, html, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TemplatesApi.create_template ...'
  end
  # verify the required parameter 'name' is set
  if @api_client.config.client_side_validation && name.nil?
    fail ArgumentError, "Missing the required parameter 'name' when calling TemplatesApi.create_template"
  end
  # verify the required parameter 'html' is set
  if @api_client.config.client_side_validation && html.nil?
    fail ArgumentError, "Missing the required parameter 'html' when calling TemplatesApi.create_template"
  end
  # resource path
  local_var_path = '/v1/email-templates'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['name'] = name
  form_params['html'] = html

  # http body (model)
  post_body = opts[:body]

  # return_type
  return_type = opts[:debug_return_type] || 'Template'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"TemplatesApi.create_template",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TemplatesApi#create_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_template(template_id, opts = {}) ⇒ Hash<String, Object>

Delete Template Deletes a given template.

Parameters:

  • template_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Hash<String, Object>)


178
179
180
181
# File 'lib/klaviyo_sdk/api/templates_api.rb', line 178

def delete_template(template_id, opts = {})
  data, _status_code, _headers = delete_template_with_http_info(template_id, opts)
  data
end

#delete_template_with_http_info(template_id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>

Delete Template Deletes a given template.

Parameters:

  • template_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/klaviyo_sdk/api/templates_api.rb', line 188

def delete_template_with_http_info(template_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TemplatesApi.delete_template ...'
  end
  # verify the required parameter 'template_id' is set
  if @api_client.config.client_side_validation && template_id.nil?
    fail ArgumentError, "Missing the required parameter 'template_id' when calling TemplatesApi.delete_template"
  end
  # resource path
  local_var_path = '/v1/email-template/{template_id}'.sub('{' + 'template_id' + '}', CGI.escape(template_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body]

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"TemplatesApi.delete_template",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TemplatesApi#delete_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_templates(opts = {}) ⇒ Hash<String, Object>

Get All Templates Returns a list of all the email templates you’ve created. The templates are returned in sorted order by ‘name`.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    For pagination, which page of results to return. Default &#x3D; 0 (default to 0)

  • :count (Integer)

    For pagination, the number of results to return. Max &#x3D; 100 (default to 50)

Returns:

  • (Hash<String, Object>)


242
243
244
245
# File 'lib/klaviyo_sdk/api/templates_api.rb', line 242

def get_templates(opts = {})
  data, _status_code, _headers = get_templates_with_http_info(opts)
  data
end

#get_templates_with_http_info(opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>

Get All Templates Returns a list of all the email templates you&#39;ve created. The templates are returned in sorted order by &#x60;name&#x60;.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    For pagination, which page of results to return. Default &#x3D; 0

  • :count (Integer)

    For pagination, the number of results to return. Max &#x3D; 100

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
# File 'lib/klaviyo_sdk/api/templates_api.rb', line 253

def get_templates_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TemplatesApi.get_templates ...'
  end
  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 0
    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling TemplatesApi.get_templates, must be greater than or equal to 0.'
  end

  if @api_client.config.client_side_validation && !opts[:'count'].nil? && opts[:'count'] > 100
    fail ArgumentError, 'invalid value for "opts[:"count"]" when calling TemplatesApi.get_templates, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'count'].nil? && opts[:'count'] < 1
    fail ArgumentError, 'invalid value for "opts[:"count"]" when calling TemplatesApi.get_templates, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/email-templates'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body]

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"TemplatesApi.get_templates",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TemplatesApi#get_templates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#render_template(template_id, opts = {}) ⇒ RenderedTemplate

Render Template Renders the specified template with the provided data and return HTML and text versions of the email.

Parameters:

  • template_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :context (String)

    This is the context your email template will be rendered with. Email templates are rendered with contexts in a similar manner to how Django templates are rendered. This means that nested template variables can be referenced via dot notation and template variables without corresponding context values are treated as falsy and output nothing. (default to ‘{ "name" : "George Washington", "state" : "VA" }’)

Returns:



317
318
319
320
# File 'lib/klaviyo_sdk/api/templates_api.rb', line 317

def render_template(template_id, opts = {})
  data, _status_code, _headers = render_template_with_http_info(template_id, opts)
  data
end

#render_template_with_http_info(template_id, opts = {}) ⇒ Array<(RenderedTemplate, Integer, Hash)>

Render Template Renders the specified template with the provided data and return HTML and text versions of the email.

Parameters:

  • template_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :context (String)

    This is the context your email template will be rendered with. Email templates are rendered with contexts in a similar manner to how Django templates are rendered. This means that nested template variables can be referenced via dot notation and template variables without corresponding context values are treated as falsy and output nothing.

Returns:

  • (Array<(RenderedTemplate, Integer, Hash)>)

    RenderedTemplate data, response status code and response headers



328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
# File 'lib/klaviyo_sdk/api/templates_api.rb', line 328

def render_template_with_http_info(template_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TemplatesApi.render_template ...'
  end
  # verify the required parameter 'template_id' is set
  if @api_client.config.client_side_validation && template_id.nil?
    fail ArgumentError, "Missing the required parameter 'template_id' when calling TemplatesApi.render_template"
  end
  # resource path
  local_var_path = '/v1/email-template/{template_id}/render'.sub('{' + 'template_id' + '}', CGI.escape(template_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['context'] = opts[:'context'] if !opts[:'context'].nil?

  # http body (model)
  post_body = opts[:body]

  # return_type
  return_type = opts[:debug_return_type] || 'RenderedTemplate'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"TemplatesApi.render_template",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TemplatesApi#render_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_template(template_id, from_email, from_name, subject, to, opts = {}) ⇒ RenderedTemplate

Render and Send Template Renders the specified template with the provided data and send the contents in an email via the service specified. This API is intended to test templates only, and is rate limited to the following thresholds: 100/hour, 1,000/day.

Parameters:

  • template_id (String)
  • from_email (String)
  • from_name (String)
  • subject (String)
  • to (String)

    Mixed. string, or JSON encoded array of objects with \&quot;email\&quot; and \&quot;name\&quot; keys. &#x60;[email protected]&#x60; OR &#x60;[Lincoln\&quot;,\&quot;email\&quot;:\&quot;[email protected]\&quot;]&#x60;

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :context (String)

    Optional, JSON object. This is the context your email template will be rendered with. Email templates are rendered with contexts in a similar manner to how Django templates are rendered. This means that nested template variables can be referenced via dot notation and template variables without corresponding context values are treated as falsy and output nothing. ex: &#x60;{ \&quot;name\&quot; : \&quot;George Washington\&quot;, \&quot;state\&quot; : \&quot;VA\&quot; }&#x60; (default to ‘{ "name" : "George Washington", "state" : "VA" }’)

Returns:



392
393
394
395
# File 'lib/klaviyo_sdk/api/templates_api.rb', line 392

def send_template(template_id, from_email, from_name, subject, to, opts = {})
  data, _status_code, _headers = send_template_with_http_info(template_id, from_email, from_name, subject, to, opts)
  data
end

#send_template_with_http_info(template_id, from_email, from_name, subject, to, opts = {}) ⇒ Array<(RenderedTemplate, Integer, Hash)>

Render and Send Template Renders the specified template with the provided data and send the contents in an email via the service specified. This API is intended to test templates only, and is rate limited to the following thresholds: 100/hour, 1,000/day.

Parameters:

  • template_id (String)
  • from_email (String)
  • from_name (String)
  • subject (String)
  • to (String)

    Mixed. string, or JSON encoded array of objects with \&quot;email\&quot; and \&quot;name\&quot; keys. &#x60;[email protected]&#x60; OR &#x60;[Lincoln\&quot;,\&quot;email\&quot;:\&quot;[email protected]\&quot;]&#x60;

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :context (String)

    Optional, JSON object. This is the context your email template will be rendered with. Email templates are rendered with contexts in a similar manner to how Django templates are rendered. This means that nested template variables can be referenced via dot notation and template variables without corresponding context values are treated as falsy and output nothing. ex: &#x60;{ \&quot;name\&quot; : \&quot;George Washington\&quot;, \&quot;state\&quot; : \&quot;VA\&quot; }&#x60;

Returns:

  • (Array<(RenderedTemplate, Integer, Hash)>)

    RenderedTemplate data, response status code and response headers



407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
# File 'lib/klaviyo_sdk/api/templates_api.rb', line 407

def send_template_with_http_info(template_id, from_email, from_name, subject, to, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TemplatesApi.send_template ...'
  end
  # verify the required parameter 'template_id' is set
  if @api_client.config.client_side_validation && template_id.nil?
    fail ArgumentError, "Missing the required parameter 'template_id' when calling TemplatesApi.send_template"
  end
  # verify the required parameter 'from_email' is set
  if @api_client.config.client_side_validation && from_email.nil?
    fail ArgumentError, "Missing the required parameter 'from_email' when calling TemplatesApi.send_template"
  end
  # verify the required parameter 'from_name' is set
  if @api_client.config.client_side_validation && from_name.nil?
    fail ArgumentError, "Missing the required parameter 'from_name' when calling TemplatesApi.send_template"
  end
  # verify the required parameter 'subject' is set
  if @api_client.config.client_side_validation && subject.nil?
    fail ArgumentError, "Missing the required parameter 'subject' when calling TemplatesApi.send_template"
  end
  # verify the required parameter 'to' is set
  if @api_client.config.client_side_validation && to.nil?
    fail ArgumentError, "Missing the required parameter 'to' when calling TemplatesApi.send_template"
  end
  # resource path
  local_var_path = '/v1/email-template/{template_id}/send'.sub('{' + 'template_id' + '}', CGI.escape(template_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['from_email'] = from_email
  form_params['from_name'] = from_name
  form_params['subject'] = subject
  form_params['to'] = to
  form_params['context'] = opts[:'context'] if !opts[:'context'].nil?

  # http body (model)
  post_body = opts[:body]

  # return_type
  return_type = opts[:debug_return_type] || 'RenderedTemplate'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"TemplatesApi.send_template",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TemplatesApi#send_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_template(template_id, opts = {}) ⇒ Template

Update Template Updates the name and/or HTML content of a template. Only updates imported HTML templates; does not currently update drag & drop templates.

Parameters:

  • template_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :name (String)

    The new name of the email template.

  • :html (String)

    The new HTML content for this template.

Returns:



488
489
490
491
# File 'lib/klaviyo_sdk/api/templates_api.rb', line 488

def update_template(template_id, opts = {})
  data, _status_code, _headers = update_template_with_http_info(template_id, opts)
  data
end

#update_template_with_http_info(template_id, opts = {}) ⇒ Array<(Template, Integer, Hash)>

Update Template Updates the name and/or HTML content of a template. Only updates imported HTML templates; does not currently update drag &amp; drop templates.

Parameters:

  • template_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :name (String)

    The new name of the email template.

  • :html (String)

    The new HTML content for this template.

Returns:

  • (Array<(Template, Integer, Hash)>)

    Template data, response status code and response headers



500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
# File 'lib/klaviyo_sdk/api/templates_api.rb', line 500

def update_template_with_http_info(template_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TemplatesApi.update_template ...'
  end
  # verify the required parameter 'template_id' is set
  if @api_client.config.client_side_validation && template_id.nil?
    fail ArgumentError, "Missing the required parameter 'template_id' when calling TemplatesApi.update_template"
  end
  # resource path
  local_var_path = '/v1/email-template/{template_id}'.sub('{' + 'template_id' + '}', CGI.escape(template_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['name'] = opts[:'name'] if !opts[:'name'].nil?
  form_params['html'] = opts[:'html'] if !opts[:'html'].nil?

  # http body (model)
  post_body = opts[:body]

  # return_type
  return_type = opts[:debug_return_type] || 'Template'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"TemplatesApi.update_template",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TemplatesApi#update_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end