Skip to content

Commit 5986ec0

Browse files
committed
Generate SDK with OpenAPI Generator Version
1 parent 1bd47c6 commit 5986ec0

11 files changed

Lines changed: 237 additions & 4 deletions

.openapi-generator/FILES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ bandwidth/models/rbm_web_view_enum.py
172172
bandwidth/models/recording_available_callback.py
173173
bandwidth/models/recording_complete_callback.py
174174
bandwidth/models/recording_state_enum.py
175+
bandwidth/models/recording_transcription_clip.py
175176
bandwidth/models/recording_transcription_metadata.py
176177
bandwidth/models/recording_transcriptions.py
177178
bandwidth/models/redirect_callback.py
@@ -380,6 +381,7 @@ docs/RbmWebViewEnum.md
380381
docs/RecordingAvailableCallback.md
381382
docs/RecordingCompleteCallback.md
382383
docs/RecordingStateEnum.md
384+
docs/RecordingTranscriptionClip.md
383385
docs/RecordingTranscriptionMetadata.md
384386
docs/RecordingTranscriptions.md
385387
docs/RecordingsApi.md

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ Class | Method | HTTP request | Description
314314
- [RecordingAvailableCallback](docs/RecordingAvailableCallback.md)
315315
- [RecordingCompleteCallback](docs/RecordingCompleteCallback.md)
316316
- [RecordingStateEnum](docs/RecordingStateEnum.md)
317+
- [RecordingTranscriptionClip](docs/RecordingTranscriptionClip.md)
317318
- [RecordingTranscriptionMetadata](docs/RecordingTranscriptionMetadata.md)
318319
- [RecordingTranscriptions](docs/RecordingTranscriptions.md)
319320
- [RedirectCallback](docs/RedirectCallback.md)

bandwidth.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4354,6 +4354,72 @@ components:
43544354
type: array
43554355
items:
43564356
$ref: '#/components/schemas/transcription'
4357+
clips:
4358+
type: array
4359+
description: >-
4360+
A list of individual speech clips with speaker, timing, and
4361+
confidence information.
4362+
items:
4363+
$ref: '#/components/schemas/recordingTranscriptionClip'
4364+
example:
4365+
transcripts:
4366+
- speaker: 0
4367+
text: Hi, is Thursday at two still good for you? Perfect, talk soon.
4368+
confidence: 0.96
4369+
- speaker: 1
4370+
text: Yes, that works great. See you then! Sounds good, bye!
4371+
confidence: 0.97
4372+
clips:
4373+
- speaker: 0
4374+
text: Hi, is Thursday at two still good for you?
4375+
confidence: 0.97
4376+
startTimeSeconds: 0.4
4377+
endTimeSeconds: 3.1
4378+
- speaker: 1
4379+
text: Yes, that works great. See you then!
4380+
confidence: 0.95
4381+
startTimeSeconds: 3.8
4382+
endTimeSeconds: 6.2
4383+
- speaker: 0
4384+
text: Perfect, talk soon.
4385+
confidence: 0.94
4386+
startTimeSeconds: 6.9
4387+
endTimeSeconds: 8.1
4388+
- speaker: 1
4389+
text: Sounds good, bye!
4390+
confidence: 0.98
4391+
startTimeSeconds: 8.5
4392+
endTimeSeconds: 9.7
4393+
recordingTranscriptionClip:
4394+
type: object
4395+
properties:
4396+
speaker:
4397+
type: integer
4398+
description: Zero-based index identifying the speaker.
4399+
example: 0
4400+
text:
4401+
type: string
4402+
description: The transcribed text of this clip.
4403+
example: Hi there, thanks for calling!
4404+
confidence:
4405+
type: number
4406+
format: double
4407+
minimum: 0
4408+
maximum: 1
4409+
description: >-
4410+
How confident the transcription engine was in transcribing this clip
4411+
(from `0.0` to `1.0`).
4412+
example: 0.85
4413+
startTimeSeconds:
4414+
type: number
4415+
format: double
4416+
description: The start time of this clip within the recording, in seconds.
4417+
example: 2.3
4418+
endTimeSeconds:
4419+
type: number
4420+
format: double
4421+
description: The end time of this clip within the recording, in seconds.
4422+
example: 3.1
43574423
callTranscriptionMetadataList:
43584424
type: array
43594425
items:
@@ -5480,6 +5546,10 @@ components:
54805546
transcription:
54815547
type: object
54825548
properties:
5549+
speaker:
5550+
type: integer
5551+
description: Zero-based index identifying the speaker.
5552+
example: 0
54835553
text:
54845554
type: string
54855555
description: The transcribed text

