Skip to content

Commit

Permalink
SWI-5802 Update SDK Based on Recent Spec Changes (#146)
Browse files Browse the repository at this point in the history
* Generate SDK with OpenAPI Generator Version 7.7.0

* Clean SDK using Rubocop

* add unit tests

---------

Co-authored-by: DX-Bandwidth <[email protected]>
Co-authored-by: ckoegel <[email protected]>
  • Loading branch information
3 people authored Aug 12, 2024
1 parent 20bd10d commit 5d9dffa
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 12 deletions.
8 changes: 8 additions & 0 deletions bandwidth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2802,6 +2802,8 @@ components:
$ref: '#/components/schemas/mediaUrl'
transcription:
$ref: '#/components/schemas/recordingTranscriptionMetadata'
recordingName:
$ref: '#/components/schemas/recordingName'
conference:
type: object
properties:
Expand Down Expand Up @@ -3041,6 +3043,8 @@ components:
$ref: '#/components/schemas/status'
mediaUrl:
$ref: '#/components/schemas/mediaUrl'
recordingName:
$ref: '#/components/schemas/recordingName'
machineDetectionConfiguration:
type: object
description: >-
Expand Down Expand Up @@ -4266,6 +4270,10 @@ components:
type: string
description: The call id associated with the event.
example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85
recordingName:
type: string
description: A name to identify this recording.
example: my-recording-name
callUrl:
type: string
description: The URL of the call associated with the event.
Expand Down
4 changes: 3 additions & 1 deletion docs/CallRecordingMetadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
| **status** | **String** | The current status of the process. For recording, current possible values are &#39;processing&#39;, &#39;partial&#39;, &#39;complete&#39;, &#39;deleted&#39;, and &#39;error&#39;. For transcriptions, current possible values are &#39;none&#39;, &#39;processing&#39;, &#39;available&#39;, &#39;error&#39;, &#39;timeout&#39;, &#39;file-size-too-big&#39;, and &#39;file-size-too-small&#39;. Additional states may be added in the future, so your application must be tolerant of unknown values. | [optional] |
| **media_url** | **String** | The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. | [optional] |
| **transcription** | [**RecordingTranscriptionMetadata**](RecordingTranscriptionMetadata.md) | | [optional] |
| **recording_name** | **String** | A name to identify this recording. | [optional] |

## Example

Expand All @@ -46,7 +47,8 @@ instance = Bandwidth::CallRecordingMetadata.new(
file_format: null,
status: completed,
media_url: https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9/recordings/r-fbe05094-9fd2afe9-bf5b-4c68-820a-41a01c1c5833/media,
transcription: null
transcription: null,
recording_name: my-recording-name
)
```

4 changes: 3 additions & 1 deletion docs/ConferenceRecordingMetadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
| **file_format** | [**FileFormatEnum**](FileFormatEnum.md) | | [optional] |
| **status** | **String** | The current status of the process. For recording, current possible values are &#39;processing&#39;, &#39;partial&#39;, &#39;complete&#39;, &#39;deleted&#39;, and &#39;error&#39;. For transcriptions, current possible values are &#39;none&#39;, &#39;processing&#39;, &#39;available&#39;, &#39;error&#39;, &#39;timeout&#39;, &#39;file-size-too-big&#39;, and &#39;file-size-too-small&#39;. Additional states may be added in the future, so your application must be tolerant of unknown values. | [optional] |
| **media_url** | **String** | The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. | [optional] |
| **recording_name** | **String** | A name to identify this recording. | [optional] |

## Example

Expand All @@ -32,7 +33,8 @@ instance = Bandwidth::ConferenceRecordingMetadata.new(
end_time: 2022-06-17T22:20Z,
file_format: null,
status: completed,
media_url: https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9/recordings/r-fbe05094-9fd2afe9-bf5b-4c68-820a-41a01c1c5833/media
media_url: https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9/recordings/r-fbe05094-9fd2afe9-bf5b-4c68-820a-41a01c1c5833/media,
recording_name: my-recording-name
)
```

20 changes: 15 additions & 5 deletions lib/bandwidth-sdk/models/call_recording_metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ class CallRecordingMetadata

attr_accessor :transcription

# A name to identify this recording.
attr_accessor :recording_name

class EnumAttributeValidator
attr_reader :datatype
attr_reader :allowable_values
Expand Down Expand Up @@ -108,7 +111,8 @@ def self.attribute_map
:'file_format' => :'fileFormat',
:'status' => :'status',
:'media_url' => :'mediaUrl',
:'transcription' => :'transcription'
:'transcription' => :'transcription',
:'recording_name' => :'recordingName'
}
end

