Class: PhoneComClient::MediaApi

Inherits:
Object
  • Object
show all
Defined in:
lib/phone_com_client/api/media_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ MediaApi

Returns a new instance of MediaApi.



19
20
21
# File 'lib/phone_com_client/api/media_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/phone_com_client/api/media_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_account_media_files(account_id, opts = {}) ⇒ MediaFull

Add a media object to your account that can be used as a greeting or hold music. Users may create a media by using the built-in Text-to-speech (TTS) facility or upload a file of their choice. (Note: The maximum size for media files or JSON objects included with a POST or PUT request is 10 MB) See Account Media for more info on the properties.

Parameters:

  • account_id

    Account ID

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

    the optional parameters

Options Hash (opts):

  • :json (String)

    Media extra parameters

  • :file (File)

    Media file

Returns:



29
30
31
32
# File 'lib/phone_com_client/api/media_api.rb', line 29

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

#create_account_media_files_with_http_info(account_id, opts = {}) ⇒ Array<(MediaFull, Fixnum, Hash)>

Add a media object to your account that can be used as a greeting or hold music. Users may create a media by using the built-in Text-to-speech (TTS) facility or upload a file of their choice. (Note: The maximum size for media files or JSON objects included with a POST or PUT request is 10 MB) See Account Media for more info on the properties.

Parameters:

  • account_id

    Account ID

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

    the optional parameters

Options Hash (opts):

  • :json (String)

    Media extra parameters

  • :file (File)

    Media file

Returns:

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

    MediaFull 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
# File 'lib/phone_com_client/api/media_api.rb', line 41