bandwidth/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@
192192
"RecordingAvailableCallback",
193193
"RecordingCompleteCallback",
194194
"RecordingStateEnum",
195+
"RecordingTranscriptionClip",
195196
"RecordingTranscriptionMetadata",
196197
"RecordingTranscriptions",
197198
"RedirectCallback",
@@ -418,6 +419,7 @@
418419
from bandwidth.models.recording_available_callback import RecordingAvailableCallback as RecordingAvailableCallback
419420
from bandwidth.models.recording_complete_callback import RecordingCompleteCallback as RecordingCompleteCallback
420421
from bandwidth.models.recording_state_enum import RecordingStateEnum as RecordingStateEnum
422+
from bandwidth.models.recording_transcription_clip import RecordingTranscriptionClip as RecordingTranscriptionClip
421423
from bandwidth.models.recording_transcription_metadata import RecordingTranscriptionMetadata as RecordingTranscriptionMetadata
422424
from bandwidth.models.recording_transcriptions import RecordingTranscriptions as RecordingTranscriptions
423425
from bandwidth.models.redirect_callback import RedirectCallback as RedirectCallback

bandwidth/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@
166166
from bandwidth.models.recording_available_callback import RecordingAvailableCallback
167167
from bandwidth.models.recording_complete_callback import RecordingCompleteCallback
168168
from bandwidth.models.recording_state_enum import RecordingStateEnum
169+
from bandwidth.models.recording_transcription_clip import RecordingTranscriptionClip
169170
from bandwidth.models.recording_transcription_metadata import RecordingTranscriptionMetadata
170171
from bandwidth.models.recording_transcriptions import RecordingTranscriptions
171172
from bandwidth.models.redirect_callback import RedirectCallback
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# coding: utf-8
2+
3+
"""
4+
Bandwidth
5+
6+
Bandwidth's Communication APIs
7+
8+
The version of the OpenAPI document: 1.0.0
9+
Contact: letstalk@bandwidth.com
10+
Generated by OpenAPI Generator (https://openapi-generator.tech)
11+
12+
Do not edit the class manually.
13+
""" # noqa: E501
14+
15+
16+
from __future__ import annotations
17+
import pprint
18+
import re # noqa: F401
19+
import json
20+
21+
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr
22+
from typing import Any, ClassVar, Dict, List, Optional, Union
23+
from typing_extensions import Annotated
24+
from typing import Optional, Set
25+
from typing_extensions import Self
26+
27+
class RecordingTranscriptionClip(BaseModel):
28+
"""
29+
RecordingTranscriptionClip
30+
""" # noqa: E501
31+
speaker: Optional[StrictInt] = Field(default=None, description="Zero-based index identifying the speaker.")
32+
text: Optional[StrictStr] = Field(default=None, description="The transcribed text of this clip.")
33+
confidence: Optional[Union[Annotated[float, Field(le=1, strict=True, ge=0)], Annotated[int, Field(le=1, strict=True, ge=0)]]] = Field(default=None, description="How confident the transcription engine was in transcribing this clip (from `0.0` to `1.0`).")
34+
start_time_seconds: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The start time of this clip within the recording, in seconds.", alias="startTimeSeconds")
35+
end_time_seconds: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The end time of this clip within the recording, in seconds.", alias="endTimeSeconds")
36+
additional_properties: Dict[str, Any] = {}
37+
__properties: ClassVar[List[str]] = ["speaker", "text", "confidence", "startTimeSeconds", "endTimeSeconds"]
38+
39+
model_config = ConfigDict(
40+
populate_by_name=True,
41+
validate_assignment=True,
42+
protected_namespaces=(),
43+
)
44+
45+
46+
def to_str(self) -> str:
47+
"""Returns the string representation of the model using alias"""
48+
return pprint.pformat(self.model_dump(by_alias=True))
49+
50+
def to_json(self) -> str:
51+
"""Returns the JSON representation of the model using alias"""
52+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
53+
return json.dumps(self.to_dict())
54+
55+
@classmethod
56+
def from_json(cls, json_str: str) -> Optional[Self]:
57+
"""Create an instance of RecordingTranscriptionClip from a JSON string"""
58+
return cls.from_dict(json.loads(json_str))
59+
60+
def to_dict(self) -> Dict[str, Any]:
61+
"""Return the dictionary representation of the model using alias.
62+
63+
This has the following differences from calling pydantic's
64+
`self.model_dump(by_alias=True)`:
65+
66+
* `None` is only added to the output dict for nullable fields that
67+
were set at model initialization. Other fields with value `None`
68+
are ignored.
69+
* Fields in `self.additional_properties` are added to the output dict.
70+
"""
71+
excluded_fields: Set[str] = set([
72+
"additional_properties",
73+
])
74+
75+
_dict = self.model_dump(
76+
by_alias=True,
77+
exclude=excluded_fields,
78+
exclude_none=True,
79+
)
80+
# puts key-value pairs in additional_properties in the top level
81+
if self.additional_properties is not None:
82+
for _key, _value in self.additional_properties.items():
83+
_dict[_key] = _value
84+
85+
return _dict
86+
87+
@classmethod
88+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
89+
"""Create an instance of RecordingTranscriptionClip from a dict"""
90+
if obj is None:
91+
return None
92+
93+
if not isinstance(obj, dict):
94+
return cls.model_validate(obj)
95+
96+
_obj = cls.model_validate({
97+
"speaker": obj.get("speaker"),
98+
"text": obj.get("text"),
99+
"confidence": obj.get("confidence"),
100+
"startTimeSeconds": obj.get("startTimeSeconds"),
101+
"endTimeSeconds": obj.get("endTimeSeconds")
102+
})
103+
# store additional fields in additional_properties
104+
for _key in obj.keys():
105+
if _key not in cls.__properties:
106+
_obj.additional_properties[_key] = obj.get(_key)
107+
108+
return _obj
109+
110+

