Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SWI-3663 Update SDK Based on Recent Spec Changes #110

Merged
merged 5 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*Bandwidth::CallsApi* | [**create_call**](docs/CallsApi.md#create_call) | **POST** /accounts/{accountId}/calls | Create Call
*Bandwidth::CallsApi* | [**get_call_state**](docs/CallsApi.md#get_call_state) | **GET** /accounts/{accountId}/calls/{callId} | Get Call State Information
*Bandwidth::CallsApi* | [**list_calls**](docs/CallsApi.md#list_calls) | **GET** /accounts/{accountId}/calls | Get Calls
*Bandwidth::CallsApi* | [**update_call**](docs/CallsApi.md#update_call) | **POST** /accounts/{accountId}/calls/{callId} | Update Call
*Bandwidth::CallsApi* | [**update_call_bxml**](docs/CallsApi.md#update_call_bxml) | **PUT** /accounts/{accountId}/calls/{callId}/bxml | Update Call BXML
*Bandwidth::ConferencesApi* | [**download_conference_recording**](docs/ConferencesApi.md#download_conference_recording) | **GET** /accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media | Download Conference Recording
Expand Down
94 changes: 94 additions & 0 deletions bandwidth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,52 @@ paths:
$ref: '#/components/responses/voiceTooManyRequestsError'
'500':
$ref: '#/components/responses/voiceInternalServerError'
get:
tags:
- Calls
summary: Get Calls
description: >-
Returns a max of 10000 calls, sorted by `createdTime` from oldest to
newest.


**NOTE:** If the number of calls in the account is bigger than
`pageSize`, a `Link` header (with format `<{url}>; rel="next"`) will be
returned in the response. The url can be used to retrieve the next page
of call records.

Also, call information is kept for 7 days after the calls are hung up.
If you attempt to retrieve information for a call that is older than 7
days, you will get an empty array [] in response.
operationId: listCalls
parameters:
- $ref: '#/components/parameters/accountId'
- $ref: '#/components/parameters/to'
- $ref: '#/components/parameters/from'
- $ref: '#/components/parameters/minStartTimeCalls'
- $ref: '#/components/parameters/maxStartTimeCalls'
- $ref: '#/components/parameters/disconnectCause'
- $ref: '#/components/parameters/pageSizeCalls'
- $ref: '#/components/parameters/pageToken1'
responses:
'200':
$ref: '#/components/responses/listCallsResponse'
'400':
$ref: '#/components/responses/voiceBadRequestError'
'401':
$ref: '#/components/responses/voiceUnauthorizedError'
'403':
$ref: '#/components/responses/voiceForbiddenError'
'404':
$ref: '#/components/responses/voiceNotFoundError'
'405':
$ref: '#/components/responses/voiceNotAllowedError'
'415':
$ref: '#/components/responses/voiceUnsupportedMediaTypeError'
'429':
$ref: '#/components/responses/voiceTooManyRequestsError'
'500':
$ref: '#/components/responses/voiceInternalServerError'
servers: &ref_1
- url: https://voice.bandwidth.com/api/v2
description: Production
Expand Down Expand Up @@ -4491,6 +4537,14 @@ components:
application/json:
schema:
$ref: '#/components/schemas/callState'
listCallsResponse:
description: Calls retrieved successfully
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/callState'
getStatisticsResponse:
description: Statistics Found
content:
Expand Down Expand Up @@ -5106,6 +5160,38 @@ components:
default: 1000
description: Specifies the max number of conferences that will be returned.
example: 500
minStartTimeCalls:
name: minStartTime
in: query
required: false
schema:
type: string
description: >-
Filter results to calls which have a `startTime` after or including
`minStartTime` (in ISO8601 format).
example: '2022-06-21T19:13:21Z'
maxStartTimeCalls:
name: maxStartTime
in: query
required: false
schema:
type: string
description: >-
Filter results to calls which have a `startTime` before or including
`maxStartTime` (in ISO8601 format).
example: '2022-06-21T19:13:21Z'
pageSizeCalls:
name: pageSize
in: query
required: false
schema:
type: integer
format: int32
minimum: 1
maximum: 10000
default: 1000
description: Specifies the max number of calls that will be returned.
example: 500
pageToken1:
name: pageToken
in: query
Expand All @@ -5116,6 +5202,14 @@ components:
Not intended for explicit use. To use pagination, follow the links in
the `Link` header of the response, as indicated in the endpoint
description.
disconnectCause:
name: disconnectCause
in: query
required: false
schema:
type: string
description: Filter results to calls with specified call Disconnect Cause.
example: hangup
requestId:
name: requestId
in: path
Expand Down
87 changes: 87 additions & 0 deletions docs/CallsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ All URIs are relative to *http://localhost*
| ------ | ------------ | ----------- |
| [**create_call**](CallsApi.md#create_call) | **POST** /accounts/{accountId}/calls | Create Call |
| [**get_call_state**](CallsApi.md#get_call_state) | **GET** /accounts/{accountId}/calls/{callId} | Get Call State Information |
| [**list_calls**](CallsApi.md#list_calls) | **GET** /accounts/{accountId}/calls | Get Calls |
| [**update_call**](CallsApi.md#update_call) | **POST** /accounts/{accountId}/calls/{callId} | Update Call |
| [**update_call_bxml**](CallsApi.md#update_call_bxml) | **PUT** /accounts/{accountId}/calls/{callId}/bxml | Update Call BXML |

Expand Down Expand Up @@ -154,6 +155,92 @@ end
- **Accept**: application/json


## list_calls

> <Array<CallState>> list_calls(account_id, opts)

Get Calls

Returns a max of 10000 calls, sorted by `createdTime` from oldest to newest. **NOTE:** If the number of calls in the account is bigger than `pageSize`, a `Link` header (with format `<{url}>; rel=\"next\"`) will be returned in the response. The url can be used to retrieve the next page of call records. Also, call information is kept for 7 days after the calls are hung up. If you attempt to retrieve information for a call that is older than 7 days, you will get an empty array [] in response.

### Examples

```ruby
require 'time'
require 'bandwidth-sdk'
# setup authorization
Bandwidth.configure do |config|
# Configure HTTP basic authorization: Basic
config.username = 'YOUR USERNAME'
config.password = 'YOUR PASSWORD'
end

api_instance = Bandwidth::CallsApi.new
account_id = '9900000' # String | Your Bandwidth Account ID.
opts = {
to: '%2b19195551234', # String | Filter results by the `to` field.
from: '%2b19195554321', # String | Filter results by the `from` field.
min_start_time: '2022-06-21T19:13:21Z', # String | Filter results to calls which have a `startTime` after or including `minStartTime` (in ISO8601 format).
max_start_time: '2022-06-21T19:13:21Z', # String | Filter results to calls which have a `startTime` before or including `maxStartTime` (in ISO8601 format).
disconnect_cause: 'hangup', # String | Filter results to calls with specified call Disconnect Cause.
page_size: 500, # Integer | Specifies the max number of calls that will be returned.
page_token: 'page_token_example' # String | Not intended for explicit use. To use pagination, follow the links in the `Link` header of the response, as indicated in the endpoint description.
}

begin
# Get Calls
result = api_instance.list_calls(account_id, opts)
p result
rescue Bandwidth::ApiError => e
puts "Error when calling CallsApi->list_calls: #{e}"
end
```

#### Using the list_calls_with_http_info variant

This returns an Array which contains the response data, status code and headers.

> <Array(<Array<CallState>>, Integer, Hash)> list_calls_with_http_info(account_id, opts)

```ruby
begin
# Get Calls
data, status_code, headers = api_instance.list_calls_with_http_info(account_id, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => <Array<CallState>>
rescue Bandwidth::ApiError => e
puts "Error when calling CallsApi->list_calls_with_http_info: #{e}"
end
```

### Parameters

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **account_id** | **String** | Your Bandwidth Account ID. | |
| **to** | **String** | Filter results by the &#x60;to&#x60; field. | [optional] |
| **from** | **String** | Filter results by the &#x60;from&#x60; field. | [optional] |
| **min_start_time** | **String** | Filter results to calls which have a &#x60;startTime&#x60; after or including &#x60;minStartTime&#x60; (in ISO8601 format). | [optional] |
| **max_start_time** | **String** | Filter results to calls which have a &#x60;startTime&#x60; before or including &#x60;maxStartTime&#x60; (in ISO8601 format). | [optional] |
| **disconnect_cause** | **String** | Filter results to calls with specified call Disconnect Cause. | [optional] |
| **page_size** | **Integer** | Specifies the max number of calls that will be returned. | [optional][default to 1000] |
| **page_token** | **String** | Not intended for explicit use. To use pagination, follow the links in the &#x60;Link&#x60; header of the response, as indicated in the endpoint description. | [optional] |

### Return type

[**Array&lt;CallState&gt;**](CallState.md)

### Authorization

[Basic](../README.md#Basic)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json


## update_call

> update_call(account_id, call_id, update_call)
Expand Down
92 changes: 92 additions & 0 deletions lib/bandwidth-sdk/api/calls_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,98 @@ def get_call_state_with_http_info(account_id, call_id, opts = {})
return data, status_code, headers
end

# Get Calls
# Returns a max of 10000 calls, sorted by `createdTime` from oldest to newest. **NOTE:** If the number of calls in the account is bigger than `pageSize`, a `Link` header (with format `<{url}>; rel=\"next\"`) will be returned in the response. The url can be used to retrieve the next page of call records. Also, call information is kept for 7 days after the calls are hung up. If you attempt to retrieve information for a call that is older than 7 days, you will get an empty array [] in response.
# @param account_id [String] Your Bandwidth Account ID.
# @param [Hash] opts the optional parameters
# @option opts [String] :to Filter results by the &#x60;to&#x60; field.
# @option opts [String] :from Filter results by the &#x60;from&#x60; field.
# @option opts [String] :min_start_time Filter results to calls which have a &#x60;startTime&#x60; after or including &#x60;minStartTime&#x60; (in ISO8601 format).
# @option opts [String] :max_start_time Filter results to calls which have a &#x60;startTime&#x60; before or including &#x60;maxStartTime&#x60; (in ISO8601 format).
# @option opts [String] :disconnect_cause Filter results to calls with specified call Disconnect Cause.
# @option opts [Integer] :page_size Specifies the max number of calls that will be returned. (default to 1000)
# @option opts [String] :page_token Not intended for explicit use. To use pagination, follow the links in the &#x60;Link&#x60; header of the response, as indicated in the endpoint description.
# @return [Array<CallState>]
def list_calls(account_id, opts = {})
data, _status_code, _headers = list_calls_with_http_info(account_id, opts)
data
end

# Get Calls
# Returns a max of 10000 calls, sorted by &#x60;createdTime&#x60; from oldest to newest. **NOTE:** If the number of calls in the account is bigger than &#x60;pageSize&#x60;, a &#x60;Link&#x60; header (with format &#x60;&lt;{url}&gt;; rel&#x3D;\&quot;next\&quot;&#x60;) will be returned in the response. The url can be used to retrieve the next page of call records. Also, call information is kept for 7 days after the calls are hung up. If you attempt to retrieve information for a call that is older than 7 days, you will get an empty array [] in response.
# @param account_id [String] Your Bandwidth Account ID.
# @param [Hash] opts the optional parameters
# @option opts [String] :to Filter results by the &#x60;to&#x60; field.
# @option opts [String] :from Filter results by the &#x60;from&#x60; field.
# @option opts [String] :min_start_time Filter results to calls which have a &#x60;startTime&#x60; after or including &#x60;minStartTime&#x60; (in ISO8601 format).
# @option opts [String] :max_start_time Filter results to calls which have a &#x60;startTime&#x60; before or including &#x60;maxStartTime&#x60; (in ISO8601 format).
# @option opts [String] :disconnect_cause Filter results to calls with specified call Disconnect Cause.
# @option opts [Integer] :page_size Specifies the max number of calls that will be returned. (default to 1000)
# @option opts [String] :page_token Not intended for explicit use. To use pagination, follow the links in the &#x60;Link&#x60; header of the response, as indicated in the endpoint description.
# @return [Array<(Array<CallState>, Integer, Hash)>] Array<CallState> data, response status code and response headers
def list_calls_with_http_info(account_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: CallsApi.list_calls ...'
end
# verify the required parameter 'account_id' is set
if @api_client.config.client_side_validation && account_id.nil?
fail ArgumentError, "Missing the required parameter 'account_id' when calling CallsApi.list_calls"
end
if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 10000
fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling CallsApi.list_calls, must be smaller than or equal to 10000.'
end

if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling CallsApi.list_calls, must be greater than or equal to 1.'
end

# resource path
local_var_path = '/accounts/{accountId}/calls'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))

# query parameters
query_params = opts[:query_params] || {}
query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?
query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
query_params[:'minStartTime'] = opts[:'min_start_time'] if !opts[:'min_start_time'].nil?
query_params[:'maxStartTime'] = opts[:'max_start_time'] if !opts[:'max_start_time'].nil?
query_params[:'disconnectCause'] = opts[:'disconnect_cause'] if !opts[:'disconnect_cause'].nil?
query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'pageToken'] = opts[:'page_token'] if !opts[:'page_token'].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] || 'Array<CallState>'

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

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

# Update Call
# Interrupts and redirects a call to a different URL that should return a BXML document.
# @param account_id [String] Your Bandwidth Account ID.
Expand Down
6 changes: 6 additions & 0 deletions lib/bandwidth-sdk/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,12 @@ def operation_server_settings
description: "Production",
}
],
"CallsApi.list_calls": [
{
url: "https://voice.bandwidth.com/api/v2",
description: "Production",
}
],
"CallsApi.update_call": [
{
url: "https://voice.bandwidth.com/api/v2",
Expand Down
Loading