Skip to content

Commit 72bb79f

Browse files
committed
Merge branch 'main' of github.com:viamrobotics/viam-python-sdk into audio
2 parents a07d042 + a09e916 commit 72bb79f

File tree

17 files changed

+488
-72
lines changed

17 files changed

+488
-72
lines changed

src/viam/app/billing_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ async def create_invoice_and_charge_immediately(
155155
156156
::
157157
158-
await billing_client.create_invoice_and_charge_immediately("<ORG-ID-TO-CHARGE>", <AMOUNT>, <DESCRIPTION>, "<ORG-ID-FOR-BRANDING>")
158+
await billing_client.create_invoice_and_charge_immediately("<ORG-ID-TO-CHARGE>", <AMOUNT>, <DESCRIPTION>, "<ORG-ID-FOR-BRANDING>", False)
159159
160160
Args:
161161
org_id_to_charge (str): the organization to charge

src/viam/gen/common/v1/common_pb2.py

Lines changed: 67 additions & 61 deletions
Large diffs are not rendered by default.

src/viam/gen/common/v1/common_pb2.pyi

Lines changed: 67 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,15 @@ class ResourceName(google.protobuf.message.Message):
4444
TYPE_FIELD_NUMBER: builtins.int
4545
SUBTYPE_FIELD_NUMBER: builtins.int
4646
NAME_FIELD_NUMBER: builtins.int
47-
REMOTE_PATH_FIELD_NUMBER: builtins.int
48-
LOCAL_NAME_FIELD_NUMBER: builtins.int
4947
namespace: builtins.str
5048
type: builtins.str
5149
subtype: builtins.str
5250
name: builtins.str
53-
local_name: builtins.str
5451

55-
@property
56-
def remote_path(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]:
57-
...
58-
59-
def __init__(self, *, namespace: builtins.str=..., type: builtins.str=..., subtype: builtins.str=..., name: builtins.str=..., remote_path: collections.abc.Iterable[builtins.str] | None=..., local_name: builtins.str=...) -> None:
52+
def __init__(self, *, namespace: builtins.str=..., type: builtins.str=..., subtype: builtins.str=..., name: builtins.str=...) -> None:
6053
...
6154

62-
def ClearField(self, field_name: typing.Literal['local_name', b'local_name', 'name', b'name', 'namespace', b'namespace', 'remote_path', b'remote_path', 'subtype', b'subtype', 'type', b'type']) -> None:
55+
def ClearField(self, field_name: typing.Literal['name', b'name', 'namespace', b'namespace', 'subtype', b'subtype', 'type', b'type']) -> None:
6356
...
6457
global___ResourceName = ResourceName
6558

@@ -713,6 +706,71 @@ class LogEntry(google.protobuf.message.Message):
713706
def ClearField(self, field_name: typing.Literal['caller', b'caller', 'fields', b'fields', 'host', b'host', 'level', b'level', 'logger_name', b'logger_name', 'message', b'message', 'stack', b'stack', 'time', b'time']) -> None:
714707
...
715708
global___LogEntry = LogEntry
709+
710+
@typing.final
711+
class AudioInfo(google.protobuf.message.Message):
712+
"""Information about an audio stream or device."""
713+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
714+
CODEC_FIELD_NUMBER: builtins.int
715+
SAMPLE_RATE_HZ_FIELD_NUMBER: builtins.int
716+
NUM_CHANNELS_FIELD_NUMBER: builtins.int
717+
codec: builtins.str
718+
'Audio codec used for the stream or device (e.g., "pcm16", "pcm32float", "mp3")'
719+
sample_rate_hz: builtins.int
720+
'Sample rate of the audio in Hz'
721+
num_channels: builtins.int
722+
'Number of audio channels in the recording or playback'
723+
724+
def __init__(self, *, codec: builtins.str=..., sample_rate_hz: builtins.int=..., num_channels: builtins.int=...) -> None:
725+
...
726+
727+
def ClearField(self, field_name: typing.Literal['codec', b'codec', 'num_channels', b'num_channels', 'sample_rate_hz', b'sample_rate_hz']) -> None:
728+
...
729+
global___AudioInfo = AudioInfo
730+
731+
@typing.final
732+
class GetPropertiesRequest(google.protobuf.message.Message):
733+
"""Shared properties for AudioIn and AudioOut components."""
734+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
735+
NAME_FIELD_NUMBER: builtins.int
736+
EXTRA_FIELD_NUMBER: builtins.int
737+
name: builtins.str
738+
739+
@property
740+
def extra(self) -> google.protobuf.struct_pb2.Struct:
741+
...
742+
743+
def __init__(self, *, name: builtins.str=..., extra: google.protobuf.struct_pb2.Struct | None=...) -> None:
744+
...
745+
746+
def HasField(self, field_name: typing.Literal['extra', b'extra']) -> builtins.bool:
747+
...
748+
749+
def ClearField(self, field_name: typing.Literal['extra', b'extra', 'name', b'name']) -> None:
750+
...
751+
global___GetPropertiesRequest = GetPropertiesRequest
752+
753+
@typing.final
754+
class GetPropertiesResponse(google.protobuf.message.Message):
755+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
756+
SUPPORTED_CODECS_FIELD_NUMBER: builtins.int
757+
SAMPLE_RATE_HZ_FIELD_NUMBER: builtins.int
758+
NUM_CHANNELS_FIELD_NUMBER: builtins.int
759+
sample_rate_hz: builtins.int
760+
'current sample rate in Hz'
761+
num_channels: builtins.int
762+
'Maximum number of audio channels supported (e.g., 1 for mono, 2 for stereo)'
763+
764+
@property
765+
def supported_codecs(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]:
766+
"""List of audio codecs supported by the system (e.g., "mp3", "pcm16", "pcm32float")"""
767+
768+
def __init__(self, *, supported_codecs: collections.abc.Iterable[builtins.str] | None=..., sample_rate_hz: builtins.int=..., num_channels: builtins.int=...) -> None:
769+
...
770+
771+
def ClearField(self, field_name: typing.Literal['num_channels', b'num_channels', 'sample_rate_hz', b'sample_rate_hz', 'supported_codecs', b'supported_codecs']) -> None:
772+
...
773+
global___GetPropertiesResponse = GetPropertiesResponse
716774
SAFETY_HEARTBEAT_MONITORED_FIELD_NUMBER: builtins.int
717775
safety_heartbeat_monitored: google.protobuf.internal.extension_dict._ExtensionFieldDescriptor[google.protobuf.descriptor_pb2.MethodOptions, builtins.bool]
718776
'safety_heartbeat_monitored is used on methods to signify that if a session is in use\nand the session was the last to call this method, the resource associated with the\nmethod will be stopped.\n'

src/viam/gen/component/audioin/__init__.py

Whitespace-only changes.

src/viam/gen/component/audioin/v1/__init__.py

Whitespace-only changes.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import abc
2+
import typing
3+
import grpclib.const
4+
import grpclib.client
5+
import grpclib.exceptions
6+
if typing.TYPE_CHECKING:
7+
import grpclib.server
8+
from .... import common
9+
import google.api.annotations_pb2
10+
import google.protobuf.struct_pb2
11+
from .... import component
12+
13+
class AudioInServiceBase(abc.ABC):
14+
15+
@abc.abstractmethod
16+
async def GetAudio(self, stream: 'grpclib.server.Stream[component.audioin.v1.audioin_pb2.GetAudioRequest, component.audioin.v1.audioin_pb2.GetAudioResponse]') -> None:
17+
pass
18+
19+
@abc.abstractmethod
20+
async def GetProperties(self, stream: 'grpclib.server.Stream[common.v1.common_pb2.GetPropertiesRequest, common.v1.common_pb2.GetPropertiesResponse]') -> None:
21+
pass
22+
23+
@abc.abstractmethod
24+
async def DoCommand(self, stream: 'grpclib.server.Stream[common.v1.common_pb2.DoCommandRequest, common.v1.common_pb2.DoCommandResponse]') -> None:
25+
pass
26+
27+
@abc.abstractmethod
28+
async def GetGeometries(self, stream: 'grpclib.server.Stream[common.v1.common_pb2.GetGeometriesRequest, common.v1.common_pb2.GetGeometriesResponse]') -> None:
29+
pass
30+
31+
def __mapping__(self) -> typing.Dict[str, grpclib.const.Handler]:
32+
return {'/viam.component.audioin.v1.AudioInService/GetAudio': grpclib.const.Handler(self.GetAudio, grpclib.const.Cardinality.UNARY_STREAM, component.audioin.v1.audioin_pb2.GetAudioRequest, component.audioin.v1.audioin_pb2.GetAudioResponse), '/viam.component.audioin.v1.AudioInService/GetProperties': grpclib.const.Handler(self.GetProperties, grpclib.const.Cardinality.UNARY_UNARY, common.v1.common_pb2.GetPropertiesRequest, common.v1.common_pb2.GetPropertiesResponse), '/viam.component.audioin.v1.AudioInService/DoCommand': grpclib.const.Handler(self.DoCommand, grpclib.const.Cardinality.UNARY_UNARY, common.v1.common_pb2.DoCommandRequest, common.v1.common_pb2.DoCommandResponse), '/viam.component.audioin.v1.AudioInService/GetGeometries': grpclib.const.Handler(self.GetGeometries, grpclib.const.Cardinality.UNARY_UNARY, common.v1.common_pb2.GetGeometriesRequest, common.v1.common_pb2.GetGeometriesResponse)}
33+
34+
class UnimplementedAudioInServiceBase(AudioInServiceBase):
35+
36+
async def GetAudio(self, stream: 'grpclib.server.Stream[component.audioin.v1.audioin_pb2.GetAudioRequest, component.audioin.v1.audioin_pb2.GetAudioResponse]') -> None:
37+
raise grpclib.exceptions.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
38+
39+
async def GetProperties(self, stream: 'grpclib.server.Stream[common.v1.common_pb2.GetPropertiesRequest, common.v1.common_pb2.GetPropertiesResponse]') -> None:
40+
raise grpclib.exceptions.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
41+
42+
async def DoCommand(self, stream: 'grpclib.server.Stream[common.v1.common_pb2.DoCommandRequest, common.v1.common_pb2.DoCommandResponse]') -> None:
43+
raise grpclib.exceptions.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
44+
45+
async def GetGeometries(self, stream: 'grpclib.server.Stream[common.v1.common_pb2.GetGeometriesRequest, common.v1.common_pb2.GetGeometriesResponse]') -> None:
46+
raise grpclib.exceptions.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
47+
48+
class AudioInServiceStub:
49+
50+
def __init__(self, channel: grpclib.client.Channel) -> None:
51+
self.GetAudio = grpclib.client.UnaryStreamMethod(channel, '/viam.component.audioin.v1.AudioInService/GetAudio', component.audioin.v1.audioin_pb2.GetAudioRequest, component.audioin.v1.audioin_pb2.GetAudioResponse)
52+
self.GetProperties = grpclib.client.UnaryUnaryMethod(channel, '/viam.component.audioin.v1.AudioInService/GetProperties', common.v1.common_pb2.GetPropertiesRequest, common.v1.common_pb2.GetPropertiesResponse)
53+
self.DoCommand = grpclib.client.UnaryUnaryMethod(channel, '/viam.component.audioin.v1.AudioInService/DoCommand', common.v1.common_pb2.DoCommandRequest, common.v1.common_pb2.DoCommandResponse)
54+
self.GetGeometries = grpclib.client.UnaryUnaryMethod(channel, '/viam.component.audioin.v1.AudioInService/GetGeometries', common.v1.common_pb2.GetGeometriesRequest, common.v1.common_pb2.GetGeometriesResponse)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"""Generated protocol buffer code."""
2+
from google.protobuf import descriptor as _descriptor
3+
from google.protobuf import descriptor_pool as _descriptor_pool
4+
from google.protobuf import runtime_version as _runtime_version
5+
from google.protobuf import symbol_database as _symbol_database
6+
from google.protobuf.internal import builder as _builder
7+
_runtime_version.ValidateProtobufRuntimeVersion(_runtime_version.Domain.PUBLIC, 5, 29, 2, '', 'component/audioin/v1/audioin.proto')
8+
_sym_db = _symbol_database.Default()
9+
from ....common.v1 import common_pb2 as common_dot_v1_dot_common__pb2
10+
from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2
11+
from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2
12+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n"component/audioin/v1/audioin.proto\x12\x19viam.component.audioin.v1\x1a\x16common/v1/common.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x1cgoogle/protobuf/struct.proto"\xfa\x01\n\x0fGetAudioRequest\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12)\n\x10duration_seconds\x18\x02 \x01(\x02R\x0fdurationSeconds\x12\x14\n\x05codec\x18\x03 \x01(\tR\x05codec\x12\x1d\n\nrequest_id\x18\x04 \x01(\tR\trequestId\x12D\n\x1eprevious_timestamp_nanoseconds\x18\x05 \x01(\x03R\x1cpreviousTimestampNanoseconds\x12-\n\x05extra\x18c \x01(\x0b2\x17.google.protobuf.StructR\x05extra"n\n\x10GetAudioResponse\x12;\n\x05audio\x18\x01 \x01(\x0b2%.viam.component.audioin.v1.AudioChunkR\x05audio\x12\x1d\n\nrequest_id\x18\x02 \x01(\tR\trequestId"\xfd\x01\n\nAudioChunk\x12\x1d\n\naudio_data\x18\x01 \x01(\x0cR\taudioData\x128\n\naudio_info\x18\x02 \x01(\x0b2\x19.viam.common.v1.AudioInfoR\taudioInfo\x12>\n\x1bstart_timestamp_nanoseconds\x18\x03 \x01(\x03R\x19startTimestampNanoseconds\x12:\n\x19end_timestamp_nanoseconds\x18\x04 \x01(\x03R\x17endTimestampNanoseconds\x12\x1a\n\x08sequence\x18\x05 \x01(\x05R\x08sequence2\xee\x04\n\x0eAudioInService\x12\x9e\x01\n\x08GetAudio\x12*.viam.component.audioin.v1.GetAudioRequest\x1a+.viam.component.audioin.v1.GetAudioResponse"7\x82\xd3\xe4\x93\x021\x12//viam/api/v1/component/audioin/{name}/get_audio0\x01\x12\x96\x01\n\rGetProperties\x12$.viam.common.v1.GetPropertiesRequest\x1a%.viam.common.v1.GetPropertiesResponse"8\x82\xd3\xe4\x93\x022\x120/viam/api/v1/component/audioin/{name}/properties\x12\x88\x01\n\tDoCommand\x12 .viam.common.v1.DoCommandRequest\x1a!.viam.common.v1.DoCommandResponse"6\x82\xd3\xe4\x93\x020"./viam/api/v1/service/audioin/{name}/do_command\x12\x96\x01\n\rGetGeometries\x12$.viam.common.v1.GetGeometriesRequest\x1a%.viam.common.v1.GetGeometriesResponse"8\x82\xd3\xe4\x93\x022\x120/viam/api/v1/component/audioin/{name}/geometriesBE\n\x1dcom.viam.component.audioin.v1Z$go.viam.com/api/component/audioin/v1b\x06proto3')
13+
_globals = globals()
14+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
15+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'component.audioin.v1.audioin_pb2', _globals)
16+
if not _descriptor._USE_C_DESCRIPTORS:
17+
_globals['DESCRIPTOR']._loaded_options = None
18+
_globals['DESCRIPTOR']._serialized_options = b'\n\x1dcom.viam.component.audioin.v1Z$go.viam.com/api/component/audioin/v1'
19+
_globals['_AUDIOINSERVICE'].methods_by_name['GetAudio']._loaded_options = None
20+
_globals['_AUDIOINSERVICE'].methods_by_name['GetAudio']._serialized_options = b'\x82\xd3\xe4\x93\x021\x12//viam/api/v1/component/audioin/{name}/get_audio'
21+
_globals['_AUDIOINSERVICE'].methods_by_name['GetProperties']._loaded_options = None
22+
_globals['_AUDIOINSERVICE'].methods_by_name['GetProperties']._serialized_options = b'\x82\xd3\xe4\x93\x022\x120/viam/api/v1/component/audioin/{name}/properties'
23+
_globals['_AUDIOINSERVICE'].methods_by_name['DoCommand']._loaded_options = None
24+
_globals['_AUDIOINSERVICE'].methods_by_name['DoCommand']._serialized_options = b'\x82\xd3\xe4\x93\x020"./viam/api/v1/service/audioin/{name}/do_command'
25+
_globals['_AUDIOINSERVICE'].methods_by_name['GetGeometries']._loaded_options = None
26+
_globals['_AUDIOINSERVICE'].methods_by_name['GetGeometries']._serialized_options = b'\x82\xd3\xe4\x93\x022\x120/viam/api/v1/component/audioin/{name}/geometries'
27+
_globals['_GETAUDIOREQUEST']._serialized_start = 150
28+
_globals['_GETAUDIOREQUEST']._serialized_end = 400
29+
_globals['_GETAUDIORESPONSE']._serialized_start = 402
30+
_globals['_GETAUDIORESPONSE']._serialized_end = 512
31+
_globals['_AUDIOCHUNK']._serialized_start = 515
32+
_globals['_AUDIOCHUNK']._serialized_end = 768
33+
_globals['_AUDIOINSERVICE']._serialized_start = 771
34+
_globals['_AUDIOINSERVICE']._serialized_end = 1393
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
"""
2+
@generated by mypy-protobuf. Do not edit manually!
3+
isort:skip_file
4+
"""
5+
import builtins
6+
from .... import common
7+
import google.protobuf.descriptor
8+
import google.protobuf.message
9+
import google.protobuf.struct_pb2
10+
import typing
11+
DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
12+
13+
@typing.final
14+
class GetAudioRequest(google.protobuf.message.Message):
15+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
16+
NAME_FIELD_NUMBER: builtins.int
17+
DURATION_SECONDS_FIELD_NUMBER: builtins.int
18+
CODEC_FIELD_NUMBER: builtins.int
19+
REQUEST_ID_FIELD_NUMBER: builtins.int
20+
PREVIOUS_TIMESTAMP_NANOSECONDS_FIELD_NUMBER: builtins.int
21+
EXTRA_FIELD_NUMBER: builtins.int
22+
name: builtins.str
23+
duration_seconds: builtins.float
24+
'Desired duration of audio stream\n If not set or set to 0, the stream is infinite\n '
25+
codec: builtins.str
26+
'Requested audio codec for the response (e.g., "mp3", "pcm16")'
27+
request_id: builtins.str
28+
"To match a request to it's responses"
29+
previous_timestamp_nanoseconds: builtins.int
30+
'Timestamp of the previous audio chunk, in nanoseconds, used for resuming and continuity.'
31+
32+
@property
33+
def extra(self) -> google.protobuf.struct_pb2.Struct:
34+
...
35+
36+
def __init__(self, *, name: builtins.str=..., duration_seconds: builtins.float=..., codec: builtins.str=..., request_id: builtins.str=..., previous_timestamp_nanoseconds: builtins.int=..., extra: google.protobuf.struct_pb2.Struct | None=...) -> None:
37+
...
38+
39+
def HasField(self, field_name: typing.Literal['extra', b'extra']) -> builtins.bool:
40+
...
41+
42+
def ClearField(self, field_name: typing.Literal['codec', b'codec', 'duration_seconds', b'duration_seconds', 'extra', b'extra', 'name', b'name', 'previous_timestamp_nanoseconds', b'previous_timestamp_nanoseconds', 'request_id', b'request_id']) -> None:
43+
...
44+
global___GetAudioRequest = GetAudioRequest
45+
46+
@typing.final
47+
class GetAudioResponse(google.protobuf.message.Message):
48+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
49+
AUDIO_FIELD_NUMBER: builtins.int
50+
REQUEST_ID_FIELD_NUMBER: builtins.int
51+
request_id: builtins.str
52+
53+
@property
54+
def audio(self) -> global___AudioChunk:
55+
...
56+
57+
def __init__(self, *, audio: global___AudioChunk | None=..., request_id: builtins.str=...) -> None:
58+
...
59+
60+
def HasField(self, field_name: typing.Literal['audio', b'audio']) -> builtins.bool:
61+
...
62+
63+
def ClearField(self, field_name: typing.Literal['audio', b'audio', 'request_id', b'request_id']) -> None:
64+
...
65+
global___GetAudioResponse = GetAudioResponse
66+
67+
@typing.final
68+
class AudioChunk(google.protobuf.message.Message):
69+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
70+
AUDIO_DATA_FIELD_NUMBER: builtins.int
71+
AUDIO_INFO_FIELD_NUMBER: builtins.int
72+
START_TIMESTAMP_NANOSECONDS_FIELD_NUMBER: builtins.int
73+
END_TIMESTAMP_NANOSECONDS_FIELD_NUMBER: builtins.int
74+
SEQUENCE_FIELD_NUMBER: builtins.int
75+
audio_data: builtins.bytes
76+
'Audio data for this chunk, encoded according to the requested codec.'
77+
start_timestamp_nanoseconds: builtins.int
78+
end_timestamp_nanoseconds: builtins.int
79+
sequence: builtins.int
80+
'Sequential chunk number'
81+
82+
@property
83+
def audio_info(self) -> common.v1.common_pb2.AudioInfo:
84+
"""Info about the audio stream for this chunk"""
85+
86+
def __init__(self, *, audio_data: builtins.bytes=..., audio_info: common.v1.common_pb2.AudioInfo | None=..., start_timestamp_nanoseconds: builtins.int=..., end_timestamp_nanoseconds: builtins.int=..., sequence: builtins.int=...) -> None:
87+
...
88+
89+
def HasField(self, field_name: typing.Literal['audio_info', b'audio_info']) -> builtins.bool:
90+
...
91+
92+
def ClearField(self, field_name: typing.Literal['audio_data', b'audio_data', 'audio_info', b'audio_info', 'end_timestamp_nanoseconds', b'end_timestamp_nanoseconds', 'sequence', b'sequence', 'start_timestamp_nanoseconds', b'start_timestamp_nanoseconds']) -> None:
93+
...
94+
global___AudioChunk = AudioChunk

src/viam/gen/component/audioout/__init__.py

Whitespace-only changes.

src/viam/gen/component/audioout/v1/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)