bandwidth/models/recording_transcriptions.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
import re # noqa: F401
1919
import json
2020

21-
from pydantic import BaseModel, ConfigDict
21+
from pydantic import BaseModel, ConfigDict, Field
2222
from typing import Any, ClassVar, Dict, List, Optional
23+
from bandwidth.models.recording_transcription_clip import RecordingTranscriptionClip
2324
from bandwidth.models.transcription import Transcription
2425
from typing import Optional, Set
2526
from typing_extensions import Self
@@ -29,8 +30,9 @@ class RecordingTranscriptions(BaseModel):
2930
RecordingTranscriptions
3031
""" # noqa: E501
3132
transcripts: Optional[List[Transcription]] = None
33+
clips: Optional[List[RecordingTranscriptionClip]] = Field(default=None, description="A list of individual speech clips with speaker, timing, and confidence information.")
3234
additional_properties: Dict[str, Any] = {}
33-
__properties: ClassVar[List[str]] = ["transcripts"]
35+
__properties: ClassVar[List[str]] = ["transcripts", "clips"]
3436

3537
model_config = ConfigDict(
3638
populate_by_name=True,
@@ -80,6 +82,13 @@ def to_dict(self) -> Dict[str, Any]:
8082
if _item_transcripts:
8183
_items.append(_item_transcripts.to_dict())
8284
_dict['transcripts'] = _items
85+
# override the default output from pydantic by calling `to_dict()` of each item in clips (list)
86+
_items = []
87+
if self.clips:
88+
for _item_clips in self.clips:
89+
if _item_clips:
90+
_items.append(_item_clips.to_dict())
91+
_dict['clips'] = _items
8392
# puts key-value pairs in additional_properties in the top level
8493
if self.additional_properties is not None:
8594
for _key, _value in self.additional_properties.items():
@@ -97,7 +106,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
97106
return cls.model_validate(obj)
98107

99108
_obj = cls.model_validate({
100-
"transcripts": [Transcription.from_dict(_item) for _item in obj["transcripts"]] if obj.get("transcripts") is not None else None
109+
"transcripts": [Transcription.from_dict(_item) for _item in obj["transcripts"]] if obj.get("transcripts") is not None else None,
110+
"clips": [RecordingTranscriptionClip.from_dict(_item) for _item in obj["clips"]] if obj.get("clips") is not None else None
101111
})
102112
# store additional fields in additional_properties
103113
for _key in obj.keys():

bandwidth/models/transcription.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ class Transcription(BaseModel):
2727
"""
2828
Transcription
2929
""" # noqa: E501
30+
speaker: Optional[StrictInt] = Field(default=None, description="Zero-based index identifying the speaker.")
3031
text: Optional[StrictStr] = Field(default=None, description="The transcribed text")
3132
confidence: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The confidence on the recognized content, ranging from `0.0` to `1.0` with `1.0` being the highest confidence.")
3233
additional_properties: Dict[str, Any] = {}
33-
__properties: ClassVar[List[str]] = ["text", "confidence"]
34+
__properties: ClassVar[List[str]] = ["speaker", "text", "confidence"]
3435

3536
model_config = ConfigDict(
3637
populate_by_name=True,
@@ -90,6 +91,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
9091
return cls.model_validate(obj)
9192

9293
_obj = cls.model_validate({
94+
"speaker": obj.get("speaker"),
9395
"text": obj.get("text"),
9496
"confidence": obj.get("confidence")
9597
})

docs/RecordingTranscriptionClip.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# RecordingTranscriptionClip
2+
3+
4+
## Properties
5+
6+
Name | Type | Description | Notes
7+
------------ | ------------- | ------------- | -------------
8+
**speaker** | **int** | Zero-based index identifying the speaker. | [optional]
9+
**text** | **str** | The transcribed text of this clip. | [optional]
10+
**confidence** | **float** | How confident the transcription engine was in transcribing this clip (from `0.0` to `1.0`). | [optional]
11+
**start_time_seconds** | **float** | The start time of this clip within the recording, in seconds. | [optional]
12+
**end_time_seconds** | **float** | The end time of this clip within the recording, in seconds. | [optional]
13+
14+
## Example
15+
16+
```python
17+
from bandwidth.models.recording_transcription_clip import RecordingTranscriptionClip
18+
19+
# TODO update the JSON string below
20+
json = "{}"
21+
# create an instance of RecordingTranscriptionClip from a JSON string
22+
recording_transcription_clip_instance = RecordingTranscriptionClip.from_json(json)
23+
# print the JSON string representation of the object
24+
print(RecordingTranscriptionClip.to_json())
25+
26+
# convert the object into a dict
27+
recording_transcription_clip_dict = recording_transcription_clip_instance.to_dict()
28+
# create an instance of RecordingTranscriptionClip from a dict
29+
recording_transcription_clip_from_dict = RecordingTranscriptionClip.from_dict(recording_transcription_clip_dict)
30+
```
31+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
32+
33+

docs/RecordingTranscriptions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Name | Type | Description | Notes
77
------------ | ------------- | ------------- | -------------
88
**transcripts** | [**List[Transcription]**](Transcription.md) | | [optional]
9+
**clips** | [**List[RecordingTranscriptionClip]**](RecordingTranscriptionClip.md) | A list of individual speech clips with speaker, timing, and confidence information. | [optional]
910

1011
## Example
1112

0 commit comments

Comments
 (0)