Class: Hubspot::Crm::Lists::MembershipsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot/codegen/crm/lists/api/memberships_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ MembershipsApi

Returns a new instance of MembershipsApi.



21
22
23
# File 'lib/hubspot/codegen/crm/lists/api/memberships_api.rb', line 21

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



19
20
21
# File 'lib/hubspot/codegen/crm/lists/api/memberships_api.rb', line 19

def api_client
  @api_client
end

Instance Method Details

#add(list_id, request_body, opts = {}) ⇒ MembershipsUpdateResponse

Add Records to a List Add the records provided to the list. Records that do not exist or that are already members of the list are ignored. This endpoint only works for lists that have a ‘processingType` of `MANUAL` or `SNAPSHOT`.

Parameters:

  • list_id (String)

    The **ILS ID** of the `MANUAL` or `SNAPSHOT` list.

  • request_body (Array<String>)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



30
31
32
33
# File 'lib/hubspot/codegen/crm/lists/api/memberships_api.rb', line 30

def add(list_id, request_body, opts = {})
  data, _status_code, _headers = add_with_http_info(list_id, request_body, opts)
  data
end

#add_all_from_list(list_id, source_list_id, opts = {}) ⇒ nil

Add All Records from a Source List to a Destination List Add all of the records from a *source list* (specified by the ‘sourceListId`) to a *destination list* (specified by the `listId`). Records that are already members of the *destination list* will be ignored. The destination and *source list* IDs must be different. The destination and *source lists* must contain records of the same type (e.g. contacts, companies, etc.). This endpoint only works for *destination lists* that have a `processingType` of `MANUAL` or `SNAPSHOT`. The *source list* can have any `processingType`. This endpoint only supports a `sourceListId` for lists with less than 100,000 memberships.

Parameters:

  • list_id (String)

    The **ILS ID** of the &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60; *destination list*, which the *source list* records are added to.

  • source_list_id (String)

    The **ILS ID** of the *source list* to grab the records from, which are then added to the *destination list*.

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

    the optional parameters

Returns:

  • (nil)


104
105
106
107
# File 'lib/hubspot/codegen/crm/lists/api/memberships_api.rb', line 104

def add_all_from_list(list_id, source_list_id, opts = {})
  add_all_from_list_with_http_info(list_id, source_list_id, opts)
  nil
end

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

