klaviyo_sdk 1.0.0.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 +7 -0
- data/CHANGELOG.md +6 -0
- data/README.md +1121 -0
- data/klaviyo_sdk.gemspec +35 -0
- data/lib/klaviyo_sdk/api/campaigns_api.rb +717 -0
- data/lib/klaviyo_sdk/api/data_privacy_api.rb +86 -0
- data/lib/klaviyo_sdk/api/lists_segments_api.rb +1101 -0
- data/lib/klaviyo_sdk/api/metrics_api.rb +343 -0
- data/lib/klaviyo_sdk/api/profiles_api.rb +381 -0
- data/lib/klaviyo_sdk/api/templates_api.rb +555 -0
- data/lib/klaviyo_sdk/api/track_identify_api.rb +288 -0
- data/lib/klaviyo_sdk/api_client.rb +389 -0
- data/lib/klaviyo_sdk/api_error.rb +57 -0
- data/lib/klaviyo_sdk/configuration.rb +278 -0
- data/lib/klaviyo_sdk/models/campaign.rb +310 -0
- data/lib/klaviyo_sdk/models/check_membership_request.rb +244 -0
- data/lib/klaviyo_sdk/models/delete_email.rb +218 -0
- data/lib/klaviyo_sdk/models/delete_person.rb +218 -0
- data/lib/klaviyo_sdk/models/delete_phone.rb +219 -0
- data/lib/klaviyo_sdk/models/deprecated_get_list_response.rb +298 -0
- data/lib/klaviyo_sdk/models/deprecated_get_list_response_data.rb +263 -0
- data/lib/klaviyo_sdk/models/global_exclusion_response_data.rb +274 -0
- data/lib/klaviyo_sdk/models/identify_payload.rb +237 -0
- data/lib/klaviyo_sdk/models/identify_payload_properties.rb +327 -0
- data/lib/klaviyo_sdk/models/inline_object.rb +220 -0
- data/lib/klaviyo_sdk/models/inline_object3.rb +226 -0
- data/lib/klaviyo_sdk/models/inline_object4.rb +254 -0
- data/lib/klaviyo_sdk/models/inline_object5.rb +288 -0
- data/lib/klaviyo_sdk/models/metric.rb +265 -0
- data/lib/klaviyo_sdk/models/metric_export.rb +285 -0
- data/lib/klaviyo_sdk/models/metric_timeline.rb +271 -0
- data/lib/klaviyo_sdk/models/metric_timeline_data.rb +294 -0
- data/lib/klaviyo_sdk/models/person.rb +389 -0
- data/lib/klaviyo_sdk/models/person.rb.bak +389 -0
- data/lib/klaviyo_sdk/models/privacy_email.rb +218 -0
- data/lib/klaviyo_sdk/models/privacy_id.rb +218 -0
- data/lib/klaviyo_sdk/models/privacy_phone.rb +218 -0
- data/lib/klaviyo_sdk/models/rendered_template.rb +247 -0
- data/lib/klaviyo_sdk/models/template.rb +272 -0
- data/lib/klaviyo_sdk/models/track_payload.rb +261 -0
- data/lib/klaviyo_sdk/models/track_payload_customer_properties.rb +227 -0
- data/lib/klaviyo_sdk/models/track_payload_properties.rb +237 -0
- data/lib/klaviyo_sdk/version.rb +15 -0
- data/lib/klaviyo_sdk.rb +124 -0
- metadata +120 -0
@@ -0,0 +1,288 @@
|
|
1
|
+
=begin
|
2
|
+
#Klaviyo API
|
3
|
+
|
4
|
+
#Empowering creators to own their destiny
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 2022.03.29
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.4.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'cgi'
|
14
|
+
|
15
|
+
module Client
|
16
|
+
class TrackIdentifyApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Identify Profile (Legacy)
|
23
|
+
# This endpoint is also used to identify a profile and update its properties without an associated event. It takes as input the same payload as the above POST request, but as a base64-encoded string passed as a query parameter. NOTE: This is offered for backwards compatibility; we recommend all new implementations use the POST approach above. **EXAMPLE:** ``` { \"token\": \"PUBLIC_KEY\", \"properties\": { \"$email\": \"abraham.lincoln@klaviyo.com\", \"$first_name\": \"Abraham\", \"$last_name\": \"Lincoln\", \"$city\": \"Springfield\", \"$region\": \"Illinois\" } } ``` Gets encoded into the following string, which is passed into the `data` parameter: `eyJ0b2tlbiI6ICJQVUJMSUNfS0VZIiwicHJvcGVydGllcyI6IHsiJGVtYWlsIjogImFicmFoYW0ubGluY29sbkBrbGF2aXlvLmNvbSIsIiRmaXJzdF9uYW1lIjogIkFicmFoYW0iLCIkbGFzdF9uYW1lIjogIkxpbmNvbG4iLCIkY2l0eSI6ICJTcHJpbmdmaWVsZCIsIiRyZWdpb24iOiAiSWxsaW5vaXMifX0K`
|
24
|
+
# @param data [String] String representation of base64 encoded JSON object
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @return [String]
|
27
|
+
def identify_get(data, opts = {})
|
28
|
+
data, _status_code, _headers = identify_get_with_http_info(data, opts)
|
29
|
+
data
|
30
|
+
end
|
31
|
+
|
32
|
+
# Identify Profile (Legacy)
|
33
|
+
# This endpoint is also used to identify a profile and update its properties without an associated event. It takes as input the same payload as the above POST request, but as a base64-encoded string passed as a query parameter. NOTE: This is offered for backwards compatibility; we recommend all new implementations use the POST approach above. **EXAMPLE:** ``` { \"token\": \"PUBLIC_KEY\", \"properties\": { \"$email\": \"abraham.lincoln@klaviyo.com\", \"$first_name\": \"Abraham\", \"$last_name\": \"Lincoln\", \"$city\": \"Springfield\", \"$region\": \"Illinois\" } } ``` Gets encoded into the following string, which is passed into the `data` parameter: `eyJ0b2tlbiI6ICJQVUJMSUNfS0VZIiwicHJvcGVydGllcyI6IHsiJGVtYWlsIjogImFicmFoYW0ubGluY29sbkBrbGF2aXlvLmNvbSIsIiRmaXJzdF9uYW1lIjogIkFicmFoYW0iLCIkbGFzdF9uYW1lIjogIkxpbmNvbG4iLCIkY2l0eSI6ICJTcHJpbmdmaWVsZCIsIiRyZWdpb24iOiAiSWxsaW5vaXMifX0K`
|
34
|
+
# @param data [String] String representation of base64 encoded JSON object
|
35
|
+
# @param [Hash] opts the optional parameters
|
36
|
+
# @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
|
37
|
+
def identify_get_with_http_info(data, opts = {})
|
38
|
+
if @api_client.config.debugging
|
39
|
+
@api_client.config.logger.debug 'Calling API: TrackIdentifyApi.identify_get ...'
|
40
|
+
end
|
41
|
+
# verify the required parameter 'data' is set
|
42
|
+
if @api_client.config.client_side_validation && data.nil?
|
43
|
+
fail ArgumentError, "Missing the required parameter 'data' when calling TrackIdentifyApi.identify_get"
|
44
|
+
end
|
45
|
+
# resource path
|
46
|
+
local_var_path = '/identify'
|
47
|
+
|
48
|
+
# query parameters
|
49
|
+
query_params = opts[:query_params] || {}
|
50
|
+
query_params[:'data'] = data
|
51
|
+
|
52
|
+
# header parameters
|
53
|
+
header_params = opts[:header_params] || {}
|
54
|
+
# HTTP header 'Accept' (if needed)
|
55
|
+
header_params['Accept'] = @api_client.select_header_accept(['text/html'])
|
56
|
+
|
57
|
+
# form parameters
|
58
|
+
form_params = opts[:form_params] || {}
|
59
|
+
|
60
|
+
# http body (model)
|
61
|
+
post_body = opts[:body]
|
62
|
+
|
63
|
+
# return_type
|
64
|
+
return_type = opts[:debug_return_type] || 'String'
|
65
|
+
|
66
|
+
# auth_names
|
67
|
+
auth_names = opts[:debug_auth_names] || []
|
68
|
+
|
69
|
+
new_options = opts.merge(
|
70
|
+
:operation => :"TrackIdentifyApi.identify_get",
|
71
|
+
:header_params => header_params,
|
72
|
+
:query_params => query_params,
|
73
|
+
:form_params => form_params,
|
74
|
+
:body => post_body,
|
75
|
+
:auth_names => auth_names,
|
76
|
+
:return_type => return_type
|
77
|
+
)
|
78
|
+
|
79
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
80
|
+
if @api_client.config.debugging
|
81
|
+
@api_client.config.logger.debug "API called: TrackIdentifyApi#identify_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
82
|
+
end
|
83
|
+
return data, status_code, headers
|
84
|
+
end
|
85
|
+
|
86
|
+
# Identify Profile
|
87
|
+
# This endpoint is used to track and update properties about an individual without tracking an associated event. The following data is stored in a JSON object. **JSON OBJECT STRUCTURE:** __token: *string*__ This is your public API key. __properties: *JSON Object or null*__ Properties of the profile to track/update. You must identify the person by their email using a $email key (or by their phone number using a `$phone_number` key if you have SMS-only contacts). Other than that, you can include any data you want and it can then be used to create segments of people. For example, if you wanted to create a list of people on trial plans, include a person's plan type in this JSON object so you can use that information later. **SPECIAL FIELDS:** The Klaviyo CRM has the following special fields you can set for customer **properties** with the **Identify** endpoint, to unlock additional functionality: **$email:** _string_ **$first_name:** _string_ **$last_name:** _string_ **$phone_number:** _string; eg: \"+13239169023\"_ **$city:** _string_ **$region:** _string; state, or other region_ **$country:** _string_ **$zip:** _string_ **$image:** _string; url to a photo of a person_ **$consent:** _list of strings; eg: ['sms', 'email', 'web', 'directmail', 'mobile']_ **EXAMPLE:** ``` { \"token\": \"PUBLIC_KEY\", \"properties\": { \"$email\": \"abraham.lincoln@klaviyo.com\", \"$first_name\": \"Abraham\", \"$last_name\": \"Lincoln\", \"$city\": \"Springfield\", \"$region\": \"Illinois\" } }
|
88
|
+
# @param data [String]
|
89
|
+
# @param [Hash] opts the optional parameters
|
90
|
+
# @return [String]
|
91
|
+
def identify_post(data, opts = {})
|
92
|
+
data, _status_code, _headers = identify_post_with_http_info(data, opts)
|
93
|
+
data
|
94
|
+
end
|
95
|
+
|
96
|
+
# Identify Profile
|
97
|
+
# This endpoint is used to track and update properties about an individual without tracking an associated event. The following data is stored in a JSON object. **JSON OBJECT STRUCTURE:** __token: *string*__ This is your public API key. __properties: *JSON Object or null*__ Properties of the profile to track/update. You must identify the person by their email using a $email key (or by their phone number using a `$phone_number` key if you have SMS-only contacts). Other than that, you can include any data you want and it can then be used to create segments of people. For example, if you wanted to create a list of people on trial plans, include a person's plan type in this JSON object so you can use that information later. **SPECIAL FIELDS:** The Klaviyo CRM has the following special fields you can set for customer **properties** with the **Identify** endpoint, to unlock additional functionality: **$email:** _string_ **$first_name:** _string_ **$last_name:** _string_ **$phone_number:** _string; eg: \"+13239169023\"_ **$city:** _string_ **$region:** _string; state, or other region_ **$country:** _string_ **$zip:** _string_ **$image:** _string; url to a photo of a person_ **$consent:** _list of strings; eg: ['sms', 'email', 'web', 'directmail', 'mobile']_ **EXAMPLE:** ``` { \"token\": \"PUBLIC_KEY\", \"properties\": { \"$email\": \"abraham.lincoln@klaviyo.com\", \"$first_name\": \"Abraham\", \"$last_name\": \"Lincoln\", \"$city\": \"Springfield\", \"$region\": \"Illinois\" } }
|
98
|
+
# @param data [String]
|
99
|
+
# @param [Hash] opts the optional parameters
|
100
|
+
# @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
|
101
|
+
def identify_post_with_http_info(data, opts = {})
|
102
|
+
if @api_client.config.debugging
|
103
|
+
@api_client.config.logger.debug 'Calling API: TrackIdentifyApi.identify_post ...'
|
104
|
+
end
|
105
|
+
# verify the required parameter 'data' is set
|
106
|
+
if @api_client.config.client_side_validation && data.nil?
|
107
|
+
fail ArgumentError, "Missing the required parameter 'data' when calling TrackIdentifyApi.identify_post"
|
108
|
+
end
|
109
|
+
# resource path
|
110
|
+
local_var_path = '/identify'
|
111
|
+
|
112
|
+
# query parameters
|
113
|
+
query_params = opts[:query_params] || {}
|
114
|
+
|
115
|
+
# header parameters
|
116
|
+
header_params = opts[:header_params] || {}
|
117
|
+
# HTTP header 'Accept' (if needed)
|
118
|
+
header_params['Accept'] = @api_client.select_header_accept(['text/html'])
|
119
|
+
# HTTP header 'Content-Type'
|
120
|
+
content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
|
121
|
+
if !content_type.nil?
|
122
|
+
header_params['Content-Type'] = content_type
|
123
|
+
end
|
124
|
+
|
125
|
+
# form parameters
|
126
|
+
form_params = opts[:form_params] || {}
|
127
|
+
form_params['data'] = data
|
128
|
+
|
129
|
+
# http body (model)
|
130
|
+
post_body = opts[:body]
|
131
|
+
|
132
|
+
# return_type
|
133
|
+
return_type = opts[:debug_return_type] || 'String'
|
134
|
+
|
135
|
+
# auth_names
|
136
|
+
auth_names = opts[:debug_auth_names] || []
|
137
|
+
|
138
|
+
new_options = opts.merge(
|
139
|
+
:operation => :"TrackIdentifyApi.identify_post",
|
140
|
+
:header_params => header_params,
|
141
|
+
:query_params => query_params,
|
142
|
+
:form_params => form_params,
|
143
|
+
:body => post_body,
|
144
|
+
:auth_names => auth_names,
|
145
|
+
:return_type => return_type
|
146
|
+
)
|
147
|
+
|
148
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
149
|
+
if @api_client.config.debugging
|
150
|
+
@api_client.config.logger.debug "API called: TrackIdentifyApi#identify_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
151
|
+
end
|
152
|
+
return data, status_code, headers
|
153
|
+
end
|
154
|
+
|
155
|
+
# Track Profile Activity (Legacy)
|
156
|
+
# This endpoint is also used to track a profile's activity. It takes as input the same payload as the above POST request, but as a base64-encoded string passed as a query parameter. NOTE: This is offered for backwards compatibility; we recommend all new implementations use the POST approach above. **EXAMPLE:** ``` { \"token\": \"PUBLIC_KEY\", \"event\": \"Ordered Product\", \"customer_properties\": { \"$email\": \"abraham.lincoln@klaviyo.com\" }, \"properties\": { \"item_name\": \"Boots\", \"$value\": 100 } } ``` Gets encoded into the following string, which is passed into the `data` parameter: `eyJ0b2tlbiI6ICJQVUJMSUNfS0VZIiwiZXZlbnQiOiAiT3JkZXJlZEl0ZW0iLCJjdXN0b21lcl9wcm9wZXJ0aWVzIjogeyIkZW1haWwiOiAiYWJyYWhhbS5saW5jb2xuQGtsYXZpeW8uY29tIn0sInByb3BlcnRpZXMiOiB7Iml0ZW1fbmFtZSI6ICJCb290cyIsIiR2YWx1ZSI6IDEwMH19`
|
157
|
+
# @param data [String] String representation of base64 encoded JSON object
|
158
|
+
# @param [Hash] opts the optional parameters
|
159
|
+
# @return [String]
|
160
|
+
def track_get(data, opts = {})
|
161
|
+
data, _status_code, _headers = track_get_with_http_info(data, opts)
|
162
|
+
data
|
163
|
+
end
|
164
|
+
|
165
|
+
# Track Profile Activity (Legacy)
|
166
|
+
# This endpoint is also used to track a profile's activity. It takes as input the same payload as the above POST request, but as a base64-encoded string passed as a query parameter. NOTE: This is offered for backwards compatibility; we recommend all new implementations use the POST approach above. **EXAMPLE:** ``` { \"token\": \"PUBLIC_KEY\", \"event\": \"Ordered Product\", \"customer_properties\": { \"$email\": \"abraham.lincoln@klaviyo.com\" }, \"properties\": { \"item_name\": \"Boots\", \"$value\": 100 } } ``` Gets encoded into the following string, which is passed into the `data` parameter: `eyJ0b2tlbiI6ICJQVUJMSUNfS0VZIiwiZXZlbnQiOiAiT3JkZXJlZEl0ZW0iLCJjdXN0b21lcl9wcm9wZXJ0aWVzIjogeyIkZW1haWwiOiAiYWJyYWhhbS5saW5jb2xuQGtsYXZpeW8uY29tIn0sInByb3BlcnRpZXMiOiB7Iml0ZW1fbmFtZSI6ICJCb290cyIsIiR2YWx1ZSI6IDEwMH19`
|
167
|
+
# @param data [String] String representation of base64 encoded JSON object
|
168
|
+
# @param [Hash] opts the optional parameters
|
169
|
+
# @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
|
170
|
+
def track_get_with_http_info(data, opts = {})
|
171
|
+
if @api_client.config.debugging
|
172
|
+
@api_client.config.logger.debug 'Calling API: TrackIdentifyApi.track_get ...'
|
173
|
+
end
|
174
|
+
# verify the required parameter 'data' is set
|
175
|
+
if @api_client.config.client_side_validation && data.nil?
|
176
|
+
fail ArgumentError, "Missing the required parameter 'data' when calling TrackIdentifyApi.track_get"
|
177
|
+
end
|
178
|
+
# resource path
|
179
|
+
local_var_path = '/track'
|
180
|
+
|
181
|
+
# query parameters
|
182
|
+
query_params = opts[:query_params] || {}
|
183
|
+
query_params[:'data'] = data
|
184
|
+
|
185
|
+
# header parameters
|
186
|
+
header_params = opts[:header_params] || {}
|
187
|
+
# HTTP header 'Accept' (if needed)
|
188
|
+
header_params['Accept'] = @api_client.select_header_accept(['text/html'])
|
189
|
+
|
190
|
+
# form parameters
|
191
|
+
form_params = opts[:form_params] || {}
|
192
|
+
|
193
|
+
# http body (model)
|
194
|
+
post_body = opts[:body]
|
195
|
+
|
196
|
+
# return_type
|
197
|
+
return_type = opts[:debug_return_type] || 'String'
|
198
|
+
|
199
|
+
# auth_names
|
200
|
+
auth_names = opts[:debug_auth_names] || []
|
201
|
+
|
202
|
+
new_options = opts.merge(
|
203
|
+
:operation => :"TrackIdentifyApi.track_get",
|
204
|
+
:header_params => header_params,
|
205
|
+
:query_params => query_params,
|
206
|
+
:form_params => form_params,
|
207
|
+
:body => post_body,
|
208
|
+
:auth_names => auth_names,
|
209
|
+
:return_type => return_type
|
210
|
+
)
|
211
|
+
|
212
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
213
|
+
if @api_client.config.debugging
|
214
|
+
@api_client.config.logger.debug "API called: TrackIdentifyApi#track_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
215
|
+
end
|
216
|
+
return data, status_code, headers
|
217
|
+
end
|
218
|
+
|
219
|
+
# Track Profile Activity
|
220
|
+
# This endpoint is used to track a profile's activity. The following data is encoded in a JSON object. NOTE: an account can have up to 200 unique metrics (event types). This endpoint can accept payloads up to approximately 1MB. **JSON OBJECT STRUCTURE:** __token: *string*__ This is your public API key. __event: *string*__ Name of the event you want to track. __customer_properties: *JSON Object or null*__ Properties of the profile that triggered this event. You must identify the person by their email using a $email key (or by their phone number using a `$phone_number` key if you have SMS-only contacts). Other than that, you can include any data you want and it can then be used to create segments of people. For example, if you wanted to create a list of people on trial plans, include a person's plan type in this JSON object so you can use that information later. __properties: *optional; JSON Object or null*__ Properties of this event. Any properties included here can be used for creating segments later For example, if you track an event called \"Ordered Product\" you could include a property for item type (e.g. image, article, etc.), size, etc. __time: *optional; 10-digit UNIX timestamp or null*__ When this event occurred. By default, Klaviyo assumes events happen when a request is made. If you'd like to track an event that happened in past, use this property. **SPECIAL FIELDS:** The Klaviyo CRM has the following special fields you can set for **customer_properties** with the **Track** endpoint, to unlock additional functionality: **$email:** _string_ **$first_name:** _string_ **$last_name:** _string_ **$phone_number:** _string; eg: \"+13239169023\"_ **$city:** _string_ **$region:** _string; state, or other region_ **$country:** _string_ **$zip:** _string_ **$image:** _string; url to a photo of a person_ **$consent:** _list of strings; eg: ['sms', 'email', 'web', 'directmail', 'mobile']_ You can also set the following special fields in event **properties** with the **Track** endpoint: **$event_id:** _a unique identifier for an event_ **$value:** _a numeric value to associate with this event (e.g. the dollar value of a purchase)_ **EXAMPLE:** ``` { \"token\": \"PUBLIC_KEY\", \"event\": \"Ordered Product\", \"customer_properties\": { \"$email\": \"abraham.lincoln@klaviyo.com\" }, \"properties\": { \"item_name\": \"Boots\", \"$value\": 100 } }
|
221
|
+
# @param data [String]
|
222
|
+
# @param [Hash] opts the optional parameters
|
223
|
+
# @return [String]
|
224
|
+
def track_post(data, opts = {})
|
225
|
+
data, _status_code, _headers = track_post_with_http_info(data, opts)
|
226
|
+
data
|
227
|
+
end
|
228
|
+
|
229
|
+
# Track Profile Activity
|
230
|
+
# This endpoint is used to track a profile's activity. The following data is encoded in a JSON object. NOTE: an account can have up to 200 unique metrics (event types). This endpoint can accept payloads up to approximately 1MB. **JSON OBJECT STRUCTURE:** __token: *string*__ This is your public API key. __event: *string*__ Name of the event you want to track. __customer_properties: *JSON Object or null*__ Properties of the profile that triggered this event. You must identify the person by their email using a $email key (or by their phone number using a `$phone_number` key if you have SMS-only contacts). Other than that, you can include any data you want and it can then be used to create segments of people. For example, if you wanted to create a list of people on trial plans, include a person's plan type in this JSON object so you can use that information later. __properties: *optional; JSON Object or null*__ Properties of this event. Any properties included here can be used for creating segments later For example, if you track an event called \"Ordered Product\" you could include a property for item type (e.g. image, article, etc.), size, etc. __time: *optional; 10-digit UNIX timestamp or null*__ When this event occurred. By default, Klaviyo assumes events happen when a request is made. If you'd like to track an event that happened in past, use this property. **SPECIAL FIELDS:** The Klaviyo CRM has the following special fields you can set for **customer_properties** with the **Track** endpoint, to unlock additional functionality: **$email:** _string_ **$first_name:** _string_ **$last_name:** _string_ **$phone_number:** _string; eg: \"+13239169023\"_ **$city:** _string_ **$region:** _string; state, or other region_ **$country:** _string_ **$zip:** _string_ **$image:** _string; url to a photo of a person_ **$consent:** _list of strings; eg: ['sms', 'email', 'web', 'directmail', 'mobile']_ You can also set the following special fields in event **properties** with the **Track** endpoint: **$event_id:** _a unique identifier for an event_ **$value:** _a numeric value to associate with this event (e.g. the dollar value of a purchase)_ **EXAMPLE:** ``` { \"token\": \"PUBLIC_KEY\", \"event\": \"Ordered Product\", \"customer_properties\": { \"$email\": \"abraham.lincoln@klaviyo.com\" }, \"properties\": { \"item_name\": \"Boots\", \"$value\": 100 } }
|
231
|
+
# @param data [String]
|
232
|
+
# @param [Hash] opts the optional parameters
|
233
|
+
# @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
|
234
|
+
def track_post_with_http_info(data, opts = {})
|
235
|
+
if @api_client.config.debugging
|
236
|
+
@api_client.config.logger.debug 'Calling API: TrackIdentifyApi.track_post ...'
|
237
|
+
end
|
238
|
+
# verify the required parameter 'data' is set
|
239
|
+
if @api_client.config.client_side_validation && data.nil?
|
240
|
+
fail ArgumentError, "Missing the required parameter 'data' when calling TrackIdentifyApi.track_post"
|
241
|
+
end
|
242
|
+
# resource path
|
243
|
+
local_var_path = '/track'
|
244
|
+
|
245
|
+
# query parameters
|
246
|
+
query_params = opts[:query_params] || {}
|
247
|
+
|
248
|
+
# header parameters
|
249
|
+
header_params = opts[:header_params] || {}
|
250
|
+
# HTTP header 'Accept' (if needed)
|
251
|
+
header_params['Accept'] = @api_client.select_header_accept(['text/html'])
|
252
|
+
# HTTP header 'Content-Type'
|
253
|
+
content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
|
254
|
+
if !content_type.nil?
|
255
|
+
header_params['Content-Type'] = content_type
|
256
|
+
end
|
257
|
+
|
258
|
+
# form parameters
|
259
|
+
form_params = opts[:form_params] || {}
|
260
|
+
form_params['data'] = data
|
261
|
+
|
262
|
+
# http body (model)
|
263
|
+
post_body = opts[:body]
|
264
|
+
|
265
|
+
# return_type
|
266
|
+
return_type = opts[:debug_return_type] || 'String'
|
267
|
+
|
268
|
+
# auth_names
|
269
|
+
auth_names = opts[:debug_auth_names] || []
|
270
|
+
|
271
|
+
new_options = opts.merge(
|
272
|
+
:operation => :"TrackIdentifyApi.track_post",
|
273
|
+
:header_params => header_params,
|
274
|
+
:query_params => query_params,
|
275
|
+
:form_params => form_params,
|
276
|
+
:body => post_body,
|
277
|
+
:auth_names => auth_names,
|
278
|
+
:return_type => return_type
|
279
|
+
)
|
280
|
+
|
281
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
282
|
+
if @api_client.config.debugging
|
283
|
+
@api_client.config.logger.debug "API called: TrackIdentifyApi#track_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
284
|
+
end
|
285
|
+
return data, status_code, headers
|
286
|
+
end
|
287
|
+
end
|
288
|
+
end
|