Class: Klaviyo::ListsSegmentsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ListsSegmentsApi

Returns a new instance of ListsSegmentsApi.



19
20
21
# File 'lib/klaviyo_sdk/api/lists_segments_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/lists_segments_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#add_members(list_id, opts = {}) ⇒ Array<Hash<String, Object>>

Add Members to a List Adds profiles to a list. This endpoint is functionally equivalent to adding profiles to a list via a CSV upload and will immediately add profiles to the list. If you would like to subscribe profiles to a list and use the double opt-in settings for the list, please use the subscribe endpoint.

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

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


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

def add_members(list_id, opts = {})
  data, _status_code, _headers = add_members_with_http_info(list_id, opts)
  data
end

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

Add Members to a List Adds profiles to a list. This endpoint is functionally equivalent to adding profiles to a list via a CSV upload and will immediately add profiles to the list. If you would like to subscribe profiles to a list and use the double opt-in settings for the list, please use the subscribe endpoint.

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

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

    Array<Hash<String, Object>> 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
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 39

def add_members_with_http_info(list_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListsSegmentsApi.add_members ...'
  end
  # verify the required parameter 'list_id' is set
  if @api_client.config.client_side_validation && list_id.nil?
    fail ArgumentError, "Missing the required parameter 'list_id' when calling ListsSegmentsApi.add_members"
  end
  # resource path
  local_var_path = '/v2/list/{list_id}/members'.sub('{' + 'list_id' + '}', CGI.escape(list_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/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(opts[:'inline_object4'])

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

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

  new_options = opts.merge(
    :operation => :"ListsSegmentsApi.add_members",
    :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: ListsSegmentsApi#add_members\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Create List Creates a new list.

Parameters:

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

    the optional parameters

Returns:

  • (Hash<String, Object>)


97
98
99
100
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 97

def create_list(list_name, opts = {})
  data, _status_code, _headers = create_list_with_http_info(list_name, opts)
  data
end

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

Create List Creates a new list.

Parameters:

  • list_name (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



107
108
109
110
111
112
113
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
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 107

def create_list_with_http_info(list_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListsSegmentsApi.create_list ...'
  end
  # verify the required parameter 'list_name' is set
  if @api_client.config.client_side_validation && list_name.nil?
    fail ArgumentError, "Missing the required parameter 'list_name' when calling ListsSegmentsApi.create_list"
  end
  # resource path
  local_var_path = '/v2/lists'

  # 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['list_name'] = list_name

  # 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 => :"ListsSegmentsApi.create_list",
    :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: ListsSegmentsApi#create_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_list(list_id, opts = {}) ⇒ nil

Delete List Deletes a list from an account. This is a destructive operation and cannot be undone. It will also remove flow triggers associated with the list.

Parameters:

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

    the optional parameters

Returns:

  • (nil)


166
167
168
169
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 166

def delete_list(list_id, opts = {})
  delete_list_with_http_info(list_id, opts)
  nil
end

#delete_list_with_http_info(list_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete List Deletes a list from an account. This is a destructive operation and cannot be undone. It will also remove flow triggers associated with the list.

Parameters:

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



176
177
178
179
180
181
182
183
184
185
186
187
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
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 176

def delete_list_with_http_info(list_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListsSegmentsApi.delete_list ...'
  end
  # verify the required parameter 'list_id' is set
  if @api_client.config.client_side_validation && list_id.nil?
    fail ArgumentError, "Missing the required parameter 'list_id' when calling ListsSegmentsApi.delete_list"
  end
  # resource path
  local_var_path = '/v2/list/{list_id}'.sub('{' + 'list_id' + '}', CGI.escape(list_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}

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

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

  # return_type
  return_type = opts[:debug_return_type]

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

  new_options = opts.merge(
    :operation => :"ListsSegmentsApi.delete_list",
    :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: ListsSegmentsApi#delete_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Exclude Profile From All Email Marks a person as excluded from all email. This works the same way as manually excluding someone via the excluded people page. Someone who is excluded will no longer receive any campaigns or flow emails.

Parameters:

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

    the optional parameters

Returns:

  • (Hash<String, Object>)


227
228
229
230
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 227

def exclude_globally(email, opts = {})
  data, _status_code, _headers = exclude_globally_with_http_info(email, opts)
  data
end

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

Exclude Profile From All Email Marks a person as excluded from all email. This works the same way as manually excluding someone via the excluded people page. Someone who is excluded will no longer receive any campaigns or flow emails.

Parameters:

  • email (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



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
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
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 237

def exclude_globally_with_http_info(email, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListsSegmentsApi.exclude_globally ...'
  end
  # verify the required parameter 'email' is set
  if @api_client.config.client_side_validation && email.nil?
    fail ArgumentError, "Missing the required parameter 'email' when calling ListsSegmentsApi.exclude_globally"
  end
  # resource path
  local_var_path = '/v1/people/exclusions'

  # 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['email'] = email

  # 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 => :"ListsSegmentsApi.exclude_globally",
    :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: ListsSegmentsApi#exclude_globally\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_global_exclusions(opts = {}) ⇒ GlobalExclusionResponseData

Get Global Exclusions & Unsubscribes Returns global exclusions/unsubscribes. Global exclusions are distinct from list exclusions in that these email addresses will not receive any emails from any list. Typically, when someone unsubscribes from a campaign, they are only unsubscribed from that list and are not globally unsubscribed.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :reason (String)

    Filter results based on the reason for someone being excluded. The possible values are &#x60;unsubscribed&#x60;, &#x60;bounced&#x60;, &#x60;invalid_email&#x60;, &#x60;reported_spam&#x60; and &#x60;manually_excluded&#x60;. Only a single value may be specified at a time. Defaults to return all profiles regardless of reason.

  • :sort (String)

    Sort order to apply to results, either ascending or descending. Valid values are &#x60;asc&#x60; or &#x60;desc&#x60;. Defaults to &#x60;asc&#x60;. (default to ‘asc’)

  • :count (Integer)

    For pagination, the number of results to return. Default &#x3D; 500 (default to 500)

  • :page (Integer)

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

Returns:



299
300
301
302
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 299

def get_global_exclusions(opts = {})
  data, _status_code, _headers = get_global_exclusions_with_http_info(opts)
  data
end

#get_global_exclusions_with_http_info(opts = {}) ⇒ Array<(GlobalExclusionResponseData, Integer, Hash)>

Get Global Exclusions &amp; Unsubscribes Returns global exclusions/unsubscribes. Global exclusions are distinct from list exclusions in that these email addresses will not receive any emails from any list. Typically, when someone unsubscribes from a campaign, they are only unsubscribed from that list and are not globally unsubscribed.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :reason (String)

    Filter results based on the reason for someone being excluded. The possible values are &#x60;unsubscribed&#x60;, &#x60;bounced&#x60;, &#x60;invalid_email&#x60;, &#x60;reported_spam&#x60; and &#x60;manually_excluded&#x60;. Only a single value may be specified at a time. Defaults to return all profiles regardless of reason.

  • :sort (String)

    Sort order to apply to results, either ascending or descending. Valid values are &#x60;asc&#x60; or &#x60;desc&#x60;. Defaults to &#x60;asc&#x60;.

  • :count (Integer)

    For pagination, the number of results to return. Default &#x3D; 500

  • :page (Integer)

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

Returns:

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

    GlobalExclusionResponseData data, response status code and response headers



312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
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
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 312

def get_global_exclusions_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListsSegmentsApi.get_global_exclusions ...'
  end
  # resource path
  local_var_path = '/v1/people/exclusions'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'reason'] = opts[:'reason'] if !opts[:'reason'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].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] || 'GlobalExclusionResponseData'

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

  new_options = opts.merge(
    :operation => :"ListsSegmentsApi.get_global_exclusions",
    :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: ListsSegmentsApi#get_global_exclusions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Get All Exclusions for a List Gets all of the emails and phone numbers that have been excluded from a list along with the exclusion reasons and exclusion time. This endpoint uses batching to return the records, so for a large list multiple calls will need to be made to get all of the records.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :marker (Integer)

    A marker value returned by a previous GET call. Use this to grab the next batch of records.

Returns:

  • (Hash<String, Object>)


366
367
368
369
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 366

def get_list_exclusions(list_id, opts = {})
  data, _status_code, _headers = get_list_exclusions_with_http_info(list_id, opts)
  data
end

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

Get All Exclusions for a List Gets all of the emails and phone numbers that have been excluded from a list along with the exclusion reasons and exclusion time. This endpoint uses batching to return the records, so for a large list multiple calls will need to be made to get all of the records.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :marker (Integer)

    A marker value returned by a previous GET call. Use this to grab the next batch of records.

Returns:

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

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



377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 377

def get_list_exclusions_with_http_info(list_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListsSegmentsApi.get_list_exclusions ...'
  end
  # verify the required parameter 'list_id' is set
  if @api_client.config.client_side_validation && list_id.nil?
    fail ArgumentError, "Missing the required parameter 'list_id' when calling ListsSegmentsApi.get_list_exclusions"
  end
  # resource path
  local_var_path = '/v2/list/{list_id}/exclusions/all'.sub('{' + 'list_id' + '}', CGI.escape(list_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'marker'] = opts[:'marker'] if !opts[:'marker'].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 => :"ListsSegmentsApi.get_list_exclusions",
    :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: ListsSegmentsApi#get_list_exclusions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Get List Info Returns information about a list.

Parameters:

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

    the optional parameters

Returns:

  • (Hash<String, Object>)


431
432
433
434
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 431

def get_list_info(list_id, opts = {})
  data, _status_code, _headers = get_list_info_with_http_info(list_id, opts)
  data
end

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

Get List Info Returns information about a list.

Parameters:

  • list_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



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
480
481
482
483
484
485
486
487
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 441

def get_list_info_with_http_info(list_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListsSegmentsApi.get_list_info ...'
  end
  # verify the required parameter 'list_id' is set
  if @api_client.config.client_side_validation && list_id.nil?
    fail ArgumentError, "Missing the required parameter 'list_id' when calling ListsSegmentsApi.get_list_info"
  end
  # resource path
  local_var_path = '/v2/list/{list_id}'.sub('{' + 'list_id' + '}', CGI.escape(list_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 => :"ListsSegmentsApi.get_list_info",
    :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: ListsSegmentsApi#get_list_info\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_list_members(list_id, opts = {}) ⇒ Array<Hash<String, Object>>

Check if Profiles Are in a List Checks if one or more emails, phone numbers, or push tokens are in a given list. No distinction is made between a person not being in a given list, and not being present in Klaviyo at all. Can check up to a maximum of 100 emails at a time.

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

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


495
496
497
498
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 495

def get_list_members(list_id, opts = {})
  data, _status_code, _headers = get_list_members_with_http_info(list_id, opts)
  data
end

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

Check if Profiles Are in a List Checks if one or more emails, phone numbers, or push tokens are in a given list. No distinction is made between a person not being in a given list, and not being present in Klaviyo at all. Can check up to a maximum of 100 emails at a time.

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

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

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



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
554
555
556
557
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 506

def get_list_members_with_http_info(list_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListsSegmentsApi.get_list_members ...'
  end
  # verify the required parameter 'list_id' is set
  if @api_client.config.client_side_validation && list_id.nil?
    fail ArgumentError, "Missing the required parameter 'list_id' when calling ListsSegmentsApi.get_list_members"
  end
  # resource path
  local_var_path = '/v2/list/{list_id}/get-members'.sub('{' + 'list_id' + '}', CGI.escape(list_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/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(opts[:'check_membership_request'])

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

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

  new_options = opts.merge(
    :operation => :"ListsSegmentsApi.get_list_members",
    :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: ListsSegmentsApi#get_list_members\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_list_subscriptions(list_id, opts = {}) ⇒ Array<Hash<String, Object>>

Check if Profiles Are in a List and not Suppressed Checks if one or more emails are in a given list and not suppressed. No distinction is made between a person not being in a given list, and not being present in Klaviyo at all. Can check up to a maximum of 100 emails at a time.

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

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


565
566
567
568
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 565

def get_list_subscriptions(list_id, opts = {})
  data, _status_code, _headers = get_list_subscriptions_with_http_info(list_id, opts)
  data
end

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

Check if Profiles Are in a List and not Suppressed Checks if one or more emails are in a given list and not suppressed. No distinction is made between a person not being in a given list, and not being present in Klaviyo at all. Can check up to a maximum of 100 emails at a time.

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

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

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



576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 576

def get_list_subscriptions_with_http_info(list_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListsSegmentsApi.get_list_subscriptions ...'
  end
  # verify the required parameter 'list_id' is set
  if @api_client.config.client_side_validation && list_id.nil?
    fail ArgumentError, "Missing the required parameter 'list_id' when calling ListsSegmentsApi.get_list_subscriptions"
  end
  # resource path
  local_var_path = '/v2/list/{list_id}/get-list-subscriptions'.sub('{' + 'list_id' + '}', CGI.escape(list_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/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(opts[:'check_membership_request'])

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

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

  new_options = opts.merge(
    :operation => :"ListsSegmentsApi.get_list_subscriptions",
    :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: ListsSegmentsApi#get_list_subscriptions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Get Lists Returns a listing of all of the lists in an account.

Parameters:

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

    the optional parameters

Returns:

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


633
634
635
636
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 633

def get_lists(opts = {})
  data, _status_code, _headers = get_lists_with_http_info(opts)
  data
end

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

Get Lists Returns a listing of all of the lists in an account.

Parameters:

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

    the optional parameters

Returns:

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

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



642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 642

def get_lists_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListsSegmentsApi.get_lists ...'
  end
  # resource path
  local_var_path = '/v2/lists'

  # 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] || 'Array<Hash<String, Object>>'

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

  new_options = opts.merge(
    :operation => :"ListsSegmentsApi.get_lists",
    :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: ListsSegmentsApi#get_lists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Get List and Segment Members Gets all of the emails, phone numbers, and push tokens for profiles in a given list or segment

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :marker (Integer)

    A marker value returned by a previous GET call. Use this to grab the next batch of records.

Returns:

  • (Hash<String, Object>)


692
693
694
695
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 692

def get_members(list_or_segment_id, opts = {})
  data, _status_code, _headers = get_members_with_http_info(list_or_segment_id, opts)
  data
end

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

Get List and Segment Members Gets all of the emails, phone numbers, and push tokens for profiles in a given list or segment

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :marker (Integer)

    A marker value returned by a previous GET call. Use this to grab the next batch of records.

Returns:

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

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



703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 703

def get_members_with_http_info(list_or_segment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListsSegmentsApi.get_members ...'
  end
  # verify the required parameter 'list_or_segment_id' is set
  if @api_client.config.client_side_validation && list_or_segment_id.nil?
    fail ArgumentError, "Missing the required parameter 'list_or_segment_id' when calling ListsSegmentsApi.get_members"
  end
  # resource path
  local_var_path = '/v2/group/{list_or_segment_id}/members/all'.sub('{' + 'list_or_segment_id' + '}', CGI.escape(list_or_segment_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'marker'] = opts[:'marker'] if !opts[:'marker'].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 => :"ListsSegmentsApi.get_members",
    :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: ListsSegmentsApi#get_members\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_segment_members(segment_id, opts = {}) ⇒ Array<Hash<String, Object>>

Check if Profiles Are in a Segment Checks if one or more emails, phone numbers, or push tokens are in a given segment. No distinction is made between a person not being in a given segment, and not being present in Klaviyo at all. Can check up to a maximum of 100 emails at a time.

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

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


758
759
760
761
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 758

def get_segment_members(segment_id, opts = {})
  data, _status_code, _headers = get_segment_members_with_http_info(segment_id, opts)
  data
end

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

Check if Profiles Are in a Segment Checks if one or more emails, phone numbers, or push tokens are in a given segment. No distinction is made between a person not being in a given segment, and not being present in Klaviyo at all. Can check up to a maximum of 100 emails at a time.

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

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

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



769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 769

def get_segment_members_with_http_info(segment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListsSegmentsApi.get_segment_members ...'
  end
  # verify the required parameter 'segment_id' is set
  if @api_client.config.client_side_validation && segment_id.nil?
    fail ArgumentError, "Missing the required parameter 'segment_id' when calling ListsSegmentsApi.get_segment_members"
  end
  # resource path
  local_var_path = '/v2/segment/{segment_id}/get-members'.sub('{' + 'segment_id' + '}', CGI.escape(segment_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/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(opts[:'check_membership_request'])

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

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

  new_options = opts.merge(
    :operation => :"ListsSegmentsApi.get_segment_members",
    :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: ListsSegmentsApi#get_segment_members\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#remove_members(list_id, opts = {}) ⇒ nil

Remove Profiles From List Removes profiles from a list.

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (nil)


828
829
830
831
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 828

def remove_members(list_id, opts = {})
  remove_members_with_http_info(list_id, opts)
  nil
end

#remove_members_with_http_info(list_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Remove Profiles From List Removes profiles from a list.

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

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

    nil, response status code and response headers



839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 839

def remove_members_with_http_info(list_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListsSegmentsApi.remove_members ...'
  end
  # verify the required parameter 'list_id' is set
  if @api_client.config.client_side_validation && list_id.nil?
    fail ArgumentError, "Missing the required parameter 'list_id' when calling ListsSegmentsApi.remove_members"
  end
  # resource path
  local_var_path = '/v2/list/{list_id}/members'.sub('{' + 'list_id' + '}', CGI.escape(list_id.to_s))

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

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

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

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(opts[:'inline_object5'])

  # return_type
  return_type = opts[:debug_return_type]

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

  new_options = opts.merge(
    :operation => :"ListsSegmentsApi.remove_members",
    :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: ListsSegmentsApi#remove_members\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#subscribe(list_id, opts = {}) ⇒ Array<Object>

Subscribe Profiles to List Subscribes profiles to a list. Profiles will be single or double opted into the specified list in accordance with that list’s settings. Note: If you have double opt-in enabled (default behavior), users will not be added to list until they opt-in, and so API will respond with an empty list: ‘[]`

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<Object>)


896
897
898
899
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 896

def subscribe(list_id, opts = {})
  data, _status_code, _headers = subscribe_with_http_info(list_id, opts)
  data
end

#subscribe_with_http_info(list_id, opts = {}) ⇒ Array<(Array<Object>, Integer, Hash)>

Subscribe Profiles to List Subscribes profiles to a list. Profiles will be single or double opted into the specified list in accordance with that list’s settings. Note: If you have double opt-in enabled (default behavior), users will not be added to list until they opt-in, and so API will respond with an empty list: &#x60;[]&#x60;

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

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

    Array<Object> data, response status code and response headers



907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 907

def subscribe_with_http_info(list_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListsSegmentsApi.subscribe ...'
  end
  # verify the required parameter 'list_id' is set
  if @api_client.config.client_side_validation && list_id.nil?
    fail ArgumentError, "Missing the required parameter 'list_id' when calling ListsSegmentsApi.subscribe"
  end
  # resource path
  local_var_path = '/v2/list/{list_id}/subscribe'.sub('{' + 'list_id' + '}', CGI.escape(list_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/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(opts[:'inline_object3'])

  # return_type
  return_type = opts[:debug_return_type] || 'Array<Object>'

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

  new_options = opts.merge(
    :operation => :"ListsSegmentsApi.subscribe",
    :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: ListsSegmentsApi#subscribe\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#unsubscribe(list_id, opts = {}) ⇒ nil

Unsubscribe Profiles From List Unsubscribes and removes profiles from a list.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :request_body (Hash<String, Object>)

    Unsubscribe and remove profiles from a list.

Returns:

  • (nil)


966
967
968
969
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 966

def unsubscribe(list_id, opts = {})
  unsubscribe_with_http_info(list_id, opts)
  nil
end

#unsubscribe_with_http_info(list_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Unsubscribe Profiles From List Unsubscribes and removes profiles from a list.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :request_body (Hash<String, Object>)

    Unsubscribe and remove profiles from a list.

Returns:

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

    nil, response status code and response headers



977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 977

def unsubscribe_with_http_info(list_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListsSegmentsApi.unsubscribe ...'
  end
  # verify the required parameter 'list_id' is set
  if @api_client.config.client_side_validation && list_id.nil?
    fail ArgumentError, "Missing the required parameter 'list_id' when calling ListsSegmentsApi.unsubscribe"
  end
  # resource path
  local_var_path = '/v2/list/{list_id}/subscribe'.sub('{' + 'list_id' + '}', CGI.escape(list_id.to_s))

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

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

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

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(opts[:'request_body'])

  # return_type
  return_type = opts[:debug_return_type]

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

  new_options = opts.merge(
    :operation => :"ListsSegmentsApi.unsubscribe",
    :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: ListsSegmentsApi#unsubscribe\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_list_name(list_id, list_name, opts = {}) ⇒ nil

Update List Name Updates a list’s name.

Parameters:

  • list_id (String)
  • list_name (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


1034
1035
1036
1037
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 1034

def update_list_name(list_id, list_name, opts = {})
  update_list_name_with_http_info(list_id, list_name, opts)
  nil
end

#update_list_name_with_http_info(list_id, list_name, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Update List Name Updates a list&#39;s name.

Parameters:

  • list_id (String)
  • list_name (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    nil, response status code and response headers



1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
# File 'lib/klaviyo_sdk/api/lists_segments_api.rb', line 1045

def update_list_name_with_http_info(list_id, list_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListsSegmentsApi.update_list_name ...'
  end
  # verify the required parameter 'list_id' is set
  if @api_client.config.client_side_validation && list_id.nil?
    fail ArgumentError, "Missing the required parameter 'list_id' when calling ListsSegmentsApi.update_list_name"
  end
  # verify the required parameter 'list_name' is set
  if @api_client.config.client_side_validation && list_name.nil?
    fail ArgumentError, "Missing the required parameter 'list_name' when calling ListsSegmentsApi.update_list_name"
  end
  # resource path
  local_var_path = '/v2/list/{list_id}'.sub('{' + 'list_id' + '}', CGI.escape(list_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # 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['list_name'] = list_name

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

  # return_type
  return_type = opts[:debug_return_type]

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

  new_options = opts.merge(
    :operation => :"ListsSegmentsApi.update_list_name",
    :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: ListsSegmentsApi#update_list_name\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end