Add All Records from a Source List to a Destination List Add all of the records from a *source list* (specified by the &#x60;sourceListId&#x60;) to a *destination list* (specified by the &#x60;listId&#x60;). Records that are already members of the *destination list* will be ignored. The destination and *source list* IDs must be different. The destination and *source lists* must contain records of the same type (e.g. contacts, companies, etc.). This endpoint only works for *destination lists* that have a &#x60;processingType&#x60; of &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60;. The *source list* can have any &#x60;processingType&#x60;. This endpoint only supports a &#x60;sourceListId&#x60; for lists with less than 100,000 memberships.

Parameters:

  • list_id (String)

    The **ILS ID** of the &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60; *destination list*, which the *source list* records are added to.

  • source_list_id (String)

    The **ILS ID** of the *source list* to grab the records from, which are then added to the *destination list*.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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

def add_all_from_list_with_http_info(list_id, source_list_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MembershipsApi.add_all_from_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 MembershipsApi.add_all_from_list"
  end
  # verify the required parameter 'source_list_id' is set
  if @api_client.config.client_side_validation && source_list_id.nil?
    fail ArgumentError, "Missing the required parameter 'source_list_id' when calling MembershipsApi.add_all_from_list"
  end
  # resource path
  local_var_path = '/crm/v3/lists/{listId}/memberships/add-from/{sourceListId}'.sub('{' + 'listId' + '}', CGI.escape(list_id.to_s)).sub('{' + 'sourceListId' + '}', CGI.escape(source_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(['*/*'])

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

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

  # return_type
  return_type = opts[:debug_return_type]

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

  new_options = opts.merge(
    :operation => :"MembershipsApi.add_all_from_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(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MembershipsApi#add_all_from_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#add_and_remove(list_id, membership_change_request, opts = {}) ⇒ MembershipsUpdateResponse

Add and/or Remove Records from a List Add and/or remove records that have already been created in the system to and/or from a list. This endpoint only works for lists that have a ‘processingType` of `MANUAL` or `SNAPSHOT`.

Parameters:

  • list_id (String)

    The **ILS ID** of the &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60; list.

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

    the optional parameters

Returns:



173
174
175
176
# File 'lib/hubspot/codegen/crm/lists/api/memberships_api.rb', line 173

def add_and_remove(list_id, membership_change_request, opts = {})
  data, _status_code, _headers = add_and_remove_with_http_info(list_id, membership_change_request, opts)
  data
end

#add_and_remove_with_http_info(list_id, membership_change_request, opts = {}) ⇒ Array<(MembershipsUpdateResponse, Integer, Hash)>

Add and/or Remove Records from a List Add and/or remove records that have already been created in the system to and/or from a list. This endpoint only works for lists that have a &#x60;processingType&#x60; of &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60;.

Parameters:

  • list_id (String)

    The **ILS ID** of the &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60; list.

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

    the optional parameters

Returns:

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

    MembershipsUpdateResponse data, response status code and response headers



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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/hubspot/codegen/crm/lists/api/memberships_api.rb', line 184

def add_and_remove_with_http_info(list_id, membership_change_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MembershipsApi.add_and_remove ...'
  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 MembershipsApi.add_and_remove"
  end
  # verify the required parameter 'membership_change_request' is set
  if @api_client.config.client_side_validation && membership_change_request.nil?
    fail ArgumentError, "Missing the required parameter 'membership_change_request' when calling MembershipsApi.add_and_remove"
  end
  # resource path
  local_var_path = '/crm/v3/lists/{listId}/memberships/add-and-remove'.sub('{' + 'listId' + '}', 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[:debug_body] || @api_client.object_to_http_body(membership_change_request)

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

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

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

#add_with_http_info(list_id, request_body, opts = {}) ⇒ Array<(MembershipsUpdateResponse, Integer, Hash)>

Add Records to a List Add the records provided to the list. Records that do not exist or that are already members of the list are ignored. This endpoint only works for lists that have a &#x60;processingType&#x60; of &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60;.

Parameters:

  • list_id (String)

    The **ILS ID** of the &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60; list.

  • request_body (Array<String>)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    MembershipsUpdateResponse data, response status code and response headers



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

def add_with_http_info(list_id, request_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MembershipsApi.add ...'
  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 MembershipsApi.add"
  end
  # verify the required parameter 'request_body' is set
  if @api_client.config.client_side_validation && request_body.nil?
    fail ArgumentError, "Missing the required parameter 'request_body' when calling MembershipsApi.add"
  end
  # resource path
  local_var_path = '/crm/v3/lists/{listId}/memberships/add'.sub('{' + 'listId' + '}', 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[:debug_body] || @api_client.object_to_http_body(request_body)

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

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

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

#get_lists(object_type_id, record_id, opts = {}) ⇒ ApiCollectionResponseRecordListMembershipNoPaging

Get lists record is member of For given record provide lists this record is member of.

Parameters:

  • object_type_id (String)

    Object type id of the record

  • record_id (String)

    Id of the record

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

    the optional parameters

Returns:



247
248
249
250
# File 'lib/hubspot/codegen/crm/lists/api/memberships_api.rb', line 247

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

#get_lists_with_http_info(object_type_id, record_id, opts = {}) ⇒ Array<(ApiCollectionResponseRecordListMembershipNoPaging, Integer, Hash)>

Get lists record is member of For given record provide lists this record is member of.

Parameters:

  • object_type_id (String)

    Object type id of the record

  • record_id (String)

    Id of the record

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

    the optional parameters

Returns:



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

def get_lists_with_http_info(object_type_id, record_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MembershipsApi.get_lists ...'
  end
  # verify the required parameter 'object_type_id' is set
  if @api_client.config.client_side_validation && object_type_id.nil?
    fail ArgumentError, "Missing the required parameter 'object_type_id' when calling MembershipsApi.get_lists"
  end
  # verify the required parameter 'record_id' is set
  if @api_client.config.client_side_validation && record_id.nil?
    fail ArgumentError, "Missing the required parameter 'record_id' when calling MembershipsApi.get_lists"
  end
  # resource path
  local_var_path = '/crm/v3/lists/records/{objectTypeId}/{recordId}/memberships'.sub('{' + 'objectTypeId' + '}', CGI.escape(object_type_id.to_s)).sub('{' + 'recordId' + '}', CGI.escape(record_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[:debug_body]

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

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

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

#get_page(list_id, opts = {}) ⇒ ApiCollectionResponseJoinTimeAndRecordId

Fetch List Memberships Ordered by ID Fetch the memberships of a list in order sorted by the ‘recordId` of the records in the list. The `recordId`s are sorted in ascending order if an `after` offset or no offset is provided. If only a `before` offset is provided, then the records are sorted in descending order. The `after` offset parameter will take precedence over the `before` offset in a case where both are provided.

Parameters:

  • list_id (String)

    The **ILS ID** of the list.

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

    the optional parameters

Options Hash (opts):

  • :after (String)

    The paging offset token for the page that comes &#x60;after&#x60; the previously requested records. If provided, then the records in the response will be the records following the offset, sorted in ascending order. Takes precedence over the &#x60;before&#x60; offset.

  • :before (String)

    The paging offset token for the page that comes &#x60;before&#x60; the previously requested records. If provided, then the records in the response will be the records preceding the offset, sorted in descending order.

  • :limit (Integer)

    The number of records to return in the response. The maximum &#x60;limit&#x60; is 250. (default to 100)

Returns:



318
319
320
321
# File 'lib/hubspot/codegen/crm/lists/api/memberships_api.rb', line 318

def get_page(list_id, opts = {})
  data, _status_code, _headers = get_page_with_http_info(list_id, opts)
  data
end

#get_page_ordered_by_added_to_list_date(list_id, opts = {}) ⇒ ApiCollectionResponseJoinTimeAndRecordId

Fetch List Memberships Ordered by Added to List Date Fetch the memberships of a list in order sorted by the time the records were added to the list. The ‘recordId`s are sorted in ascending order if an `after` offset or no offset is provided. If only a `before` offset is provided, then the records are sorted in descending order. The `after` offset parameter will take precedence over the `before` offset in a case where both are provided.

Parameters:

  • list_id (String)

    The **ILS ID** of the list.

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

    the optional parameters

Options Hash (opts):

  • :after (String)

    The paging offset token for the page that comes &#x60;after&#x60; the previously requested records. If provided, then the records in the response will be the records following the offset, sorted in ascending order. Takes precedence over the &#x60;before&#x60; offset.

  • :before (String)

    The paging offset token for the page that comes &#x60;before&#x60; the previously requested records. If provided, then the records in the response will be the records preceding the offset, sorted in descending order.

  • :limit (Integer)

    The number of records to return in the response. The maximum &#x60;limit&#x60; is 250. (default to 100)

Returns:



390
391
392
393
# File 'lib/hubspot/codegen/crm/lists/api/memberships_api.rb', line 390

def get_page_ordered_by_added_to_list_date(list_id, opts = {})
  data, _status_code, _headers = get_page_ordered_by_added_to_list_date_with_http_info(list_id, opts)
  data
end

#get_page_ordered_by_added_to_list_date_with_http_info(list_id, opts = {}) ⇒ Array<(ApiCollectionResponseJoinTimeAndRecordId, Integer, Hash)>

Fetch List Memberships Ordered by Added to List Date Fetch the memberships of a list in order sorted by the time the records were added to the list. The &#x60;recordId&#x60;s are sorted in ascending order if an &#x60;after&#x60; offset or no offset is provided. If only a &#x60;before&#x60; offset is provided, then the records are sorted in descending order. The &#x60;after&#x60; offset parameter will take precedence over the &#x60;before&#x60; offset in a case where both are provided.

Parameters:

  • list_id (String)

    The **ILS ID** of the list.

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

    the optional parameters

Options Hash (opts):

  • :after (String)

    The paging offset token for the page that comes &#x60;after&#x60; the previously requested records. If provided, then the records in the response will be the records following the offset, sorted in ascending order. Takes precedence over the &#x60;before&#x60; offset.

  • :before (String)

    The paging offset token for the page that comes &#x60;before&#x60; the previously requested records. If provided, then the records in the response will be the records preceding the offset, sorted in descending order.

  • :limit (Integer)

    The number of records to return in the response. The maximum &#x60;limit&#x60; is 250. (default to 100)

Returns:



403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
# File 'lib/hubspot/codegen/crm/lists/api/memberships_api.rb', line 403

def get_page_ordered_by_added_to_list_date_with_http_info(list_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MembershipsApi.get_page_ordered_by_added_to_list_date ...'
  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 MembershipsApi.get_page_ordered_by_added_to_list_date"
  end
  # resource path
  local_var_path = '/crm/v3/lists/{listId}/memberships/join-order'.sub('{' + 'listId' + '}', CGI.escape(list_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
  query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].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[:debug_body]

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

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

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

#get_page_with_http_info(list_id, opts = {}) ⇒ Array<(ApiCollectionResponseJoinTimeAndRecordId, Integer, Hash)>

Fetch List Memberships Ordered by ID Fetch the memberships of a list in order sorted by the &#x60;recordId&#x60; of the records in the list. The &#x60;recordId&#x60;s are sorted in ascending order if an &#x60;after&#x60; offset or no offset is provided. If only a &#x60;before&#x60; offset is provided, then the records are sorted in descending order. The &#x60;after&#x60; offset parameter will take precedence over the &#x60;before&#x60; offset in a case where both are provided.

Parameters:

  • list_id (String)

    The **ILS ID** of the list.

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

    the optional parameters

Options Hash (opts):

  • :after (String)

    The paging offset token for the page that comes &#x60;after&#x60; the previously requested records. If provided, then the records in the response will be the records following the offset, sorted in ascending order. Takes precedence over the &#x60;before&#x60; offset.

  • :before (String)

    The paging offset token for the page that comes &#x60;before&#x60; the previously requested records. If provided, then the records in the response will be the records preceding the offset, sorted in descending order.

  • :limit (Integer)

    The number of records to return in the response. The maximum &#x60;limit&#x60; is 250. (default to 100)

Returns:



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

def get_page_with_http_info(list_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MembershipsApi.get_page ...'
  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 MembershipsApi.get_page"
  end
  # resource path
  local_var_path = '/crm/v3/lists/{listId}/memberships'.sub('{' + 'listId' + '}', CGI.escape(list_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
  query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].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[:debug_body]

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

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

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

#remove(list_id, request_body, opts = {}) ⇒ MembershipsUpdateResponse

Remove Records from a List Remove the records provided from the list. Records that do not exist or that are not members of the list are ignored. This endpoint only works for lists that have a ‘processingType` of `MANUAL` or `SNAPSHOT`.

Parameters:

  • list_id (String)

    The **ILS ID** of the &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60; list.

  • request_body (Array<String>)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



460
461
462
463
# File 'lib/hubspot/codegen/crm/lists/api/memberships_api.rb', line 460

def remove(list_id, request_body, opts = {})
  data, _status_code, _headers = remove_with_http_info(list_id, request_body, opts)
  data
end

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

Delete All Records from a List Remove all of the records from a list. ***Note:*** *The list is not deleted.* This endpoint only works for lists that have a ‘processingType` of `MANUAL` or `SNAPSHOT`. This endpoint only supports lists that have less than 100,000 memberships.

Parameters:

  • list_id (String)

    The **ILS ID** of the &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60; list.

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

    the optional parameters

Returns:

  • (nil)


533
534
535
536
# File 'lib/hubspot/codegen/crm/lists/api/memberships_api.rb', line 533

def remove_all(list_id, opts = {})
  remove_all_with_http_info(list_id, opts)
  nil
end

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

Delete All Records from a List Remove all of the records from a list. ***Note:*** *The list is not deleted.* This endpoint only works for lists that have a &#x60;processingType&#x60; of &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60;. This endpoint only supports lists that have less than 100,000 memberships.

Parameters:

  • list_id (String)

    The **ILS ID** of the &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60; list.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
# File 'lib/hubspot/codegen/crm/lists/api/memberships_api.rb', line 543

def remove_all_with_http_info(list_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MembershipsApi.remove_all ...'
  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 MembershipsApi.remove_all"
  end
  # resource path
  local_var_path = '/crm/v3/lists/{listId}/memberships'.sub('{' + 'listId' + '}', 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(['*/*'])

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

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

  # return_type
  return_type = opts[:debug_return_type]

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

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

#remove_with_http_info(list_id, request_body, opts = {}) ⇒ Array<(MembershipsUpdateResponse, Integer, Hash)>

Remove Records from a List Remove the records provided from the list. Records that do not exist or that are not members of the list are ignored. This endpoint only works for lists that have a &#x60;processingType&#x60; of &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60;.

Parameters:

  • list_id (String)

    The **ILS ID** of the &#x60;MANUAL&#x60; or &#x60;SNAPSHOT&#x60; list.

  • request_body (Array<String>)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    MembershipsUpdateResponse data, response status code and response headers



471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
# File 'lib/hubspot/codegen/crm/lists/api/memberships_api.rb', line 471

def remove_with_http_info(list_id, request_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MembershipsApi.remove ...'
  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 MembershipsApi.remove"
  end
  # verify the required parameter 'request_body' is set
  if @api_client.config.client_side_validation && request_body.nil?
    fail ArgumentError, "Missing the required parameter 'request_body' when calling MembershipsApi.remove"
  end
  # resource path
  local_var_path = '/crm/v3/lists/{listId}/memberships/remove'.sub('{' + 'listId' + '}', 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[:debug_body] || @api_client.object_to_http_body(request_body)

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

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

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