def (, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MediaApi.create_account_media_files ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling MediaApi.create_account_media_files"
  end
  # resource path
  local_var_path = '/accounts/{account_id}/media/files'.sub('{' + 'account_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(['multipart/form-data'])

  # form parameters
  form_params = {}
  form_params['json'] = opts[:'json'] if !opts[:'json'].nil?
  form_params['file'] = opts[:'file'] if !opts[:'file'].nil?

  # http body (model)
  post_body = nil
  auth_names = ['apiKey']
  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 => 'MediaFull')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MediaApi#create_account_media_files\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_account_media_tts(account_id, opts = {}) ⇒ MediaFull

Add a media object to your account that can be used as a greeting or hold music. Users may create a media by using the built-in Text-to-speech (TTS) facility or upload a file of their choice. (Note: The maximum size for media files or JSON objects included with a POST or PUT request is 10 MB) See Account Media for more info on the properties.

Parameters:

  • account_id

    Account ID

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

    the optional parameters

Options Hash (opts):

Returns:



88
89
90
91
# File 'lib/phone_com_client/api/media_api.rb', line 88

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

#create_account_media_tts_with_http_info(account_id, opts = {}) ⇒ Array<(MediaFull, Fixnum, Hash)>

Add a media object to your account that can be used as a greeting or hold music. Users may create a media by using the built-in Text-to-speech (TTS) facility or upload a file of their choice. (Note: The maximum size for media files or JSON objects included with a POST or PUT request is 10 MB) See Account Media for more info on the properties.

Parameters:

  • account_id

    Account ID

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

    the optional parameters

Options Hash (opts):

Returns:

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

    MediaFull data, response status code and response headers



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
131
132
133
134
135
136
137
# File 'lib/phone_com_client/api/media_api.rb', line 99

def (, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MediaApi.create_account_media_tts ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling MediaApi.create_account_media_tts"
  end
  # resource path
  local_var_path = '/accounts/{account_id}/media/tts'.sub('{' + 'account_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(opts[:'data'])
  auth_names = ['apiKey']
  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 => 'MediaFull')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MediaApi#create_account_media_tts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_account_media(account_id, media_id, opts = {}) ⇒ DeleteEntry

Delete an individual media record See Account Media for more info on the properties.

Parameters:

  • account_id

    Account ID

  • media_id

    Media ID

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

    the optional parameters

Returns:



144
145
146
147
# File 'lib/phone_com_client/api/media_api.rb', line 144

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

#delete_account_media_with_http_info(account_id, media_id, opts = {}) ⇒ Array<(DeleteEntry, Fixnum, Hash)>

Delete an individual media record See Account Media for more info on the properties.

Parameters:

  • account_id

    Account ID

  • media_id

    Media ID

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

    the optional parameters

Returns:

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

    DeleteEntry data, response status code and response headers



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
193
194
195
196
197
# File 'lib/phone_com_client/api/media_api.rb', line 155

def (, media_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MediaApi.delete_account_media ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling MediaApi.delete_account_media"
  end
  # verify the required parameter 'media_id' is set
  if @api_client.config.client_side_validation && media_id.nil?
    fail ArgumentError, "Missing the required parameter 'media_id' when calling MediaApi.delete_account_media"
  end
  # resource path
  local_var_path = '/accounts/{account_id}/media/{media_id}'.sub('{' + 'account_id' + '}', .to_s).sub('{' + 'media_id' + '}', media_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 = ['apiKey']
  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,
    :return_type => 'DeleteEntry')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MediaApi#delete_account_media\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_account_media(account_id, media_id, opts = {}) ⇒ MediaFull

Show details of an individual media recording (Greeting or Hold Music) Get individual media recording

Parameters:

  • account_id

    Account ID

  • media_id

    Media ID

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

    the optional parameters

Returns:



204
205
206
207
# File 'lib/phone_com_client/api/media_api.rb', line 204

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

#get_account_media_with_http_info(account_id, media_id, opts = {}) ⇒ Array<(MediaFull, Fixnum, Hash)>

Show details of an individual media recording (Greeting or Hold Music) Get individual media recording

Parameters:

  • account_id

    Account ID

  • media_id

    Media ID

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

    the optional parameters

Returns:

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

    MediaFull data, response status code and response headers



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
# File 'lib/phone_com_client/api/media_api.rb', line 215

def (, media_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MediaApi.get_account_media ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling MediaApi.get_account_media"
  end
  # verify the required parameter 'media_id' is set
  if @api_client.config.client_side_validation && media_id.nil?
    fail ArgumentError, "Missing the required parameter 'media_id' when calling MediaApi.get_account_media"
  end
  # resource path
  local_var_path = '/accounts/{account_id}/media/{media_id}'.sub('{' + 'account_id' + '}', .to_s).sub('{' + 'media_id' + '}', media_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 = ['apiKey']
  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 => 'MediaFull')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MediaApi#get_account_media\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_account_media(account_id, opts = {}) ⇒ ListMedia

Get a list of media recordings for an account. Get a list of media recordings for an account. See Account Media for more info on the properties. Note: This API is for users with Account Owner scope access token. Users with Extension User scope token should invoke the Extension level List Media API with the following definition: GET api.phone.com/v4/accounts/:account_id/extensions/:extension_id/media

Parameters:

  • account_id

    Account ID

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

    the optional parameters

Options Hash (opts):

  • :filters_id (Array<String>)

    ID filter

  • :filters_name (Array<String>)

    Name filter

  • :sort_id (String)

    ID sorting

  • :sort_name (String)

    Name sorting

  • :limit (Integer)

    Max results

  • :offset (Integer)

    Results to skip

  • :fields (String)

    Field set

Returns:



270
271
272
273
# File 'lib/phone_com_client/api/media_api.rb', line 270

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

#list_account_media_with_http_info(account_id, opts = {}) ⇒ Array<(ListMedia, Fixnum, Hash)>

Get a list of media recordings for an account. Get a list of media recordings for an account. See Account Media for more info on the properties. Note: This API is for users with Account Owner scope access token. Users with Extension User scope token should invoke the Extension level List Media API with the following definition: GET api.phone.com/v4/accounts/:account_id/extensions/:extension_id/media

Parameters:

  • account_id

    Account ID

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

    the optional parameters

Options Hash (opts):

  • :filters_id (Array<String>)

    ID filter

  • :filters_name (Array<String>)

    Name filter

  • :sort_id (String)

    ID sorting

  • :sort_name (String)

    Name sorting

  • :limit (Integer)

    Max results

  • :offset (Integer)

    Results to skip

  • :fields (String)

    Field set

Returns:

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

    ListMedia data, response status code and response headers



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
332
333
334
335
336
337
338
339
340
# File 'lib/phone_com_client/api/media_api.rb', line 287

def (, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MediaApi.list_account_media ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling MediaApi.list_account_media"
  end
  if @api_client.config.client_side_validation && !opts[:'sort_id'].nil? && opts[:'sort_id'] !~ Regexp.new(/asc|desc/)
    fail ArgumentError, "invalid value for 'opts[:\"sort_id\"]' when calling MediaApi.list_account_media, must conform to the pattern /asc|desc/."
  end

  if @api_client.config.client_side_validation && !opts[:'sort_name'].nil? && opts[:'sort_name'] !~ Regexp.new(/asc|desc/)
    fail ArgumentError, "invalid value for 'opts[:\"sort_name\"]' when calling MediaApi.list_account_media, must conform to the pattern /asc|desc/."
  end

  # resource path
  local_var_path = '/accounts/{account_id}/media'.sub('{' + 'account_id' + '}', .to_s)

  # query parameters
  query_params = {}
  query_params[:'filters[id]'] = @api_client.build_collection_param(opts[:'filters_id'], :multi) if !opts[:'filters_id'].nil?
  query_params[:'filters[name]'] = @api_client.build_collection_param(opts[:'filters_name'], :multi) if !opts[:'filters_name'].nil?
  query_params[:'sort[id]'] = opts[:'sort_id'] if !opts[:'sort_id'].nil?
  query_params[:'sort[name]'] = opts[:'sort_name'] if !opts[:'sort_name'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].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 = ['apiKey']
  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 => 'ListMedia')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MediaApi#list_account_media\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#replace_account_media_files(account_id, media_id, opts = {}) ⇒ MediaFull

Update a media object to your account. Note: The maximum size for media files or JSON objects included with a POST or PUT request is 10 MB. See Account Media for more info on the properties.

Parameters:

  • account_id

    Account ID

  • media_id

    Media ID

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

    the optional parameters

Options Hash (opts):

  • :json (String)

    Media extra parameters

  • :file (File)

    Media file

Returns:



349
350
351
352
# File 'lib/phone_com_client/api/media_api.rb', line 349

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

#replace_account_media_files_with_http_info(account_id, media_id, opts = {}) ⇒ Array<(MediaFull, Fixnum, Hash)>

Update a media object to your account. Note: The maximum size for media files or JSON objects included with a POST or PUT request is 10 MB. See Account Media for more info on the properties.

Parameters:

  • account_id

    Account ID

  • media_id

    Media ID

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

    the optional parameters

Options Hash (opts):

  • :json (String)

    Media extra parameters

  • :file (File)

    Media file

Returns:

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

    MediaFull data, response status code and response headers



362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
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
# File 'lib/phone_com_client/api/media_api.rb', line 362

def (, media_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MediaApi.replace_account_media_files ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling MediaApi.replace_account_media_files"
  end
  # verify the required parameter 'media_id' is set
  if @api_client.config.client_side_validation && media_id.nil?
    fail ArgumentError, "Missing the required parameter 'media_id' when calling MediaApi.replace_account_media_files"
  end
  # resource path
  local_var_path = '/accounts/{account_id}/media/files/{media_id}'.sub('{' + 'account_id' + '}', .to_s).sub('{' + 'media_id' + '}', media_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(['multipart/form-data'])

  # form parameters
  form_params = {}
  form_params['json'] = opts[:'json'] if !opts[:'json'].nil?
  form_params['file'] = opts[:'file'] if !opts[:'file'].nil?

  # http body (model)
  post_body = nil
  auth_names = ['apiKey']
  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,
    :return_type => 'MediaFull')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MediaApi#replace_account_media_files\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#replace_account_media_tts(account_id, media_id, opts = {}) ⇒ MediaFull

Update a media object to your account. Update a media object to your account. Note: The maximum size for media files or JSON objects included with a POST or PUT request is 10 MB. See Account Media for more info on the properties. Note: This API is for users with Account Owner scope access token. Users with Extension User scope token should invoke the Extension level Replace Media API with the following definition: PUT api.phone.com/v4/accounts/:account_id/extensions/:extension_id/media/:media_id

Parameters:

  • account_id

    Account ID

  • media_id

    Media ID

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

    the optional parameters

Options Hash (opts):

Returns:



414
415
416
417
# File 'lib/phone_com_client/api/media_api.rb', line 414

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

#replace_account_media_tts_with_http_info(account_id, media_id, opts = {}) ⇒ Array<(MediaFull, Fixnum, Hash)>

Update a media object to your account. Update a media object to your account. Note: The maximum size for media files or JSON objects included with a POST or PUT request is 10 MB. See Account Media for more info on the properties. Note: This API is for users with Account Owner scope access token. Users with Extension User scope token should invoke the Extension level Replace Media API with the following definition: PUT api.phone.com/v4/accounts/:account_id/extensions/:extension_id/media/:media_id

Parameters:

  • account_id

    Account ID

  • media_id

    Media ID

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

    the optional parameters

Options Hash (opts):

Returns:

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

    MediaFull data, response status code and response headers



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
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
# File 'lib/phone_com_client/api/media_api.rb', line 426

def (, media_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MediaApi.replace_account_media_tts ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling MediaApi.replace_account_media_tts"
  end
  # verify the required parameter 'media_id' is set
  if @api_client.config.client_side_validation && media_id.nil?
    fail ArgumentError, "Missing the required parameter 'media_id' when calling MediaApi.replace_account_media_tts"
  end
  # resource path
  local_var_path = '/accounts/{account_id}/media/tts/{media_id}'.sub('{' + 'account_id' + '}', .to_s).sub('{' + 'media_id' + '}', media_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(opts[:'data'])
  auth_names = ['apiKey']
  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,
    :return_type => 'MediaFull')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MediaApi#replace_account_media_tts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end