Class: SibApiV3Sdk::ListsApi
- Inherits:
-
Object
- Object
- SibApiV3Sdk::ListsApi
- Defined in:
- lib/sib-api-v3-sdk/api/lists_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#add_contact_to_list(list_id, contact_emails, opts = {}) ⇒ PostContactInfo
Add existing contacts to a list.
-
#add_contact_to_list_with_http_info(list_id, contact_emails, opts = {}) ⇒ Array<(PostContactInfo, Fixnum, Hash)>
Add existing contacts to a list.
-
#create_list(create_list, opts = {}) ⇒ CreateModel
Create a list.
-
#create_list_with_http_info(create_list, opts = {}) ⇒ Array<(CreateModel, Fixnum, Hash)>
Create a list.
-
#delete_list(list_id, opts = {}) ⇒ nil
Delete a list.
-
#delete_list_with_http_info(list_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>
Delete a list.
-
#get_contacts_from_list(list_id, opts = {}) ⇒ GetContacts
Get contacts in a list.
-
#get_contacts_from_list_with_http_info(list_id, opts = {}) ⇒ Array<(GetContacts, Fixnum, Hash)>
Get contacts in a list.
-
#get_folder_lists(folder_id, opts = {}) ⇒ GetFolderLists
Get lists in a folder.
-
#get_folder_lists_with_http_info(folder_id, opts = {}) ⇒ Array<(GetFolderLists, Fixnum, Hash)>
Get lists in a folder.
-
#get_list(list_id, opts = {}) ⇒ GetExtendedList
Get a list’s details.
-
#get_list_with_http_info(list_id, opts = {}) ⇒ Array<(GetExtendedList, Fixnum, Hash)>
Get a list's details.
-
#get_lists(opts = {}) ⇒ GetLists
Get all the lists.
-
#get_lists_with_http_info(opts = {}) ⇒ Array<(GetLists, Fixnum, Hash)>
Get all the lists.
-
#initialize(api_client = ApiClient.default) ⇒ ListsApi
constructor
A new instance of ListsApi.
-
#remove_contact_from_list(list_id, contact_emails, opts = {}) ⇒ PostContactInfo
Delete a contact from a list.
-
#remove_contact_from_list_with_http_info(list_id, contact_emails, opts = {}) ⇒ Array<(PostContactInfo, Fixnum, Hash)>
Delete a contact from a list.
-
#setUserAgent(user_agent) ⇒ Object
Set custom user_agent if explicitly passed in api default will still remain Swagger-Codegen/#VERSION/ruby.
-
#update_list(list_id, update_list, opts = {}) ⇒ nil
Update a list.
-
#update_list_with_http_info(list_id, update_list, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>
Update a list.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/sib-api-v3-sdk/api/lists_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#add_contact_to_list(list_id, contact_emails, opts = {}) ⇒ PostContactInfo
Add existing contacts to a list
37 38 39 40 |
# File 'lib/sib-api-v3-sdk/api/lists_api.rb', line 37 def add_contact_to_list(list_id, contact_emails, opts = {}) data, _status_code, _headers = add_contact_to_list_with_http_info(list_id, contact_emails, opts) data end |
#add_contact_to_list_with_http_info(list_id, contact_emails, opts = {}) ⇒ Array<(PostContactInfo, Fixnum, Hash)>
Add existing contacts to a list
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 |
# File 'lib/sib-api-v3-sdk/api/lists_api.rb', line 47 def add_contact_to_list_with_http_info(list_id, contact_emails, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ListsApi.add_contact_to_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 ListsApi.add_contact_to_list" end # verify the required parameter 'contact_emails' is set if @api_client.config.client_side_validation && contact_emails.nil? fail ArgumentError, "Missing the required parameter 'contact_emails' when calling ListsApi.add_contact_to_list" end # resource path local_var_path = '/contacts/lists/{listId}/contacts/add'.sub('{' + 'listId' + '}', list_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(contact_emails) auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'PostContactInfo') if @api_client.config.debugging @api_client.config.logger.debug "API called: ListsApi#add_contact_to_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#create_list(create_list, opts = {}) ⇒ CreateModel
Create a list
94 95 96 97 |
# File 'lib/sib-api-v3-sdk/api/lists_api.rb', line 94 def create_list(create_list, opts = {}) data, _status_code, _headers = create_list_with_http_info(create_list, opts) data end |
#create_list_with_http_info(create_list, opts = {}) ⇒ Array<(CreateModel, Fixnum, Hash)>
Create a list
103 104 105 106 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 |
# File 'lib/sib-api-v3-sdk/api/lists_api.rb', line 103 def create_list_with_http_info(create_list, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ListsApi.create_list ...' end # verify the required parameter 'create_list' is set if @api_client.config.client_side_validation && create_list.nil? fail ArgumentError, "Missing the required parameter 'create_list' when calling ListsApi.create_list" end # resource path local_var_path = '/contacts/lists' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(create_list) auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CreateModel') if @api_client.config.debugging @api_client.config.logger.debug "API called: ListsApi#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 a list
146 147 148 149 |
# File 'lib/sib-api-v3-sdk/api/lists_api.rb', line 146 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, Fixnum, Hash)>
Delete a list
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/sib-api-v3-sdk/api/lists_api.rb', line 155 def delete_list_with_http_info(list_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ListsApi.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 ListsApi.delete_list" end # resource path local_var_path = '/contacts/lists/{listId}'.sub('{' + 'listId' + '}', list_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: ListsApi#delete_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_contacts_from_list(list_id, opts = {}) ⇒ GetContacts
Get contacts in a list
201 202 203 204 |
# File 'lib/sib-api-v3-sdk/api/lists_api.rb', line 201 def get_contacts_from_list(list_id, opts = {}) data, _status_code, _headers = get_contacts_from_list_with_http_info(list_id, opts) data end |
#get_contacts_from_list_with_http_info(list_id, opts = {}) ⇒ Array<(GetContacts, Fixnum, Hash)>
Get contacts in a list
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 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
# File 'lib/sib-api-v3-sdk/api/lists_api.rb', line 214 def get_contacts_from_list_with_http_info(list_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ListsApi.get_contacts_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 ListsApi.get_contacts_from_list" end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ListsApi.get_contacts_from_list, must be smaller than or equal to 500.' end if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort']) fail ArgumentError, 'invalid value for "sort", must be one of asc, desc' end # resource path local_var_path = '/contacts/lists/{listId}/contacts'.sub('{' + 'listId' + '}', list_id.to_s) # query parameters query_params = {} query_params[:'modifiedSince'] = opts[:'modified_since'] if !opts[:'modified_since'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'GetContacts') if @api_client.config.debugging @api_client.config.logger.debug "API called: ListsApi#get_contacts_from_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_folder_lists(folder_id, opts = {}) ⇒ GetFolderLists
Get lists in a folder
271 272 273 274 |
# File 'lib/sib-api-v3-sdk/api/lists_api.rb', line 271 def get_folder_lists(folder_id, opts = {}) data, _status_code, _headers = get_folder_lists_with_http_info(folder_id, opts) data end |
#get_folder_lists_with_http_info(folder_id, opts = {}) ⇒ Array<(GetFolderLists, Fixnum, Hash)>
Get lists in a folder
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
# File 'lib/sib-api-v3-sdk/api/lists_api.rb', line 283 def get_folder_lists_with_http_info(folder_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ListsApi.get_folder_lists ...' end # verify the required parameter 'folder_id' is set if @api_client.config.client_side_validation && folder_id.nil? fail ArgumentError, "Missing the required parameter 'folder_id' when calling ListsApi.get_folder_lists" end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 50 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ListsApi.get_folder_lists, must be smaller than or equal to 50.' end if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort']) fail ArgumentError, 'invalid value for "sort", must be one of asc, desc' end # resource path local_var_path = '/contacts/folders/{folderId}/lists'.sub('{' + 'folderId' + '}', folder_id.to_s) # query parameters query_params = {} query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'GetFolderLists') if @api_client.config.debugging @api_client.config.logger.debug "API called: ListsApi#get_folder_lists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_list(list_id, opts = {}) ⇒ GetExtendedList
Get a list’s details
336 337 338 339 |
# File 'lib/sib-api-v3-sdk/api/lists_api.rb', line 336 def get_list(list_id, opts = {}) data, _status_code, _headers = get_list_with_http_info(list_id, opts) data end |
#get_list_with_http_info(list_id, opts = {}) ⇒ Array<(GetExtendedList, Fixnum, Hash)>
Get a list's details
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 381 382 383 |
# File 'lib/sib-api-v3-sdk/api/lists_api.rb', line 345 def get_list_with_http_info(list_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ListsApi.get_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 ListsApi.get_list" end # resource path local_var_path = '/contacts/lists/{listId}'.sub('{' + 'listId' + '}', list_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'GetExtendedList') if @api_client.config.debugging @api_client.config.logger.debug "API called: ListsApi#get_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_lists(opts = {}) ⇒ GetLists
Get all the lists
390 391 392 393 |
# File 'lib/sib-api-v3-sdk/api/lists_api.rb', line 390 def get_lists(opts = {}) data, _status_code, _headers = get_lists_with_http_info(opts) data end |
#get_lists_with_http_info(opts = {}) ⇒ Array<(GetLists, Fixnum, Hash)>
Get all the lists
401 402 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 |
# File 'lib/sib-api-v3-sdk/api/lists_api.rb', line 401 def get_lists_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ListsApi.get_lists ...' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 50 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ListsApi.get_lists, must be smaller than or equal to 50.' end if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort']) fail ArgumentError, 'invalid value for "sort", must be one of asc, desc' end # resource path local_var_path = '/contacts/lists' # query parameters query_params = {} query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'GetLists') if @api_client.config.debugging @api_client.config.logger.debug "API called: ListsApi#get_lists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#remove_contact_from_list(list_id, contact_emails, opts = {}) ⇒ PostContactInfo
Delete a contact from a list
451 452 453 454 |
# File 'lib/sib-api-v3-sdk/api/lists_api.rb', line 451 def remove_contact_from_list(list_id, contact_emails, opts = {}) data, _status_code, _headers = remove_contact_from_list_with_http_info(list_id, contact_emails, opts) data end |
#remove_contact_from_list_with_http_info(list_id, contact_emails, opts = {}) ⇒ Array<(PostContactInfo, Fixnum, Hash)>
Delete a contact from a list
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 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 |
# File 'lib/sib-api-v3-sdk/api/lists_api.rb', line 461 def remove_contact_from_list_with_http_info(list_id, contact_emails, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ListsApi.remove_contact_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 ListsApi.remove_contact_from_list" end # verify the required parameter 'contact_emails' is set if @api_client.config.client_side_validation && contact_emails.nil? fail ArgumentError, "Missing the required parameter 'contact_emails' when calling ListsApi.remove_contact_from_list" end # resource path local_var_path = '/contacts/lists/{listId}/contacts/remove'.sub('{' + 'listId' + '}', list_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(contact_emails) auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'PostContactInfo') if @api_client.config.debugging @api_client.config.logger.debug "API called: ListsApi#remove_contact_from_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#setUserAgent(user_agent) ⇒ Object
Set custom user_agent if explicitly passed in api default will still remain Swagger-Codegen/#VERSION/ruby
25 26 27 28 29 30 |
# File 'lib/sib-api-v3-sdk/api/lists_api.rb', line 25 def setUserAgent(user_agent) @user_agent = user_agent if user_agent.is_a?(String) && user_agent.downcase.start_with?('sendinblue_') @api_client.default_headers['User-Agent'] = @user_agent end end |
#update_list(list_id, update_list, opts = {}) ⇒ nil
Update a list
509 510 511 512 |
# File 'lib/sib-api-v3-sdk/api/lists_api.rb', line 509 def update_list(list_id, update_list, opts = {}) update_list_with_http_info(list_id, update_list, opts) nil end |
#update_list_with_http_info(list_id, update_list, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>
Update a list
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 558 559 560 |
# File 'lib/sib-api-v3-sdk/api/lists_api.rb', line 519 def update_list_with_http_info(list_id, update_list, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ListsApi.update_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 ListsApi.update_list" end # verify the required parameter 'update_list' is set if @api_client.config.client_side_validation && update_list.nil? fail ArgumentError, "Missing the required parameter 'update_list' when calling ListsApi.update_list" end # resource path local_var_path = '/contacts/lists/{listId}'.sub('{' + 'listId' + '}', list_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(update_list) auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: ListsApi#update_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |