Class: SibApiV3Sdk::FoldersApi

Inherits:
Object
  • Object
show all
Defined in:
lib/sib-api-v3-sdk/api/folders_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ FoldersApi

Returns a new instance of FoldersApi.



19
20
21
# File 'lib/sib-api-v3-sdk/api/folders_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/sib-api-v3-sdk/api/folders_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_folder(create_folder, opts = {}) ⇒ CreateModel

Create a folder

Parameters:

  • create_folder

    Name of the folder

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

    the optional parameters

Returns:



28
29
30
31
# File 'lib/sib-api-v3-sdk/api/folders_api.rb', line 28

def create_folder(create_folder, opts = {})
  data, _status_code, _headers = create_folder_with_http_info(create_folder, opts)
  return data
end

#create_folder_with_http_info(create_folder, opts = {}) ⇒ Array<(CreateModel, Fixnum, Hash)>

Create a folder

Parameters:

  • create_folder

    Name of the folder

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

    the optional parameters

Returns:

  • (Array<(CreateModel, Fixnum, Hash)>)

    CreateModel data, response status code and response headers



38
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
# File 'lib/sib-api-v3-sdk/api/folders_api.rb', line 38

def create_folder_with_http_info(create_folder, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: FoldersApi.create_folder ..."
  end
  # verify the required parameter 'create_folder' is set
  if @api_client.config.client_side_validation && create_folder.nil?
    fail ArgumentError, "Missing the required parameter 'create_folder' when calling FoldersApi.create_folder"
  end
  # resource path
  local_var_path = "/contacts/folders"

  # 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_folder)
  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: FoldersApi#create_folder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_folder(folder_id, opts = {}) ⇒ nil

Delete a folder (and all its lists)

Parameters:

  • folder_id

    Id of the folder

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

    the optional parameters

Returns:

  • (nil)


83
84
85
86
# File 'lib/sib-api-v3-sdk/api/folders_api.rb', line 83

def delete_folder(folder_id, opts = {})
  delete_folder_with_http_info(folder_id, opts)
  return nil
end

#delete_folder_with_http_info(folder_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete a folder (and all its lists)

Parameters:

  • folder_id

    Id of the folder

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



93
94
95
96
97
98
99
100
101
102
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
# File 'lib/sib-api-v3-sdk/api/folders_api.rb', line 93

def delete_folder_with_http_info(folder_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: FoldersApi.delete_folder ..."
  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 FoldersApi.delete_folder"
  end
  # resource path
  local_var_path = "/contacts/folders/{folderId}".sub('{' + 'folderId' + '}', folder_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: FoldersApi#delete_folder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_folder(folder_id, opts = {}) ⇒ GetFolder

Returns folder details

Parameters:

  • folder_id

    id of the folder

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

    the optional parameters

Returns:



137
138
139
140
# File 'lib/sib-api-v3-sdk/api/folders_api.rb', line 137

def get_folder(folder_id, opts = {})
  data, _status_code, _headers = get_folder_with_http_info(folder_id, opts)
  return data
end

#get_folder_lists(folder_id, opts = {}) ⇒ GetFolderLists

Get the lists in a folder

Parameters:

  • folder_id

    Id of the folder

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Number of documents per page (default to 10)

  • :offset (Integer)

    Index of the first document of the page (default to 0)

Returns:



194
195
196
197
# File 'lib/sib-api-v3-sdk/api/folders_api.rb', line 194

def get_folder_lists(folder_id, opts = {})
  data, _status_code, _headers = get_folder_lists_with_http_info(folder_id, opts)
  return data
end

#get_folder_lists_with_http_info(folder_id, opts = {}) ⇒ Array<(GetFolderLists, Fixnum, Hash)>

Get the lists in a folder

Parameters:

  • folder_id

    Id of the folder

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Number of documents per page

  • :offset (Integer)

    Index of the first document of the page

Returns:

  • (Array<(GetFolderLists, Fixnum, Hash)>)

    GetFolderLists data, response status code and response headers



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
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/sib-api-v3-sdk/api/folders_api.rb', line 206

def get_folder_lists_with_http_info(folder_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: FoldersApi.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 FoldersApi.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 FoldersApi.get_folder_lists, must be smaller than or equal to 50.'
  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?

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

#get_folder_with_http_info(folder_id, opts = {}) ⇒ Array<(GetFolder, Fixnum, Hash)>

Returns folder details

Parameters:

  • folder_id

    id of the folder

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

    the optional parameters

Returns:

  • (Array<(GetFolder, Fixnum, Hash)>)

    GetFolder data, response status code and response headers



147
148
149
150
151
152
153
154
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
# File 'lib/sib-api-v3-sdk/api/folders_api.rb', line 147

def get_folder_with_http_info(folder_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: FoldersApi.get_folder ..."
  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 FoldersApi.get_folder"
  end
  # resource path
  local_var_path = "/contacts/folders/{folderId}".sub('{' + 'folderId' + '}', folder_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 => 'GetFolder')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FoldersApi#get_folder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_folders(limit, offset, opts = {}) ⇒ GetFolders

Get all the folders

Parameters:

  • limit

    Number of documents per page

  • offset

    Index of the first document of the page

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

    the optional parameters

Returns:



258
259
260
261
# File 'lib/sib-api-v3-sdk/api/folders_api.rb', line 258

def get_folders(limit, offset, opts = {})
  data, _status_code, _headers = get_folders_with_http_info(limit, offset, opts)
  return data
end

#get_folders_with_http_info(limit, offset, opts = {}) ⇒ Array<(GetFolders, Fixnum, Hash)>

Get all the folders

Parameters:

  • limit

    Number of documents per page

  • offset

    Index of the first document of the page

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

    the optional parameters

Returns:

  • (Array<(GetFolders, Fixnum, Hash)>)

    GetFolders data, response status code and response headers



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
309
310
311
312
313
314
315
316
317
# File 'lib/sib-api-v3-sdk/api/folders_api.rb', line 269

def get_folders_with_http_info(limit, offset, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: FoldersApi.get_folders ..."
  end
  # verify the required parameter 'limit' is set
  if @api_client.config.client_side_validation && limit.nil?
    fail ArgumentError, "Missing the required parameter 'limit' when calling FoldersApi.get_folders"
  end
  if @api_client.config.client_side_validation && limit > 50
    fail ArgumentError, 'invalid value for "limit" when calling FoldersApi.get_folders, must be smaller than or equal to 50.'
  end

  # verify the required parameter 'offset' is set
  if @api_client.config.client_side_validation && offset.nil?
    fail ArgumentError, "Missing the required parameter 'offset' when calling FoldersApi.get_folders"
  end
  # resource path
  local_var_path = "/contacts/folders"

  # query parameters
  query_params = {}
  query_params[:'limit'] = limit
  query_params[:'offset'] = offset

  # 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 => 'GetFolders')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FoldersApi#get_folders\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_folder(folder_id, update_folder, opts = {}) ⇒ nil

Update a contact folder

Parameters:

  • folder_id

    Id of the folder

  • update_folder

    Name of the folder

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

    the optional parameters

Returns:

  • (nil)


325
326
327
328
# File 'lib/sib-api-v3-sdk/api/folders_api.rb', line 325

def update_folder(folder_id, update_folder, opts = {})
  update_folder_with_http_info(folder_id, update_folder, opts)
  return nil
end

#update_folder_with_http_info(folder_id, update_folder, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Update a contact folder

Parameters:

  • folder_id

    Id of the folder

  • update_folder

    Name of the folder

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
# File 'lib/sib-api-v3-sdk/api/folders_api.rb', line 336

def update_folder_with_http_info(folder_id, update_folder, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: FoldersApi.update_folder ..."
  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 FoldersApi.update_folder"
  end
  # verify the required parameter 'update_folder' is set
  if @api_client.config.client_side_validation && update_folder.nil?
    fail ArgumentError, "Missing the required parameter 'update_folder' when calling FoldersApi.update_folder"
  end
  # resource path
  local_var_path = "/contacts/folders/{folderId}".sub('{' + 'folderId' + '}', folder_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_folder)
  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: FoldersApi#update_folder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end