klaviyo_sdk 1.0.0.20220329 → 1.0.1.20220329
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +10 -0
- data/README.md +3 -3
- data/Rakefile +10 -0
- data/docs/Campaign.md +38 -0
- data/docs/CampaignsApi.md +707 -0
- data/docs/CheckMembershipRequest.md +22 -0
- data/docs/DataPrivacyApi.md +81 -0
- data/docs/DeleteEmail.md +18 -0
- data/docs/DeletePerson.md +18 -0
- data/docs/DeletePhone.md +18 -0
- data/docs/DeprecatedGetListResponse.md +30 -0
- data/docs/DeprecatedGetListResponseData.md +28 -0
- data/docs/GlobalExclusionResponseData.md +30 -0
- data/docs/IdentifyPayload.md +20 -0
- data/docs/IdentifyPayloadProperties.md +42 -0
- data/docs/InlineObject.md +18 -0
- data/docs/InlineObject3.md +18 -0
- data/docs/InlineObject4.md +18 -0
- data/docs/InlineObject5.md +22 -0
- data/docs/ListsSegmentsApi.md +1198 -0
- data/docs/Metric.md +28 -0
- data/docs/MetricExport.md +32 -0
- data/docs/MetricTimeline.md +24 -0
- data/docs/MetricTimelineData.md +34 -0
- data/docs/MetricsApi.md +329 -0
- data/docs/Person.md +56 -0
- data/docs/PrivacyEmail.md +18 -0
- data/docs/PrivacyId.md +18 -0
- data/docs/PrivacyPhone.md +18 -0
- data/docs/ProfilesApi.md +391 -0
- data/docs/RenderedTemplate.md +24 -0
- data/docs/Template.md +30 -0
- data/docs/TemplatesApi.md +541 -0
- data/docs/TrackIdentifyApi.md +267 -0
- data/docs/TrackPayload.md +24 -0
- data/docs/TrackPayloadCustomerProperties.md +20 -0
- data/docs/TrackPayloadProperties.md +22 -0
- data/git_push.sh +57 -0
- data/klaviyo_sdk-1.0.0.20220329.gem +0 -0
- data/klaviyo_sdk.gemspec +6 -1
- data/lib/klaviyo_sdk/api_client.rb +1 -1
- data/spec/api/campaigns_api_spec.rb +165 -0
- data/spec/api/data_privacy_api_spec.rb +47 -0
- data/spec/api/lists_segments_api_spec.rb +239 -0
- data/spec/api/metrics_api_spec.rb +96 -0
- data/spec/api/profiles_api_spec.rb +103 -0
- data/spec/api/templates_api_spec.rb +130 -0
- data/spec/api/track_identify_api_spec.rb +83 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/campaign_spec.rb +94 -0
- data/spec/models/check_membership_request_spec.rb +46 -0
- data/spec/models/delete_email_spec.rb +34 -0
- data/spec/models/delete_person_spec.rb +34 -0
- data/spec/models/delete_phone_spec.rb +34 -0
- data/spec/models/deprecated_get_list_response_data_spec.rb +64 -0
- data/spec/models/deprecated_get_list_response_spec.rb +70 -0
- data/spec/models/global_exclusion_response_data_spec.rb +70 -0
- data/spec/models/identify_payload_properties_spec.rb +106 -0
- data/spec/models/identify_payload_spec.rb +40 -0
- data/spec/models/inline_object3_spec.rb +34 -0
- data/spec/models/inline_object4_spec.rb +34 -0
- data/spec/models/inline_object5_spec.rb +46 -0
- data/spec/models/inline_object_spec.rb +34 -0
- data/spec/models/metric_export_spec.rb +76 -0
- data/spec/models/metric_spec.rb +64 -0
- data/spec/models/metric_timeline_data_spec.rb +82 -0
- data/spec/models/metric_timeline_spec.rb +52 -0
- data/spec/models/person_spec.rb +148 -0
- data/spec/models/privacy_email_spec.rb +34 -0
- data/spec/models/privacy_id_spec.rb +34 -0
- data/spec/models/privacy_phone_spec.rb +34 -0
- data/spec/models/rendered_template_spec.rb +52 -0
- data/spec/models/template_spec.rb +70 -0
- data/spec/models/track_payload_customer_properties_spec.rb +40 -0
- data/spec/models/track_payload_properties_spec.rb +46 -0
- data/spec/models/track_payload_spec.rb +52 -0
- data/spec/spec_helper.rb +111 -0
- metadata +79 -2
@@ -0,0 +1,541 @@
|
|
1
|
+
# Client::TemplatesApi
|
2
|
+
|
3
|
+
All URIs are relative to *https://a.klaviyo.com/api*
|
4
|
+
|
5
|
+
| Method | HTTP request | Description |
|
6
|
+
| ------ | ------------ | ----------- |
|
7
|
+
| [**clone_template**](TemplatesApi.md#clone_template) | **POST** /v1/email-template/{template_id}/clone | Clone Template |
|
8
|
+
| [**create_template**](TemplatesApi.md#create_template) | **POST** /v1/email-templates | Create New Template |
|
9
|
+
| [**delete_template**](TemplatesApi.md#delete_template) | **DELETE** /v1/email-template/{template_id} | Delete Template |
|
10
|
+
| [**get_templates**](TemplatesApi.md#get_templates) | **GET** /v1/email-templates | Get All Templates |
|
11
|
+
| [**render_template**](TemplatesApi.md#render_template) | **POST** /v1/email-template/{template_id}/render | Render Template |
|
12
|
+
| [**send_template**](TemplatesApi.md#send_template) | **POST** /v1/email-template/{template_id}/send | Render and Send Template |
|
13
|
+
| [**update_template**](TemplatesApi.md#update_template) | **PUT** /v1/email-template/{template_id} | Update Template |
|
14
|
+
|
15
|
+
|
16
|
+
## clone_template
|
17
|
+
|
18
|
+
> <Template> clone_template(template_id, name)
|
19
|
+
|
20
|
+
Clone Template
|
21
|
+
|
22
|
+
Creates a copy of a given template with a new name.
|
23
|
+
|
24
|
+
### Examples
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
require 'time'
|
28
|
+
require 'klaviyo_sdk'
|
29
|
+
# setup authorization
|
30
|
+
Client.configure do |config|
|
31
|
+
# Configure API key authorization: ApiKeyAuth
|
32
|
+
config.api_key['ApiKeyAuth'] = 'YOUR API KEY'
|
33
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
34
|
+
# config.api_key_prefix['ApiKeyAuth'] = 'Bearer'
|
35
|
+
end
|
36
|
+
|
37
|
+
api_instance = Client::TemplatesApi.new
|
38
|
+
template_id = 'TEMPLATE_ID' # String |
|
39
|
+
name = 'name_example' # String | The new name of the email template.
|
40
|
+
|
41
|
+
begin
|
42
|
+
# Clone Template
|
43
|
+
result = api_instance.clone_template(template_id, name)
|
44
|
+
p result
|
45
|
+
rescue Client::ApiError => e
|
46
|
+
puts "Error when calling TemplatesApi->clone_template: #{e}"
|
47
|
+
end
|
48
|
+
```
|
49
|
+
|
50
|
+
#### Using the clone_template_with_http_info variant
|
51
|
+
|
52
|
+
This returns an Array which contains the response data, status code and headers.
|
53
|
+
|
54
|
+
> <Array(<Template>, Integer, Hash)> clone_template_with_http_info(template_id, name)
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
begin
|
58
|
+
# Clone Template
|
59
|
+
data, status_code, headers = api_instance.clone_template_with_http_info(template_id, name)
|
60
|
+
p status_code # => 2xx
|
61
|
+
p headers # => { ... }
|
62
|
+
p data # => <Template>
|
63
|
+
rescue Client::ApiError => e
|
64
|
+
puts "Error when calling TemplatesApi->clone_template_with_http_info: #{e}"
|
65
|
+
end
|
66
|
+
```
|
67
|
+
|
68
|
+
### Parameters
|
69
|
+
|
70
|
+
| Name | Type | Description | Notes |
|
71
|
+
| ---- | ---- | ----------- | ----- |
|
72
|
+
| **template_id** | **String** | | [default to 'TEMPLATE_ID'] |
|
73
|
+
| **name** | **String** | The new name of the email template. | [default to 'My Cloned Template'] |
|
74
|
+
|
75
|
+
### Return type
|
76
|
+
|
77
|
+
[**Template**](Template.md)
|
78
|
+
|
79
|
+
### Authorization
|
80
|
+
|
81
|
+
[ApiKeyAuth](../README.md#ApiKeyAuth)
|
82
|
+
|
83
|
+
### HTTP request headers
|
84
|
+
|
85
|
+
- **Content-Type**: application/x-www-form-urlencoded
|
86
|
+
- **Accept**: application/json
|
87
|
+
|
88
|
+
|
89
|
+
## create_template
|
90
|
+
|
91
|
+
> <Template> create_template(name, html)
|
92
|
+
|
93
|
+
Create New Template
|
94
|
+
|
95
|
+
Creates a new email template.
|
96
|
+
|
97
|
+
### Examples
|
98
|
+
|
99
|
+
```ruby
|
100
|
+
require 'time'
|
101
|
+
require 'klaviyo_sdk'
|
102
|
+
# setup authorization
|
103
|
+
Client.configure do |config|
|
104
|
+
# Configure API key authorization: ApiKeyAuth
|
105
|
+
config.api_key['ApiKeyAuth'] = 'YOUR API KEY'
|
106
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
107
|
+
# config.api_key_prefix['ApiKeyAuth'] = 'Bearer'
|
108
|
+
end
|
109
|
+
|
110
|
+
api_instance = Client::TemplatesApi.new
|
111
|
+
name = 'name_example' # String | The name of the email template.
|
112
|
+
html = 'html_example' # String |
|
113
|
+
|
114
|
+
begin
|
115
|
+
# Create New Template
|
116
|
+
result = api_instance.create_template(name, html)
|
117
|
+
p result
|
118
|
+
rescue Client::ApiError => e
|
119
|
+
puts "Error when calling TemplatesApi->create_template: #{e}"
|
120
|
+
end
|
121
|
+
```
|
122
|
+
|
123
|
+
#### Using the create_template_with_http_info variant
|
124
|
+
|
125
|
+
This returns an Array which contains the response data, status code and headers.
|
126
|
+
|
127
|
+
> <Array(<Template>, Integer, Hash)> create_template_with_http_info(name, html)
|
128
|
+
|
129
|
+
```ruby
|
130
|
+
begin
|
131
|
+
# Create New Template
|
132
|
+
data, status_code, headers = api_instance.create_template_with_http_info(name, html)
|
133
|
+
p status_code # => 2xx
|
134
|
+
p headers # => { ... }
|
135
|
+
p data # => <Template>
|
136
|
+
rescue Client::ApiError => e
|
137
|
+
puts "Error when calling TemplatesApi->create_template_with_http_info: #{e}"
|
138
|
+
end
|
139
|
+
```
|
140
|
+
|
141
|
+
### Parameters
|
142
|
+
|
143
|
+
| Name | Type | Description | Notes |
|
144
|
+
| ---- | ---- | ----------- | ----- |
|
145
|
+
| **name** | **String** | The name of the email template. | [default to 'New Template Name'] |
|
146
|
+
| **html** | **String** | | [default to '<html><body><p>This is an email for {{ email }}.</p></body></html>'] |
|
147
|
+
|
148
|
+
### Return type
|
149
|
+
|
150
|
+
[**Template**](Template.md)
|
151
|
+
|
152
|
+
### Authorization
|
153
|
+
|
154
|
+
[ApiKeyAuth](../README.md#ApiKeyAuth)
|
155
|
+
|
156
|
+
### HTTP request headers
|
157
|
+
|
158
|
+
- **Content-Type**: application/x-www-form-urlencoded
|
159
|
+
- **Accept**: application/json
|
160
|
+
|
161
|
+
|
162
|
+
## delete_template
|
163
|
+
|
164
|
+
> Hash<String, Object> delete_template(template_id)
|
165
|
+
|
166
|
+
Delete Template
|
167
|
+
|
168
|
+
Deletes a given template.
|
169
|
+
|
170
|
+
### Examples
|
171
|
+
|
172
|
+
```ruby
|
173
|
+
require 'time'
|
174
|
+
require 'klaviyo_sdk'
|
175
|
+
# setup authorization
|
176
|
+
Client.configure do |config|
|
177
|
+
# Configure API key authorization: ApiKeyAuth
|
178
|
+
config.api_key['ApiKeyAuth'] = 'YOUR API KEY'
|
179
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
180
|
+
# config.api_key_prefix['ApiKeyAuth'] = 'Bearer'
|
181
|
+
end
|
182
|
+
|
183
|
+
api_instance = Client::TemplatesApi.new
|
184
|
+
template_id = 'TEMPLATE_ID' # String |
|
185
|
+
|
186
|
+
begin
|
187
|
+
# Delete Template
|
188
|
+
result = api_instance.delete_template(template_id)
|
189
|
+
p result
|
190
|
+
rescue Client::ApiError => e
|
191
|
+
puts "Error when calling TemplatesApi->delete_template: #{e}"
|
192
|
+
end
|
193
|
+
```
|
194
|
+
|
195
|
+
#### Using the delete_template_with_http_info variant
|
196
|
+
|
197
|
+
This returns an Array which contains the response data, status code and headers.
|
198
|
+
|
199
|
+
> <Array(Hash<String, Object>, Integer, Hash)> delete_template_with_http_info(template_id)
|
200
|
+
|
201
|
+
```ruby
|
202
|
+
begin
|
203
|
+
# Delete Template
|
204
|
+
data, status_code, headers = api_instance.delete_template_with_http_info(template_id)
|
205
|
+
p status_code # => 2xx
|
206
|
+
p headers # => { ... }
|
207
|
+
p data # => Hash<String, Object>
|
208
|
+
rescue Client::ApiError => e
|
209
|
+
puts "Error when calling TemplatesApi->delete_template_with_http_info: #{e}"
|
210
|
+
end
|
211
|
+
```
|
212
|
+
|
213
|
+
### Parameters
|
214
|
+
|
215
|
+
| Name | Type | Description | Notes |
|
216
|
+
| ---- | ---- | ----------- | ----- |
|
217
|
+
| **template_id** | **String** | | [default to 'TEMPLATE_ID'] |
|
218
|
+
|
219
|
+
### Return type
|
220
|
+
|
221
|
+
**Hash<String, Object>**
|
222
|
+
|
223
|
+
### Authorization
|
224
|
+
|
225
|
+
[ApiKeyAuth](../README.md#ApiKeyAuth)
|
226
|
+
|
227
|
+
### HTTP request headers
|
228
|
+
|
229
|
+
- **Content-Type**: Not defined
|
230
|
+
- **Accept**: application/json
|
231
|
+
|
232
|
+
|
233
|
+
## get_templates
|
234
|
+
|
235
|
+
> Hash<String, Object> get_templates(opts)
|
236
|
+
|
237
|
+
Get All Templates
|
238
|
+
|
239
|
+
Returns a list of all the email templates you've created. The templates are returned in sorted order by `name`.
|
240
|
+
|
241
|
+
### Examples
|
242
|
+
|
243
|
+
```ruby
|
244
|
+
require 'time'
|
245
|
+
require 'klaviyo_sdk'
|
246
|
+
# setup authorization
|
247
|
+
Client.configure do |config|
|
248
|
+
# Configure API key authorization: ApiKeyAuth
|
249
|
+
config.api_key['ApiKeyAuth'] = 'YOUR API KEY'
|
250
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
251
|
+
# config.api_key_prefix['ApiKeyAuth'] = 'Bearer'
|
252
|
+
end
|
253
|
+
|
254
|
+
api_instance = Client::TemplatesApi.new
|
255
|
+
opts = {
|
256
|
+
page: 0, # Integer | For pagination, which page of results to return. Default = 0
|
257
|
+
count: 100 # Integer | For pagination, the number of results to return. Max = 100
|
258
|
+
}
|
259
|
+
|
260
|
+
begin
|
261
|
+
# Get All Templates
|
262
|
+
result = api_instance.get_templates(opts)
|
263
|
+
p result
|
264
|
+
rescue Client::ApiError => e
|
265
|
+
puts "Error when calling TemplatesApi->get_templates: #{e}"
|
266
|
+
end
|
267
|
+
```
|
268
|
+
|
269
|
+
#### Using the get_templates_with_http_info variant
|
270
|
+
|
271
|
+
This returns an Array which contains the response data, status code and headers.
|
272
|
+
|
273
|
+
> <Array(Hash<String, Object>, Integer, Hash)> get_templates_with_http_info(opts)
|
274
|
+
|
275
|
+
```ruby
|
276
|
+
begin
|
277
|
+
# Get All Templates
|
278
|
+
data, status_code, headers = api_instance.get_templates_with_http_info(opts)
|
279
|
+
p status_code # => 2xx
|
280
|
+
p headers # => { ... }
|
281
|
+
p data # => Hash<String, Object>
|
282
|
+
rescue Client::ApiError => e
|
283
|
+
puts "Error when calling TemplatesApi->get_templates_with_http_info: #{e}"
|
284
|
+
end
|
285
|
+
```
|
286
|
+
|
287
|
+
### Parameters
|
288
|
+
|
289
|
+
| Name | Type | Description | Notes |
|
290
|
+
| ---- | ---- | ----------- | ----- |
|
291
|
+
| **page** | **Integer** | For pagination, which page of results to return. Default = 0 | [optional][default to 0] |
|
292
|
+
| **count** | **Integer** | For pagination, the number of results to return. Max = 100 | [optional][default to 50] |
|
293
|
+
|
294
|
+
### Return type
|
295
|
+
|
296
|
+
**Hash<String, Object>**
|
297
|
+
|
298
|
+
### Authorization
|
299
|
+
|
300
|
+
[ApiKeyAuth](../README.md#ApiKeyAuth)
|
301
|
+
|
302
|
+
### HTTP request headers
|
303
|
+
|
304
|
+
- **Content-Type**: Not defined
|
305
|
+
- **Accept**: application/json
|
306
|
+
|
307
|
+
|
308
|
+
## render_template
|
309
|
+
|
310
|
+
> <RenderedTemplate> render_template(template_id, opts)
|
311
|
+
|
312
|
+
Render Template
|
313
|
+
|
314
|
+
Renders the specified template with the provided data and return HTML and text versions of the email.
|
315
|
+
|
316
|
+
### Examples
|
317
|
+
|
318
|
+
```ruby
|
319
|
+
require 'time'
|
320
|
+
require 'klaviyo_sdk'
|
321
|
+
# setup authorization
|
322
|
+
Client.configure do |config|
|
323
|
+
# Configure API key authorization: ApiKeyAuth
|
324
|
+
config.api_key['ApiKeyAuth'] = 'YOUR API KEY'
|
325
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
326
|
+
# config.api_key_prefix['ApiKeyAuth'] = 'Bearer'
|
327
|
+
end
|
328
|
+
|
329
|
+
api_instance = Client::TemplatesApi.new
|
330
|
+
template_id = 'TEMPLATE_ID' # String |
|
331
|
+
opts = {
|
332
|
+
context: 'context_example' # 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.
|
333
|
+
}
|
334
|
+
|
335
|
+
begin
|
336
|
+
# Render Template
|
337
|
+
result = api_instance.render_template(template_id, opts)
|
338
|
+
p result
|
339
|
+
rescue Client::ApiError => e
|
340
|
+
puts "Error when calling TemplatesApi->render_template: #{e}"
|
341
|
+
end
|
342
|
+
```
|
343
|
+
|
344
|
+
#### Using the render_template_with_http_info variant
|
345
|
+
|
346
|
+
This returns an Array which contains the response data, status code and headers.
|
347
|
+
|
348
|
+
> <Array(<RenderedTemplate>, Integer, Hash)> render_template_with_http_info(template_id, opts)
|
349
|
+
|
350
|
+
```ruby
|
351
|
+
begin
|
352
|
+
# Render Template
|
353
|
+
data, status_code, headers = api_instance.render_template_with_http_info(template_id, opts)
|
354
|
+
p status_code # => 2xx
|
355
|
+
p headers # => { ... }
|
356
|
+
p data # => <RenderedTemplate>
|
357
|
+
rescue Client::ApiError => e
|
358
|
+
puts "Error when calling TemplatesApi->render_template_with_http_info: #{e}"
|
359
|
+
end
|
360
|
+
```
|
361
|
+
|
362
|
+
### Parameters
|
363
|
+
|
364
|
+
| Name | Type | Description | Notes |
|
365
|
+
| ---- | ---- | ----------- | ----- |
|
366
|
+
| **template_id** | **String** | | [default to 'TEMPLATE_ID'] |
|
367
|
+
| **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. | [optional][default to '{ \"name\" : \"George Washington\", \"state\" : \"VA\" }'] |
|
368
|
+
|
369
|
+
### Return type
|
370
|
+
|
371
|
+
[**RenderedTemplate**](RenderedTemplate.md)
|
372
|
+
|
373
|
+
### Authorization
|
374
|
+
|
375
|
+
[ApiKeyAuth](../README.md#ApiKeyAuth)
|
376
|
+
|
377
|
+
### HTTP request headers
|
378
|
+
|
379
|
+
- **Content-Type**: application/x-www-form-urlencoded
|
380
|
+
- **Accept**: application/json
|
381
|
+
|
382
|
+
|
383
|
+
## send_template
|
384
|
+
|
385
|
+
> <RenderedTemplate> send_template(template_id, from_email, from_name, subject, to, opts)
|
386
|
+
|
387
|
+
Render and Send Template
|
388
|
+
|
389
|
+
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.
|
390
|
+
|
391
|
+
### Examples
|
392
|
+
|
393
|
+
```ruby
|
394
|
+
require 'time'
|
395
|
+
require 'klaviyo_sdk'
|
396
|
+
# setup authorization
|
397
|
+
Client.configure do |config|
|
398
|
+
# Configure API key authorization: ApiKeyAuth
|
399
|
+
config.api_key['ApiKeyAuth'] = 'YOUR API KEY'
|
400
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
401
|
+
# config.api_key_prefix['ApiKeyAuth'] = 'Bearer'
|
402
|
+
end
|
403
|
+
|
404
|
+
api_instance = Client::TemplatesApi.new
|
405
|
+
template_id = 'TEMPLATE_ID' # String |
|
406
|
+
from_email = 'from_email_example' # String |
|
407
|
+
from_name = 'from_name_example' # String |
|
408
|
+
subject = 'subject_example' # String |
|
409
|
+
to = 'to_example' # String | **Mixed**. string, or JSON encoded array of objects with \\\"email\\\" and \\\"name\\\" keys. `abraham.lincoln@klaviyo.com` OR `[{\\\"name\\\":\\\"Abraham Lincoln\\\",\\\"email\\\":\\\"abraham.lincoln@klaviyo.com\\\"}]`
|
410
|
+
opts = {
|
411
|
+
context: 'context_example' # 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: `{ \\\"name\\\" : \\\"George Washington\\\", \\\"state\\\" : \\\"VA\\\" }`
|
412
|
+
}
|
413
|
+
|
414
|
+
begin
|
415
|
+
# Render and Send Template
|
416
|
+
result = api_instance.send_template(template_id, from_email, from_name, subject, to, opts)
|
417
|
+
p result
|
418
|
+
rescue Client::ApiError => e
|
419
|
+
puts "Error when calling TemplatesApi->send_template: #{e}"
|
420
|
+
end
|
421
|
+
```
|
422
|
+
|
423
|
+
#### Using the send_template_with_http_info variant
|
424
|
+
|
425
|
+
This returns an Array which contains the response data, status code and headers.
|
426
|
+
|
427
|
+
> <Array(<RenderedTemplate>, Integer, Hash)> send_template_with_http_info(template_id, from_email, from_name, subject, to, opts)
|
428
|
+
|
429
|
+
```ruby
|
430
|
+
begin
|
431
|
+
# Render and Send Template
|
432
|
+
data, status_code, headers = api_instance.send_template_with_http_info(template_id, from_email, from_name, subject, to, opts)
|
433
|
+
p status_code # => 2xx
|
434
|
+
p headers # => { ... }
|
435
|
+
p data # => <RenderedTemplate>
|
436
|
+
rescue Client::ApiError => e
|
437
|
+
puts "Error when calling TemplatesApi->send_template_with_http_info: #{e}"
|
438
|
+
end
|
439
|
+
```
|
440
|
+
|
441
|
+
### Parameters
|
442
|
+
|
443
|
+
| Name | Type | Description | Notes |
|
444
|
+
| ---- | ---- | ----------- | ----- |
|
445
|
+
| **template_id** | **String** | | [default to 'TEMPLATE_ID'] |
|
446
|
+
| **from_email** | **String** | | [default to 'george.washington@klaviyo.com'] |
|
447
|
+
| **from_name** | **String** | | [default to 'George Washington'] |
|
448
|
+
| **subject** | **String** | | [default to 'Happy Fourth!'] |
|
449
|
+
| **to** | **String** | **Mixed**. string, or JSON encoded array of objects with \\\"email\\\" and \\\"name\\\" keys. `abraham.lincoln@klaviyo.com` OR `[{\\\"name\\\":\\\"Abraham Lincoln\\\",\\\"email\\\":\\\"abraham.lincoln@klaviyo.com\\\"}]` | [default to '[{\"name\":\"Abraham Lincoln\",\"email\":\"abraham.lincoln@klaviyo.com\"}]'] |
|
450
|
+
| **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: `{ \\\"name\\\" : \\\"George Washington\\\", \\\"state\\\" : \\\"VA\\\" }` | [optional][default to '{ \"name\" : \"George Washington\", \"state\" : \"VA\" }'] |
|
451
|
+
|
452
|
+
### Return type
|
453
|
+
|
454
|
+
[**RenderedTemplate**](RenderedTemplate.md)
|
455
|
+
|
456
|
+
### Authorization
|
457
|
+
|
458
|
+
[ApiKeyAuth](../README.md#ApiKeyAuth)
|
459
|
+
|
460
|
+
### HTTP request headers
|
461
|
+
|
462
|
+
- **Content-Type**: application/x-www-form-urlencoded
|
463
|
+
- **Accept**: application/json
|
464
|
+
|
465
|
+
|
466
|
+
## update_template
|
467
|
+
|
468
|
+
> <Template> update_template(template_id, opts)
|
469
|
+
|
470
|
+
Update Template
|
471
|
+
|
472
|
+
Updates the name and/or HTML content of a template. Only updates imported HTML templates; does not currently update drag & drop templates.
|
473
|
+
|
474
|
+
### Examples
|
475
|
+
|
476
|
+
```ruby
|
477
|
+
require 'time'
|
478
|
+
require 'klaviyo_sdk'
|
479
|
+
# setup authorization
|
480
|
+
Client.configure do |config|
|
481
|
+
# Configure API key authorization: ApiKeyAuth
|
482
|
+
config.api_key['ApiKeyAuth'] = 'YOUR API KEY'
|
483
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
484
|
+
# config.api_key_prefix['ApiKeyAuth'] = 'Bearer'
|
485
|
+
end
|
486
|
+
|
487
|
+
api_instance = Client::TemplatesApi.new
|
488
|
+
template_id = 'TEMPLATE_ID' # String |
|
489
|
+
opts = {
|
490
|
+
name: 'name_example', # String | The new name of the email template.
|
491
|
+
html: 'html_example' # String | The new HTML content for this template.
|
492
|
+
}
|
493
|
+
|
494
|
+
begin
|
495
|
+
# Update Template
|
496
|
+
result = api_instance.update_template(template_id, opts)
|
497
|
+
p result
|
498
|
+
rescue Client::ApiError => e
|
499
|
+
puts "Error when calling TemplatesApi->update_template: #{e}"
|
500
|
+
end
|
501
|
+
```
|
502
|
+
|
503
|
+
#### Using the update_template_with_http_info variant
|
504
|
+
|
505
|
+
This returns an Array which contains the response data, status code and headers.
|
506
|
+
|
507
|
+
> <Array(<Template>, Integer, Hash)> update_template_with_http_info(template_id, opts)
|
508
|
+
|
509
|
+
```ruby
|
510
|
+
begin
|
511
|
+
# Update Template
|
512
|
+
data, status_code, headers = api_instance.update_template_with_http_info(template_id, opts)
|
513
|
+
p status_code # => 2xx
|
514
|
+
p headers # => { ... }
|
515
|
+
p data # => <Template>
|
516
|
+
rescue Client::ApiError => e
|
517
|
+
puts "Error when calling TemplatesApi->update_template_with_http_info: #{e}"
|
518
|
+
end
|
519
|
+
```
|
520
|
+
|
521
|
+
### Parameters
|
522
|
+
|
523
|
+
| Name | Type | Description | Notes |
|
524
|
+
| ---- | ---- | ----------- | ----- |
|
525
|
+
| **template_id** | **String** | | [default to 'TEMPLATE_ID'] |
|
526
|
+
| **name** | **String** | The new name of the email template. | [optional] |
|
527
|
+
| **html** | **String** | The new HTML content for this template. | [optional] |
|
528
|
+
|
529
|
+
### Return type
|
530
|
+
|
531
|
+
[**Template**](Template.md)
|
532
|
+
|
533
|
+
### Authorization
|
534
|
+
|
535
|
+
[ApiKeyAuth](../README.md#ApiKeyAuth)
|
536
|
+
|
537
|
+
### HTTP request headers
|
538
|
+
|
539
|
+
- **Content-Type**: application/x-www-form-urlencoded
|
540
|
+
- **Accept**: application/json
|
541
|
+
|