Expand Down Expand Up @@ -137,15 +141,16 @@ def self.openapi_types
:'file_format' => :'FileFormatEnum',
:'status' => :'String',
:'media_url' => :'String',
:'transcription' => :'RecordingTranscriptionMetadata'
:'transcription' => :'RecordingTranscriptionMetadata',
:'recording_name' => :'String'
}
end

# List of attributes with nullable: true
def self.openapi_nullable
Set.new([
:'media_url',
:'transcription'
:'transcription',
])
end

Expand Down Expand Up @@ -235,6 +240,10 @@ def initialize(attributes = {})
if attributes.key?(:'transcription')
self.transcription = attributes[:'transcription']
end

if attributes.key?(:'recording_name')
self.recording_name = attributes[:'recording_name']
end
end

# Show invalid properties with the reasons. Usually used together with valid?
Expand Down Expand Up @@ -274,7 +283,8 @@ def ==(o)
file_format == o.file_format &&
status == o.status &&
media_url == o.media_url &&
transcription == o.transcription
transcription == o.transcription &&
recording_name == o.recording_name
end

# @see the `==` method
Expand All @@ -286,7 +296,7 @@ def eql?(o)
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
[application_id, account_id, call_id, parent_call_id, recording_id, to, from, transfer_caller_id, transfer_to, duration, direction, channels, start_time, end_time, file_format, status, media_url, transcription].hash
[application_id, account_id, call_id, parent_call_id, recording_id, to, from, transfer_caller_id, transfer_to, duration, direction, channels, start_time, end_time, file_format, status, media_url, transcription, recording_name].hash
end

# Builds the object from hash
Expand Down
20 changes: 15 additions & 5 deletions lib/bandwidth-sdk/models/conference_recording_metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ class ConferenceRecordingMetadata
# The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded.
attr_accessor :media_url

# A name to identify this recording.
attr_accessor :recording_name

class EnumAttributeValidator
attr_reader :datatype
attr_reader :allowable_values
Expand Down Expand Up @@ -82,7 +85,8 @@ def self.attribute_map
:'end_time' => :'endTime',
:'file_format' => :'fileFormat',
:'status' => :'status',
:'media_url' => :'mediaUrl'
:'media_url' => :'mediaUrl',
:'recording_name' => :'recordingName'
}
end

Expand All @@ -104,14 +108,15 @@ def self.openapi_types
:'end_time' => :'Time',
:'file_format' => :'FileFormatEnum',
:'status' => :'String',
:'media_url' => :'String'
:'media_url' => :'String',
:'recording_name' => :'String'
}
end

# List of attributes with nullable: true
def self.openapi_nullable
Set.new([
:'media_url'
:'media_url',
])
end

Expand Down Expand Up @@ -173,6 +178,10 @@ def initialize(attributes = {})
if attributes.key?(:'media_url')
self.media_url = attributes[:'media_url']
end

if attributes.key?(:'recording_name')
self.recording_name = attributes[:'recording_name']
end
end

# Show invalid properties with the reasons. Usually used together with valid?
Expand Down Expand Up @@ -205,7 +214,8 @@ def ==(o)
end_time == o.end_time &&
file_format == o.file_format &&
status == o.status &&
media_url == o.media_url
media_url == o.media_url &&
recording_name == o.recording_name
end

# @see the `==` method
Expand All @@ -217,7 +227,7 @@ def eql?(o)
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
[account_id, conference_id, name, recording_id, duration, channels, start_time, end_time, file_format, status, media_url].hash
[account_id, conference_id, name, recording_id, duration, channels, start_time, end_time, file_format, status, media_url, recording_name].hash
end

# Builds the object from hash
Expand Down
3 changes: 3 additions & 0 deletions spec/unit/api/recordings_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
expect(data.transcription.status).to be_instance_of(String)
expect(data.transcription.completed_time).to be_instance_of(Time)
expect(data.transcription.url).to start_with('http')
expect(data.recording_name).to be_instance_of(String)
end if false # skip due to prism error

it 'causes an ArgumentError for a missing account_id' do
Expand Down Expand Up @@ -243,6 +244,7 @@
expect(data[0].transcription.status).to be_instance_of(String)
expect(data[0].transcription.completed_time).to be_instance_of(Time)
expect(data[0].transcription.url).to start_with('http')
expect(data[0].recording_name).to be_instance_of(String)
end

it 'causes an ArgumentError for a missing account_id' do
Expand Down Expand Up @@ -282,6 +284,7 @@
expect(data[0].transcription.status).to be_instance_of(String)
expect(data[0].transcription.completed_time).to be_instance_of(Time)
expect(data[0].transcription.url).to start_with('http')
expect(data[0].recording_name).to be_instance_of(String)
end

it 'causes an ArgumentError for a missing account_id' do
Expand Down

0 comments on commit 5d9dffa

Please sign in to comment.