diff --git a/README.md b/README.md index a396166..6862bd4 100644 --- a/README.md +++ b/README.md @@ -10,13 +10,13 @@ The Mozart API is an async REST API with WebSocket notification channel for immediate state information from Mozart devices. Currently the API is distributed as a [Python package](https://pypi.org/project/mozart-api) and as an OpenAPI document that can be found in the [Github releases](https://github.com/bang-olufsen/mozart-open-api/releases). Supported by: +- [Beoconnect Core](https://www.bang-olufsen.com/en/dk/accessories/beoconnect-core) - [Beolab 8](https://www.bang-olufsen.com/en/dk/speakers/beolab-8) - [Beolab 28](https://www.bang-olufsen.com/en/dk/speakers/beolab-28) - [Beosound 2 3rd gen](https://www.bang-olufsen.com/en/dk/speakers/beosound-2) - [Beosound A5](https://www.bang-olufsen.com/en/dk/speakers/beosound-a5) - [Beosound A9 5th gen](https://www.bang-olufsen.com/en/dk/speakers/beosound-a9) - [Beosound Balance](https://www.bang-olufsen.com/en/dk/speakers/beosound-balance) -- [Beoconnect Core](https://www.bang-olufsen.com/en/dk/accessories/beoconnect-core) - [Beosound Emerge](https://www.bang-olufsen.com/en/dk/speakers/beosound-emerge) - [Beosound Level](https://www.bang-olufsen.com/en/dk/speakers/beosound-level) - [Beosound Theatre](https://www.bang-olufsen.com/en/dk/soundbars/beosound-theatre) diff --git a/docs/mozart-api.yaml b/docs/mozart-api.yaml index d22c238..1858e24 100644 --- a/docs/mozart-api.yaml +++ b/docs/mozart-api.yaml @@ -2500,6 +2500,24 @@ components: connected: type: boolean type: object + StandMovement: + properties: + angle: + format: float + nullable: true + type: number + ignoreEndstop: + example: false + type: boolean + standMotion: + enum: + - continuousCCW + - stepCCW + - stop + - stepCW + - continuousCW + type: string + type: object StandPosition: properties: angle: @@ -3837,20 +3855,20 @@ info: \ immediate state information from Mozart devices. Currently the API is distributed\ \ as a [Python package](https://pypi.org/project/mozart-api) and as an OpenAPI\ \ document that can be found in the [Github releases](https://github.com/bang-olufsen/mozart-open-api/releases).\n\ - \n\nSupported by:\n- [Beolab 8](https://www.bang-olufsen.com/en/dk/speakers/beolab-8)\n\ - - [Beolab 28](https://www.bang-olufsen.com/en/dk/speakers/beolab-28)\n- [Beosound\ + \n\nSupported by:\n- [Beoconnect Core](https://www.bang-olufsen.com/en/dk/accessories/beoconnect-core)\n\ + - [Beolab 8](https://www.bang-olufsen.com/en/dk/speakers/beolab-8)\n- [Beolab\ + \ 28](https://www.bang-olufsen.com/en/dk/speakers/beolab-28)\n- [Beosound\ \ 2 3rd gen](https://www.bang-olufsen.com/en/dk/speakers/beosound-2)\n- [Beosound\ \ A5](https://www.bang-olufsen.com/en/dk/speakers/beosound-a5)\n- [Beosound\ \ A9 5th gen](https://www.bang-olufsen.com/en/dk/speakers/beosound-a9)\n-\ \ [Beosound Balance](https://www.bang-olufsen.com/en/dk/speakers/beosound-balance)\n\ - - [Beoconnect Core](https://www.bang-olufsen.com/en/dk/accessories/beoconnect-core)\n\ - [Beosound Emerge](https://www.bang-olufsen.com/en/dk/speakers/beosound-emerge)\n\ - [Beosound Level](https://www.bang-olufsen.com/en/dk/speakers/beosound-level)\n\ - [Beosound Theatre](https://www.bang-olufsen.com/en/dk/soundbars/beosound-theatre)\n\ \n\nThis API documentation has been generated for version 3.4.1.8 of the Mozart\ - \ platform and API generation version 3.4.1.8.1.\n\n## Python API\n\nThe Python\ + \ platform and API generation version 3.4.1.8.2.\n\n## Python API\n\nThe Python\ \ package has been generated using the [OpenAPI Generator](https:/openapi-generator.tech/)\ - \ version 7.1.0. On top of the generated API, a helper file, mozart_client.py,\ + \ version 7.4.0. On top of the generated API, a helper file, mozart_client.py,\ \ has been made that makes the API more pythonic. We recommend using this.\n\ \nAnother file, mozart_cli.py, has been made for using the Mozart API in a\ \ simple CLI program. This has been set as the \"entry point\" for the Python\ @@ -5869,6 +5887,46 @@ paths: tags: - Sound - mozart + /api/v1/stand/move: + post: + description: |- + Use the `set-stand-movement` method in the Python package with one of: + ```mozart_client + await mozart_client.set_stand_movement() + ``` + ```mozart_api + await mozart_api.set_stand_movement() + ``` + ```stand_api + await stand_api.set_stand_movement() + ``` + operationId: set-stand-movement + parameters: + - description: Use slow speed on continuous movement + in: query + name: slow-speed + schema: + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/StandMovement' + description: Stand Movement + required: true + responses: + '204': + description: the movement were accepted + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: Stand not connected ot stand capability is not available + summary: Set stand movement with either an angle or a movement type + tags: + - Stand + - mozart /api/v1/state: get: description: |- diff --git a/mozart-api-3.4.1.8.yaml b/mozart-api-3.4.1.8.yaml new file mode 100755 index 0000000..af4da10 --- /dev/null +++ b/mozart-api-3.4.1.8.yaml @@ -0,0 +1,4371 @@ +components: + parameters: + ListeningModeID: + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/ListeningModeID' + responses: + BeolinkJoinResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/BeolinkJoinRequest' + description: 'Join started + + + Joining always happens asynchronously, use the `requestID` field in + + the response to match your request with a + + `WebsocketEventBeolinkJoinResult` web socket event. + + ' + MissingListeningMode: + description: No such listening mode + schemas: + Action: + description: "An action object. Examples:\n\nRadioAction:\n```json\n{\n\ + \ \"type\": \"radio\",\n \"radioStationId\": \"8779112938791514\"\ + \n}\n```\n\nToneAction:\n```json\n{\n \"type\": \"tone\",\n \"toneName\"\ + : \"alarm_2\"\n}\n```\n\nSourcePresetAction:\n```json\n{\n \"type\"\ + : \"sourcePreset\",\n \"source\": {\n \"value\": \"spotify\"\n\ + \ },\n \"presetKey\": \"Preset3\"\n}\n```\n\nDeezerFlowAction:\n\ + ```json\n{\n \"type\": \"deezerFlow\",\n \"deezerUserId\": \"1234\"\ + \n}\n```\n\nActivateSourceAction:\n```json\n{\n \"type\": \"activateSource\"\ + ,\n \"source\": {\n \"value\": \"spotify\"\n }\n}\n```\n\nPlayQueueAction:\n\ + ```\n {\n \"type\": \"playQueue\",\n \"queueItem\": {\n \ + \ \"provider\": {\n \"value\": \"deezer\"\n },\n \ + \ \"startNowFromPosition\": 0,\n \"type\": \"playlist\",\n\ + \ \"uri\": \"playlist:8074581462\"\n },\n \"queueSettings\"\ + : {\n \"consume\": false,\n \"repeat\": \"none\",\n \ + \ \"shuffle\": false\n }\n }\n```\n\nStandbyAction:\n```json\n\ + {\n \"type\": \"standby\"\n}\n```\n\nAllStandbyAction:\n```json\n\ + {\n \"type\": \"allStandby\"\n}\n```\n\nTouchToJoinAction:\n```json\n\ + {\n \"type\": \"touchToJoin\"\n}\n```\n\nButtonShortPressAction:\n\ + ```json\n{\n \"type\": \"buttonShortPress\",\n \"buttonName\": \"\ + preset1\"\n}\n```\n\nFallbackAction:\n```json\n{\n \"type\": \"fallback\"\ + \n}\n```\n\nVolumeAction:\n```json\n{\n \"type\": \"volume\",\n \ + \ \"volumeLevel\": 25\n}\n```\n\nStopAction:\n```json\n{\n \"type\"\ + : \"stop\",\n \"stopDuration\": 1300\n}\n```\n\nTriggerContentAction:\n\ + ```json\n{\n \"contentId\": \"tv://netflix\",\n \"type\": \"triggerContent\"\ + \n}\n```\n\nSpeakerGroupAction:\n```json\n{\n \"type\": \"speakerGroup\"\ + ,\n \"speakerGroupId\": \"00112233-4455-6677-8899-aabbccddeeff\"\n\ + }\n```\n\nListeningModeAction:\n```json\n{\n \"type\": \"listeningMode\"\ + ,\n \"listeningModeId\": 1234\n}\n```\n\nStandAction:\n```json\n\ + {\n \"type\": \"stand\",\n \"standPosition\": {\n \"angle\":\ + \ 7.5\n }\n}\n```\n\nGainAction:\n```json\n{\n \"type\": \"sourceGain\"\ + ,\n \"source\": {\n \"value\": \"spotify\"\n },\n \"gainDb\"\ + : 1.0\n}\n```\n" + properties: + buttonName: + description: Name of the Button used for button-press types ('buttonShortPress') + enum: + - preset1 + - preset2 + - preset3 + - preset4 + nullable: true + type: string + contentId: + description: Id of content only used for 'type=triggerContent' + nullable: true + type: string + deezerUserId: + description: Id of user only used for 'type=deezerFlow' and is + optional + format: '[0-9]+' + nullable: true + type: string + gainDb: + description: Only usef for 'type=sourceGain' + maximum: 12 + minimum: -12 + type: number + listeningModeId: + $ref: '#/components/schemas/ListeningModeID' + description: Only used for 'type=listeningMode' + nullable: true + presetKey: + description: Only used for 'type=sourcePreset' + format: ^Preset[0-9]+$ + nullable: true + type: string + queueItem: + $ref: '#/components/schemas/PlayQueueItem' + description: PlayQueue item only used for 'type=playQueue' + nullable: true + queueSettings: + $ref: '#/components/schemas/PlayQueueSettings' + description: PlayQueue settings only used for 'type=playQueue' + and is optional + nullable: true + radioStationId: + description: Id of RadioStation only used for 'type=radio' + format: '[0-9]+' + nullable: true + type: string + source: + $ref: '#/components/schemas/SourceTypeEnum' + nullable: true + speakerGroupId: + $ref: '#/components/schemas/SpeakerGroupId' + description: Only used for 'type=speakerGroup' + nullable: true + standPosition: + $ref: '#/components/schemas/StandPosition' + description: Only used for 'type=stand' + stopDuration: + description: The duration to wait (seconds) until stopping only + used for 'type=stop' + format: int32 + minimum: 0 + nullable: true + type: integer + toneName: + description: Name of the tone only used for 'type=tone' + enum: + - alarm_1 + - alarm_2 + nullable: true + type: string + type: + description: The type of Action + enum: + - standby + - tone + - radio + - sourcePreset + - deezerFlow + - activateSource + - playQueue + - buttonShortPress + - allStandby + - touchToJoin + - fallback + - volume + - stop + - triggerContent + - speakerGroup + - listeningMode + - stand + - sourceGain + type: string + volumeLevel: + description: The volume level to configure only used for 'type=volume' + format: int32 + maximum: 100 + minimum: 0 + nullable: true + type: integer + required: + - type + type: object + ActionList: + description: An ordered list of Actions to run on the product + example: + - type: volume + volumeLevel: 35 + - radioStationId: '8779112938791514' + type: radio + - stopDuration: 1300 + type: stop + items: + $ref: '#/components/schemas/Action' + type: array + AlarmId: + format: uuid + type: string + AlarmLabel: + description: Label for an alarm + maxLength: 128 + type: string + AlarmTimerEventData: + properties: + event: + enum: + - add + - update + - delete + type: string + id: + $ref: '#/components/schemas/AlarmId' + type: + enum: + - alarm + - timer + type: string + type: object + AlarmTriggeredInfo: + properties: + id: + $ref: '#/components/schemas/AlarmId' + label: + $ref: '#/components/schemas/AlarmLabel' + type: object + Ambience: + properties: + value: + description: Selected ambience value + format: double + type: number + required: + - value + type: object + AmbienceFeature: + allOf: + - $ref: '#/components/schemas/Ambience' + - $ref: '#/components/schemas/AmbienceRange' + AmbienceRange: + properties: + default: + $ref: '#/components/schemas/Ambience' + description: Product and role specific default ambience value + range: + description: Product and role specific ambience range + items: + $ref: '#/components/schemas/Ambience' + type: array + uniqueItems: true + required: + - default + - range + type: object + Art: + properties: + hasLocalImage: + type: boolean + key: + type: string + size: + type: string + type: + type: string + url: + type: string + type: object + Balance: + properties: + value: + description: Selected balance value + format: double + type: number + required: + - value + type: object + BalanceFeature: + allOf: + - $ref: '#/components/schemas/Balance' + - $ref: '#/components/schemas/BalanceRange' + BalanceRange: + properties: + default: + $ref: '#/components/schemas/Balance' + description: Default balance value + range: + description: balance range + items: + $ref: '#/components/schemas/Balance' + type: array + uniqueItems: true + required: + - default + - range + type: object + Bass: + properties: + value: + description: Selected bass value + format: int32 + type: integer + required: + - value + type: object + BassFeature: + allOf: + - $ref: '#/components/schemas/Bass' + - $ref: '#/components/schemas/BassRange' + BassManagement: + properties: + value: + description: Selected bass-management value + enum: + - 'on' + - 'off' + type: string + required: + - value + type: object + BassManagementFeature: + allOf: + - $ref: '#/components/schemas/BassManagement' + - $ref: '#/components/schemas/BassManagementRange' + BassManagementRange: + properties: + default: + $ref: '#/components/schemas/BassManagement' + description: Default bass-management value + range: + description: bass-management range + items: + $ref: '#/components/schemas/BassManagement' + type: array + uniqueItems: true + required: + - default + - range + type: object + BassRange: + properties: + default: + $ref: '#/components/schemas/Bass' + description: Product and role specific default bass value + range: + description: Product and role specific bass range + items: + $ref: '#/components/schemas/Bass' + type: array + uniqueItems: true + required: + - default + - range + type: object + BatteryState: + properties: + batteryLevel: + description: 'Batterylevel in percent + + ' + type: integer + isCharging: + type: boolean + remainingChargingTimeMinutes: + description: Remaining charging time in minutes + type: integer + remainingPlayingTimeMinutes: + description: Remaining playing time in minutes + type: integer + type: object + BeoRemoteButton: + properties: + Key: + type: string + Type: + enum: + - KeyPress + - KeyRelease + type: object + BeolinkAvailableListener: + properties: + jid: + $ref: '#/components/schemas/BeolinkPeerID' + required: + - jid + type: object + BeolinkExperience: + properties: + category: + description: Source category + enum: + - TV + - RADIO + - MUSIC + - MEDIA + - UNKNOWN + type: string + id: + description: experience id, e.g. "RADIO" or "toslink" + type: string + linkable: + description: Linkable means "Does pressing play on this source + make sense" + type: boolean + name: + description: Experience name, e.g. "Bluetooth" or "B&O Radio" + type: string + productFriendlyName: + description: Optional product friendly name + type: string + sourceFriendlyName: + description: Optional friendly name for source + type: string + type: + description: Source type. This corresponds to the exhaustive list + or sources provided by the control layer + type: string + uniqueSourceId: + description: The actual device jabber id that the experience comes + from + type: string + required: + - id + - name + - type + - category + - uniqueSourceId + - linkable + type: object + BeolinkExperiencesResult: + properties: + experiences: + items: + $ref: '#/components/schemas/BeolinkExperience' + type: array + requestID: + $ref: '#/components/schemas/BeolinkRequestID' + status: + description: 'Current scan status. + + * busy: there is another scan in progress + + * timeout: the scan timed out. The results will be partial + + ' + enum: + - ok + - busy + - timeout + type: string + required: + - requestID + - status + - experiences + type: object + BeolinkJoinRequest: + properties: + jid: + $ref: '#/components/schemas/BeolinkPeerID' + requestID: + $ref: '#/components/schemas/BeolinkRequestID' + result: + description: Relative URL of the join result + format: uri + type: string + required: + - requestID + - result + type: object + BeolinkJoinResult: + properties: + error: + description: Join error + enum: + - ok + - busy + - leaderless + - alone + - silent + - missing + - rejected + - timeout + type: string + jid: + $ref: '#/components/schemas/BeolinkPeerID' + requestID: + $ref: '#/components/schemas/BeolinkRequestID' + status: + description: Overall join status + enum: + - idle + - joined + - failed + type: string + type: + description: The type of join request this is a result of + enum: + - join + - joinRequested + - expand + - expandRequested + type: string + required: + - requestID + - status + - jid + - type + type: object + BeolinkLeader: + properties: + friendlyName: + type: string + jid: + $ref: '#/components/schemas/BeolinkPeerID' + required: + - jid + - friendlyName + type: object + BeolinkListener: + properties: + jid: + $ref: '#/components/schemas/BeolinkPeerID' + required: + - jid + type: object + BeolinkPeer: + properties: + friendlyName: + type: string + jid: + $ref: '#/components/schemas/BeolinkPeerID' + required: + - jid + - friendlyName + type: object + BeolinkPeerID: + description: Beolink peer ID + example: 2714.1200304.26451293@products.bang-olufsen.com + type: string + BeolinkRequestID: + description: Beolink request ID + example: 48985a4f-a4de-4b44-9757-c9a7407b8882 + format: uuid + type: string + BluetoothDevice: + properties: + address: + type: string + connected: + type: boolean + name: + type: string + type: object + BluetoothDeviceList: + properties: + items: + items: + $ref: '#/components/schemas/BluetoothDevice' + type: array + type: object + ButtonEvent: + properties: + button: + description: identifies the button + type: string + state: + description: identifies the state change + type: string + type: object + Compression: + properties: + value: + description: Selected compression value + enum: + - 'off' + - medium + - maximum + type: string + required: + - value + type: object + CompressionFeature: + allOf: + - $ref: '#/components/schemas/Compression' + - $ref: '#/components/schemas/CompressionRange' + CompressionRange: + properties: + default: + $ref: '#/components/schemas/Compression' + description: Default compression value + range: + description: compression range + items: + $ref: '#/components/schemas/Compression' + type: array + uniqueItems: true + required: + - default + - range + type: object + ContentCategoryList: + items: + enum: + - music + - movie + - tv + - hdmi + - app + type: string + type: array + ContentItem: + example: + contentUri: tv://netflix + label: Netflix + properties: + categories: + $ref: '#/components/schemas/ContentCategoryList' + nullable: true + contentUri: + type: string + label: + nullable: true + type: string + source: + $ref: '#/components/schemas/SourceTypeEnum' + required: + - contentUri + - source + type: object + ContentItemMap: + additionalProperties: + $ref: '#/components/schemas/ContentItem' + example: + 475169e4-32bb-59ad-b88d-a6d53c289838: + contentUri: tv://netflix + label: Netflix + type: object + Directivity: + properties: + value: + enum: + - front + - left + - right + - omni + - narrow + - wide + - standalone + type: string + required: + - value + type: object + DirectivityFeature: + allOf: + - $ref: '#/components/schemas/Directivity' + - $ref: '#/components/schemas/DirectivityRange' + DirectivityRange: + properties: + default: + $ref: '#/components/schemas/Directivity' + description: Product and role specific default directivity value + range: + description: Product and role specific list of directivities + items: + $ref: '#/components/schemas/Directivity' + type: array + uniqueItems: true + required: + - default + - range + type: object + ErrorModel: + description: the general error model + properties: + errorCode: + description: 'A wellknown code that signal the error, can be used + by callers + + ' + type: string + errorId: + description: 'A unique identifier used to e.g. quick find in logs + + ' + type: string + errorMessage: + description: 'A textual representation, human readable and suitable + for logs + + ' + type: string + type: object + Fader: + properties: + value: + description: Selected fader value + format: double + type: number + required: + - value + type: object + FaderFeature: + allOf: + - $ref: '#/components/schemas/Fader' + - $ref: '#/components/schemas/FaderRange' + FaderRange: + properties: + default: + $ref: '#/components/schemas/Fader' + description: Default fader value + range: + description: fader range + items: + $ref: '#/components/schemas/Fader' + type: array + uniqueItems: true + required: + - default + - range + type: object + HdmiIdType: + type: string + HdmiInput: + properties: + contentUri: + description: This points to the editable content trigger for this + specific hdmi input + type: string + input: + $ref: '#/components/schemas/HdmiIdType' + type: object + HdmiVideoFormat: + properties: + pixelFormat: + $ref: '#/components/schemas/VideoPixelFormat' + vIC: + format: int32 + minimum: 0 + type: integer + videoTimings: + $ref: '#/components/schemas/VideoTimings' + type: object + HomeControlIxp: + properties: + uri: + type: string + type: object + HomeControlUri: + properties: + ixp: + nullable: true + type: string + uri: + type: string + type: object + InstallRecordIdState: + properties: + value: + enum: + - idle + - gettingUrl + - urlInvalid + - downloading + - downloadFinished + - downloadFailed + type: string + type: object + LatencyProfile: + description: 'The latency profile of this speaker group. + + Needed to handle Beolab''s with latency dependant audio quality. + + Default is set to performance. + + ' + properties: + value: + enum: + - performance + - quality + type: string + type: object + LgeTvSoundSettings: + properties: + digitalOutput: + enum: + - auto + - passThrough + - pcm + - unknown + type: string + eArc: + type: boolean + output: + enum: + - tvSpeaker + - externalOptical + - externalArc + - bluetooth + - wisaSpeakers + - lineout + - headphone + - tvSpeakerAndExternalOptical + - tvSpeakerAndHeadphone + - tvSpeakerAndBluetooth + - externalArcBno + - unknown + type: string + type: object + ListeningMode: + allOf: + - $ref: '#/components/schemas/ListeningModeProps' + required: + - features + - id + - name + - triggers + ListeningModeFeatures: + description: Sound features to apply + properties: + ambience: + $ref: '#/components/schemas/Ambience' + balance: + $ref: '#/components/schemas/Balance' + bassManagement: + $ref: '#/components/schemas/BassManagement' + compression: + $ref: '#/components/schemas/Compression' + directivity: + $ref: '#/components/schemas/Directivity' + fader: + $ref: '#/components/schemas/Fader' + roomCompensation: + $ref: '#/components/schemas/RoomCompensation' + spatialEnvelopment: + $ref: '#/components/schemas/SpatialEnvelopment' + spatialHeight: + $ref: '#/components/schemas/SpatialHeight' + spatialProcessing: + $ref: '#/components/schemas/SpatialProcessing' + spatialSurround: + $ref: '#/components/schemas/SpatialSurround' + spatialWidth: + $ref: '#/components/schemas/SpatialWidth' + speechEnhance: + $ref: '#/components/schemas/SpeechEnhance' + toneTouch: + $ref: '#/components/schemas/ToneTouch' + type: object + ListeningModeID: + format: int32 + minimum: 0 + type: integer + ListeningModeProps: + properties: + clientCtx: + description: 'An optional generic string property supplied from + the client. If + + provided, it will be stored without changes. + + If not supplied, any current clientCtx will remain unchanged. + + ' + maxLength: 4096 + nullable: true + type: string + features: + $ref: '#/components/schemas/ListeningModeFeatures' + id: + $ref: '#/components/schemas/ListeningModeID' + name: + description: Friendly name + type: string + origin: + description: User created, default or an edited default listening + mode + enum: + - user + - default + - edited + type: string + role: + description: Role a listening mode applies to + enum: + - standalone + - multichannel + - all + nullable: true + type: string + triggers: + items: + $ref: '#/components/schemas/ListeningModeTrigger' + type: array + type: object + ListeningModeRef: + description: Reference to a listening mode + properties: + href: + description: 'Host relative URI of the listening mode or `null` + if there is no + + active listening mode. + + ' + format: uri + nullable: true + type: string + id: + description: 'ID of the active listening mode or `null` if there + is no active + + listening mode. + + ' + format: int32 + minimum: 0 + nullable: true + type: integer + required: + - id + - href + type: object + ListeningModeSet: + items: + allOf: + - $ref: '#/components/schemas/ListeningMode' + type: array + ListeningModeTrigger: + oneOf: + - $ref: '#/components/schemas/PowerLinkTrigger' + Loudness: + properties: + value: + type: boolean + type: object + MicrophoneState: + properties: + value: + enum: + - 'on' + - 'off' + type: string + type: object + MicrophonesState: + description: state of microphones, both physical switches and software + state + properties: + microphoneState: + $ref: '#/components/schemas/MicrophoneState' + microphoneSwitchState: + $ref: '#/components/schemas/MicrophoneState' + type: object + OptionalIpAddress: + description: IP address + example: fe80::209:a7ff:fe78:f605 + nullable: true + type: string + OverlayPlayRequest: + allOf: + - $ref: '#/components/schemas/OverlayPlayRequestCommon' + - $ref: '#/components/schemas/OverlayPlayRequestUri' + - $ref: '#/components/schemas/OverlayPlayRequestTextToSpeech' + - $ref: '#/components/schemas/OverlayPlayRequestFromUsb' + OverlayPlayRequestCommon: + properties: + volumeAbsolute: + description: 'An optional absolute volume level at which to play + the URI. If not provided, the URI will play at the currently + configured volume level on the product. The level should be + provided in volume steps [0, 100] + + ' + format: int32 + maximum: 100 + minimum: 0 + nullable: true + type: integer + type: object + OverlayPlayRequestFromUsb: + nullable: true + properties: + fromUsb: + properties: + fileLocation: + description: 'Required field containing the relative path + (i.e. from the USB drive root) and file name with + extension (if one exists) that will be played. A maximum + length of 1024 characters is allowed. + + ' + maxLength: 1024 + type: string + required: + - fileLocation + type: object + type: object + OverlayPlayRequestTextToSpeech: + nullable: true + properties: + textToSpeech: + description: 'Object used for performing a text-to-speech operation + on the product. + + ' + properties: + lang: + description: 'An optional specification of the language + to use. The default value is ultimately decided by + the BeoCloud API, but currently it defaults to `en-us`. + + ' + example: en-us + nullable: true + type: string + text: + description: 'Required field containing the actual text + that will be converted to speech (audio). A maximum + length of 2048 characters is allowed. + + ' + maxLength: 2048 + type: string + required: + - text + type: object + type: object + OverlayPlayRequestUri: + nullable: true + properties: + uri: + $ref: '#/components/schemas/Uri' + type: object + PairedRemote: + properties: + address: + type: string + appVersion: + type: string + batteryLevel: + maximum: 100 + minimum: 0 + type: integer + dbVersion: + type: string + name: + type: string + serialNumber: + type: string + updated: + items: + enum: + - app + - db + type: string + type: array + required: + - address + - name + type: object + PairedRemoteList: + items: + $ref: '#/components/schemas/PairedRemote' + type: array + PairedRemoteResponse: + properties: + items: + $ref: '#/components/schemas/PairedRemoteList' + type: object + PlayQueueIdType: + format: uuid + type: string + PlayQueueItem: + properties: + index: + format: int32 + type: integer + metadata: + $ref: '#/components/schemas/PlaybackContentMetadata' + nullable: true + provider: + $ref: '#/components/schemas/PlayQueueItemType' + startNowFromPosition: + description: Start playing specified track as soon as possible. + This works for any type, for `track` set to 0 and for `playlist` + specify the wanted track from position 0 + format: int32 + nullable: true + type: integer + type: + enum: + - track + - playlist + type: string + uri: + description: This can be url, track id, playlist id, radio id + and suchlike + type: string + required: + - provider + - type + - uri + type: object + PlayQueueItemType: + properties: + value: + enum: + - uri + - dlna + - radio + - deezer + - beoCloud + - tidal + type: string + required: + - value + type: object + PlayQueueSettings: + properties: + consume: + type: boolean + gapless: + type: boolean + repeat: + enum: + - all + - track + - none + type: string + shuffle: + type: boolean + type: object + PlaybackContentMetadata: + properties: + albumName: + type: string + art: + items: + $ref: '#/components/schemas/Art' + type: array + artistName: + type: string + bitdepth: + format: int32 + type: integer + bitrate: + format: int32 + type: integer + containerName: + type: string + encoding: + enum: + - pcm + - wav + - mp3 + - oggvorbis + - aac + - flac + - sbc + - alac + - opus + - DolbyDigital + - DolbyDigitalPlus + - DolbyTrueHD + - unknown + type: string + genre: + type: string + id: + type: integer + inputChannelProcessing: + description: 'Input processing/decoding on top of the base codec + indicated in encoding. E.g. Dolby Atmos on top of Dolby TrueHD + or Dolby Surround on top of PCM. For Dolby, this value has + priority over encoding, meaning that if inputChannelProcessing + has a value, it must be indicated in the app, and optionally + the encoding value can be indicated as well. If inputChannelProcessing + does not have value the encoding value must be indicated. + + ' + enum: + - dolbySurround + - dolbyAtmos + nullable: true + type: string + inputChannels: + description: e.g. 5.1 + nullable: true + type: string + organization: + description: 'This can be filled by gstreamer''s GST_TAG_ORGANIZATION. + Mozart can also fill this with netradio station name like + "P3" and TV content like "Netflix". This is needed so it''s + possible to show who the provider is for the playing audio + track/content. + + ' + type: string + outputChannelProcessing: + description: e.g. downmix + enum: + - Direct + - Downmix + - TrueImage + nullable: true + type: string + outputChannels: + description: e.g. 7.1 + nullable: true + type: string + queueId: + $ref: '#/components/schemas/PlayQueueIdType' + remoteLeader: + $ref: '#/components/schemas/BeolinkLeader' + remoteSource: + nullable: true + type: string + samplerate: + format: int32 + type: integer + source: + type: string + sourceInternalId: + type: string + title: + type: string + totalDuration: + description: to be removed once all devices and apps are updated + format: int32 + nullable: true + type: integer + totalDurationSeconds: + format: int32 + nullable: true + type: integer + track: + format: int32 + type: integer + trackCount: + format: int32 + type: integer + uri: + type: string + type: object + PlaybackError: + properties: + error: + type: string + item: + $ref: '#/components/schemas/PlaybackContentMetadata' + type: object + PlaybackProgress: + properties: + id: + type: string + progress: + format: int32 + type: integer + totalDuration: + format: int32 + nullable: true + type: integer + type: object + PlaybackState: + properties: + metadata: + $ref: '#/components/schemas/PlaybackContentMetadata' + progress: + $ref: '#/components/schemas/PlaybackProgress' + source: + $ref: '#/components/schemas/Source' + state: + $ref: '#/components/schemas/RenderingState' + type: object + PowerLinkTrigger: + properties: + powerLinkPreset: + description: 'Despite the name, this preset is used anytime a + speaker is used as a + + secondary as a way for the primary to indicate which directivity + + (and possibly other caracteristics in the future) should be + used on + + a speaker by speaker basis. It is used when a speaker is a + powerlink + + speaker (hence the name), WISA speaker or a speakerlink secondary + in multichannel. + + ' + type: integer + type: object + PowerStateEnum: + properties: + value: + enum: + - networkStandby + - 'on' + - standby + - shutdown + - storage + type: string + type: object + Preset: + allOf: + - $ref: '#/components/schemas/SceneTriggerBaseProperties' + - properties: + content: + $ref: '#/components/schemas/ContentItem' + nullable: true + id: + type: string + name: + nullable: true + type: string + source: + $ref: '#/components/schemas/SourceTypeEnum' + nullable: true + title: + type: string + type: object + PresetMap: + additionalProperties: + $ref: '#/components/schemas/Preset' + type: object + ProductCurtainStatus: + properties: + moving: + type: boolean + position: + enum: + - unknown + - closed + - narrow + - wide + type: string + type: object + ProductFriendlyName: + properties: + friendlyName: + description: 'The friendly name of the product, assignable by + the end user, e.g. ''Kitchen speaker + + ' + type: string + type: object + ProductState: + properties: + microphones: + $ref: '#/components/schemas/MicrophonesState' + playback: + $ref: '#/components/schemas/PlaybackState' + powerState: + $ref: '#/components/schemas/PowerStateEnum' + softwareUpdateState: + $ref: '#/components/schemas/SoftwareUpdateState' + soundSettings: + $ref: '#/components/schemas/SoundSettings' + source: + $ref: '#/components/schemas/Source' + tv: + $ref: '#/components/schemas/TvState' + volume: + $ref: '#/components/schemas/VolumeState' + type: object + RemoteMenuItem: + allOf: + - $ref: '#/components/schemas/RemoteMenuItemProperties' + - properties: + available: + nullable: true + type: boolean + content: + $ref: '#/components/schemas/ContentItem' + fixed: + description: True if this is a fixed menu item. A fixed item + can't be deleted or moved + type: boolean + id: + description: Unique ID for this menu item + format: uuid + type: string + required: + - id + - fixed + type: object + RemoteMenuItemMap: + additionalProperties: + $ref: '#/components/schemas/RemoteMenuItem' + example: + 6c2ab917-2a9e-42dd-87c6-1fa2fabcdeb0: + content: + contentUri: netRadio://123456 + source: netRadio + label: P3 + ee5196ce-65c4-4c56-9a48-1943c4afef9c: + content: + contentUri: tv://netflix + source: netRadio + label: Netflix + type: object + RemoteMenuItemProperties: + allOf: + - $ref: '#/components/schemas/SceneTriggerBaseProperties' + - properties: + disabled: + nullable: true + type: boolean + dynamicList: + description: 'Let mozart create a dynamic list. This list + will be attached as children to the menu item. If dynamicList + is set it''s not possible to change or manipulate any + of the children because mozart can alter them at any given + time + + ' + enum: + - none + - radioFavorites + nullable: true + type: string + firstChildMenuItemId: + description: ID of the first child menu item + format: uuid + nullable: true + type: string + label: + description: Alternative label, if omitted mozart will try + its best + nullable: true + type: string + nextSiblingMenuItemId: + description: ID of the next sibling menu item + format: uuid + nullable: true + type: string + parentMenuItemId: + description: ID of the parent menu item + format: uuid + nullable: true + type: string + type: object + RemoteUIKeyState: + properties: + state: + description: 'The state of the pressed key. ShortPress and LongPress''s + duration are determined by the remote. Whereas Down, Continue, + and Release reflect the state of the key and press duration + is the time between a Down and a Release state. Continue indicates + that a button is pressed and the key event should be handled + multiple times until a release is received. + + ' + enum: + - ShortPress + - LongPress + - Down + - Continue + - Release + type: string + type: object + RenderingState: + properties: + value: + enum: + - idle + - buffering + - started + - paused + - stopped + - ended + - error + - unknown + type: string + type: object + RoomCompensation: + properties: + value: + $ref: '#/components/schemas/RoomCompensationValue' + required: + - value + type: object + RoomCompensationCurrentMeasurement: + description: 'State and speaker ID of the currently running measurement. + + Is only relevant for advanced room compensation. + + ' + properties: + speakerId: + $ref: '#/components/schemas/SpeakerId' + description: Speaker ID of the speaker being measured. + state: + description: "State of the measurement for the speaker.\nstarted:\n\ + \ The measurement has started.\ndone:\n The measurement\ + \ has ended successfully.\nlastDone:\n The last measurement\ + \ in the run has ended successfully.\nerror:\n An error occurred\ + \ during measurement.\n" + enum: + - started + - done + - lastDone + - error + type: string + type: object + RoomCompensationDebug: + properties: + value: + type: boolean + type: object + RoomCompensationEnabled: + properties: + value: + type: boolean + type: object + RoomCompensationErrorDetails: + properties: + errorList: + description: List of the speakers where measurement failed, including + error type. + items: + $ref: '#/components/schemas/RoomCompensationMeasurementError' + type: array + type: object + RoomCompensationFeature: + allOf: + - $ref: '#/components/schemas/RoomCompensation' + - $ref: '#/components/schemas/RoomCompensationRange' + RoomCompensationInfo: + properties: + debug: + $ref: '#/components/schemas/RoomCompensationDebug' + enabled: + $ref: '#/components/schemas/RoomCompensationEnabled' + lastResult: + $ref: '#/components/schemas/RoomCompensationResult' + lastRun: + $ref: '#/components/schemas/RoomCompensationState' + type: + $ref: '#/components/schemas/RoomCompensationType' + version: + $ref: '#/components/schemas/RoomCompensationVersion' + type: object + RoomCompensationMeasurementError: + properties: + error: + description: "noError:\n The measurement went OK.\nlowSignal:\n\ + \ When there is too low signal in the recording, e.g. due\ + \ to a loudspeaker being placed at\n too great a distance\ + \ from the microphone.\nspeakerSilent:\n No signal could\ + \ be measured.\n Could be because:\n - The speaker is\ + \ powered off or not connected.\n - The left/right switch\ + \ on a wired powerlink speaker is set in the wrong position.\n\ + \ - The speaker is placed in another room behind closed\ + \ doors.\nnoisyMicrophone:\n When the\ + \ recording of the given microphone is too noisy.\n Could\ + \ be because:\n - Something is blocking the microphone\n\ + externalMicrophoneLocation:\n When the location of the external\ + \ microphone is invalid.\nexternalMicrophoneMissing:\n If\ + \ the external microphone was missing/disconnected during\ + \ a measurement.\nmicrophonesDisabled:\n If the microphones\ + \ are either muted or disabled.\nnoisyMeasurement:\n When\ + \ too much background noise has been detected during the measurement\n\ + internalError:\n Something went wrong internally - can not\ + \ be fixed by the user. Try again.\n" + enum: + - noError + - lowSignal + - speakerSilent + - noisyLeftMicrophone + - noisyRightMicrophone + - noisyExternalMicrophone + - externalMicrophoneLocation + - externalMicrophoneMissing + - microphonesDisabled + - noisyMeasurement + - internalError + type: string + speakerId: + $ref: '#/components/schemas/SpeakerId' + description: 'Speaker ID of the speaker with measurement error. + + Is only relevant for advanced room compensation. + + ' + type: object + RoomCompensationProperties: + allOf: + - $ref: '#/components/schemas/RoomCompensationType' + - properties: + action: + description: "Must be set if room compensation type is advanced.\n\ + runAll:\n Do measurements on all connected speakers.\n\ + continue:\n Continue from and including the speaker where\ + \ last interrupted (stopped or failed).\nuseSpeakerList:\n\ + \ Do measurements on the speakers in the list property.\n" + enum: + - runAll + - continue + - useSpeakerList + nullable: true + type: string + continueOnError: + description: 'On failing measurement on a speaker, default + behavior is to stop measurement and skip the remaining + speakers. + + Setting continueOnError to true will make the measurement + process continue and finish measurement on all speakers, + + even though an error ocurred on one of the speakers. + + ' + nullable: true + type: boolean + latencyProfile: + $ref: '#/components/schemas/LatencyProfile' + nullable: true + skipAutomaticRoleAssignment: + description: Skip calculation of automatic role assignment. + nullable: true + type: boolean + speakerList: + description: 'List of speaker IDs to include in room compensation + / automatic role assignment measurement. + + Relevant e.g. if you want to create a speaker group without + the external speakers included. + + This can not be used for doing measurements on a partial + speaker group, only on all + + speakers in an existing group or for all speakers in a + new group. + + ' + items: + $ref: '#/components/schemas/SpeakerId' + nullable: true + type: array + speakerPreset: + description: The Powerlink preset to use for the external + PL/WPL speakers. + format: int32 + maximum: 255 + minimum: 0 + nullable: true + type: integer + type: object + RoomCompensationRange: + properties: + default: + $ref: '#/components/schemas/RoomCompensationValue' + description: Product and role specific default room compensation + value + maxItems: + description: Maximum number of items in the `value` field + maximum: 20 + minimum: 1 + type: integer + range: + description: Possible values for the `value` field + example: + - internal + - external + items: + type: string + type: array + required: + - default + - range + type: object + RoomCompensationResponse: + properties: + frequency: + format: int32 + type: integer + gain: + format: double + type: number + type: object + RoomCompensationResult: + properties: + compensation: + items: + $ref: '#/components/schemas/RoomCompensationResponse' + type: array + measuredResponse: + items: + $ref: '#/components/schemas/RoomCompensationResponse' + type: array + placement: + enum: + - free + - nearWall + - unknown + type: string + referenceResponse: + items: + $ref: '#/components/schemas/RoomCompensationResponse' + type: array + speakerGroupSuggestion: + $ref: '#/components/schemas/SpeakerGroup' + description: 'Result from automatic speaker role assignment and + room compensation measurements. + + Is only relevant for advanced room compensation. + + Includes id, type, role, gain, distance and location for requested + speakers, + + together with the ID of the room compensation result. + + This is not persisted on Mozart side, but can be used by the + client, + + e.g. as basis for a new speaker group. + + ' + timeStamp: + format: date-time + type: string + type: object + RoomCompensationState: + allOf: + - $ref: '#/components/schemas/RoomCompensationStateValue' + - properties: + error: + description: "microphoneMuted:\n The microphone is muted\ + \ (soft-off, using touch button).\nmicrophoneSwitchOff:\n\ + \ The microphone switch is set in its off position.\n\ + microphoneSignalMissing:\n No signal was detected. Is\ + \ the microphone blocked?\nexternalMicrophoneMissing:\n\ + \ The external microphone is not connected.\n Is only\ + \ relevant for advanced room compensation.\nexternalMicrophoneInvalidPosition:\n\ + \ The external microphone is placed in an invalid position,\n\ + \ e.g. placed too close or in an extreme angle to the\ + \ internal speakers.\n Is only relevant for advanced\ + \ room compensation.\nnoisyEnvironment:\n Too much environment\ + \ noise to get a valid measurement.\nspeakerMeasurementFailed:\n\ + \ A measurement failed, related to one of the individual\ + \ speakers.\n See the errorDetails property for details\ + \ about the error and which speaker measurement failed.\n\ + \ Is only relevant for advanced room compensation.\n\ + invalidSpeakerList:\n The speaker list contains invalid\ + \ speakers.\n Valid speakers are: all external speakers\ + \ and non-virtual internal speakers.\n Is only relevant\ + \ for advanced room compensation.\ninvalidAction:\n Could\ + \ not start with given action.\n Eg. can't run from last\ + \ failed speaker if there isn't any failed run.\n Is\ + \ only relevant for advanced room compensation.\ninternalError:\n\ + \ Internal product error.\n" + enum: + - noError + - microphoneMuted + - microphoneSwitchOff + - microphoneSignalMissing + - externalMicrophoneMissing + - externalMicrophoneInvalidPosition + - noisyEnvironment + - speakerMeasurementFailed + - invalidSpeakerList + - invalidAction + - internalError + type: string + errorDetails: + $ref: '#/components/schemas/RoomCompensationErrorDetails' + lastRunAvailable: + description: 'When true, measurements have been cached due + to manual interrupt or failure, + + making it possible to use the action "continue" where + the system will continue from the speaker where interrupted. + + The cached measurements are only temporary and will be + cleared after some time (default 15min), + + in which case lastRunAvailable becomes false. + + ' + type: boolean + properties: + $ref: '#/components/schemas/RoomCompensationProperties' + timeStamp: + format: date-time + type: string + type: object + RoomCompensationStateValue: + properties: + state: + enum: + - notStarted + - running + - done + - error + - stopped + type: string + type: object + RoomCompensationType: + properties: + value: + description: "The type of roomcompensation used / to use.\nsimple:\n\ + \ For speakers without external speakers.\nadvanced:\n For\ + \ products with external speakers or other advanced multichannel\ + \ capabilities.\n This requires that at least action in the\ + \ other properties of RoomCompensationProperties is set.\n" + enum: + - simple + - advanced + type: string + type: object + RoomCompensationValue: + description: 'List of room compensation sweeps to combine. No room compensation + is done + + if this list is empty. The maximum length of this list is product + + specific. + + ' + items: + type: string + type: array + RoomCompensationVersion: + properties: + algorithm: + format: int32 + minimum: 0 + type: integer + coefficients: + format: int32 + minimum: 0 + type: integer + type: object + Scene: + allOf: + - $ref: '#/components/schemas/SceneProperties' + - $ref: '#/components/schemas/SceneClassification' + SceneClassification: + properties: + classification: + description: The classification of Scene + enum: + - system + - userDefined + nullable: true + type: string + type: object + SceneList: + description: A list of scenes + items: + format: uuid + type: string + type: array + SceneMap: + additionalProperties: + $ref: '#/components/schemas/Scene' + example: + fdecf968-3ab9-46dc-a71d-e4204ef47fdb: + actionList: + - type: volume + volumeLevel: 35 + - radioStationId: '8779112938791514' + type: radio + - stopDuration: 20 + type: stop + label: New label + type: object + SceneMatch: + properties: + label: + nullable: true + type: string + tags: + $ref: '#/components/schemas/SceneTags' + nullable: true + type: object + SceneProperties: + properties: + actionList: + $ref: '#/components/schemas/ActionList' + clientContext: + description: 'An optional generic string property supplied from + the client. If + + supplied it will overwrite any currently stored clientContext. + If + + not supplied any stored clientContext will be left unchanged. + + ' + maxLength: 4096 + nullable: true + type: string + label: + nullable: true + type: string + tags: + $ref: '#/components/schemas/SceneTags' + nullable: true + required: + - actionList + type: object + SceneTags: + description: A list of user defined tags. This allows a client to create + virtual lists + items: + type: string + type: array + SceneTriggerBaseProperties: + description: Base properties for a scene trigger + properties: + actionList: + $ref: '#/components/schemas/ActionList' + nullable: true + sceneList: + $ref: '#/components/schemas/SceneList' + description: 'Actions will be extracted from all scenes in this + list and will be merged together with (`actionList`). + + On colliding actions the priority will be: (N represent last + index in `sceneList`) + + 1. `actionList` + + 2. scene N in `sceneList` + + ... + + 3. scene 0 in `sceneList` + + ' + nullable: true + type: object + SerialNumber: + description: Speaker serial number + example: '12345678' + pattern: ^\d{8} + type: string + SoftwareUpdateState: + properties: + secondsRemaining: + format: int32 + type: integer + value: + enum: + - idle + - checking + - updateCheckFailed + - noUpdatesAvailable + - updateAvailable + - downloadingUpdate + - updateDownloaded + - downloadFailed + - installingUpdate + - installingAutomaticUpdate + - installationFailed + - installationDonePendingReboot + - schedulerFailed + - rebooting + type: string + type: object + SoftwareUpdateStatus: + properties: + availableUpdate: + $ref: '#/components/schemas/SoftwareVersion' + lastCheck: + format: date-time + type: string + lastUpdate: + format: date-time + type: string + softwareVersion: + $ref: '#/components/schemas/SoftwareVersion' + state: + $ref: '#/components/schemas/SoftwareUpdateState' + updateProgress: + format: int32 + type: integer + updateType: + enum: + - none + - normal + - critical + - forced + type: string + required: + - softwareVersion + - state + type: object + SoftwareVersion: + type: string + SoundAdjustments: + properties: + ambience: + format: double + type: number + bass: + format: int32 + type: integer + directivity: + type: string + ecoMode: + type: boolean + fadein: + type: boolean + loudness: + type: boolean + treble: + format: int32 + type: integer + type: object + SoundFeatureSet: + properties: + ambience: + $ref: '#/components/schemas/AmbienceFeature' + balance: + $ref: '#/components/schemas/BalanceFeature' + bass: + $ref: '#/components/schemas/BassFeature' + bass-management: + $ref: '#/components/schemas/BassManagementFeature' + compression: + $ref: '#/components/schemas/CompressionFeature' + directivity: + $ref: '#/components/schemas/DirectivityFeature' + fader: + $ref: '#/components/schemas/FaderFeature' + roomCompensation: + $ref: '#/components/schemas/RoomCompensationFeature' + spatial-envelopment: + $ref: '#/components/schemas/SpatialEnvelopmentFeature' + spatial-height: + $ref: '#/components/schemas/SpatialHeightFeature' + spatial-processing: + $ref: '#/components/schemas/SpatialProcessingFeature' + spatial-surround: + $ref: '#/components/schemas/SpatialSurroundFeature' + spatial-width: + $ref: '#/components/schemas/SpatialWidthFeature' + speech-enhance: + $ref: '#/components/schemas/SpeechEnhanceFeature' + toneTouchX: + $ref: '#/components/schemas/ToneTouchXFeature' + toneTouchY: + $ref: '#/components/schemas/ToneTouchYFeature' + treble: + $ref: '#/components/schemas/TrebleFeature' + type: object + SoundSettings: + properties: + adjustments: + $ref: '#/components/schemas/SoundAdjustments' + roomCompensation: + $ref: '#/components/schemas/RoomCompensationInfo' + toneTouch: + $ref: '#/components/schemas/SoundToneTouch' + type: object + SoundToneTouch: + properties: + x: + format: double + type: number + y: + format: double + type: number + z: + format: double + type: number + type: object + Source: + properties: + id: + type: string + isEnabled: + description: some sources require an explicit activation or accept + of terms before being enabled + type: boolean + isMultiroomAvailable: + type: boolean + isPlayable: + type: boolean + name: + type: string + type: + $ref: '#/components/schemas/SourceTypeEnum' + type: object + SourceArray: + properties: + items: + items: + $ref: '#/components/schemas/Source' + type: array + type: object + SourceTypeEnum: + properties: + value: + description: '- beolink + + - bluetooth + + - dlna + + - qplay + + - airPlay + + - lineIn + + - chromeCast + + - uriStreamer + + - netRadio + + - local + + - generator + + - spotify + + - spdif + + - pl + + - wpl + + - tv + + - deezer + + - usbIn + + - tidal + + - tidalConnect + + - unknown' + example: netRadio + type: string + type: object + SpatialEnvelopment: + properties: + value: + description: Selected spatial-envelopment value + format: double + type: number + required: + - value + type: object + SpatialEnvelopmentFeature: + allOf: + - $ref: '#/components/schemas/SpatialEnvelopment' + - $ref: '#/components/schemas/SpatialEnvelopmentRange' + SpatialEnvelopmentRange: + properties: + default: + $ref: '#/components/schemas/SpatialEnvelopment' + description: Default spatial-envelopment value + range: + description: spatial-envelopment range + items: + $ref: '#/components/schemas/SpatialEnvelopment' + type: array + uniqueItems: true + required: + - default + - range + type: object + SpatialHeight: + properties: + value: + description: Selected spatial-height value + format: double + type: number + required: + - value + type: object + SpatialHeightFeature: + allOf: + - $ref: '#/components/schemas/SpatialHeight' + - $ref: '#/components/schemas/SpatialHeightRange' + SpatialHeightRange: + properties: + default: + $ref: '#/components/schemas/SpatialHeight' + description: Default spatial-height value + range: + description: spatial-height range + items: + $ref: '#/components/schemas/SpatialHeight' + type: array + uniqueItems: true + required: + - default + - range + type: object + SpatialProcessing: + properties: + value: + description: Selected spatial-processing value + enum: + - direct + - trueimage + - downmix + type: string + required: + - value + type: object + SpatialProcessingFeature: + allOf: + - $ref: '#/components/schemas/SpatialProcessing' + - $ref: '#/components/schemas/SpatialProcessingRange' + SpatialProcessingRange: + properties: + default: + $ref: '#/components/schemas/SpatialProcessing' + description: Default spatial-processing value + range: + description: spatial-processing range + items: + $ref: '#/components/schemas/SpatialProcessing' + type: array + uniqueItems: true + required: + - default + - range + type: object + SpatialSurround: + properties: + value: + description: Selected spatial-surround value + format: double + type: number + required: + - value + type: object + SpatialSurroundFeature: + allOf: + - $ref: '#/components/schemas/SpatialSurround' + - $ref: '#/components/schemas/SpatialSurroundRange' + SpatialSurroundRange: + properties: + default: + $ref: '#/components/schemas/SpatialSurround' + description: Default spatial-surround value + range: + description: spatial-surround range + items: + $ref: '#/components/schemas/SpatialSurround' + type: array + uniqueItems: true + required: + - default + - range + type: object + SpatialWidth: + properties: + value: + description: Selected spatial-width value + format: double + type: number + required: + - value + type: object + SpatialWidthFeature: + allOf: + - $ref: '#/components/schemas/SpatialWidth' + - $ref: '#/components/schemas/SpatialWidthRange' + SpatialWidthRange: + properties: + default: + $ref: '#/components/schemas/SpatialWidth' + description: Default spatial-width value + range: + description: spatial-width range + items: + $ref: '#/components/schemas/SpatialWidth' + type: array + uniqueItems: true + required: + - default + - range + type: object + SpeakerGroup: + properties: + crossoverFrequency: + description: Crossover frequency for bass management in Hz + format: int32 + maximum: 300 + minimum: 20 + nullable: true + type: integer + enablePhaseCompensation: + description: Enable phase compensation in bass management. + nullable: true + type: boolean + friendlyName: + description: 'Friendly name of the SpeakerGroup. + + Required when creating a new group + + ' + nullable: true + type: string + id: + $ref: '#/components/schemas/SpeakerGroupId' + nullable: true + isDeleteable: + nullable: true + type: boolean + items: + items: + $ref: '#/components/schemas/SpeakerGroupMember' + nullable: true + type: array + latencyProfile: + $ref: '#/components/schemas/LatencyProfile' + nullable: true + roomCompensationId: + description: 'ID of the calculated coefficents for this group, + made during advanced room compensation. + + When updating an existing group, an empty string will clear + roomCompensationId. + + ' + format: uuid + nullable: true + type: string + speakerPreset: + description: Speaker preset / listening mode eg. BL28 curtain + position etc. + format: int32 + maximum: 99 + minimum: 0 + nullable: true + type: integer + type: object + SpeakerGroupId: + format: uuid + type: string + SpeakerGroupMember: + properties: + distance: + description: Distance from listening position in cm + format: int32 + maximum: 1500 + minimum: 0 + nullable: true + type: integer + friendlyName: + nullable: true + type: string + gain: + description: Level in dB + format: float + maximum: 6 + minimum: -24 + nullable: true + type: number + id: + type: string + location: + description: "Coordinates of the speaker position in cm.\nLocation\ + \ is only relevant when the group is based on the automatic\ + \ role assignment of advanced room compensation.\nThe location\ + \ is relative to the external microphone used during advanced\ + \ room compensation measurements:\n x=0, y=0, z=0: The location\ + \ of the external microphone used during measurement.\n x<0:\ + \ To the left of the external microphone.\n x>0: To the right\ + \ of the external microphone.\n y<0: Behind the external\ + \ microphone.\n y>0: In front of the external microphone.\n\ + \ z<0: Above the external microphone (may not be reliable).\n\ + \ z>0: Below the external microphone (may not be reliable).\n" + nullable: true + properties: + x: + format: int32 + type: integer + y: + format: int32 + type: integer + z: + format: int32 + type: integer + required: + - x + - y + - z + type: object + redirectionLevel: + description: Redirection level for bass management in dB + format: int32 + maximum: 6 + minimum: -100 + nullable: true + type: integer + role: + $ref: '#/components/schemas/SpeakerRole' + type: + nullable: true + type: string + required: + - id + type: object + SpeakerGroupOverview: + properties: + friendlyName: + type: string + id: + $ref: '#/components/schemas/SpeakerGroupId' + isDeleteable: + type: boolean + required: + - friendlyName + - id + - isDeleteable + type: object + SpeakerId: + example: FrontLeft + type: string + SpeakerLinkMemberStatus: + properties: + baseUrl: + description: API prefix to use when talking to the secondary + format: uri + nullable: true + type: string + health: + enum: + - unknown + - good + - warning + - bad + example: good + type: string + ipAddress: + $ref: '#/components/schemas/OptionalIpAddress' + networkType: + enum: + - none + - wired + - wireless + type: string + productType: + type: string + serialNumber: + $ref: '#/components/schemas/SerialNumber' + updatedAt: + $ref: '#/components/schemas/Timestamp' + required: + - health + - serialNumber + - updatedAt + - productName + - networkType + type: object + SpeakerLinkStatus: + properties: + speakers: + items: + $ref: '#/components/schemas/SpeakerLinkMemberStatus' + type: array + type: + enum: + - standalone + - stereo + - surround + type: string + required: + - type + - speakers + type: object + SpeakerRole: + nullable: true + type: string + SpeakerRoleEnum: + properties: + value: + enum: + - standalone + - multichannel + type: string + type: object + SpeechEnhance: + properties: + value: + description: Selected speech-enhance value + format: double + type: number + required: + - value + type: object + SpeechEnhanceFeature: + allOf: + - $ref: '#/components/schemas/SpeechEnhance' + - $ref: '#/components/schemas/SpeechEnhanceRange' + SpeechEnhanceRange: + properties: + default: + $ref: '#/components/schemas/SpeechEnhance' + description: Default speech-enhance value + range: + description: speech-enhance range + items: + $ref: '#/components/schemas/SpeechEnhance' + type: array + uniqueItems: true + required: + - default + - range + type: object + StandConnected: + properties: + connected: + type: boolean + type: object + StandMovement: + properties: + angle: + format: float + nullable: true + type: number + ignoreEndstop: + example: false + type: boolean + standMotion: + enum: + - continuousCCW + - stepCCW + - stop + - stepCW + - continuousCW + type: string + type: object + StandPosition: + properties: + angle: + format: float + type: number + type: object + SupportedSoundFeatures: + additionalProperties: + $ref: '#/components/schemas/SoundFeatureSet' + description: Supported sound features + type: object + Timestamp: + description: Timestamp in RFC3393 format + format: date-time + type: string + ToneTouch: + properties: + x: + $ref: '#/components/schemas/ToneTouchType' + y: + $ref: '#/components/schemas/ToneTouchType' + type: object + ToneTouchType: + properties: + value: + format: double + type: number + required: + - value + type: object + ToneTouchTypeRange: + properties: + default: + $ref: '#/components/schemas/ToneTouchType' + description: Product and role specific default ToneTouch X or + Y + range: + description: Product and role specific tone touch X or Y range + items: + $ref: '#/components/schemas/ToneTouchType' + type: array + uniqueItems: true + required: + - default + - range + type: object + ToneTouchXFeature: + allOf: + - $ref: '#/components/schemas/ToneTouchType' + - $ref: '#/components/schemas/ToneTouchTypeRange' + ToneTouchYFeature: + allOf: + - $ref: '#/components/schemas/ToneTouchType' + - $ref: '#/components/schemas/ToneTouchTypeRange' + Treble: + properties: + value: + description: Selected treble value + format: int32 + type: integer + required: + - value + type: object + TrebleFeature: + allOf: + - $ref: '#/components/schemas/Treble' + - $ref: '#/components/schemas/TrebleRange' + TrebleRange: + properties: + default: + $ref: '#/components/schemas/Treble' + description: Product and role specific default treble value + range: + description: Product and role specific treble range + items: + $ref: '#/components/schemas/Treble' + type: array + uniqueItems: true + required: + - default + - range + type: object + TvInfoEventData: + properties: + integration: + $ref: '#/components/schemas/TvIntegrationTypes' + type: object + TvIntegrationTypes: + properties: + value: + enum: + - ThirdParty + - Lge + type: string + type: object + TvProperties: + properties: + integrationSupported: + $ref: '#/components/schemas/TvIntegrationTypes' + name: + nullable: true + type: string + year: + nullable: true + type: integer + type: object + TvSoundSettings: + properties: + lge: + $ref: '#/components/schemas/LgeTvSoundSettings' + type: object + TvState: + properties: + integration: + $ref: '#/components/schemas/TvIntegrationTypes' + soundSettings: + $ref: '#/components/schemas/TvSoundSettings' + tvInfo: + $ref: '#/components/schemas/TvProperties' + type: object + Uri: + properties: + location: + type: string + type: object + UserFlow: + properties: + userId: + format: int64 + type: string + type: object + VideoPixelFormat: + properties: + bitdepth: + enum: + - bit8 + - bit10 + - bit12 + type: string + chromaSubsample: + enum: + - yCbCr444RGB + - yCbCr422 + - yCbCr420 + type: string + colorimetry: + enum: + - rGB + - opRGB + - rGBP3D65 + - rGBP3DCI + - rGB2020 + - yCC601 + - yCC709 + - xvYCC601 + - xvYCC709 + - sYCC601 + - opYCC601 + - yCC2020NCL + - yCC2020NL + type: string + fullRange: + type: boolean + type: object + VideoTimings: + properties: + horizontalResolution: + type: integer + interlaced: + type: boolean + refreshRate: + format: double + type: number + verticalResolution: + type: integer + type: object + VolumeLevel: + properties: + level: + format: int32 + type: integer + type: object + VolumeMute: + properties: + muted: + type: boolean + type: object + VolumeSettings: + properties: + default: + $ref: '#/components/schemas/VolumeLevel' + maximum: + $ref: '#/components/schemas/VolumeLevel' + type: object + VolumeState: + properties: + default: + $ref: '#/components/schemas/VolumeLevel' + level: + $ref: '#/components/schemas/VolumeLevel' + maximum: + $ref: '#/components/schemas/VolumeLevel' + muted: + $ref: '#/components/schemas/VolumeMute' + type: object + WebSocketEventActiveHdmiInputSignal: + properties: + eventData: + $ref: '#/components/schemas/HdmiInput' + eventType: + type: string + type: object + WebSocketEventActiveListeningMode: + properties: + eventData: + $ref: '#/components/schemas/ListeningModeProps' + eventType: + type: string + type: object + WebSocketEventActiveSpeakerGroup: + properties: + eventData: + $ref: '#/components/schemas/SpeakerGroupOverview' + eventType: + type: string + type: object + WebSocketEventAlarmTimer: + properties: + eventData: + $ref: '#/components/schemas/AlarmTimerEventData' + eventType: + type: string + type: object + WebSocketEventAlarmTriggered: + properties: + eventData: + $ref: '#/components/schemas/AlarmTriggeredInfo' + eventType: + type: string + type: object + WebSocketEventBattery: + properties: + eventData: + $ref: '#/components/schemas/BatteryState' + eventType: + type: string + type: object + WebSocketEventBeoRemoteButton: + properties: + eventData: + $ref: '#/components/schemas/BeoRemoteButton' + eventType: + type: string + type: object + WebSocketEventBeolinkExperiencesResult: + properties: + eventData: + $ref: '#/components/schemas/BeolinkExperiencesResult' + eventType: + type: string + required: + - eventType + - eventData + type: object + WebSocketEventBeolinkJoinResult: + properties: + eventData: + $ref: '#/components/schemas/BeolinkJoinResult' + eventType: + type: string + required: + - eventType + - eventData + type: object + WebSocketEventButton: + properties: + eventData: + $ref: '#/components/schemas/ButtonEvent' + eventType: + type: string + type: object + WebSocketEventCurtains: + properties: + eventData: + $ref: '#/components/schemas/ProductCurtainStatus' + eventType: + type: string + type: object + WebSocketEventHdmiVideoFormatSignal: + properties: + eventData: + $ref: '#/components/schemas/HdmiVideoFormat' + eventType: + type: string + type: object + WebSocketEventNotification: + description: This telegram is used to send a tagged notification. + properties: + eventData: + $ref: '#/components/schemas/WebsocketNotificationTag' + eventType: + type: string + type: object + WebSocketEventPlaybackError: + properties: + eventData: + $ref: '#/components/schemas/PlaybackError' + eventType: + type: string + type: object + WebSocketEventPlaybackMetadata: + properties: + eventData: + $ref: '#/components/schemas/PlaybackContentMetadata' + eventType: + type: string + type: object + WebSocketEventPlaybackProgress: + properties: + eventData: + $ref: '#/components/schemas/PlaybackProgress' + eventType: + type: string + type: object + WebSocketEventPlaybackSource: + properties: + eventData: + $ref: '#/components/schemas/Source' + eventType: + type: string + type: object + WebSocketEventPlaybackState: + properties: + eventData: + $ref: '#/components/schemas/RenderingState' + eventType: + type: string + type: object + WebSocketEventPowerState: + properties: + eventData: + $ref: '#/components/schemas/PowerStateEnum' + eventType: + type: string + type: object + WebSocketEventPucInstallRemoteIdStatus: + properties: + eventData: + $ref: '#/components/schemas/InstallRecordIdState' + eventType: + type: string + type: object + WebSocketEventRole: + properties: + eventData: + $ref: '#/components/schemas/SpeakerRoleEnum' + eventType: + type: string + type: object + WebSocketEventRoomCompensationCurrentMeasurementEvent: + description: 'Sent when a room compensation measurement is started/done. + + Is only sent when room compensation type is advanced. + + ' + properties: + eventData: + $ref: '#/components/schemas/RoomCompensationCurrentMeasurement' + eventType: + type: string + type: object + WebSocketEventRoomCompensationState: + properties: + eventData: + $ref: '#/components/schemas/RoomCompensationStateValue' + eventType: + type: string + type: object + WebSocketEventSoftwareUpdateState: + properties: + eventData: + $ref: '#/components/schemas/SoftwareUpdateState' + eventType: + type: string + type: object + WebSocketEventSoundSettings: + properties: + eventData: + $ref: '#/components/schemas/SoundSettings' + eventType: + type: string + type: object + WebSocketEventSourceChange: + properties: + eventData: + $ref: '#/components/schemas/Source' + eventType: + type: string + type: object + WebSocketEventSpeakerGroupChanged: + properties: + eventData: + $ref: '#/components/schemas/SpeakerGroupId' + eventType: + type: string + type: object + WebSocketEventSpeakerLinkStatusChanged: + properties: + eventData: + $ref: '#/components/schemas/SpeakerLinkStatus' + eventType: + type: string + type: object + WebSocketEventStandConnected: + properties: + eventData: + $ref: '#/components/schemas/StandConnected' + eventType: + type: string + type: object + WebSocketEventStandPosition: + properties: + eventData: + $ref: '#/components/schemas/StandPosition' + eventType: + type: string + type: object + WebSocketEventTvInfo: + properties: + eventData: + $ref: '#/components/schemas/TvInfoEventData' + eventType: + type: string + type: object + WebSocketEventVolume: + properties: + eventData: + $ref: '#/components/schemas/VolumeState' + eventType: + type: string + type: object + WebSocketEventWisaOutState: + description: Speaker Discovery State changed + properties: + eventData: + $ref: '#/components/schemas/WisaOutState' + eventType: + type: string + required: + - eventType + - eventData + type: object + WebsocketNotificationTag: + properties: + value: + enum: + - configuration + - uri + - generatorSettings + - lineInSettings + - bluetoothDevices + - remoteControlDevices + - secondariesList + - queueHasBeenChanged + - endOfQueueHasBeenReached + - beolinkPeers + - beolinkListeners + - beolinkAvailableListeners + - bluetoothPairingStateChanged + - outputsChanged + - speakerGroupOverviewChanged + - remoteMenuChanged + - proximityPresenceDetected + - proximityPresenceNotDetected + type: string + type: object + WisaOutState: + properties: + state: + enum: + - idle + - discovering + - deleting + - updatingSpeakerFirmware + type: string + type: object +info: + contact: + email: support@bang-olufsen.dk + name: Bang & Olufsen + description: API for interacting with the Mozart platform. + license: + name: MIT + url: https://opensource.org/licenses/MIT + title: Mozart platform API + version: 0.2.0 +openapi: 3.0.0 +paths: + /api/v1/battery: + get: + operationId: get-battery-state + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/BatteryState' + description: The battery state of the product + summary: Get battery state of the product + tags: + - Power + - mozart + /api/v1/beolink/allstandby: + post: + operationId: post-beolink-allstandby + responses: + '202': + description: successful operation + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: Beolink not enabled on this device + summary: Broadcast an all standby event to turn all Beolink devices off + tags: + - Beolink + - mozart + /api/v1/beolink/available-listeners: + get: + description: 'Get a list of devices that can be listening to this device + active experience. + + ' + operationId: get-beolink-available-listeners + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/BeolinkAvailableListener' + type: array + description: Success + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: Beolink not enabled on this device + summary: Get available listeners + tags: + - Beolink + - mozart + /api/v1/beolink/expand/{jid}: + parameters: + - description: Jabber id of peer to expand the active experience to + in: path + name: jid + required: true + schema: + $ref: '#/components/schemas/BeolinkPeerID' + post: + description: 'Expand the current active experience to another device with + jabber id `{jid}`. + + ' + operationId: post-beolink-expand + responses: + '202': + description: Success + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: Beolink not enabled on this device + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: Not allowed to initiate join + '404': + description: Remote device not found + summary: Expand the current active experience + tags: + - Beolink + - mozart + /api/v1/beolink/join: + post: + operationId: join-latest-beolink-experience + responses: + '202': + $ref: '#/components/responses/BeolinkJoinResponse' + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: Beolink not enabled on this device + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: Not allowed to initiate join + summary: Trigger touch to join + tags: + - Beolink + - mozart + /api/v1/beolink/join-result/{id}: + get: + description: 'Returns the result of a join request. + + + **WARNING:** This end-point is only for testing purposes. Only a limited + + number of results are kept, so if there are multiple API clients using + + the device at the same time, and you are polling this end-point, you + may + + miss the result of your join request. + + ' + operationId: get-beolink-join-result + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/BeolinkJoinResult' + description: Join result available + '404': + description: Join result unavailable + summary: Get Beolink join result, test-endpoint + tags: + - Beolink + - mozart + parameters: + - description: Join request ID + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/BeolinkRequestID' + /api/v1/beolink/join/{jid}: + parameters: + - description: Jabber ID of peer to join + in: path + name: jid + required: true + schema: + $ref: '#/components/schemas/BeolinkPeerID' + - description: Ask to join a specific source on peer + in: query + name: source + required: false + schema: + type: string + post: + description: 'Join the experience currently active on peer with Jabber + ID `{jid}`. + + ' + operationId: join-beolink-peer + responses: + '202': + $ref: '#/components/responses/BeolinkJoinResponse' + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: Beolink not enabled on this device + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: Not allowed to initiate join + summary: Join multi-room experience + tags: + - Beolink + - mozart + /api/v1/beolink/leave: + post: + operationId: post-beolink-leave + responses: + '202': + description: successful operation + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: Beolink not enabled on this device + '404': + description: No active experience found + summary: Leave the ongoing experience (disconnect this device from remote) + tags: + - Beolink + - mozart + /api/v1/beolink/listeners: + get: + description: 'Get a list of devices that are listening to this device + active experience (that have joined). + + ' + operationId: get-beolink-listeners + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/BeolinkListener' + type: array + description: Success + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: Beolink not enabled on this device + summary: Get joined peers + tags: + - Beolink + - mozart + /api/v1/beolink/peers: + get: + description: 'Get information about the Beolink peers discovered by this + device. + + ' + operationId: get-beolink-peers + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/BeolinkPeer' + type: array + description: Success + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: Beolink not enabled on this device + summary: Get discovered peers + tags: + - Beolink + - mozart + /api/v1/beolink/self: + get: + description: 'Returns Beolink information like about this device. This + can be useful if you want to expand _to_ this device. + + ' + operationId: get-beolink-self + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/BeolinkPeer' + description: successful operation + summary: Get information about this device + tags: + - Beolink + - mozart + /api/v1/beolink/unexpand/{jid}: + parameters: + - description: Jabber id of peer to unexpand + in: path + name: jid + required: true + schema: + $ref: '#/components/schemas/BeolinkPeerID' + post: + description: 'Disconnect the device with jabber id `{jid}` from the current + active experience. + + ' + operationId: post-beolink-unexpand + responses: + '202': + description: Success + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: Beolink not enabled on this device + '404': + description: Remote device not found + summary: Unexpand (disconnect) a device from the multiroom session + tags: + - Beolink + - mozart + /api/v1/content: + get: + operationId: get-content + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ContentItemMap' + description: Successful request + summary: Get a list of available content + tags: + - Content + - mozart + parameters: + - description: Filter result that start with x. It could be input source + "tv", "netradio" or content "tv://TV", "tv://netflix" + in: query + name: startWith + required: false + schema: + type: string + /api/v1/overlay/play: + post: + description: 'Play some audio as an overlay. This will duck currently + playing music while the audio is playing. Currently 100 unique TTS + messages can be generated a day and generated messages are cached + for 24 hours. + + ' + operationId: post-overlay-play + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OverlayPlayRequest' + description: settings to use for the overlay + required: true + responses: + '202': + description: successful request; will attempt to play overlay + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: Bad request + summary: Play overlay + tags: + - Overlay + - mozart + /api/v1/playback/command/{command}: + post: + operationId: post-playback-command + parameters: + - description: the named command to execute + in: path + name: command + required: true + schema: + enum: + - play + - pause + - stop + - skip + - prev + type: string + responses: + '201': + description: successful operation + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + summary: Send a specific playback command to the product + tags: + - Playback + - mozart + /api/v1/playback/deezer/flow: + post: + operationId: start-deezer-flow + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UserFlow' + description: Select user + responses: + '201': + description: successful request + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + summary: Play users flow. If no provided user id it will play the flow + connected to the active account + tags: + - Deezer + - Playback + - mozart + /api/v1/playback/preset/{id}/trigger: + post: + operationId: activate-preset + parameters: + - description: the id of the preset you want to trigger + in: path + name: id + required: true + schema: + type: integer + responses: + '204': + description: successful operation + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + '412': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: Pre-condition not met + summary: Trigger a preset + tags: + - Playback + - mozart + /api/v1/playback/queue: + post: + operationId: add-to-queue + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PlayQueueItem' + description: the queue element you want to add + required: true + responses: + '204': + description: successful operation + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + summary: Add an element to the queue + tags: + - Playback + - mozart + /api/v1/playback/queue/clear: + post: + operationId: post-clear-queue + responses: + '201': + description: successful operation + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + summary: Clear the queue + tags: + - Playback + - mozart + /api/v1/playback/queue/settings: + get: + operationId: get-settings-queue + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PlayQueueSettings' + type: object + description: successful operation + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + summary: Get the current queue settings + tags: + - Playback + - mozart + put: + operationId: set-settings-queue + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PlayQueueSettings' + description: the desired settings + required: true + responses: + '204': + description: the new settings were accepted + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + summary: Set queue settings + tags: + - Playback + - mozart + /api/v1/playback/seek: + put: + operationId: seek-to-position + parameters: + - description: position in milliseconds + in: query + name: position_ms + required: true + schema: + format: int32 + type: integer + responses: + '204': + description: successful operation + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + summary: Seek to position in stream + tags: + - Playback + - mozart + /api/v1/playback/sources: + get: + operationId: get-available-sources + parameters: + - description: filter sources for remote control + in: query + name: target-remote + required: false + schema: + type: boolean + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SourceArray' + description: Returns a list of available sources + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + summary: Get all the available sources + tags: + - Playback + - mozart + /api/v1/playback/sources/active/{sourceId}: + post: + operationId: set-active-source + parameters: + - description: the id of the source to activate + in: path + name: sourceId + required: true + schema: + type: string + responses: + '201': + description: Successfully changed the active source + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + summary: Set the active source + tags: + - Playback + - mozart + /api/v1/playback/state: + get: + operationId: get-playback-state + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PlaybackState' + description: Model describing the current playback state and meta + data + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + summary: Get the current playback state + tags: + - Playback + - mozart + /api/v1/playback/uri: + post: + operationId: post-uri-source + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Uri' + description: the desired uri from which to stream data + required: true + responses: + '201': + description: successful operation + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + summary: Set the URI from which sound is streamed + tags: + - Playback + - mozart + /api/v1/product/info/friendlyname: + put: + operationId: set-product-friendly-name + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ProductFriendlyName' + description: the friendly name for the product + required: true + responses: + '204': + description: product friendly name updated + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + summary: Set the friendly name + tags: + - Product + - mozart + /api/v1/remote: + get: + operationId: get-remote-menu + parameters: + - description: Get all descendants to this item + in: query + name: descendantsTo + schema: + format: uuid + type: string + responses: + '200': + content: + application/json: + example: + 6c2ab917-2a9e-42dd-87c6-1fa2fabcdeb0: + content: + contentUri: tv + source: tv + firstChildMenuItemId: ee5196ce-65c4-4c56-9a48-1943c4afef9c + fixed: true + id: 6c2ab917-2a9e-42dd-87c6-1fa2fabcdeb0 + label: TV + parentMenuItemId: null + dd5196ce-65c4-4c56-9a48-1943c4afef9c: + content: + contentUri: tv://HBO + source: tv + fixed: false + id: dd5196ce-65c4-4c56-9a48-1943c4afef9c + label: HBO + parentMenuItemId: 6c2ab917-2a9e-42dd-87c6-1fa2fabcdeb0 + ee5196ce-65c4-4c56-9a48-1943c4afef9c: + content: + contentUri: tv://Netflix + source: tv + fixed: false + id: ee5196ce-65c4-4c56-9a48-1943c4afef9c + label: Netflix + nextSiblingMenuItemId: dd5196ce-65c4-4c56-9a48-1943c4afef9c + parentMenuItemId: 6c2ab917-2a9e-42dd-87c6-1fa2fabcdeb0 + schema: + $ref: '#/components/schemas/RemoteMenuItemMap' + description: Successful request + summary: Get all remote menu items + tags: + - Remote + - mozart + /api/v1/remote/key/{id}/trigger: + post: + operationId: post-remote-key-trigger + parameters: + - description: Key identifier + in: path + name: id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RemoteUIKeyState' + required: true + responses: + '204': + description: Remote input key press registered successfully + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: Failed to register key press + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: Key not found + summary: Remote input key press + tags: + - Remote + - mozart + /api/v1/remote/{id}/trigger: + parameters: + - description: Remote menu item ID + in: path + name: id + required: true + schema: + format: uuid + type: string + post: + operationId: post-remote-trigger + responses: + '204': + description: Menu item successfully triggered + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: Menu item not found + summary: Trigger a remote menu item + tags: + - Remote + - mozart + /api/v1/scene/match-trigger: + post: + operationId: post-scene-match-trigger + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SceneMatch' + required: true + responses: + '204': + description: Successful request + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: Bad request no match objects provided + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: Could not find any matching scene + summary: Trigger the first scene with same non null objects provided in + the SceneMatch object + tags: + - Scenes + - mozart + /api/v1/scene/run: + post: + operationId: run-provided-scene + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SceneProperties' + description: The scene you want to run + required: true + responses: + '204': + description: Successful request + summary: Run provided scene + tags: + - Scenes + - mozart + /api/v1/scene/{id}/trigger: + post: + operationId: post-scene-trigger + parameters: + - description: ID of the scene + in: path + name: id + required: true + schema: + format: uuid + type: string + responses: + '204': + description: Successful request + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: Bad request can't convert id to UUID + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: Could not find scene + summary: Trigger a specific scene + tags: + - Scenes + - mozart + /api/v1/scenes: + get: + operationId: get-all-scenes + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SceneMap' + description: Successful request + summary: Get a list of configured scenes + tags: + - Scenes + - mozart + /api/v1/setup/bluetooth/devices: + get: + operationId: get-bluetooth-devices-status + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/BluetoothDeviceList' + description: returns the current bluetooth devices + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + summary: Get the bluetooth devices status + tags: + - Bluetooth + - mozart + /api/v1/setup/presets: + get: + operationId: get-presets + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PresetMap' + description: The preset audio source mapping + summary: Get the preset configuration + tags: + - Settings + - mozart + /api/v1/setup/remote/home-control-ixp: + post: + operationId: post-remote-home-control-ixp + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/HomeControlIxp' + description: The new IXP + required: true + responses: + '200': + description: IXP updated + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + summary: Change any active Immersive Experience (IXP) + tags: + - Settings + - mozart + /api/v1/setup/remote/home-control-uri: + get: + operationId: get-remote-home-control-uri + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/HomeControlUri' + description: HomeControl dashboard and IXP uri + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + summary: Get HomeControl dashboard uri and (optional) Immersive Experience + (IXP) start page + tags: + - Settings + - mozart + put: + operationId: set-remote-home-control-uri + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/HomeControlUri' + description: The new uri for HomeControl dashboard and IXP start page + required: true + responses: + '200': + description: Uri for HomeControl dashboard and IXP start page + updated + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + summary: Set the uri for HomeControl dashboard and Immersive Experience + (IXP) start page + tags: + - Settings + - mozart + /api/v1/setup/remotes: + get: + operationId: get-bluetooth-remotes + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PairedRemoteResponse' + description: List of paired remotes was obtained + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + summary: Get a list of paired bluetooth remotes + tags: + - Settings + - mozart + /api/v1/softwareupdate: + get: + operationId: get-softwareupdate-status + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SoftwareUpdateStatus' + description: the software update status + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + summary: Get the current software update status + tags: + - Software update + - mozart + /api/v1/sound/features: + get: + operationId: get-sound-features + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SupportedSoundFeatures' + description: Supported sound features + summary: 'Get available sound features + + that match the current role (standalone or multichannel). + + ' + tags: + - Sound + - mozart + /api/v1/sound/listening-modes: + get: + operationId: get-listening-mode-set + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListeningModeSet' + description: the list of listening modes + summary: 'Get available listening modes that match the current role + + (standalone, multichannel or both(all)). + + ' + tags: + - Sound + - mozart + /api/v1/sound/listening-modes/active: + get: + operationId: get-active-listening-mode + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListeningModeRef' + description: the active listening mode + summary: Get the active listening mode + tags: + - Sound + - mozart + /api/v1/sound/listening-modes/{id}/activate: + parameters: + - $ref: '#/components/parameters/ListeningModeID' + post: + operationId: activate-listening-mode + responses: + '204': + description: Listening mode active + '404': + $ref: '#/components/responses/MissingListeningMode' + summary: Activate a listening mode + tags: + - Sound + - mozart + /api/v1/sound/settings/adjustments/bass: + put: + operationId: set-sound-settings-adjustments-bass + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Bass' + description: the bass level + required: true + responses: + '201': + description: accepted the bass sound settings + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + summary: Update the sound settings adjustments for bass + tags: + - Sound + - mozart + /api/v1/sound/settings/adjustments/directivity: + put: + operationId: set-sound-settings-adjustments-directivity + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Directivity' + description: the directivity + required: true + responses: + '201': + description: accepted the directivity sound settings + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + summary: Update the sound settings adjustments for directivity + tags: + - Sound + - mozart + /api/v1/sound/settings/adjustments/loudness: + put: + operationId: set-sound-settings-adjustments-loudness + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Loudness' + description: the loudness mode + required: true + responses: + '201': + description: accepted the loudness sound settings + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + summary: Update the sound settings adjustments for loudness + tags: + - Sound + - mozart + /api/v1/sound/settings/adjustments/treble: + put: + operationId: set-sound-settings-adjustments-treble + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Treble' + description: the treble level + required: true + responses: + '201': + description: accepted the treble sound settings + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + summary: Update the sound settings adjustments for treble + tags: + - Sound + - mozart + /api/v1/sound/speakergroup/active: + get: + operationId: get-speakergroup-active + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SpeakerGroupOverview' + description: The active speaker group, or empty if none + summary: Get the active speaker group + tags: + - SpeakerGroup + - mozart + /api/v1/sound/volume: + get: + operationId: get-current-volume + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/VolumeState' + description: The currently active volume + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + summary: Get the current volume state + tags: + - Sound + - mozart + /api/v1/sound/volume/level: + put: + operationId: set-current-volume-level + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/VolumeLevel' + description: The volume level to apply + required: true + responses: + '201': + description: volume level change accepted + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request (e.g. volume cannot be set) + summary: Set the current volume level + tags: + - Sound + - mozart + /api/v1/sound/volume/mute: + put: + operationId: set-volume-mute + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/VolumeMute' + description: The mute state to apply + required: true + responses: + '201': + description: volume mute state accepted + '400': + description: volume mute not accepted + summary: Set the volume mute state + tags: + - Sound + - mozart + /api/v1/sound/volume/settings: + get: + operationId: get-volume-settings + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/VolumeSettings' + description: returns the volume settings + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + summary: Get the current volume settings for default and maximum volume + level + tags: + - Sound + - mozart + put: + operationId: set-volume-settings + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/VolumeSettings' + description: The settings to apply + required: true + responses: + '201': + description: volume settings accepted + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + summary: Set the current volume settings for default and maximum volume + level + tags: + - Sound + - mozart + /api/v1/stand/move: + post: + operationId: set-stand-movement + parameters: + - description: Use slow speed on continuous movement + in: query + name: slow-speed + schema: + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/StandMovement' + description: Stand Movement + required: true + responses: + '204': + description: the movement were accepted + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: Stand not connected ot stand capability is not available + summary: Set stand movement with either an angle or a movement type + tags: + - Stand + - mozart + /api/v1/state: + get: + operationId: get-product-state + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ProductState' + description: A snapshot of the overall state of the product + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + summary: Get the overall state from the product + tags: + - Product + - mozart + /api/v1/state/power: + get: + operationId: get-power-state + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PowerStateEnum' + description: The power state of the product + summary: Get power state of the product + tags: + - Power + - mozart + /api/v1/state/standby: + put: + operationId: post-standby + responses: + '200': + description: The device is put in standby + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' + description: invalid request + summary: Put the device in standby + tags: + - Power + - mozart +security: [] diff --git a/python_client/PKG-INFO b/python_client/PKG-INFO index a803f23..ba07b02 100644 --- a/python_client/PKG-INFO +++ b/python_client/PKG-INFO @@ -1,31 +1,30 @@ Metadata-Version: 2.1 Name: mozart_api -Version: 3.2.1.150.6 +Version: 3.4.1.8.2 Summary: Mozart platform API Home-page: https://pypi.org/project/mozart-api/ License: MIT Keywords: OpenAPI,OpenAPI-Generator,Mozart platform API Author: BangOlufsen Author-email: support@bang-olufsen.dk -Requires-Python: >=3.8 +Requires-Python: >=3.11 Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 Classifier: Programming Language :: Python :: 3 :: Only Classifier: Topic :: Multimedia -Requires-Dist: aenum (>=3.1.11) Requires-Dist: aioconsole (>=0.4.1) Requires-Dist: aiohttp (>=3.8.3) +Requires-Dist: aiohttp-retry (>=2.8.3) Requires-Dist: inflection (>=0.5.1) -Requires-Dist: pydantic (>=1.10.5,<2.0.0) +Requires-Dist: pydantic (>=2) Requires-Dist: python-dateutil (>=2.8.2) Requires-Dist: typing-extensions (>=4.7.1) Requires-Dist: urllib3 (>=1.25.3) +Requires-Dist: websockets (>=12.0) Requires-Dist: zeroconf (>=0.25.1) Project-URL: Bug Tracker, https://github.com/bang-olufsen/mozart-open-api/issues Project-URL: Documentation, https://bang-olufsen.github.io/mozart-open-api/ @@ -44,7 +43,7 @@ Description-Content-Type: text/markdown The Mozart API is an async REST API with WebSocket notification channel for immediate state information from Mozart devices. Currently the API is distributed as a [Python package](https://pypi.org/project/mozart-api) and as an OpenAPI document that can be found in the [Github releases](https://github.com/bang-olufsen/mozart-open-api/releases). Supported by: - +- [Beoconnect Core](https://www.bang-olufsen.com/en/dk/accessories/beoconnect-core) - [Beolab 8](https://www.bang-olufsen.com/en/dk/speakers/beolab-8) - [Beolab 28](https://www.bang-olufsen.com/en/dk/speakers/beolab-28) - [Beosound 2 3rd gen](https://www.bang-olufsen.com/en/dk/speakers/beosound-2) diff --git a/python_client/README.md b/python_client/README.md index 1ee1250..6862bd4 100644 --- a/python_client/README.md +++ b/python_client/README.md @@ -10,7 +10,7 @@ The Mozart API is an async REST API with WebSocket notification channel for immediate state information from Mozart devices. Currently the API is distributed as a [Python package](https://pypi.org/project/mozart-api) and as an OpenAPI document that can be found in the [Github releases](https://github.com/bang-olufsen/mozart-open-api/releases). Supported by: - +- [Beoconnect Core](https://www.bang-olufsen.com/en/dk/accessories/beoconnect-core) - [Beolab 8](https://www.bang-olufsen.com/en/dk/speakers/beolab-8) - [Beolab 28](https://www.bang-olufsen.com/en/dk/speakers/beolab-28) - [Beosound 2 3rd gen](https://www.bang-olufsen.com/en/dk/speakers/beosound-2) diff --git a/python_client/mozart_api/__init__.py b/python_client/mozart_api/__init__.py index 379eb47..73445be 100644 --- a/python_client/mozart_api/__init__.py +++ b/python_client/mozart_api/__init__.py @@ -15,7 +15,7 @@ """ # noqa: E501 -__version__ = "3.2.1.150.6" +__version__ = "3.4.1.8.2" # import apis into sdk package from mozart_api.api.beolink_api import BeolinkApi @@ -32,6 +32,7 @@ from mozart_api.api.software_update_api import SoftwareUpdateApi from mozart_api.api.sound_api import SoundApi from mozart_api.api.speaker_group_api import SpeakerGroupApi +from mozart_api.api.stand_api import StandApi from mozart_api.api.mozart_api import MozartApi # import ApiClient @@ -66,7 +67,6 @@ from mozart_api.models.beo_remote_button import BeoRemoteButton from mozart_api.models.beolink_available_listener import BeolinkAvailableListener from mozart_api.models.beolink_experience import BeolinkExperience -from mozart_api.models.beolink_experiences_request import BeolinkExperiencesRequest from mozart_api.models.beolink_experiences_result import BeolinkExperiencesResult from mozart_api.models.beolink_join_request import BeolinkJoinRequest from mozart_api.models.beolink_join_result import BeolinkJoinResult @@ -89,6 +89,7 @@ from mozart_api.models.fader_range import FaderRange from mozart_api.models.hdmi_input import HdmiInput from mozart_api.models.hdmi_video_format import HdmiVideoFormat +from mozart_api.models.home_control_ixp import HomeControlIxp from mozart_api.models.home_control_uri import HomeControlUri from mozart_api.models.install_record_id_state import InstallRecordIdState from mozart_api.models.latency_profile import LatencyProfile @@ -188,11 +189,14 @@ from mozart_api.models.speaker_group_member import SpeakerGroupMember from mozart_api.models.speaker_group_member_location import SpeakerGroupMemberLocation from mozart_api.models.speaker_group_overview import SpeakerGroupOverview +from mozart_api.models.speaker_link_member_status import SpeakerLinkMemberStatus +from mozart_api.models.speaker_link_status import SpeakerLinkStatus from mozart_api.models.speaker_role_enum import SpeakerRoleEnum from mozart_api.models.speech_enhance import SpeechEnhance from mozart_api.models.speech_enhance_feature import SpeechEnhanceFeature from mozart_api.models.speech_enhance_range import SpeechEnhanceRange from mozart_api.models.stand_connected import StandConnected +from mozart_api.models.stand_movement import StandMovement from mozart_api.models.stand_position import StandPosition from mozart_api.models.tone_touch import ToneTouch from mozart_api.models.tone_touch_type import ToneTouchType @@ -280,6 +284,9 @@ from mozart_api.models.web_socket_event_speaker_group_changed import ( WebSocketEventSpeakerGroupChanged, ) +from mozart_api.models.web_socket_event_speaker_link_status_changed import ( + WebSocketEventSpeakerLinkStatusChanged, +) from mozart_api.models.web_socket_event_stand_connected import ( WebSocketEventStandConnected, ) diff --git a/python_client/mozart_api/api/__init__.py b/python_client/mozart_api/api/__init__.py index 4edece7..dcd71e0 100644 --- a/python_client/mozart_api/api/__init__.py +++ b/python_client/mozart_api/api/__init__.py @@ -15,4 +15,5 @@ from mozart_api.api.software_update_api import SoftwareUpdateApi from mozart_api.api.sound_api import SoundApi from mozart_api.api.speaker_group_api import SpeakerGroupApi +from mozart_api.api.stand_api import StandApi from mozart_api.api.mozart_api import MozartApi diff --git a/python_client/mozart_api/api/beolink_api.py b/python_client/mozart_api/api/beolink_api.py index 9fb5ac0..0f0a580 100644 --- a/python_client/mozart_api/api/beolink_api.py +++ b/python_client/mozart_api/api/beolink_api.py @@ -12,28 +12,23 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError -from typing import overload, Optional, Union, Awaitable - +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr - -from typing import List, Optional +from pydantic import Field, StrictStr +from typing import Optional +from typing_extensions import Annotated from mozart_api.models.beolink_available_listener import BeolinkAvailableListener from mozart_api.models.beolink_join_request import BeolinkJoinRequest from mozart_api.models.beolink_join_result import BeolinkJoinResult from mozart_api.models.beolink_listener import BeolinkListener from mozart_api.models.beolink_peer import BeolinkPeer -from mozart_api.api_client import ApiClient +from mozart_api.api_client import ApiClient, RequestSerialized from mozart_api.api_response import ApiResponse -from mozart_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 +from mozart_api.rest import RESTResponseType class BeolinkApi: @@ -48,1411 +43,2600 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call async def get_beolink_available_listeners( - self, **kwargs - ) -> List[BeolinkAvailableListener]: # noqa: E501 - """Get available listeners # noqa: E501 + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[BeolinkAvailableListener]: + """Get available listeners - Get a list of devices that can be listening to this device active experience. # noqa: E501 + Get a list of devices that can be listening to this device active experience. - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: List[BeolinkAvailableListener] - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_beolink_available_listeners_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_beolink_available_listeners_with_http_info( - **kwargs - ) # noqa: E501 - - @validate_arguments - async def get_beolink_available_listeners_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get available listeners # noqa: E501 - - Get a list of devices that can be listening to this device active experience. # noqa: E501 - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(List[BeolinkAvailableListener], status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_beolink_available_listeners" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + """ # noqa: E501 - # authentication setting - _auth_settings = [] # noqa: E501 + _param = self._get_beolink_available_listeners_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _response_types_map = { + _response_types_map: Dict[str, Optional[str]] = { "200": "List[BeolinkAvailableListener]", "400": "ErrorModel", } - - return await self.api_client.call_api( - "/api/v1/beolink/available-listeners", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - @validate_arguments - async def get_beolink_join_result( - self, - id: Annotated[StrictStr, Field(..., description="Join request ID")], - **kwargs - ) -> BeolinkJoinResult: # noqa: E501 - """Get Beolink join result, test-endpoint # noqa: E501 - - Returns the result of a join request. **WARNING:** This end-point is only for testing purposes. Only a limited number of results are kept, so if there are multiple API clients using the device at the same time, and you are polling this end-point, you may miss the result of your join request. # noqa: E501 - - :param id: Join request ID (required) - :type id: str - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: BeolinkJoinResult - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_beolink_join_result_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_beolink_join_result_with_http_info( - id, **kwargs - ) # noqa: E501 - - @validate_arguments - async def get_beolink_join_result_with_http_info( + @validate_call + async def get_beolink_available_listeners_with_http_info( self, - id: Annotated[StrictStr, Field(..., description="Join request ID")], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get Beolink join result, test-endpoint # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[BeolinkAvailableListener]]: + """Get available listeners - Returns the result of a join request. **WARNING:** This end-point is only for testing purposes. Only a limited number of results are kept, so if there are multiple API clients using the device at the same time, and you are polling this end-point, you may miss the result of your join request. # noqa: E501 + Get a list of devices that can be listening to this device active experience. - :param id: Join request ID (required) - :type id: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(BeolinkJoinResult, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["id"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_beolink_join_result" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params["id"] is not None: - _path_params["id"] = _params["id"] - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + """ # noqa: E501 - # authentication setting - _auth_settings = [] # noqa: E501 + _param = self._get_beolink_available_listeners_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _response_types_map = { - "200": "BeolinkJoinResult", - "404": None, + _response_types_map: Dict[str, Optional[str]] = { + "200": "List[BeolinkAvailableListener]", + "400": "ErrorModel", } - - return await self.api_client.call_api( - "/api/v1/beolink/join-result/{id}", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - async def get_beolink_listeners( - self, **kwargs - ) -> List[BeolinkListener]: # noqa: E501 - """Get joined peers # noqa: E501 + @validate_call + async def get_beolink_available_listeners_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get available listeners - Get a list of devices that are listening to this device active experience (that have joined). # noqa: E501 + Get a list of devices that can be listening to this device active experience. - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: List[BeolinkListener] - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_beolink_listeners_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_beolink_listeners_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def get_beolink_listeners_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get joined peers # noqa: E501 - - Get a list of devices that are listening to this device active experience (that have joined). # noqa: E501 - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(List[BeolinkListener], status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_beolink_listeners" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 - # process the path parameters - _path_params = {} + _param = self._get_beolink_available_listeners_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "List[BeolinkAvailableListener]", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_beolink_available_listeners_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "List[BeolinkListener]", - "400": "ErrorModel", - } - - return await self.api_client.call_api( - "/api/v1/beolink/listeners", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/beolink/available-listeners", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def get_beolink_peers(self, **kwargs) -> List[BeolinkPeer]: # noqa: E501 - """Get discovered peers # noqa: E501 + @validate_call + async def get_beolink_join_result( + self, + id: Annotated[StrictStr, Field(description="Join request ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BeolinkJoinResult: + """Get Beolink join result, test-endpoint - Get information about the Beolink peers discovered by this device. # noqa: E501 + Returns the result of a join request. **WARNING:** This end-point is only for testing purposes. Only a limited number of results are kept, so if there are multiple API clients using the device at the same time, and you are polling this end-point, you may miss the result of your join request. - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: List[BeolinkPeer] - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_beolink_peers_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_beolink_peers_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def get_beolink_peers_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get discovered peers # noqa: E501 - - Get information about the Beolink peers discovered by this device. # noqa: E501 - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + :param id: Join request ID (required) + :type id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(List[BeolinkPeer], status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_beolink_peers" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._get_beolink_join_result_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} + _response_types_map: Dict[str, Optional[str]] = { + "200": "BeolinkJoinResult", + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + @validate_call + async def get_beolink_join_result_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Join request ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BeolinkJoinResult]: + """Get Beolink join result, test-endpoint - # authentication setting - _auth_settings = [] # noqa: E501 + Returns the result of a join request. **WARNING:** This end-point is only for testing purposes. Only a limited number of results are kept, so if there are multiple API clients using the device at the same time, and you are polling this end-point, you may miss the result of your join request. - _response_types_map = { - "200": "List[BeolinkPeer]", - "400": "ErrorModel", - } + :param id: Join request ID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_beolink_join_result_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - return await self.api_client.call_api( - "/api/v1/beolink/peers", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + _response_types_map: Dict[str, Optional[str]] = { + "200": "BeolinkJoinResult", + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - async def get_beolink_self(self, **kwargs) -> BeolinkPeer: # noqa: E501 - """Get information about this device # noqa: E501 + @validate_call + async def get_beolink_join_result_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Join request ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Beolink join result, test-endpoint - Returns Beolink information like about this device. This can be useful if you want to expand _to_ this device. # noqa: E501 + Returns the result of a join request. **WARNING:** This end-point is only for testing purposes. Only a limited number of results are kept, so if there are multiple API clients using the device at the same time, and you are polling this end-point, you may miss the result of your join request. - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: BeolinkPeer - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_beolink_self_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_beolink_self_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def get_beolink_self_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get information about this device # noqa: E501 - - Returns Beolink information like about this device. This can be useful if you want to expand _to_ this device. # noqa: E501 - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + :param id: Join request ID (required) + :type id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(BeolinkPeer, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_beolink_self" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._get_beolink_join_result_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} + _response_types_map: Dict[str, Optional[str]] = { + "200": "BeolinkJoinResult", + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_beolink_join_result_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params["id"] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "BeolinkPeer", - } - - return await self.api_client.call_api( - "/api/v1/beolink/self", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/beolink/join-result/{id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def join_beolink_peer( + @validate_call + async def get_beolink_listeners( self, - jid: Annotated[StrictStr, Field(..., description="Jabber ID of peer to join")], - source: Annotated[ - Optional[StrictStr], - Field(description="Ask to join a specific source on peer"), + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], ] = None, - **kwargs - ) -> BeolinkJoinRequest: # noqa: E501 - """Join multi-room experience # noqa: E501 + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[BeolinkListener]: + """Get joined peers - Join the experience currently active on peer with Jabber ID `{jid}`. # noqa: E501 + Get a list of devices that are listening to this device active experience (that have joined). - :param jid: Jabber ID of peer to join (required) - :type jid: str - :param source: Ask to join a specific source on peer - :type source: str - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: BeolinkJoinRequest - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the join_beolink_peer_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.join_beolink_peer_with_http_info( - jid, source, **kwargs - ) # noqa: E501 - - @validate_arguments - async def join_beolink_peer_with_http_info( + """ # noqa: E501 + + _param = self._get_beolink_listeners_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "List[BeolinkListener]", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def get_beolink_listeners_with_http_info( self, - jid: Annotated[StrictStr, Field(..., description="Jabber ID of peer to join")], - source: Annotated[ - Optional[StrictStr], - Field(description="Ask to join a specific source on peer"), + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Join multi-room experience # noqa: E501 + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[BeolinkListener]]: + """Get joined peers - Join the experience currently active on peer with Jabber ID `{jid}`. # noqa: E501 + Get a list of devices that are listening to this device active experience (that have joined). - :param jid: Jabber ID of peer to join (required) - :type jid: str - :param source: Ask to join a specific source on peer - :type source: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(BeolinkJoinRequest, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["jid", "source"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method join_beolink_peer" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params["jid"] is not None: - _path_params["jid"] = _params["jid"] - - # process the query parameters - _query_params = [] - if _params.get("source") is not None: # noqa: E501 - _query_params.append(("source", _params["source"])) - - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + """ # noqa: E501 - # authentication setting - _auth_settings = [] # noqa: E501 + _param = self._get_beolink_listeners_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _response_types_map = { - "202": "BeolinkJoinRequest", + _response_types_map: Dict[str, Optional[str]] = { + "200": "List[BeolinkListener]", "400": "ErrorModel", - "403": "ErrorModel", } - - return await self.api_client.call_api( - "/api/v1/beolink/join/{jid}", - "POST", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - async def join_latest_beolink_experience( - self, **kwargs - ) -> BeolinkJoinRequest: # noqa: E501 - """Trigger touch to join # noqa: E501 + @validate_call + async def get_beolink_listeners_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get joined peers + Get a list of devices that are listening to this device active experience (that have joined). - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: BeolinkJoinRequest - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the join_latest_beolink_experience_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.join_latest_beolink_experience_with_http_info( - **kwargs - ) # noqa: E501 - - @validate_arguments - async def join_latest_beolink_experience_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Trigger touch to join # noqa: E501 - - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(BeolinkJoinRequest, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method join_latest_beolink_experience" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 - # process the path parameters - _path_params = {} + _param = self._get_beolink_listeners_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "List[BeolinkListener]", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + def _get_beolink_listeners_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "202": "BeolinkJoinRequest", - "400": "ErrorModel", - "403": "ErrorModel", - } - - return await self.api_client.call_api( - "/api/v1/beolink/join", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/beolink/listeners", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def post_beolink_allstandby(self, **kwargs) -> None: # noqa: E501 - """Broadcast an all standby event to turn all Beolink devices off # noqa: E501 + @validate_call + async def get_beolink_peers( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[BeolinkPeer]: + """Get discovered peers + Get information about the Beolink peers discovered by this device. - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the post_beolink_allstandby_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.post_beolink_allstandby_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def post_beolink_allstandby_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Broadcast an all standby event to turn all Beolink devices off # noqa: E501 - - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method post_beolink_allstandby" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 - # process the path parameters - _path_params = {} + _param = self._get_beolink_peers_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} + _response_types_map: Dict[str, Optional[str]] = { + "200": "List[BeolinkPeer]", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def get_beolink_peers_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[BeolinkPeer]]: + """Get discovered peers + + Get information about the Beolink peers discovered by this device. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_beolink_peers_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "List[BeolinkPeer]", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def get_beolink_peers_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get discovered peers + + Get information about the Beolink peers discovered by this device. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_beolink_peers_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "List[BeolinkPeer]", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_beolink_peers_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/beolink/peers", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def get_beolink_self( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BeolinkPeer: + """Get information about this device + + Returns Beolink information like about this device. This can be useful if you want to expand _to_ this device. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_beolink_self_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "BeolinkPeer", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def get_beolink_self_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BeolinkPeer]: + """Get information about this device + + Returns Beolink information like about this device. This can be useful if you want to expand _to_ this device. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_beolink_self_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "BeolinkPeer", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def get_beolink_self_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get information about this device + + Returns Beolink information like about this device. This can be useful if you want to expand _to_ this device. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_beolink_self_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "BeolinkPeer", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_beolink_self_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/beolink/self", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def join_beolink_peer( + self, + jid: Annotated[StrictStr, Field(description="Jabber ID of peer to join")], + source: Annotated[ + Optional[StrictStr], + Field(description="Ask to join a specific source on peer"), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BeolinkJoinRequest: + """Join multi-room experience + + Join the experience currently active on peer with Jabber ID `{jid}`. + + :param jid: Jabber ID of peer to join (required) + :type jid: str + :param source: Ask to join a specific source on peer + :type source: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._join_beolink_peer_serialize( + jid=jid, + source=source, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": "BeolinkJoinRequest", + "400": "ErrorModel", + "403": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def join_beolink_peer_with_http_info( + self, + jid: Annotated[StrictStr, Field(description="Jabber ID of peer to join")], + source: Annotated[ + Optional[StrictStr], + Field(description="Ask to join a specific source on peer"), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BeolinkJoinRequest]: + """Join multi-room experience + + Join the experience currently active on peer with Jabber ID `{jid}`. + + :param jid: Jabber ID of peer to join (required) + :type jid: str + :param source: Ask to join a specific source on peer + :type source: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._join_beolink_peer_serialize( + jid=jid, + source=source, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": "BeolinkJoinRequest", + "400": "ErrorModel", + "403": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def join_beolink_peer_without_preload_content( + self, + jid: Annotated[StrictStr, Field(description="Jabber ID of peer to join")], + source: Annotated[ + Optional[StrictStr], + Field(description="Ask to join a specific source on peer"), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Join multi-room experience + + Join the experience currently active on peer with Jabber ID `{jid}`. + + :param jid: Jabber ID of peer to join (required) + :type jid: str + :param source: Ask to join a specific source on peer + :type source: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._join_beolink_peer_serialize( + jid=jid, + source=source, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": "BeolinkJoinRequest", + "400": "ErrorModel", + "403": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _join_beolink_peer_serialize( + self, + jid, + source, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if jid is not None: + _path_params["jid"] = jid + # process the query parameters + if source is not None: + + _query_params.append(("source", source)) + + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/beolink/join/{jid}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def join_latest_beolink_experience( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BeolinkJoinRequest: + """Trigger touch to join + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._join_latest_beolink_experience_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": "BeolinkJoinRequest", + "400": "ErrorModel", + "403": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def join_latest_beolink_experience_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BeolinkJoinRequest]: + """Trigger touch to join + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._join_latest_beolink_experience_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": "BeolinkJoinRequest", + "400": "ErrorModel", + "403": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def join_latest_beolink_experience_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Trigger touch to join + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._join_latest_beolink_experience_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": "BeolinkJoinRequest", + "400": "ErrorModel", + "403": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _join_latest_beolink_experience_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/beolink/join", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def post_beolink_allstandby( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Broadcast an all standby event to turn all Beolink devices off + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_beolink_allstandby_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def post_beolink_allstandby_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Broadcast an all standby event to turn all Beolink devices off + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_beolink_allstandby_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def post_beolink_allstandby_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Broadcast an all standby event to turn all Beolink devices off + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_beolink_allstandby_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _post_beolink_allstandby_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/beolink/allstandby", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/beolink/allstandby", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def post_beolink_expand( self, jid: Annotated[ StrictStr, - Field( - ..., description="Jabber id of peer to expand the active experience to" - ), + Field(description="Jabber id of peer to expand the active experience to"), ], - **kwargs - ) -> None: # noqa: E501 - """Expand the current active experience # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Expand the current active experience - Expand the current active experience to another device with jabber id `{jid}`. # noqa: E501 + Expand the current active experience to another device with jabber id `{jid}`. :param jid: Jabber id of peer to expand the active experience to (required) :type jid: str - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the post_beolink_expand_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.post_beolink_expand_with_http_info( - jid, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._post_beolink_expand_serialize( + jid=jid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + "403": "ErrorModel", + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def post_beolink_expand_with_http_info( self, jid: Annotated[ StrictStr, - Field( - ..., description="Jabber id of peer to expand the active experience to" - ), + Field(description="Jabber id of peer to expand the active experience to"), ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Expand the current active experience # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Expand the current active experience - Expand the current active experience to another device with jabber id `{jid}`. # noqa: E501 + Expand the current active experience to another device with jabber id `{jid}`. :param jid: Jabber id of peer to expand the active experience to (required) :type jid: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["jid"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method post_beolink_expand" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._post_beolink_expand_serialize( + jid=jid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["jid"] is not None: - _path_params["jid"] = _params["jid"] + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + "403": "ErrorModel", + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def post_beolink_expand_without_preload_content( + self, + jid: Annotated[ + StrictStr, + Field(description="Jabber id of peer to expand the active experience to"), + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Expand the current active experience + + Expand the current active experience to another device with jabber id `{jid}`. + + :param jid: Jabber id of peer to expand the active experience to (required) + :type jid: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_beolink_expand_serialize( + jid=jid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + "403": "ErrorModel", + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _post_beolink_expand_serialize( + self, + jid, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if jid is not None: + _path_params["jid"] = jid # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/beolink/expand/{jid}", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/beolink/expand/{jid}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def post_beolink_leave(self, **kwargs) -> None: # noqa: E501 - """Leave the ongoing experience (disconnect this device from remote) # noqa: E501 + @validate_call + async def post_beolink_leave( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Leave the ongoing experience (disconnect this device from remote) - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the post_beolink_leave_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.post_beolink_leave_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._post_beolink_leave_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def post_beolink_leave_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Leave the ongoing experience (disconnect this device from remote) # noqa: E501 - - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Leave the ongoing experience (disconnect this device from remote) + + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method post_beolink_leave" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 - # process the path parameters - _path_params = {} + _param = self._post_beolink_leave_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def post_beolink_leave_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Leave the ongoing experience (disconnect this device from remote) + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_beolink_leave_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _post_beolink_leave_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/beolink/leave", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/beolink/leave", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def post_beolink_unexpand( self, - jid: Annotated[ - StrictStr, Field(..., description="Jabber id of peer to unexpand") - ], - **kwargs - ) -> None: # noqa: E501 - """Unexpand (disconnect) a device from the multiroom session # noqa: E501 + jid: Annotated[StrictStr, Field(description="Jabber id of peer to unexpand")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Unexpand (disconnect) a device from the multiroom session - Disconnect the device with jabber id `{jid}` from the current active experience. # noqa: E501 + Disconnect the device with jabber id `{jid}` from the current active experience. :param jid: Jabber id of peer to unexpand (required) :type jid: str - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the post_beolink_unexpand_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.post_beolink_unexpand_with_http_info( - jid, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._post_beolink_unexpand_serialize( + jid=jid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def post_beolink_unexpand_with_http_info( self, - jid: Annotated[ - StrictStr, Field(..., description="Jabber id of peer to unexpand") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Unexpand (disconnect) a device from the multiroom session # noqa: E501 + jid: Annotated[StrictStr, Field(description="Jabber id of peer to unexpand")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Unexpand (disconnect) a device from the multiroom session - Disconnect the device with jabber id `{jid}` from the current active experience. # noqa: E501 + Disconnect the device with jabber id `{jid}` from the current active experience. :param jid: Jabber id of peer to unexpand (required) :type jid: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["jid"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method post_beolink_unexpand" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._post_beolink_unexpand_serialize( + jid=jid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["jid"] is not None: - _path_params["jid"] = _params["jid"] + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def post_beolink_unexpand_without_preload_content( + self, + jid: Annotated[StrictStr, Field(description="Jabber id of peer to unexpand")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Unexpand (disconnect) a device from the multiroom session + + Disconnect the device with jabber id `{jid}` from the current active experience. + + :param jid: Jabber id of peer to unexpand (required) + :type jid: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_beolink_unexpand_serialize( + jid=jid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _post_beolink_unexpand_serialize( + self, + jid, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if jid is not None: + _path_params["jid"] = jid # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/beolink/unexpand/{jid}", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/beolink/unexpand/{jid}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/python_client/mozart_api/api/bluetooth_api.py b/python_client/mozart_api/api/bluetooth_api.py index 17b42c0..fc65b78 100644 --- a/python_client/mozart_api/api/bluetooth_api.py +++ b/python_client/mozart_api/api/bluetooth_api.py @@ -12,19 +12,16 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError -from typing import overload, Optional, Union, Awaitable +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from mozart_api.models.bluetooth_device_list import BluetoothDeviceList -from mozart_api.api_client import ApiClient +from mozart_api.api_client import ApiClient, RequestSerialized from mozart_api.api_response import ApiResponse -from mozart_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 +from mozart_api.rest import RESTResponseType class BluetoothApi: @@ -39,125 +36,226 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call async def get_bluetooth_devices_status( - self, **kwargs - ) -> BluetoothDeviceList: # noqa: E501 - """Get the bluetooth devices status # noqa: E501 + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BluetoothDeviceList: + """Get the bluetooth devices status - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: BluetoothDeviceList - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_bluetooth_devices_status_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_bluetooth_devices_status_with_http_info( - **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_bluetooth_devices_status_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "BluetoothDeviceList", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def get_bluetooth_devices_status_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get the bluetooth devices status # noqa: E501 - - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BluetoothDeviceList]: + """Get the bluetooth devices status + + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(BluetoothDeviceList, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._get_bluetooth_devices_status_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_bluetooth_devices_status" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "BluetoothDeviceList", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} + @validate_call + async def get_bluetooth_devices_status_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the bluetooth devices status - # process the path parameters - _path_params = {} + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_bluetooth_devices_status_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "BluetoothDeviceList", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_bluetooth_devices_status_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "BluetoothDeviceList", - "400": "ErrorModel", - } + _auth_settings: List[str] = [] - return await self.api_client.call_api( - "/api/v1/setup/bluetooth/devices", - "GET", - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/setup/bluetooth/devices", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/python_client/mozart_api/api/content_api.py b/python_client/mozart_api/api/content_api.py index 1072aa0..02f713a 100644 --- a/python_client/mozart_api/api/content_api.py +++ b/python_client/mozart_api/api/content_api.py @@ -12,24 +12,19 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError -from typing import overload, Optional, Union, Awaitable - +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr - -from typing import Dict, Optional +from pydantic import Field, StrictStr +from typing import Optional +from typing_extensions import Annotated from mozart_api.models.content_item import ContentItem -from mozart_api.api_client import ApiClient +from mozart_api.api_client import ApiClient, RequestSerialized from mozart_api.api_response import ApiResponse -from mozart_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 +from mozart_api.rest import RESTResponseType class ContentApi: @@ -44,7 +39,7 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call async def get_content( self, start_with: Annotated[ @@ -53,29 +48,66 @@ async def get_content( description='Filter result that start with x. It could be input source "tv", "netradio" or content "tv://TV", "tv://netflix"' ), ] = None, - **kwargs - ) -> Dict[str, ContentItem]: # noqa: E501 - """Get a list of available content # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Dict[str, ContentItem]: + """Get a list of available content :param start_with: Filter result that start with x. It could be input source \"tv\", \"netradio\" or content \"tv://TV\", \"tv://netflix\" :type start_with: str - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Dict[str, ContentItem] - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_content_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_content_with_http_info(start_with, **kwargs) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_content_serialize( + start_with=start_with, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, ContentItem]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def get_content_with_http_info( self, start_with: Annotated[ @@ -84,103 +116,178 @@ async def get_content_with_http_info( description='Filter result that start with x. It could be input source "tv", "netradio" or content "tv://TV", "tv://netflix"' ), ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get a list of available content # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Dict[str, ContentItem]]: + """Get a list of available content :param start_with: Filter result that start with x. It could be input source \"tv\", \"netradio\" or content \"tv://TV\", \"tv://netflix\" :type start_with: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Dict[str, ContentItem], status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["start_with"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._get_content_serialize( + start_with=start_with, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_content" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, ContentItem]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} + @validate_call + async def get_content_without_preload_content( + self, + start_with: Annotated[ + Optional[StrictStr], + Field( + description='Filter result that start with x. It could be input source "tv", "netradio" or content "tv://TV", "tv://netflix"' + ), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a list of available content - # process the path parameters - _path_params = {} + :param start_with: Filter result that start with x. It could be input source \"tv\", \"netradio\" or content \"tv://TV\", \"tv://netflix\" + :type start_with: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_content_serialize( + start_with=start_with, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, ContentItem]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_content_serialize( + self, + start_with, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] - if _params.get("start_with") is not None: # noqa: E501 - _query_params.append(("startWith", _params["start_with"])) + if start_with is not None: + + _query_params.append(("startWith", start_with)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 + _auth_settings: List[str] = [] - _response_types_map = { - "200": "Dict[str, ContentItem]", - } - - return await self.api_client.call_api( - "/api/v1/content", - "GET", - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/content", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/python_client/mozart_api/api/deezer_api.py b/python_client/mozart_api/api/deezer_api.py index 9b9489f..954cb28 100644 --- a/python_client/mozart_api/api/deezer_api.py +++ b/python_client/mozart_api/api/deezer_api.py @@ -12,24 +12,19 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError -from typing import overload, Optional, Union, Awaitable - +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field +from pydantic import Field from typing import Optional - +from typing_extensions import Annotated from mozart_api.models.user_flow import UserFlow -from mozart_api.api_client import ApiClient +from mozart_api.api_client import ApiClient, RequestSerialized from mozart_api.api_response import ApiResponse -from mozart_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 +from mozart_api.rest import RESTResponseType class DeezerApi: @@ -44,145 +39,257 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call async def start_deezer_flow( self, user_flow: Annotated[ Optional[UserFlow], Field(description="Select user") ] = None, - **kwargs - ) -> None: # noqa: E501 - """Play users flow. If no provided user id it will play the flow connected to the active account # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Play users flow. If no provided user id it will play the flow connected to the active account :param user_flow: Select user :type user_flow: UserFlow - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the start_deezer_flow_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.start_deezer_flow_with_http_info( - user_flow, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._start_deezer_flow_serialize( + user_flow=user_flow, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def start_deezer_flow_with_http_info( self, user_flow: Annotated[ Optional[UserFlow], Field(description="Select user") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Play users flow. If no provided user id it will play the flow connected to the active account # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Play users flow. If no provided user id it will play the flow connected to the active account :param user_flow: Select user :type user_flow: UserFlow - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["user_flow"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._start_deezer_flow_serialize( + user_flow=user_flow, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method start_deezer_flow" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} + @validate_call + async def start_deezer_flow_without_preload_content( + self, + user_flow: Annotated[ + Optional[UserFlow], Field(description="Select user") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Play users flow. If no provided user id it will play the flow connected to the active account - # process the path parameters - _path_params = {} + :param user_flow: Select user + :type user_flow: UserFlow + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._start_deezer_flow_serialize( + user_flow=user_flow, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _start_deezer_flow_serialize( + self, + user_flow, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["user_flow"] is not None: - _body_params = _params["user_flow"] + if user_flow is not None: + _body_params = user_flow # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/playback/deezer/flow", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/playback/deezer/flow", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/python_client/mozart_api/api/mozart_api.py b/python_client/mozart_api/api/mozart_api.py index e7e3b1a..3ccd08e 100644 --- a/python_client/mozart_api/api/mozart_api.py +++ b/python_client/mozart_api/api/mozart_api.py @@ -12,19 +12,14 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError -from typing import overload, Optional, Union, Awaitable - +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictBool, StrictInt, StrictStr, conint - -from typing import Any, Dict, List, Optional +from pydantic import Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Optional +from typing_extensions import Annotated from mozart_api.models.bass import Bass from mozart_api.models.battery_state import BatteryState from mozart_api.models.beolink_available_listener import BeolinkAvailableListener @@ -35,6 +30,7 @@ from mozart_api.models.bluetooth_device_list import BluetoothDeviceList from mozart_api.models.content_item import ContentItem from mozart_api.models.directivity import Directivity +from mozart_api.models.home_control_ixp import HomeControlIxp from mozart_api.models.home_control_uri import HomeControlUri from mozart_api.models.listening_mode import ListeningMode from mozart_api.models.listening_mode_ref import ListeningModeRef @@ -57,6 +53,7 @@ from mozart_api.models.sound_feature_set import SoundFeatureSet from mozart_api.models.source_array import SourceArray from mozart_api.models.speaker_group_overview import SpeakerGroupOverview +from mozart_api.models.stand_movement import StandMovement from mozart_api.models.treble import Treble from mozart_api.models.uri import Uri from mozart_api.models.user_flow import UserFlow @@ -65,9 +62,9 @@ from mozart_api.models.volume_settings import VolumeSettings from mozart_api.models.volume_state import VolumeState -from mozart_api.api_client import ApiClient +from mozart_api.api_client import ApiClient, RequestSerialized from mozart_api.api_response import ApiResponse -from mozart_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 +from mozart_api.rest import RESTResponseType class MozartApi: @@ -82,7409 +79,14119 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call async def activate_listening_mode( - self, id: conint(strict=True, ge=0), **kwargs - ) -> None: # noqa: E501 - """Activate a listening mode # noqa: E501 + self, + id: Annotated[int, Field(strict=True, ge=0)], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Activate a listening mode :param id: (required) :type id: int - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the activate_listening_mode_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.activate_listening_mode_with_http_info( - id, **kwargs - ) # noqa: E501 - - @validate_arguments + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._activate_listening_mode_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def activate_listening_mode_with_http_info( - self, id: conint(strict=True, ge=0), **kwargs - ) -> ApiResponse: # noqa: E501 - """Activate a listening mode # noqa: E501 + self, + id: Annotated[int, Field(strict=True, ge=0)], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Activate a listening mode :param id: (required) :type id: int - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() + _param = self._activate_listening_mode_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = ["id"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method activate_listening_mode" % _key - ) - _params[_key] = _val - del _params["kwargs"] + @validate_call + async def activate_listening_mode_without_preload_content( + self, + id: Annotated[int, Field(strict=True, ge=0)], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Activate a listening mode - _collection_formats = {} - # process the path parameters - _path_params = {} - if _params["id"] is not None: - _path_params["id"] = _params["id"] + :param id: (required) + :type id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._activate_listening_mode_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _activate_listening_mode_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params["id"] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - # authentication setting - _auth_settings = [] # noqa: E501 - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/sound/listening-modes/{id}/activate", - "POST", - _path_params, - _query_params, - _header_params, + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/sound/listening-modes/{id}/activate", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def activate_preset( self, id: Annotated[ - StrictInt, - Field(..., description="the id of the preset you want to trigger"), + StrictInt, Field(description="the id of the preset you want to trigger") ], - **kwargs - ) -> None: # noqa: E501 - """Trigger a preset # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Trigger a preset :param id: the id of the preset you want to trigger (required) :type id: int - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the activate_preset_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.activate_preset_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._activate_preset_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + "412": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def activate_preset_with_http_info( self, id: Annotated[ - StrictInt, - Field(..., description="the id of the preset you want to trigger"), + StrictInt, Field(description="the id of the preset you want to trigger") ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Trigger a preset # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Trigger a preset :param id: the id of the preset you want to trigger (required) :type id: int - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() + _param = self._activate_preset_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = ["id"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + "412": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method activate_preset" % _key - ) - _params[_key] = _val - del _params["kwargs"] + @validate_call + async def activate_preset_without_preload_content( + self, + id: Annotated[ + StrictInt, Field(description="the id of the preset you want to trigger") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Trigger a preset + + + :param id: the id of the preset you want to trigger (required) + :type id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 - _collection_formats = {} + _param = self._activate_preset_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["id"] is not None: - _path_params["id"] = _params["id"] + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + "412": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _activate_preset_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params["id"] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/playback/preset/{id}/trigger", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/playback/preset/{id}/trigger", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def add_to_queue( self, play_queue_item: Annotated[ - PlayQueueItem, Field(..., description="the queue element you want to add") + PlayQueueItem, Field(description="the queue element you want to add") ], - **kwargs - ) -> None: # noqa: E501 - """Add an element to the queue # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Add an element to the queue :param play_queue_item: the queue element you want to add (required) :type play_queue_item: PlayQueueItem - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the add_to_queue_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.add_to_queue_with_http_info( - play_queue_item, **kwargs - ) # noqa: E501 - - @validate_arguments + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_to_queue_serialize( + play_queue_item=play_queue_item, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def add_to_queue_with_http_info( self, play_queue_item: Annotated[ - PlayQueueItem, Field(..., description="the queue element you want to add") + PlayQueueItem, Field(description="the queue element you want to add") ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Add an element to the queue # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Add an element to the queue :param play_queue_item: the queue element you want to add (required) :type play_queue_item: PlayQueueItem - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() + """ # noqa: E501 - _all_params = ["play_queue_item"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _param = self._add_to_queue_serialize( + play_queue_item=play_queue_item, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method add_to_queue" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params["play_queue_item"] is not None: - _body_params = _params["play_queue_item"] - - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/playback/queue", - "POST", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - async def get_active_listening_mode( - self, **kwargs - ) -> ListeningModeRef: # noqa: E501 - """Get the active listening mode # noqa: E501 - - - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListeningModeRef - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_active_listening_mode_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_active_listening_mode_with_http_info( - **kwargs - ) # noqa: E501 - - @validate_arguments - async def get_active_listening_mode_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get the active listening mode # noqa: E501 + @validate_call + async def add_to_queue_without_preload_content( + self, + play_queue_item: Annotated[ + PlayQueueItem, Field(description="the queue element you want to add") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Add an element to the queue - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + :param play_queue_item: the queue element you want to add (required) + :type play_queue_item: PlayQueueItem :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListeningModeRef, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() + _param = self._add_to_queue_serialize( + play_queue_item=play_queue_item, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_active_listening_mode" % _key - ) - _params[_key] = _val - del _params["kwargs"] + def _add_to_queue_serialize( + self, + play_queue_item, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - _collection_formats = {} + _host = None - # process the path parameters - _path_params = {} + _collection_formats: Dict[str, str] = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + if play_queue_item is not None: + _body_params = play_queue_item + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 + ) - _response_types_map = { - "200": "ListeningModeRef", - } + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type - return await self.api_client.call_api( - "/api/v1/sound/listening-modes/active", - "GET", - _path_params, - _query_params, - _header_params, + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/playback/queue", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def get_all_scenes(self, **kwargs) -> Dict[str, Scene]: # noqa: E501 - """Get a list of configured scenes # noqa: E501 - - - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Dict[str, Scene] - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_all_scenes_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_all_scenes_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def get_all_scenes_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get a list of configured scenes # noqa: E501 + @validate_call + async def get_active_listening_mode( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListeningModeRef: + """Get the active listening mode - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Dict[str, Scene], status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() + """ # noqa: E501 - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _param = self._get_active_listening_mode_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_all_scenes" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListeningModeRef", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - _collection_formats = {} + @validate_call + async def get_active_listening_mode_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListeningModeRef]: + """Get the active listening mode - # process the path parameters - _path_params = {} - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 - # authentication setting - _auth_settings = [] # noqa: E501 + _param = self._get_active_listening_mode_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _response_types_map = { - "200": "Dict[str, Scene]", + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListeningModeRef", } - - return await self.api_client.call_api( - "/api/v1/scenes", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - async def get_available_sources( - self, - target_remote: Annotated[ - Optional[StrictBool], Field(description="filter sources for remote control") - ] = None, - **kwargs - ) -> SourceArray: # noqa: E501 - """Get all the available sources # noqa: E501 - - - :param target_remote: filter sources for remote control - :type target_remote: bool - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: SourceArray - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_available_sources_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_available_sources_with_http_info( - target_remote, **kwargs - ) # noqa: E501 - - @validate_arguments - async def get_available_sources_with_http_info( + @validate_call + async def get_active_listening_mode_without_preload_content( self, - target_remote: Annotated[ - Optional[StrictBool], Field(description="filter sources for remote control") + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get all the available sources # noqa: E501 + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the active listening mode - :param target_remote: filter sources for remote control - :type target_remote: bool - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(SourceArray, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() + _param = self._get_active_listening_mode_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = ["target_remote"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListeningModeRef", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_available_sources" % _key - ) - _params[_key] = _val - del _params["kwargs"] + def _get_active_listening_mode_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - _collection_formats = {} + _host = None - # process the path parameters - _path_params = {} + _collection_formats: Dict[str, str] = {} - # process the query parameters - _query_params = [] - if _params.get("target_remote") is not None: # noqa: E501 - _query_params.append(("target-remote", _params["target_remote"])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + # process the query parameters # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "SourceArray", - "400": "ErrorModel", - } - - return await self.api_client.call_api( - "/api/v1/playback/sources", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/sound/listening-modes/active", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def get_battery_state(self, **kwargs) -> BatteryState: # noqa: E501 - """Get battery state of the product # noqa: E501 - - - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: BatteryState - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_battery_state_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_battery_state_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def get_battery_state_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get battery state of the product # noqa: E501 + @validate_call + async def get_all_scenes( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Dict[str, Scene]: + """Get a list of configured scenes - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(BatteryState, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _param = self._get_all_scenes_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_battery_state" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, Scene]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - _collection_formats = {} + @validate_call + async def get_all_scenes_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Dict[str, Scene]]: + """Get a list of configured scenes - # process the path parameters - _path_params = {} - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 - # authentication setting - _auth_settings = [] # noqa: E501 + _param = self._get_all_scenes_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _response_types_map = { - "200": "BatteryState", + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, Scene]", } - - return await self.api_client.call_api( - "/api/v1/battery", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - async def get_beolink_available_listeners( - self, **kwargs - ) -> List[BeolinkAvailableListener]: # noqa: E501 - """Get available listeners # noqa: E501 - - Get a list of devices that can be listening to this device active experience. # noqa: E501 - - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: List[BeolinkAvailableListener] - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_beolink_available_listeners_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_beolink_available_listeners_with_http_info( - **kwargs - ) # noqa: E501 - - @validate_arguments - async def get_beolink_available_listeners_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get available listeners # noqa: E501 + @validate_call + async def get_all_scenes_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a list of configured scenes - Get a list of devices that can be listening to this device active experience. # noqa: E501 - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(List[BeolinkAvailableListener], status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() + _param = self._get_all_scenes_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, Scene]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response + + def _get_all_scenes_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_beolink_available_listeners" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _host = None - _collection_formats = {} + _collection_formats: Dict[str, str] = {} - # process the path parameters - _path_params = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "List[BeolinkAvailableListener]", - "400": "ErrorModel", - } - - return await self.api_client.call_api( - "/api/v1/beolink/available-listeners", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/scenes", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def get_beolink_join_result( - self, - id: Annotated[StrictStr, Field(..., description="Join request ID")], - **kwargs - ) -> BeolinkJoinResult: # noqa: E501 - """Get Beolink join result, test-endpoint # noqa: E501 - - Returns the result of a join request. **WARNING:** This end-point is only for testing purposes. Only a limited number of results are kept, so if there are multiple API clients using the device at the same time, and you are polling this end-point, you may miss the result of your join request. # noqa: E501 - - :param id: Join request ID (required) - :type id: str - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: BeolinkJoinResult - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_beolink_join_result_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_beolink_join_result_with_http_info( - id, **kwargs - ) # noqa: E501 - - @validate_arguments - async def get_beolink_join_result_with_http_info( + @validate_call + async def get_available_sources( self, - id: Annotated[StrictStr, Field(..., description="Join request ID")], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get Beolink join result, test-endpoint # noqa: E501 + target_remote: Annotated[ + Optional[StrictBool], Field(description="filter sources for remote control") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SourceArray: + """Get all the available sources - Returns the result of a join request. **WARNING:** This end-point is only for testing purposes. Only a limited number of results are kept, so if there are multiple API clients using the device at the same time, and you are polling this end-point, you may miss the result of your join request. # noqa: E501 - :param id: Join request ID (required) - :type id: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + :param target_remote: filter sources for remote control + :type target_remote: bool :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(BeolinkJoinResult, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() + """ # noqa: E501 - _all_params = ["id"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _param = self._get_available_sources_serialize( + target_remote=target_remote, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_beolink_join_result" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "SourceArray", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - _collection_formats = {} + @validate_call + async def get_available_sources_with_http_info( + self, + target_remote: Annotated[ + Optional[StrictBool], Field(description="filter sources for remote control") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SourceArray]: + """Get all the available sources - # process the path parameters - _path_params = {} - if _params["id"] is not None: - _path_params["id"] = _params["id"] - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + :param target_remote: filter sources for remote control + :type target_remote: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 - # authentication setting - _auth_settings = [] # noqa: E501 + _param = self._get_available_sources_serialize( + target_remote=target_remote, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _response_types_map = { - "200": "BeolinkJoinResult", - "404": None, + _response_types_map: Dict[str, Optional[str]] = { + "200": "SourceArray", + "400": "ErrorModel", } - - return await self.api_client.call_api( - "/api/v1/beolink/join-result/{id}", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - async def get_beolink_listeners( - self, **kwargs - ) -> List[BeolinkListener]: # noqa: E501 - """Get joined peers # noqa: E501 - - Get a list of devices that are listening to this device active experience (that have joined). # noqa: E501 - - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: List[BeolinkListener] - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_beolink_listeners_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_beolink_listeners_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def get_beolink_listeners_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get joined peers # noqa: E501 + @validate_call + async def get_available_sources_without_preload_content( + self, + target_remote: Annotated[ + Optional[StrictBool], Field(description="filter sources for remote control") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get all the available sources - Get a list of devices that are listening to this device active experience (that have joined). # noqa: E501 - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + :param target_remote: filter sources for remote control + :type target_remote: bool :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(List[BeolinkListener], status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() + _param = self._get_available_sources_serialize( + target_remote=target_remote, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "200": "SourceArray", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_beolink_listeners" % _key - ) - _params[_key] = _val - del _params["kwargs"] + def _get_available_sources_serialize( + self, + target_remote, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - _collection_formats = {} + _host = None - # process the path parameters - _path_params = {} + _collection_formats: Dict[str, str] = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] + if target_remote is not None: + + _query_params.append(("target-remote", target_remote)) + # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "List[BeolinkListener]", - "400": "ErrorModel", - } - - return await self.api_client.call_api( - "/api/v1/beolink/listeners", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/playback/sources", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def get_beolink_peers(self, **kwargs) -> List[BeolinkPeer]: # noqa: E501 - """Get discovered peers # noqa: E501 - - Get information about the Beolink peers discovered by this device. # noqa: E501 - - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: List[BeolinkPeer] - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_beolink_peers_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_beolink_peers_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def get_beolink_peers_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get discovered peers # noqa: E501 + @validate_call + async def get_battery_state( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BatteryState: + """Get battery state of the product - Get information about the Beolink peers discovered by this device. # noqa: E501 - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(List[BeolinkPeer], status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() + """ # noqa: E501 - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _param = self._get_battery_state_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_beolink_peers" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "BatteryState", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - _collection_formats = {} + @validate_call + async def get_battery_state_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BatteryState]: + """Get battery state of the product - # process the path parameters - _path_params = {} - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 - # authentication setting - _auth_settings = [] # noqa: E501 + _param = self._get_battery_state_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _response_types_map = { - "200": "List[BeolinkPeer]", - "400": "ErrorModel", + _response_types_map: Dict[str, Optional[str]] = { + "200": "BatteryState", } - - return await self.api_client.call_api( - "/api/v1/beolink/peers", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - async def get_beolink_self(self, **kwargs) -> BeolinkPeer: # noqa: E501 - """Get information about this device # noqa: E501 - - Returns Beolink information like about this device. This can be useful if you want to expand _to_ this device. # noqa: E501 - - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: BeolinkPeer - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_beolink_self_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_beolink_self_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def get_beolink_self_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get information about this device # noqa: E501 + @validate_call + async def get_battery_state_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get battery state of the product - Returns Beolink information like about this device. This can be useful if you want to expand _to_ this device. # noqa: E501 - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(BeolinkPeer, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() + _param = self._get_battery_state_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "200": "BatteryState", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_beolink_self" % _key - ) - _params[_key] = _val - del _params["kwargs"] + def _get_battery_state_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - _collection_formats = {} + _host = None - # process the path parameters - _path_params = {} + _collection_formats: Dict[str, str] = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "BeolinkPeer", - } - - return await self.api_client.call_api( - "/api/v1/beolink/self", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/battery", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def get_bluetooth_devices_status( - self, **kwargs - ) -> BluetoothDeviceList: # noqa: E501 - """Get the bluetooth devices status # noqa: E501 - - - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: BluetoothDeviceList - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_bluetooth_devices_status_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_bluetooth_devices_status_with_http_info( - **kwargs - ) # noqa: E501 - - @validate_arguments - async def get_bluetooth_devices_status_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get the bluetooth devices status # noqa: E501 + @validate_call + async def get_beolink_available_listeners( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[BeolinkAvailableListener]: + """Get available listeners + Get a list of devices that can be listening to this device active experience. - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(BluetoothDeviceList, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _param = self._get_beolink_available_listeners_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_bluetooth_devices_status" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "List[BeolinkAvailableListener]", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - _collection_formats = {} + @validate_call + async def get_beolink_available_listeners_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[BeolinkAvailableListener]]: + """Get available listeners - # process the path parameters - _path_params = {} + Get a list of devices that can be listening to this device active experience. - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 - # authentication setting - _auth_settings = [] # noqa: E501 + _param = self._get_beolink_available_listeners_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _response_types_map = { - "200": "BluetoothDeviceList", + _response_types_map: Dict[str, Optional[str]] = { + "200": "List[BeolinkAvailableListener]", "400": "ErrorModel", } - - return await self.api_client.call_api( - "/api/v1/setup/bluetooth/devices", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - async def get_bluetooth_remotes( - self, **kwargs - ) -> PairedRemoteResponse: # noqa: E501 - """Get a list of paired bluetooth remotes # noqa: E501 - - - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: PairedRemoteResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_bluetooth_remotes_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_bluetooth_remotes_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def get_bluetooth_remotes_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get a list of paired bluetooth remotes # noqa: E501 + @validate_call + async def get_beolink_available_listeners_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get available listeners + Get a list of devices that can be listening to this device active experience. - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(PairedRemoteResponse, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() + _param = self._get_beolink_available_listeners_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "200": "List[BeolinkAvailableListener]", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response + + def _get_beolink_available_listeners_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_bluetooth_remotes" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _host = None - _collection_formats = {} + _collection_formats: Dict[str, str] = {} - # process the path parameters - _path_params = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "PairedRemoteResponse", - "400": "ErrorModel", - } - - return await self.api_client.call_api( - "/api/v1/setup/remotes", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/beolink/available-listeners", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def get_content( - self, - start_with: Annotated[ - Optional[StrictStr], - Field( - description='Filter result that start with x. It could be input source "tv", "netradio" or content "tv://TV", "tv://netflix"' - ), - ] = None, - **kwargs - ) -> Dict[str, ContentItem]: # noqa: E501 - """Get a list of available content # noqa: E501 - - - :param start_with: Filter result that start with x. It could be input source \"tv\", \"netradio\" or content \"tv://TV\", \"tv://netflix\" - :type start_with: str - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Dict[str, ContentItem] - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_content_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_content_with_http_info(start_with, **kwargs) # noqa: E501 - - @validate_arguments - async def get_content_with_http_info( + @validate_call + async def get_beolink_join_result( self, - start_with: Annotated[ - Optional[StrictStr], - Field( - description='Filter result that start with x. It could be input source "tv", "netradio" or content "tv://TV", "tv://netflix"' - ), + id: Annotated[StrictStr, Field(description="Join request ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get a list of available content # noqa: E501 + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BeolinkJoinResult: + """Get Beolink join result, test-endpoint + Returns the result of a join request. **WARNING:** This end-point is only for testing purposes. Only a limited number of results are kept, so if there are multiple API clients using the device at the same time, and you are polling this end-point, you may miss the result of your join request. - :param start_with: Filter result that start with x. It could be input source \"tv\", \"netradio\" or content \"tv://TV\", \"tv://netflix\" - :type start_with: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + :param id: Join request ID (required) + :type id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Dict[str, ContentItem], status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() - - _all_params = ["start_with"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _param = self._get_beolink_join_result_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_content" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - if _params.get("start_with") is not None: # noqa: E501 - _query_params.append(("startWith", _params["start_with"])) - - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "Dict[str, ContentItem]", + _response_types_map: Dict[str, Optional[str]] = { + "200": "BeolinkJoinResult", + "404": None, } - - return await self.api_client.call_api( - "/api/v1/content", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - @validate_arguments - async def get_current_volume(self, **kwargs) -> VolumeState: # noqa: E501 - """Get the current volume state # noqa: E501 - - - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: VolumeState - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_current_volume_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_current_volume_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def get_current_volume_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get the current volume state # noqa: E501 + @validate_call + async def get_beolink_join_result_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Join request ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BeolinkJoinResult]: + """Get Beolink join result, test-endpoint + Returns the result of a join request. **WARNING:** This end-point is only for testing purposes. Only a limited number of results are kept, so if there are multiple API clients using the device at the same time, and you are polling this end-point, you may miss the result of your join request. - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + :param id: Join request ID (required) + :type id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(VolumeState, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() + """ # noqa: E501 - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _param = self._get_beolink_join_result_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_current_volume" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "VolumeState", - "400": "ErrorModel", + _response_types_map: Dict[str, Optional[str]] = { + "200": "BeolinkJoinResult", + "404": None, } - - return await self.api_client.call_api( - "/api/v1/sound/volume", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - async def get_listening_mode_set( - self, **kwargs - ) -> List[ListeningMode]: # noqa: E501 - """Get available listening modes that match the current role (standalone or multichannel). # noqa: E501 - - - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: List[ListeningMode] - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_listening_mode_set_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_listening_mode_set_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def get_listening_mode_set_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get available listening modes that match the current role (standalone or multichannel). # noqa: E501 + @validate_call + async def get_beolink_join_result_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Join request ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Beolink join result, test-endpoint + Returns the result of a join request. **WARNING:** This end-point is only for testing purposes. Only a limited number of results are kept, so if there are multiple API clients using the device at the same time, and you are polling this end-point, you may miss the result of your join request. - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + :param id: Join request ID (required) + :type id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(List[ListeningMode], status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() + _param = self._get_beolink_join_result_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "200": "BeolinkJoinResult", + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response + + def _get_beolink_join_result_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_listening_mode_set" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _host = None - _collection_formats = {} + _collection_formats: Dict[str, str] = {} - # process the path parameters - _path_params = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if id is not None: + _path_params["id"] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "List[ListeningMode]", - } - - return await self.api_client.call_api( - "/api/v1/sound/listening-modes", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/beolink/join-result/{id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def get_playback_state(self, **kwargs) -> PlaybackState: # noqa: E501 - """Get the current playback state # noqa: E501 - - - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: PlaybackState - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_playback_state_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_playback_state_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def get_playback_state_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get the current playback state # noqa: E501 + @validate_call + async def get_beolink_listeners( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[BeolinkListener]: + """Get joined peers + Get a list of devices that are listening to this device active experience (that have joined). - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(PlaybackState, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _param = self._get_beolink_listeners_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_playback_state" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "List[BeolinkListener]", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - _collection_formats = {} + @validate_call + async def get_beolink_listeners_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[BeolinkListener]]: + """Get joined peers - # process the path parameters - _path_params = {} + Get a list of devices that are listening to this device active experience (that have joined). - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 - # authentication setting - _auth_settings = [] # noqa: E501 + _param = self._get_beolink_listeners_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _response_types_map = { - "200": "PlaybackState", + _response_types_map: Dict[str, Optional[str]] = { + "200": "List[BeolinkListener]", "400": "ErrorModel", } - - return await self.api_client.call_api( - "/api/v1/playback/state", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - async def get_power_state(self, **kwargs) -> PowerStateEnum: # noqa: E501 - """Get power state of the product # noqa: E501 - - - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: PowerStateEnum - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_power_state_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_power_state_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def get_power_state_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get power state of the product # noqa: E501 + @validate_call + async def get_beolink_listeners_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get joined peers + Get a list of devices that are listening to this device active experience (that have joined). - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(PowerStateEnum, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() + _param = self._get_beolink_listeners_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "200": "List[BeolinkListener]", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_power_state" % _key - ) - _params[_key] = _val - del _params["kwargs"] + def _get_beolink_listeners_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - _collection_formats = {} + _host = None - # process the path parameters - _path_params = {} + _collection_formats: Dict[str, str] = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "PowerStateEnum", - } - - return await self.api_client.call_api( - "/api/v1/state/power", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/beolink/listeners", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def get_presets(self, **kwargs) -> Dict[str, Preset]: # noqa: E501 - """Get the preset configuration # noqa: E501 - - - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Dict[str, Preset] - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_presets_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_presets_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def get_presets_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """Get the preset configuration # noqa: E501 + @validate_call + async def get_beolink_peers( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[BeolinkPeer]: + """Get discovered peers + Get information about the Beolink peers discovered by this device. - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Dict[str, Preset], status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() + """ # noqa: E501 - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _param = self._get_beolink_peers_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_presets" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "List[BeolinkPeer]", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - _collection_formats = {} + @validate_call + async def get_beolink_peers_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[BeolinkPeer]]: + """Get discovered peers - # process the path parameters - _path_params = {} + Get information about the Beolink peers discovered by this device. - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 - # authentication setting - _auth_settings = [] # noqa: E501 + _param = self._get_beolink_peers_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _response_types_map = { - "200": "Dict[str, Preset]", + _response_types_map: Dict[str, Optional[str]] = { + "200": "List[BeolinkPeer]", + "400": "ErrorModel", } - - return await self.api_client.call_api( - "/api/v1/setup/presets", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - async def get_product_state(self, **kwargs) -> ProductState: # noqa: E501 - """Get the overall state from the product # noqa: E501 - - - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ProductState - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_product_state_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_product_state_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def get_product_state_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get the overall state from the product # noqa: E501 + @validate_call + async def get_beolink_peers_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get discovered peers + Get information about the Beolink peers discovered by this device. - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ProductState, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() + _param = self._get_beolink_peers_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "200": "List[BeolinkPeer]", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_product_state" % _key - ) - _params[_key] = _val - del _params["kwargs"] + def _get_beolink_peers_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - _collection_formats = {} + _host = None - # process the path parameters - _path_params = {} + _collection_formats: Dict[str, str] = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "ProductState", - "400": "ErrorModel", - } - - return await self.api_client.call_api( - "/api/v1/state", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/beolink/peers", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def get_remote_home_control_uri( - self, **kwargs - ) -> HomeControlUri: # noqa: E501 - """Get the HomeControl dashboard URI # noqa: E501 - - - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: HomeControlUri - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_remote_home_control_uri_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_remote_home_control_uri_with_http_info( - **kwargs - ) # noqa: E501 - - @validate_arguments - async def get_remote_home_control_uri_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get the HomeControl dashboard URI # noqa: E501 + @validate_call + async def get_beolink_self( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BeolinkPeer: + """Get information about this device + Returns Beolink information like about this device. This can be useful if you want to expand _to_ this device. - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(HomeControlUri, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _param = self._get_beolink_self_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_remote_home_control_uri" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "BeolinkPeer", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - _collection_formats = {} + @validate_call + async def get_beolink_self_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BeolinkPeer]: + """Get information about this device - # process the path parameters - _path_params = {} + Returns Beolink information like about this device. This can be useful if you want to expand _to_ this device. - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 - # authentication setting - _auth_settings = [] # noqa: E501 + _param = self._get_beolink_self_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _response_types_map = { - "200": "HomeControlUri", - "400": "ErrorModel", + _response_types_map: Dict[str, Optional[str]] = { + "200": "BeolinkPeer", } - - return await self.api_client.call_api( - "/api/v1/setup/remote/home-control-uri", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - async def get_remote_menu( - self, - descendants_to: Annotated[ - Optional[StrictStr], Field(description="Get all descendants to this item") - ] = None, - **kwargs - ) -> Dict[str, RemoteMenuItem]: # noqa: E501 - """Get all remote menu items # noqa: E501 - - - :param descendants_to: Get all descendants to this item - :type descendants_to: str - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Dict[str, RemoteMenuItem] - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_remote_menu_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_remote_menu_with_http_info( - descendants_to, **kwargs - ) # noqa: E501 - - @validate_arguments - async def get_remote_menu_with_http_info( + @validate_call + async def get_beolink_self_without_preload_content( self, - descendants_to: Annotated[ - Optional[StrictStr], Field(description="Get all descendants to this item") + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get all remote menu items # noqa: E501 + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get information about this device + Returns Beolink information like about this device. This can be useful if you want to expand _to_ this device. - :param descendants_to: Get all descendants to this item - :type descendants_to: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Dict[str, RemoteMenuItem], status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() + _param = self._get_beolink_self_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = ["descendants_to"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "200": "BeolinkPeer", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_remote_menu" % _key - ) - _params[_key] = _val - del _params["kwargs"] + def _get_beolink_self_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - _collection_formats = {} + _host = None - # process the path parameters - _path_params = {} + _collection_formats: Dict[str, str] = {} - # process the query parameters - _query_params = [] - if _params.get("descendants_to") is not None: # noqa: E501 - _query_params.append(("descendantsTo", _params["descendants_to"])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + # process the query parameters # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "Dict[str, RemoteMenuItem]", - } - - return await self.api_client.call_api( - "/api/v1/remote", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/beolink/self", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def get_settings_queue(self, **kwargs) -> PlayQueueSettings: # noqa: E501 - """Get the current queue settings # noqa: E501 - - - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: PlayQueueSettings - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_settings_queue_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_settings_queue_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def get_settings_queue_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get the current queue settings # noqa: E501 + @validate_call + async def get_bluetooth_devices_status( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BluetoothDeviceList: + """Get the bluetooth devices status - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(PlayQueueSettings, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _param = self._get_bluetooth_devices_status_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_settings_queue" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "PlayQueueSettings", + _response_types_map: Dict[str, Optional[str]] = { + "200": "BluetoothDeviceList", "400": "ErrorModel", } - - return await self.api_client.call_api( - "/api/v1/playback/queue/settings", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - @validate_arguments - async def get_softwareupdate_status( - self, **kwargs - ) -> SoftwareUpdateStatus: # noqa: E501 - """Get the current software update status # noqa: E501 - - - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: SoftwareUpdateStatus - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_softwareupdate_status_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_softwareupdate_status_with_http_info( - **kwargs - ) # noqa: E501 - - @validate_arguments - async def get_softwareupdate_status_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get the current software update status # noqa: E501 + @validate_call + async def get_bluetooth_devices_status_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BluetoothDeviceList]: + """Get the bluetooth devices status - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(SoftwareUpdateStatus, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _param = self._get_bluetooth_devices_status_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_softwareupdate_status" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "SoftwareUpdateStatus", + _response_types_map: Dict[str, Optional[str]] = { + "200": "BluetoothDeviceList", "400": "ErrorModel", } - - return await self.api_client.call_api( - "/api/v1/softwareupdate", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - async def get_sound_features( - self, **kwargs - ) -> Dict[str, SoundFeatureSet]: # noqa: E501 - """Get available sound features that match the current role (standalone or multichannel). # noqa: E501 - - - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Dict[str, SoundFeatureSet] - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_sound_features_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_sound_features_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def get_sound_features_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get available sound features that match the current role (standalone or multichannel). # noqa: E501 + @validate_call + async def get_bluetooth_devices_status_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the bluetooth devices status - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Dict[str, SoundFeatureSet], status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() + _param = self._get_bluetooth_devices_status_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "200": "BluetoothDeviceList", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_sound_features" % _key - ) - _params[_key] = _val - del _params["kwargs"] + def _get_bluetooth_devices_status_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - _collection_formats = {} + _host = None - # process the path parameters - _path_params = {} + _collection_formats: Dict[str, str] = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "Dict[str, SoundFeatureSet]", - } - - return await self.api_client.call_api( - "/api/v1/sound/features", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/setup/bluetooth/devices", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def get_speakergroup_active( - self, **kwargs - ) -> SpeakerGroupOverview: # noqa: E501 - """Get the active speaker group # noqa: E501 - - - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: SpeakerGroupOverview - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_speakergroup_active_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_speakergroup_active_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def get_speakergroup_active_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get the active speaker group # noqa: E501 + @validate_call + async def get_bluetooth_remotes( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PairedRemoteResponse: + """Get a list of paired bluetooth remotes - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(SpeakerGroupOverview, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _param = self._get_bluetooth_remotes_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_speakergroup_active" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "SpeakerGroupOverview", + _response_types_map: Dict[str, Optional[str]] = { + "200": "PairedRemoteResponse", + "400": "ErrorModel", } - - return await self.api_client.call_api( - "/api/v1/sound/speakergroup/active", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - @validate_arguments - async def get_volume_settings(self, **kwargs) -> VolumeSettings: # noqa: E501 - """Get the current volume settings for default and maximum volume level # noqa: E501 - - - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: VolumeSettings - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_volume_settings_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_volume_settings_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def get_volume_settings_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get the current volume settings for default and maximum volume level # noqa: E501 + @validate_call + async def get_bluetooth_remotes_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PairedRemoteResponse]: + """Get a list of paired bluetooth remotes - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(VolumeSettings, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _param = self._get_bluetooth_remotes_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_volume_settings" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "VolumeSettings", + _response_types_map: Dict[str, Optional[str]] = { + "200": "PairedRemoteResponse", "400": "ErrorModel", } - - return await self.api_client.call_api( - "/api/v1/sound/volume/settings", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - async def join_beolink_peer( - self, - jid: Annotated[StrictStr, Field(..., description="Jabber ID of peer to join")], - source: Annotated[ - Optional[StrictStr], - Field(description="Ask to join a specific source on peer"), - ] = None, - **kwargs - ) -> BeolinkJoinRequest: # noqa: E501 - """Join multi-room experience # noqa: E501 - - Join the experience currently active on peer with Jabber ID `{jid}`. # noqa: E501 - - :param jid: Jabber ID of peer to join (required) - :type jid: str - :param source: Ask to join a specific source on peer - :type source: str - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: BeolinkJoinRequest - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the join_beolink_peer_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.join_beolink_peer_with_http_info( - jid, source, **kwargs - ) # noqa: E501 - - @validate_arguments - async def join_beolink_peer_with_http_info( + @validate_call + async def get_bluetooth_remotes_without_preload_content( self, - jid: Annotated[StrictStr, Field(..., description="Jabber ID of peer to join")], - source: Annotated[ - Optional[StrictStr], - Field(description="Ask to join a specific source on peer"), + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Join multi-room experience # noqa: E501 + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a list of paired bluetooth remotes - Join the experience currently active on peer with Jabber ID `{jid}`. # noqa: E501 - :param jid: Jabber ID of peer to join (required) - :type jid: str - :param source: Ask to join a specific source on peer - :type source: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(BeolinkJoinRequest, status_code(int), headers(HTTPHeaderDict)) - """ + """ # noqa: E501 - _params = locals() + _param = self._get_bluetooth_remotes_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = ["jid", "source"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "200": "PairedRemoteResponse", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method join_beolink_peer" % _key - ) - _params[_key] = _val - del _params["kwargs"] + def _get_bluetooth_remotes_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - _collection_formats = {} + _host = None - # process the path parameters - _path_params = {} - if _params["jid"] is not None: - _path_params["jid"] = _params["jid"] + _collection_formats: Dict[str, str] = {} - # process the query parameters - _query_params = [] - if _params.get("source") is not None: # noqa: E501 - _query_params.append(("source", _params["source"])) + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + # process the query parameters # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "202": "BeolinkJoinRequest", - "400": "ErrorModel", - "403": "ErrorModel", - } - - return await self.api_client.call_api( - "/api/v1/beolink/join/{jid}", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/setup/remotes", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def join_latest_beolink_experience( - self, **kwargs - ) -> BeolinkJoinRequest: # noqa: E501 - """Trigger touch to join # noqa: E501 - - - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: BeolinkJoinRequest - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the join_latest_beolink_experience_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.join_latest_beolink_experience_with_http_info( - **kwargs - ) # noqa: E501 - - @validate_arguments - async def join_latest_beolink_experience_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Trigger touch to join # noqa: E501 + @validate_call + async def get_content( + self, + start_with: Annotated[ + Optional[StrictStr], + Field( + description='Filter result that start with x. It could be input source "tv", "netradio" or content "tv://TV", "tv://netflix"' + ), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Dict[str, ContentItem]: + """Get a list of available content - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + :param start_with: Filter result that start with x. It could be input source \"tv\", \"netradio\" or content \"tv://TV\", \"tv://netflix\" + :type start_with: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(BeolinkJoinRequest, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() + """ # noqa: E501 - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _param = self._get_content_serialize( + start_with=start_with, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method join_latest_beolink_experience" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, ContentItem]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "202": "BeolinkJoinRequest", - "400": "ErrorModel", - "403": "ErrorModel", - } - - return await self.api_client.call_api( - "/api/v1/beolink/join", - "POST", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), - ) - - @validate_arguments - async def post_beolink_allstandby(self, **kwargs) -> None: # noqa: E501 - """Broadcast an all standby event to turn all Beolink devices off # noqa: E501 - - - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the post_beolink_allstandby_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.post_beolink_allstandby_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def post_beolink_allstandby_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Broadcast an all standby event to turn all Beolink devices off # noqa: E501 + @validate_call + async def get_content_with_http_info( + self, + start_with: Annotated[ + Optional[StrictStr], + Field( + description='Filter result that start with x. It could be input source "tv", "netradio" or content "tv://TV", "tv://netflix"' + ), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Dict[str, ContentItem]]: + """Get a list of available content - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + :param start_with: Filter result that start with x. It could be input source \"tv\", \"netradio\" or content \"tv://TV\", \"tv://netflix\" + :type start_with: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _param = self._get_content_serialize( + start_with=start_with, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method post_beolink_allstandby" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/beolink/allstandby", - "POST", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, ContentItem]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - async def post_beolink_expand( - self, - jid: Annotated[ - StrictStr, - Field( - ..., description="Jabber id of peer to expand the active experience to" - ), - ], - **kwargs - ) -> None: # noqa: E501 - """Expand the current active experience # noqa: E501 - - Expand the current active experience to another device with jabber id `{jid}`. # noqa: E501 - - :param jid: Jabber id of peer to expand the active experience to (required) - :type jid: str - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the post_beolink_expand_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.post_beolink_expand_with_http_info( - jid, **kwargs - ) # noqa: E501 - - @validate_arguments - async def post_beolink_expand_with_http_info( + @validate_call + async def get_content_without_preload_content( self, - jid: Annotated[ - StrictStr, + start_with: Annotated[ + Optional[StrictStr], Field( - ..., description="Jabber id of peer to expand the active experience to" + description='Filter result that start with x. It could be input source "tv", "netradio" or content "tv://TV", "tv://netflix"' ), - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Expand the current active experience # noqa: E501 + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a list of available content - Expand the current active experience to another device with jabber id `{jid}`. # noqa: E501 - :param jid: Jabber id of peer to expand the active experience to (required) - :type jid: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + :param start_with: Filter result that start with x. It could be input source \"tv\", \"netradio\" or content \"tv://TV\", \"tv://netflix\" + :type start_with: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() + _param = self._get_content_serialize( + start_with=start_with, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = ["jid"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, ContentItem]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response + + def _get_content_serialize( + self, + start_with, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method post_beolink_expand" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _host = None - _collection_formats = {} + _collection_formats: Dict[str, str] = {} - # process the path parameters - _path_params = {} - if _params["jid"] is not None: - _path_params["jid"] = _params["jid"] + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters # process the query parameters - _query_params = [] + if start_with is not None: + + _query_params.append(("startWith", start_with)) + # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/beolink/expand/{jid}", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/content", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def post_beolink_leave(self, **kwargs) -> None: # noqa: E501 - """Leave the ongoing experience (disconnect this device from remote) # noqa: E501 - - - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the post_beolink_leave_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.post_beolink_leave_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def post_beolink_leave_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Leave the ongoing experience (disconnect this device from remote) # noqa: E501 + @validate_call + async def get_current_volume( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VolumeState: + """Get the current volume state - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() + """ # noqa: E501 - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _param = self._get_current_volume_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method post_beolink_leave" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + _response_types_map: Dict[str, Optional[str]] = { + "200": "VolumeState", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - # process the path parameters - _path_params = {} + @validate_call + async def get_current_volume_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VolumeState]: + """Get the current volume state - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - # authentication setting - _auth_settings = [] # noqa: E501 + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 - _response_types_map = {} + _param = self._get_current_volume_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - return await self.api_client.call_api( - "/api/v1/beolink/leave", - "POST", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + _response_types_map: Dict[str, Optional[str]] = { + "200": "VolumeState", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - async def post_beolink_unexpand( - self, - jid: Annotated[ - StrictStr, Field(..., description="Jabber id of peer to unexpand") - ], - **kwargs - ) -> None: # noqa: E501 - """Unexpand (disconnect) a device from the multiroom session # noqa: E501 - - Disconnect the device with jabber id `{jid}` from the current active experience. # noqa: E501 - - :param jid: Jabber id of peer to unexpand (required) - :type jid: str - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the post_beolink_unexpand_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.post_beolink_unexpand_with_http_info( - jid, **kwargs - ) # noqa: E501 - - @validate_arguments - async def post_beolink_unexpand_with_http_info( + @validate_call + async def get_current_volume_without_preload_content( self, - jid: Annotated[ - StrictStr, Field(..., description="Jabber id of peer to unexpand") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Unexpand (disconnect) a device from the multiroom session # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the current volume state - Disconnect the device with jabber id `{jid}` from the current active experience. # noqa: E501 - :param jid: Jabber id of peer to unexpand (required) - :type jid: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() + _param = self._get_current_volume_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = ["jid"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "200": "VolumeState", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response + + def _get_current_volume_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method post_beolink_unexpand" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _host = None - _collection_formats = {} + _collection_formats: Dict[str, str] = {} - # process the path parameters - _path_params = {} - if _params["jid"] is not None: - _path_params["jid"] = _params["jid"] + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/beolink/unexpand/{jid}", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/sound/volume", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def post_clear_queue(self, **kwargs) -> None: # noqa: E501 - """Clear the queue # noqa: E501 - - - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the post_clear_queue_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.post_clear_queue_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def post_clear_queue_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Clear the queue # noqa: E501 + @validate_call + async def get_listening_mode_set( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[ListeningMode]: + """Get available listening modes that match the current role (standalone, multichannel or both(all)). - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _param = self._get_listening_mode_set_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method post_clear_queue" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + _response_types_map: Dict[str, Optional[str]] = { + "200": "List[ListeningMode]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - # process the path parameters - _path_params = {} + @validate_call + async def get_listening_mode_set_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[ListeningMode]]: + """Get available listening modes that match the current role (standalone, multichannel or both(all)). - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - # authentication setting - _auth_settings = [] # noqa: E501 + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 - _response_types_map = {} + _param = self._get_listening_mode_set_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - return await self.api_client.call_api( - "/api/v1/playback/queue/clear", - "POST", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + _response_types_map: Dict[str, Optional[str]] = { + "200": "List[ListeningMode]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - async def post_overlay_play( - self, - overlay_play_request: Annotated[ - OverlayPlayRequest, - Field(..., description="settings to use for the overlay"), - ], - **kwargs - ) -> None: # noqa: E501 - """Play overlay # noqa: E501 - - Play some audio as an overlay. This will duck currently playing music while the audio is playing. Currently 100 unique TTS messages can be generated a day and generated messages are cached for 24 hours. # noqa: E501 - - :param overlay_play_request: settings to use for the overlay (required) - :type overlay_play_request: OverlayPlayRequest - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the post_overlay_play_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.post_overlay_play_with_http_info( - overlay_play_request, **kwargs - ) # noqa: E501 - - @validate_arguments - async def post_overlay_play_with_http_info( + @validate_call + async def get_listening_mode_set_without_preload_content( self, - overlay_play_request: Annotated[ - OverlayPlayRequest, - Field(..., description="settings to use for the overlay"), - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Play overlay # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get available listening modes that match the current role (standalone, multichannel or both(all)). - Play some audio as an overlay. This will duck currently playing music while the audio is playing. Currently 100 unique TTS messages can be generated a day and generated messages are cached for 24 hours. # noqa: E501 - :param overlay_play_request: settings to use for the overlay (required) - :type overlay_play_request: OverlayPlayRequest - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() + _param = self._get_listening_mode_set_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = ["overlay_play_request"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "200": "List[ListeningMode]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response + + def _get_listening_mode_set_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method post_overlay_play" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _host = None - _collection_formats = {} + _collection_formats: Dict[str, str] = {} - # process the path parameters - _path_params = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["overlay_play_request"] is not None: - _body_params = _params["overlay_play_request"] # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/overlay/play", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/sound/listening-modes", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def post_playback_command( - self, - command: Annotated[ - StrictStr, Field(..., description="the named command to execute") - ], - **kwargs - ) -> None: # noqa: E501 - """Send a specific playback command to the product # noqa: E501 - - - :param command: the named command to execute (required) - :type command: str - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the post_playback_command_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.post_playback_command_with_http_info( - command, **kwargs - ) # noqa: E501 - - @validate_arguments - async def post_playback_command_with_http_info( + @validate_call + async def get_playback_state( self, - command: Annotated[ - StrictStr, Field(..., description="the named command to execute") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Send a specific playback command to the product # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PlaybackState: + """Get the current playback state - :param command: the named command to execute (required) - :type command: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() - - _all_params = ["command"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _param = self._get_playback_state_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method post_playback_command" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + _response_types_map: Dict[str, Optional[str]] = { + "200": "PlaybackState", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - # process the path parameters - _path_params = {} - if _params["command"] is not None: - _path_params["command"] = _params["command"] + @validate_call + async def get_playback_state_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PlaybackState]: + """Get the current playback state - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - # authentication setting - _auth_settings = [] # noqa: E501 + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 - _response_types_map = {} + _param = self._get_playback_state_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - return await self.api_client.call_api( - "/api/v1/playback/command/{command}", - "POST", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + _response_types_map: Dict[str, Optional[str]] = { + "200": "PlaybackState", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - async def post_remote_key_trigger( - self, - id: Annotated[StrictStr, Field(..., description="Key identifier")], - remote_ui_key_state: RemoteUIKeyState, - **kwargs - ) -> None: # noqa: E501 - """Remote input key press # noqa: E501 - - - :param id: Key identifier (required) - :type id: str - :param remote_ui_key_state: (required) - :type remote_ui_key_state: RemoteUIKeyState - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the post_remote_key_trigger_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.post_remote_key_trigger_with_http_info( - id, remote_ui_key_state, **kwargs - ) # noqa: E501 - - @validate_arguments - async def post_remote_key_trigger_with_http_info( + @validate_call + async def get_playback_state_without_preload_content( self, - id: Annotated[StrictStr, Field(..., description="Key identifier")], - remote_ui_key_state: RemoteUIKeyState, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Remote input key press # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the current playback state - :param id: Key identifier (required) - :type id: str - :param remote_ui_key_state: (required) - :type remote_ui_key_state: RemoteUIKeyState - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() + _param = self._get_playback_state_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = ["id", "remote_ui_key_state"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "200": "PlaybackState", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method post_remote_key_trigger" % _key - ) - _params[_key] = _val - del _params["kwargs"] + def _get_playback_state_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - _collection_formats = {} + _host = None - # process the path parameters - _path_params = {} - if _params["id"] is not None: - _path_params["id"] = _params["id"] + _collection_formats: Dict[str, str] = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["remote_ui_key_state"] is not None: - _body_params = _params["remote_ui_key_state"] # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/remote/key/{id}/trigger", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/playback/state", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def post_remote_trigger( - self, - id: Annotated[StrictStr, Field(..., description="Remote menu item ID")], - **kwargs - ) -> None: # noqa: E501 - """Trigger a remote menu item # noqa: E501 - - - :param id: Remote menu item ID (required) - :type id: str - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the post_remote_trigger_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.post_remote_trigger_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - async def post_remote_trigger_with_http_info( + @validate_call + async def get_power_state( self, - id: Annotated[StrictStr, Field(..., description="Remote menu item ID")], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Trigger a remote menu item # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PowerStateEnum: + """Get power state of the product - :param id: Remote menu item ID (required) - :type id: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() + """ # noqa: E501 - _all_params = ["id"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _param = self._get_power_state_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method post_remote_trigger" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + _response_types_map: Dict[str, Optional[str]] = { + "200": "PowerStateEnum", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - # process the path parameters - _path_params = {} - if _params["id"] is not None: - _path_params["id"] = _params["id"] + @validate_call + async def get_power_state_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PowerStateEnum]: + """Get power state of the product - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - # authentication setting - _auth_settings = [] # noqa: E501 + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 - _response_types_map = {} + _param = self._get_power_state_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - return await self.api_client.call_api( - "/api/v1/remote/{id}/trigger", - "POST", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + _response_types_map: Dict[str, Optional[str]] = { + "200": "PowerStateEnum", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - async def post_scene_match_trigger( - self, scene_match: SceneMatch, **kwargs - ) -> None: # noqa: E501 - """Trigger the first scene with same non null objects provided in the SceneMatch object # noqa: E501 - - - :param scene_match: (required) - :type scene_match: SceneMatch - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the post_scene_match_trigger_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.post_scene_match_trigger_with_http_info( - scene_match, **kwargs - ) # noqa: E501 - - @validate_arguments - async def post_scene_match_trigger_with_http_info( - self, scene_match: SceneMatch, **kwargs - ) -> ApiResponse: # noqa: E501 - """Trigger the first scene with same non null objects provided in the SceneMatch object # noqa: E501 + @validate_call + async def get_power_state_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get power state of the product - :param scene_match: (required) - :type scene_match: SceneMatch - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() + _param = self._get_power_state_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = ["scene_match"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "200": "PowerStateEnum", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method post_scene_match_trigger" % _key - ) - _params[_key] = _val - del _params["kwargs"] + def _get_power_state_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - _collection_formats = {} + _host = None - # process the path parameters - _path_params = {} + _collection_formats: Dict[str, str] = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["scene_match"] is not None: - _body_params = _params["scene_match"] # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/scene/match-trigger", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/state/power", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def post_scene_trigger( - self, - id: Annotated[StrictStr, Field(..., description="ID of the scene")], - **kwargs - ) -> None: # noqa: E501 - """Trigger a specific scene # noqa: E501 - - - :param id: ID of the scene (required) - :type id: str - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the post_scene_trigger_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.post_scene_trigger_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments - async def post_scene_trigger_with_http_info( + @validate_call + async def get_presets( self, - id: Annotated[StrictStr, Field(..., description="ID of the scene")], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Trigger a specific scene # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Dict[str, Preset]: + """Get the preset configuration - :param id: ID of the scene (required) - :type id: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() + """ # noqa: E501 - _all_params = ["id"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _param = self._get_presets_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method post_scene_trigger" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, Preset]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - # process the path parameters - _path_params = {} - if _params["id"] is not None: - _path_params["id"] = _params["id"] + @validate_call + async def get_presets_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Dict[str, Preset]]: + """Get the preset configuration - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - # authentication setting - _auth_settings = [] # noqa: E501 + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 - _response_types_map = {} + _param = self._get_presets_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - return await self.api_client.call_api( - "/api/v1/scene/{id}/trigger", - "POST", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, Preset]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - async def post_standby(self, **kwargs) -> None: # noqa: E501 - """Put the device in standby # noqa: E501 - - - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the post_standby_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.post_standby_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def post_standby_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """Put the device in standby # noqa: E501 + @validate_call + async def get_presets_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the preset configuration - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() + _param = self._get_presets_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, Preset]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response + + def _get_presets_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method post_standby" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _host = None - _collection_formats = {} + _collection_formats: Dict[str, str] = {} - # process the path parameters - _path_params = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/state/standby", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/setup/presets", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def post_uri_source( + @validate_call + async def get_product_state( self, - uri: Annotated[ - Uri, Field(..., description="the desired uri from which to stream data") - ], - **kwargs - ) -> None: # noqa: E501 - """Set the URI from which sound is streamed # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ProductState: + """Get the overall state from the product - :param uri: the desired uri from which to stream data (required) - :type uri: Uri - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the post_uri_source_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.post_uri_source_with_http_info(uri, **kwargs) # noqa: E501 - - @validate_arguments - async def post_uri_source_with_http_info( + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_product_state_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ProductState", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def get_product_state_with_http_info( self, - uri: Annotated[ - Uri, Field(..., description="the desired uri from which to stream data") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Set the URI from which sound is streamed # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ProductState]: + """Get the overall state from the product + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_product_state_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ProductState", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def get_product_state_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the overall state from the product - :param uri: the desired uri from which to stream data (required) - :type uri: Uri - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() + _param = self._get_product_state_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = ["uri"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ProductState", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method post_uri_source" % _key - ) - _params[_key] = _val - del _params["kwargs"] + def _get_product_state_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - _collection_formats = {} + _host = None - # process the path parameters - _path_params = {} + _collection_formats: Dict[str, str] = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["uri"] is not None: - _body_params = _params["uri"] # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/playback/uri", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/state", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def run_provided_scene( + @validate_call + async def get_remote_home_control_uri( self, - scene_properties: Annotated[ - SceneProperties, Field(..., description="The scene you want to run") + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> HomeControlUri: + """Get HomeControl dashboard uri and (optional) Immersive Experience (IXP) start page + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_remote_home_control_uri_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "HomeControlUri", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def get_remote_home_control_uri_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[HomeControlUri]: + """Get HomeControl dashboard uri and (optional) Immersive Experience (IXP) start page + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_remote_home_control_uri_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "HomeControlUri", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def get_remote_home_control_uri_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get HomeControl dashboard uri and (optional) Immersive Experience (IXP) start page + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_remote_home_control_uri_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "HomeControlUri", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_remote_home_control_uri_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/setup/remote/home-control-uri", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def get_remote_menu( + self, + descendants_to: Annotated[ + Optional[StrictStr], Field(description="Get all descendants to this item") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Dict[str, RemoteMenuItem]: + """Get all remote menu items + + + :param descendants_to: Get all descendants to this item + :type descendants_to: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_remote_menu_serialize( + descendants_to=descendants_to, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, RemoteMenuItem]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def get_remote_menu_with_http_info( + self, + descendants_to: Annotated[ + Optional[StrictStr], Field(description="Get all descendants to this item") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Dict[str, RemoteMenuItem]]: + """Get all remote menu items + + + :param descendants_to: Get all descendants to this item + :type descendants_to: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_remote_menu_serialize( + descendants_to=descendants_to, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, RemoteMenuItem]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def get_remote_menu_without_preload_content( + self, + descendants_to: Annotated[ + Optional[StrictStr], Field(description="Get all descendants to this item") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get all remote menu items + + + :param descendants_to: Get all descendants to this item + :type descendants_to: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_remote_menu_serialize( + descendants_to=descendants_to, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, RemoteMenuItem]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_remote_menu_serialize( + self, + descendants_to, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if descendants_to is not None: + + _query_params.append(("descendantsTo", descendants_to)) + + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/remote", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def get_settings_queue( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PlayQueueSettings: + """Get the current queue settings + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_settings_queue_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "PlayQueueSettings", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def get_settings_queue_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PlayQueueSettings]: + """Get the current queue settings + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_settings_queue_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "PlayQueueSettings", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def get_settings_queue_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the current queue settings + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_settings_queue_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "PlayQueueSettings", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_settings_queue_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/playback/queue/settings", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def get_softwareupdate_status( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SoftwareUpdateStatus: + """Get the current software update status + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_softwareupdate_status_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "SoftwareUpdateStatus", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def get_softwareupdate_status_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SoftwareUpdateStatus]: + """Get the current software update status + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_softwareupdate_status_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "SoftwareUpdateStatus", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def get_softwareupdate_status_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the current software update status + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_softwareupdate_status_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "SoftwareUpdateStatus", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_softwareupdate_status_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/softwareupdate", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def get_sound_features( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Dict[str, SoundFeatureSet]: + """Get available sound features that match the current role (standalone or multichannel). + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_sound_features_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, SoundFeatureSet]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def get_sound_features_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Dict[str, SoundFeatureSet]]: + """Get available sound features that match the current role (standalone or multichannel). + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_sound_features_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, SoundFeatureSet]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def get_sound_features_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get available sound features that match the current role (standalone or multichannel). + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_sound_features_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, SoundFeatureSet]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_sound_features_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/sound/features", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def get_speakergroup_active( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SpeakerGroupOverview: + """Get the active speaker group + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_speakergroup_active_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "SpeakerGroupOverview", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def get_speakergroup_active_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SpeakerGroupOverview]: + """Get the active speaker group + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_speakergroup_active_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "SpeakerGroupOverview", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def get_speakergroup_active_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the active speaker group + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_speakergroup_active_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "SpeakerGroupOverview", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_speakergroup_active_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/sound/speakergroup/active", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def get_volume_settings( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VolumeSettings: + """Get the current volume settings for default and maximum volume level + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_volume_settings_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "VolumeSettings", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def get_volume_settings_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VolumeSettings]: + """Get the current volume settings for default and maximum volume level + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_volume_settings_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "VolumeSettings", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def get_volume_settings_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the current volume settings for default and maximum volume level + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_volume_settings_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "VolumeSettings", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_volume_settings_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/sound/volume/settings", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def join_beolink_peer( + self, + jid: Annotated[StrictStr, Field(description="Jabber ID of peer to join")], + source: Annotated[ + Optional[StrictStr], + Field(description="Ask to join a specific source on peer"), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BeolinkJoinRequest: + """Join multi-room experience + + Join the experience currently active on peer with Jabber ID `{jid}`. + + :param jid: Jabber ID of peer to join (required) + :type jid: str + :param source: Ask to join a specific source on peer + :type source: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._join_beolink_peer_serialize( + jid=jid, + source=source, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": "BeolinkJoinRequest", + "400": "ErrorModel", + "403": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def join_beolink_peer_with_http_info( + self, + jid: Annotated[StrictStr, Field(description="Jabber ID of peer to join")], + source: Annotated[ + Optional[StrictStr], + Field(description="Ask to join a specific source on peer"), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BeolinkJoinRequest]: + """Join multi-room experience + + Join the experience currently active on peer with Jabber ID `{jid}`. + + :param jid: Jabber ID of peer to join (required) + :type jid: str + :param source: Ask to join a specific source on peer + :type source: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._join_beolink_peer_serialize( + jid=jid, + source=source, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": "BeolinkJoinRequest", + "400": "ErrorModel", + "403": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def join_beolink_peer_without_preload_content( + self, + jid: Annotated[StrictStr, Field(description="Jabber ID of peer to join")], + source: Annotated[ + Optional[StrictStr], + Field(description="Ask to join a specific source on peer"), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Join multi-room experience + + Join the experience currently active on peer with Jabber ID `{jid}`. + + :param jid: Jabber ID of peer to join (required) + :type jid: str + :param source: Ask to join a specific source on peer + :type source: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._join_beolink_peer_serialize( + jid=jid, + source=source, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": "BeolinkJoinRequest", + "400": "ErrorModel", + "403": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _join_beolink_peer_serialize( + self, + jid, + source, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if jid is not None: + _path_params["jid"] = jid + # process the query parameters + if source is not None: + + _query_params.append(("source", source)) + + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/beolink/join/{jid}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def join_latest_beolink_experience( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BeolinkJoinRequest: + """Trigger touch to join + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._join_latest_beolink_experience_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": "BeolinkJoinRequest", + "400": "ErrorModel", + "403": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def join_latest_beolink_experience_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BeolinkJoinRequest]: + """Trigger touch to join + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._join_latest_beolink_experience_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": "BeolinkJoinRequest", + "400": "ErrorModel", + "403": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def join_latest_beolink_experience_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Trigger touch to join + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._join_latest_beolink_experience_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": "BeolinkJoinRequest", + "400": "ErrorModel", + "403": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _join_latest_beolink_experience_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/beolink/join", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def post_beolink_allstandby( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Broadcast an all standby event to turn all Beolink devices off + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_beolink_allstandby_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def post_beolink_allstandby_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Broadcast an all standby event to turn all Beolink devices off + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_beolink_allstandby_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def post_beolink_allstandby_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Broadcast an all standby event to turn all Beolink devices off + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_beolink_allstandby_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _post_beolink_allstandby_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/beolink/allstandby", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def post_beolink_expand( + self, + jid: Annotated[ + StrictStr, + Field(description="Jabber id of peer to expand the active experience to"), + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Expand the current active experience + + Expand the current active experience to another device with jabber id `{jid}`. + + :param jid: Jabber id of peer to expand the active experience to (required) + :type jid: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_beolink_expand_serialize( + jid=jid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + "403": "ErrorModel", + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def post_beolink_expand_with_http_info( + self, + jid: Annotated[ + StrictStr, + Field(description="Jabber id of peer to expand the active experience to"), + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Expand the current active experience + + Expand the current active experience to another device with jabber id `{jid}`. + + :param jid: Jabber id of peer to expand the active experience to (required) + :type jid: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_beolink_expand_serialize( + jid=jid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + "403": "ErrorModel", + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def post_beolink_expand_without_preload_content( + self, + jid: Annotated[ + StrictStr, + Field(description="Jabber id of peer to expand the active experience to"), + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Expand the current active experience + + Expand the current active experience to another device with jabber id `{jid}`. + + :param jid: Jabber id of peer to expand the active experience to (required) + :type jid: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_beolink_expand_serialize( + jid=jid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + "403": "ErrorModel", + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _post_beolink_expand_serialize( + self, + jid, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if jid is not None: + _path_params["jid"] = jid + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/beolink/expand/{jid}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def post_beolink_leave( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Leave the ongoing experience (disconnect this device from remote) + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_beolink_leave_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def post_beolink_leave_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Leave the ongoing experience (disconnect this device from remote) + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_beolink_leave_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def post_beolink_leave_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Leave the ongoing experience (disconnect this device from remote) + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_beolink_leave_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _post_beolink_leave_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/beolink/leave", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def post_beolink_unexpand( + self, + jid: Annotated[StrictStr, Field(description="Jabber id of peer to unexpand")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Unexpand (disconnect) a device from the multiroom session + + Disconnect the device with jabber id `{jid}` from the current active experience. + + :param jid: Jabber id of peer to unexpand (required) + :type jid: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_beolink_unexpand_serialize( + jid=jid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def post_beolink_unexpand_with_http_info( + self, + jid: Annotated[StrictStr, Field(description="Jabber id of peer to unexpand")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Unexpand (disconnect) a device from the multiroom session + + Disconnect the device with jabber id `{jid}` from the current active experience. + + :param jid: Jabber id of peer to unexpand (required) + :type jid: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_beolink_unexpand_serialize( + jid=jid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def post_beolink_unexpand_without_preload_content( + self, + jid: Annotated[StrictStr, Field(description="Jabber id of peer to unexpand")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Unexpand (disconnect) a device from the multiroom session + + Disconnect the device with jabber id `{jid}` from the current active experience. + + :param jid: Jabber id of peer to unexpand (required) + :type jid: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_beolink_unexpand_serialize( + jid=jid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _post_beolink_unexpand_serialize( + self, + jid, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if jid is not None: + _path_params["jid"] = jid + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/beolink/unexpand/{jid}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def post_clear_queue( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Clear the queue + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_clear_queue_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def post_clear_queue_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Clear the queue + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_clear_queue_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def post_clear_queue_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Clear the queue + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_clear_queue_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _post_clear_queue_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/playback/queue/clear", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def post_overlay_play( + self, + overlay_play_request: Annotated[ + OverlayPlayRequest, Field(description="settings to use for the overlay") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Play overlay + + Play some audio as an overlay. This will duck currently playing music while the audio is playing. Currently 100 unique TTS messages can be generated a day and generated messages are cached for 24 hours. + + :param overlay_play_request: settings to use for the overlay (required) + :type overlay_play_request: OverlayPlayRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_overlay_play_serialize( + overlay_play_request=overlay_play_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def post_overlay_play_with_http_info( + self, + overlay_play_request: Annotated[ + OverlayPlayRequest, Field(description="settings to use for the overlay") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Play overlay + + Play some audio as an overlay. This will duck currently playing music while the audio is playing. Currently 100 unique TTS messages can be generated a day and generated messages are cached for 24 hours. + + :param overlay_play_request: settings to use for the overlay (required) + :type overlay_play_request: OverlayPlayRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_overlay_play_serialize( + overlay_play_request=overlay_play_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def post_overlay_play_without_preload_content( + self, + overlay_play_request: Annotated[ + OverlayPlayRequest, Field(description="settings to use for the overlay") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Play overlay + + Play some audio as an overlay. This will duck currently playing music while the audio is playing. Currently 100 unique TTS messages can be generated a day and generated messages are cached for 24 hours. + + :param overlay_play_request: settings to use for the overlay (required) + :type overlay_play_request: OverlayPlayRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_overlay_play_serialize( + overlay_play_request=overlay_play_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _post_overlay_play_serialize( + self, + overlay_play_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if overlay_play_request is not None: + _body_params = overlay_play_request + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/overlay/play", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def post_playback_command( + self, + command: Annotated[ + StrictStr, Field(description="the named command to execute") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Send a specific playback command to the product + + + :param command: the named command to execute (required) + :type command: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_playback_command_serialize( + command=command, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def post_playback_command_with_http_info( + self, + command: Annotated[ + StrictStr, Field(description="the named command to execute") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Send a specific playback command to the product + + + :param command: the named command to execute (required) + :type command: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_playback_command_serialize( + command=command, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def post_playback_command_without_preload_content( + self, + command: Annotated[ + StrictStr, Field(description="the named command to execute") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Send a specific playback command to the product + + + :param command: the named command to execute (required) + :type command: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_playback_command_serialize( + command=command, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _post_playback_command_serialize( + self, + command, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if command is not None: + _path_params["command"] = command + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/playback/command/{command}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def post_remote_home_control_ixp( + self, + home_control_ixp: Annotated[HomeControlIxp, Field(description="The new IXP")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Change any active Immersive Experience (IXP) + + + :param home_control_ixp: The new IXP (required) + :type home_control_ixp: HomeControlIxp + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_remote_home_control_ixp_serialize( + home_control_ixp=home_control_ixp, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def post_remote_home_control_ixp_with_http_info( + self, + home_control_ixp: Annotated[HomeControlIxp, Field(description="The new IXP")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Change any active Immersive Experience (IXP) + + + :param home_control_ixp: The new IXP (required) + :type home_control_ixp: HomeControlIxp + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_remote_home_control_ixp_serialize( + home_control_ixp=home_control_ixp, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def post_remote_home_control_ixp_without_preload_content( + self, + home_control_ixp: Annotated[HomeControlIxp, Field(description="The new IXP")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Change any active Immersive Experience (IXP) + + + :param home_control_ixp: The new IXP (required) + :type home_control_ixp: HomeControlIxp + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_remote_home_control_ixp_serialize( + home_control_ixp=home_control_ixp, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _post_remote_home_control_ixp_serialize( + self, + home_control_ixp, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if home_control_ixp is not None: + _body_params = home_control_ixp + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/setup/remote/home-control-ixp", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def post_remote_key_trigger( + self, + id: Annotated[StrictStr, Field(description="Key identifier")], + remote_ui_key_state: RemoteUIKeyState, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Remote input key press + + + :param id: Key identifier (required) + :type id: str + :param remote_ui_key_state: (required) + :type remote_ui_key_state: RemoteUIKeyState + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_remote_key_trigger_serialize( + id=id, + remote_ui_key_state=remote_ui_key_state, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + "404": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def post_remote_key_trigger_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Key identifier")], + remote_ui_key_state: RemoteUIKeyState, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Remote input key press + + + :param id: Key identifier (required) + :type id: str + :param remote_ui_key_state: (required) + :type remote_ui_key_state: RemoteUIKeyState + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_remote_key_trigger_serialize( + id=id, + remote_ui_key_state=remote_ui_key_state, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + "404": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def post_remote_key_trigger_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Key identifier")], + remote_ui_key_state: RemoteUIKeyState, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Remote input key press + + + :param id: Key identifier (required) + :type id: str + :param remote_ui_key_state: (required) + :type remote_ui_key_state: RemoteUIKeyState + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_remote_key_trigger_serialize( + id=id, + remote_ui_key_state=remote_ui_key_state, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + "404": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _post_remote_key_trigger_serialize( + self, + id, + remote_ui_key_state, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params["id"] = id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if remote_ui_key_state is not None: + _body_params = remote_ui_key_state + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/remote/key/{id}/trigger", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def post_remote_trigger( + self, + id: Annotated[StrictStr, Field(description="Remote menu item ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Trigger a remote menu item + + + :param id: Remote menu item ID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_remote_trigger_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "404": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def post_remote_trigger_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Remote menu item ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Trigger a remote menu item + + + :param id: Remote menu item ID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_remote_trigger_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "404": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def post_remote_trigger_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Remote menu item ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Trigger a remote menu item + + + :param id: Remote menu item ID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_remote_trigger_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "404": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _post_remote_trigger_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params["id"] = id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/remote/{id}/trigger", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def post_scene_match_trigger( + self, + scene_match: SceneMatch, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Trigger the first scene with same non null objects provided in the SceneMatch object + + + :param scene_match: (required) + :type scene_match: SceneMatch + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_scene_match_trigger_serialize( + scene_match=scene_match, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + "404": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def post_scene_match_trigger_with_http_info( + self, + scene_match: SceneMatch, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Trigger the first scene with same non null objects provided in the SceneMatch object + + + :param scene_match: (required) + :type scene_match: SceneMatch + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_scene_match_trigger_serialize( + scene_match=scene_match, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + "404": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def post_scene_match_trigger_without_preload_content( + self, + scene_match: SceneMatch, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Trigger the first scene with same non null objects provided in the SceneMatch object + + + :param scene_match: (required) + :type scene_match: SceneMatch + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_scene_match_trigger_serialize( + scene_match=scene_match, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + "404": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _post_scene_match_trigger_serialize( + self, + scene_match, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if scene_match is not None: + _body_params = scene_match + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/scene/match-trigger", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def post_scene_trigger( + self, + id: Annotated[StrictStr, Field(description="ID of the scene")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Trigger a specific scene + + + :param id: ID of the scene (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_scene_trigger_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + "404": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def post_scene_trigger_with_http_info( + self, + id: Annotated[StrictStr, Field(description="ID of the scene")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Trigger a specific scene + + + :param id: ID of the scene (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_scene_trigger_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + "404": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def post_scene_trigger_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="ID of the scene")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Trigger a specific scene + + + :param id: ID of the scene (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_scene_trigger_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + "404": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _post_scene_trigger_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params["id"] = id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/scene/{id}/trigger", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def post_standby( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Put the device in standby + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_standby_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def post_standby_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Put the device in standby + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_standby_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def post_standby_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Put the device in standby + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_standby_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _post_standby_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/api/v1/state/standby", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def post_uri_source( + self, + uri: Annotated[ + Uri, Field(description="the desired uri from which to stream data") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Set the URI from which sound is streamed + + + :param uri: the desired uri from which to stream data (required) + :type uri: Uri + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_uri_source_serialize( + uri=uri, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def post_uri_source_with_http_info( + self, + uri: Annotated[ + Uri, Field(description="the desired uri from which to stream data") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Set the URI from which sound is streamed + + + :param uri: the desired uri from which to stream data (required) + :type uri: Uri + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_uri_source_serialize( + uri=uri, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def post_uri_source_without_preload_content( + self, + uri: Annotated[ + Uri, Field(description="the desired uri from which to stream data") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Set the URI from which sound is streamed + + + :param uri: the desired uri from which to stream data (required) + :type uri: Uri + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_uri_source_serialize( + uri=uri, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _post_uri_source_serialize( + self, + uri, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if uri is not None: + _body_params = uri + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/playback/uri", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def run_provided_scene( + self, + scene_properties: Annotated[ + SceneProperties, Field(description="The scene you want to run") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Run provided scene + + + :param scene_properties: The scene you want to run (required) + :type scene_properties: SceneProperties + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._run_provided_scene_serialize( + scene_properties=scene_properties, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def run_provided_scene_with_http_info( + self, + scene_properties: Annotated[ + SceneProperties, Field(description="The scene you want to run") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Run provided scene + + + :param scene_properties: The scene you want to run (required) + :type scene_properties: SceneProperties + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._run_provided_scene_serialize( + scene_properties=scene_properties, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def run_provided_scene_without_preload_content( + self, + scene_properties: Annotated[ + SceneProperties, Field(description="The scene you want to run") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Run provided scene + + + :param scene_properties: The scene you want to run (required) + :type scene_properties: SceneProperties + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._run_provided_scene_serialize( + scene_properties=scene_properties, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _run_provided_scene_serialize( + self, + scene_properties, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if scene_properties is not None: + _body_params = scene_properties + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/scene/run", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def seek_to_position( + self, + position_ms: Annotated[ + StrictInt, Field(description="position in milliseconds") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Seek to position in stream + + + :param position_ms: position in milliseconds (required) + :type position_ms: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._seek_to_position_serialize( + position_ms=position_ms, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def seek_to_position_with_http_info( + self, + position_ms: Annotated[ + StrictInt, Field(description="position in milliseconds") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Seek to position in stream + + + :param position_ms: position in milliseconds (required) + :type position_ms: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._seek_to_position_serialize( + position_ms=position_ms, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def seek_to_position_without_preload_content( + self, + position_ms: Annotated[ + StrictInt, Field(description="position in milliseconds") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Seek to position in stream + + + :param position_ms: position in milliseconds (required) + :type position_ms: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._seek_to_position_serialize( + position_ms=position_ms, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _seek_to_position_serialize( + self, + position_ms, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if position_ms is not None: + + _query_params.append(("position_ms", position_ms)) + + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/api/v1/playback/seek", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def set_active_source( + self, + source_id: Annotated[ + StrictStr, Field(description="the id of the source to activate") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Set the active source + + + :param source_id: the id of the source to activate (required) + :type source_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_active_source_serialize( + source_id=source_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def set_active_source_with_http_info( + self, + source_id: Annotated[ + StrictStr, Field(description="the id of the source to activate") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Set the active source + + + :param source_id: the id of the source to activate (required) + :type source_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_active_source_serialize( + source_id=source_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def set_active_source_without_preload_content( + self, + source_id: Annotated[ + StrictStr, Field(description="the id of the source to activate") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Set the active source + + + :param source_id: the id of the source to activate (required) + :type source_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_active_source_serialize( + source_id=source_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _set_active_source_serialize( + self, + source_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if source_id is not None: + _path_params["sourceId"] = source_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/playback/sources/active/{sourceId}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def set_current_volume_level( + self, + volume_level: Annotated[ + VolumeLevel, Field(description="The volume level to apply") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Set the current volume level + + + :param volume_level: The volume level to apply (required) + :type volume_level: VolumeLevel + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_current_volume_level_serialize( + volume_level=volume_level, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def set_current_volume_level_with_http_info( + self, + volume_level: Annotated[ + VolumeLevel, Field(description="The volume level to apply") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Set the current volume level + + + :param volume_level: The volume level to apply (required) + :type volume_level: VolumeLevel + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_current_volume_level_serialize( + volume_level=volume_level, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def set_current_volume_level_without_preload_content( + self, + volume_level: Annotated[ + VolumeLevel, Field(description="The volume level to apply") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Set the current volume level + + + :param volume_level: The volume level to apply (required) + :type volume_level: VolumeLevel + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_current_volume_level_serialize( + volume_level=volume_level, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _set_current_volume_level_serialize( + self, + volume_level, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if volume_level is not None: + _body_params = volume_level + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/api/v1/sound/volume/level", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def set_product_friendly_name( + self, + product_friendly_name: Annotated[ + ProductFriendlyName, Field(description="the friendly name for the product") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Set the friendly name + + + :param product_friendly_name: the friendly name for the product (required) + :type product_friendly_name: ProductFriendlyName + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_product_friendly_name_serialize( + product_friendly_name=product_friendly_name, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def set_product_friendly_name_with_http_info( + self, + product_friendly_name: Annotated[ + ProductFriendlyName, Field(description="the friendly name for the product") ], - **kwargs - ) -> None: # noqa: E501 - """Run provided scene # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Set the friendly name - :param scene_properties: The scene you want to run (required) - :type scene_properties: SceneProperties - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the run_provided_scene_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.run_provided_scene_with_http_info( - scene_properties, **kwargs - ) # noqa: E501 - - @validate_arguments - async def run_provided_scene_with_http_info( + :param product_friendly_name: the friendly name for the product (required) + :type product_friendly_name: ProductFriendlyName + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_product_friendly_name_serialize( + product_friendly_name=product_friendly_name, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def set_product_friendly_name_without_preload_content( self, - scene_properties: Annotated[ - SceneProperties, Field(..., description="The scene you want to run") + product_friendly_name: Annotated[ + ProductFriendlyName, Field(description="the friendly name for the product") ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Run provided scene # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Set the friendly name - :param scene_properties: The scene you want to run (required) - :type scene_properties: SceneProperties - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + :param product_friendly_name: the friendly name for the product (required) + :type product_friendly_name: ProductFriendlyName :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() + _param = self._set_product_friendly_name_serialize( + product_friendly_name=product_friendly_name, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = ["scene_properties"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response + + def _set_product_friendly_name_serialize( + self, + product_friendly_name, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method run_provided_scene" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _host = None - _collection_formats = {} + _collection_formats: Dict[str, str] = {} - # process the path parameters - _path_params = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["scene_properties"] is not None: - _body_params = _params["scene_properties"] + if product_friendly_name is not None: + _body_params = product_friendly_name - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = [] # noqa: E501 + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/api/v1/product/info/friendlyname", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def set_remote_home_control_uri( + self, + home_control_uri: Annotated[ + HomeControlUri, + Field( + description="The new uri for HomeControl dashboard and IXP start page" + ), + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Set the uri for HomeControl dashboard and Immersive Experience (IXP) start page + + + :param home_control_uri: The new uri for HomeControl dashboard and IXP start page (required) + :type home_control_uri: HomeControlUri + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_remote_home_control_uri_serialize( + home_control_uri=home_control_uri, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def set_remote_home_control_uri_with_http_info( + self, + home_control_uri: Annotated[ + HomeControlUri, + Field( + description="The new uri for HomeControl dashboard and IXP start page" + ), + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Set the uri for HomeControl dashboard and Immersive Experience (IXP) start page + + + :param home_control_uri: The new uri for HomeControl dashboard and IXP start page (required) + :type home_control_uri: HomeControlUri + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_remote_home_control_uri_serialize( + home_control_uri=home_control_uri, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def set_remote_home_control_uri_without_preload_content( + self, + home_control_uri: Annotated[ + HomeControlUri, + Field( + description="The new uri for HomeControl dashboard and IXP start page" + ), + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Set the uri for HomeControl dashboard and Immersive Experience (IXP) start page + + + :param home_control_uri: The new uri for HomeControl dashboard and IXP start page (required) + :type home_control_uri: HomeControlUri + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_remote_home_control_uri_serialize( + home_control_uri=home_control_uri, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _set_remote_home_control_uri_serialize( + self, + home_control_uri, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if home_control_uri is not None: + _body_params = home_control_uri + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) - _response_types_map = {} + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type - return await self.api_client.call_api( - "/api/v1/scene/run", - "POST", - _path_params, - _query_params, - _header_params, + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/api/v1/setup/remote/home-control-uri", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def seek_to_position( + @validate_call + async def set_settings_queue( self, - position_ms: Annotated[ - StrictInt, Field(..., description="position in milliseconds") + play_queue_settings: Annotated[ + PlayQueueSettings, Field(description="the desired settings") ], - **kwargs - ) -> None: # noqa: E501 - """Seek to position in stream # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Set queue settings - :param position_ms: position in milliseconds (required) - :type position_ms: int - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the seek_to_position_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.seek_to_position_with_http_info( - position_ms, **kwargs - ) # noqa: E501 - - @validate_arguments - async def seek_to_position_with_http_info( + :param play_queue_settings: the desired settings (required) + :type play_queue_settings: PlayQueueSettings + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_settings_queue_serialize( + play_queue_settings=play_queue_settings, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def set_settings_queue_with_http_info( self, - position_ms: Annotated[ - StrictInt, Field(..., description="position in milliseconds") + play_queue_settings: Annotated[ + PlayQueueSettings, Field(description="the desired settings") ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Seek to position in stream # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Set queue settings - :param position_ms: position in milliseconds (required) - :type position_ms: int - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + :param play_queue_settings: the desired settings (required) + :type play_queue_settings: PlayQueueSettings :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() + _param = self._set_settings_queue_serialize( + play_queue_settings=play_queue_settings, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = ["position_ms"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method seek_to_position" % _key - ) - _params[_key] = _val - del _params["kwargs"] + @validate_call + async def set_settings_queue_without_preload_content( + self, + play_queue_settings: Annotated[ + PlayQueueSettings, Field(description="the desired settings") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Set queue settings - _collection_formats = {} - # process the path parameters - _path_params = {} + :param play_queue_settings: the desired settings (required) + :type play_queue_settings: PlayQueueSettings + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 - # process the query parameters - _query_params = [] - if _params.get("position_ms") is not None: # noqa: E501 - _query_params.append(("position_ms", _params["position_ms"])) + _param = self._set_settings_queue_serialize( + play_queue_settings=play_queue_settings, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _set_settings_queue_serialize( + self, + play_queue_settings, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + if play_queue_settings is not None: + _body_params = play_queue_settings + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = [] # noqa: E501 + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/api/v1/playback/queue/settings", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def set_sound_settings_adjustments_bass( + self, + bass: Annotated[Bass, Field(description="the bass level")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Update the sound settings adjustments for bass + + + :param bass: the bass level (required) + :type bass: Bass + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_sound_settings_adjustments_bass_serialize( + bass=bass, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def set_sound_settings_adjustments_bass_with_http_info( + self, + bass: Annotated[Bass, Field(description="the bass level")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Update the sound settings adjustments for bass + + + :param bass: the bass level (required) + :type bass: Bass + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 - _response_types_map = {} + _param = self._set_sound_settings_adjustments_bass_serialize( + bass=bass, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - return await self.api_client.call_api( - "/api/v1/playback/seek", - "PUT", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - async def set_active_source( - self, - source_id: Annotated[ - StrictStr, Field(..., description="the id of the source to activate") - ], - **kwargs - ) -> None: # noqa: E501 - """Set the active source # noqa: E501 - - - :param source_id: the id of the source to activate (required) - :type source_id: str - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the set_active_source_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.set_active_source_with_http_info( - source_id, **kwargs - ) # noqa: E501 - - @validate_arguments - async def set_active_source_with_http_info( + @validate_call + async def set_sound_settings_adjustments_bass_without_preload_content( self, - source_id: Annotated[ - StrictStr, Field(..., description="the id of the source to activate") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Set the active source # noqa: E501 + bass: Annotated[Bass, Field(description="the bass level")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the sound settings adjustments for bass - :param source_id: the id of the source to activate (required) - :type source_id: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + :param bass: the bass level (required) + :type bass: Bass :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() + _param = self._set_sound_settings_adjustments_bass_serialize( + bass=bass, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = ["source_id"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method set_active_source" % _key - ) - _params[_key] = _val - del _params["kwargs"] + def _set_sound_settings_adjustments_bass_serialize( + self, + bass, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - _collection_formats = {} + _host = None - # process the path parameters - _path_params = {} - if _params["source_id"] is not None: - _path_params["sourceId"] = _params["source_id"] + _collection_formats: Dict[str, str] = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + if bass is not None: + _body_params = bass + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 + ) - _response_types_map = {} + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type - return await self.api_client.call_api( - "/api/v1/playback/sources/active/{sourceId}", - "POST", - _path_params, - _query_params, - _header_params, + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/api/v1/sound/settings/adjustments/bass", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def set_current_volume_level( - self, - volume_level: Annotated[ - VolumeLevel, Field(..., description="The volume level to apply") - ], - **kwargs - ) -> None: # noqa: E501 - """Set the current volume level # noqa: E501 - - - :param volume_level: The volume level to apply (required) - :type volume_level: VolumeLevel - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the set_current_volume_level_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.set_current_volume_level_with_http_info( - volume_level, **kwargs - ) # noqa: E501 - - @validate_arguments - async def set_current_volume_level_with_http_info( + @validate_call + async def set_sound_settings_adjustments_directivity( self, - volume_level: Annotated[ - VolumeLevel, Field(..., description="The volume level to apply") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Set the current volume level # noqa: E501 + directivity: Annotated[Directivity, Field(description="the directivity")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Update the sound settings adjustments for directivity - :param volume_level: The volume level to apply (required) - :type volume_level: VolumeLevel - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + :param directivity: the directivity (required) + :type directivity: Directivity :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() - - _all_params = ["volume_level"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _param = self._set_sound_settings_adjustments_directivity_serialize( + directivity=directivity, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method set_current_volume_level" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - # process the path parameters - _path_params = {} + @validate_call + async def set_sound_settings_adjustments_directivity_with_http_info( + self, + directivity: Annotated[Directivity, Field(description="the directivity")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Update the sound settings adjustments for directivity - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params["volume_level"] is not None: - _body_params = _params["volume_level"] - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + :param directivity: the directivity (required) + :type directivity: Directivity + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), + _param = self._set_sound_settings_adjustments_directivity_serialize( + directivity=directivity, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - return await self.api_client.call_api( - "/api/v1/sound/volume/level", - "PUT", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - async def set_product_friendly_name( - self, - product_friendly_name: Annotated[ - ProductFriendlyName, - Field(..., description="the friendly name for the product"), - ], - **kwargs - ) -> None: # noqa: E501 - """Set the friendly name # noqa: E501 - - - :param product_friendly_name: the friendly name for the product (required) - :type product_friendly_name: ProductFriendlyName - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the set_product_friendly_name_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.set_product_friendly_name_with_http_info( - product_friendly_name, **kwargs - ) # noqa: E501 - - @validate_arguments - async def set_product_friendly_name_with_http_info( + @validate_call + async def set_sound_settings_adjustments_directivity_without_preload_content( self, - product_friendly_name: Annotated[ - ProductFriendlyName, - Field(..., description="the friendly name for the product"), - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Set the friendly name # noqa: E501 + directivity: Annotated[Directivity, Field(description="the directivity")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the sound settings adjustments for directivity - :param product_friendly_name: the friendly name for the product (required) - :type product_friendly_name: ProductFriendlyName - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + :param directivity: the directivity (required) + :type directivity: Directivity :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() + _param = self._set_sound_settings_adjustments_directivity_serialize( + directivity=directivity, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = ["product_friendly_name"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response + + def _set_sound_settings_adjustments_directivity_serialize( + self, + directivity, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method set_product_friendly_name" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _host = None - _collection_formats = {} + _collection_formats: Dict[str, str] = {} - # process the path parameters - _path_params = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["product_friendly_name"] is not None: - _body_params = _params["product_friendly_name"] + if directivity is not None: + _body_params = directivity # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/product/info/friendlyname", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/api/v1/sound/settings/adjustments/directivity", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def set_remote_home_control_uri( - self, - home_control_uri: Annotated[ - HomeControlUri, Field(..., description="the new HomeControl dashboard uri") - ], - **kwargs - ) -> None: # noqa: E501 - """Set the HomeControl dashboard URI # noqa: E501 - - - :param home_control_uri: the new HomeControl dashboard uri (required) - :type home_control_uri: HomeControlUri - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the set_remote_home_control_uri_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.set_remote_home_control_uri_with_http_info( - home_control_uri, **kwargs - ) # noqa: E501 - - @validate_arguments - async def set_remote_home_control_uri_with_http_info( + @validate_call + async def set_sound_settings_adjustments_loudness( self, - home_control_uri: Annotated[ - HomeControlUri, Field(..., description="the new HomeControl dashboard uri") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Set the HomeControl dashboard URI # noqa: E501 + loudness: Annotated[Loudness, Field(description="the loudness mode")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Update the sound settings adjustments for loudness - :param home_control_uri: the new HomeControl dashboard uri (required) - :type home_control_uri: HomeControlUri - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + :param loudness: the loudness mode (required) + :type loudness: Loudness :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() + """ # noqa: E501 - _all_params = ["home_control_uri"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _param = self._set_sound_settings_adjustments_loudness_serialize( + loudness=loudness, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method set_remote_home_control_uri" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - # process the path parameters - _path_params = {} + @validate_call + async def set_sound_settings_adjustments_loudness_with_http_info( + self, + loudness: Annotated[Loudness, Field(description="the loudness mode")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Update the sound settings adjustments for loudness - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params["home_control_uri"] is not None: - _body_params = _params["home_control_uri"] - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + :param loudness: the loudness mode (required) + :type loudness: Loudness + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), + _param = self._set_sound_settings_adjustments_loudness_serialize( + loudness=loudness, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/setup/remote/home-control-uri", - "PUT", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - async def set_settings_queue( - self, - play_queue_settings: Annotated[ - PlayQueueSettings, Field(..., description="the desired settings") - ], - **kwargs - ) -> None: # noqa: E501 - """Set queue settings # noqa: E501 - - - :param play_queue_settings: the desired settings (required) - :type play_queue_settings: PlayQueueSettings - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the set_settings_queue_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.set_settings_queue_with_http_info( - play_queue_settings, **kwargs - ) # noqa: E501 - - @validate_arguments - async def set_settings_queue_with_http_info( + @validate_call + async def set_sound_settings_adjustments_loudness_without_preload_content( self, - play_queue_settings: Annotated[ - PlayQueueSettings, Field(..., description="the desired settings") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Set queue settings # noqa: E501 + loudness: Annotated[Loudness, Field(description="the loudness mode")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the sound settings adjustments for loudness - :param play_queue_settings: the desired settings (required) - :type play_queue_settings: PlayQueueSettings - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + :param loudness: the loudness mode (required) + :type loudness: Loudness :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() + _param = self._set_sound_settings_adjustments_loudness_serialize( + loudness=loudness, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = ["play_queue_settings"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method set_settings_queue" % _key - ) - _params[_key] = _val - del _params["kwargs"] + def _set_sound_settings_adjustments_loudness_serialize( + self, + loudness, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - _collection_formats = {} + _host = None - # process the path parameters - _path_params = {} + _collection_formats: Dict[str, str] = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["play_queue_settings"] is not None: - _body_params = _params["play_queue_settings"] + if loudness is not None: + _body_params = loudness # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/playback/queue/settings", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/api/v1/sound/settings/adjustments/loudness", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def set_sound_settings_adjustments_bass( - self, bass: Annotated[Bass, Field(..., description="the bass level")], **kwargs - ) -> None: # noqa: E501 - """Update the sound settings adjustments for bass # noqa: E501 - - - :param bass: the bass level (required) - :type bass: Bass - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the set_sound_settings_adjustments_bass_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.set_sound_settings_adjustments_bass_with_http_info( - bass, **kwargs - ) # noqa: E501 - - @validate_arguments - async def set_sound_settings_adjustments_bass_with_http_info( - self, bass: Annotated[Bass, Field(..., description="the bass level")], **kwargs - ) -> ApiResponse: # noqa: E501 - """Update the sound settings adjustments for bass # noqa: E501 + @validate_call + async def set_sound_settings_adjustments_treble( + self, + treble: Annotated[Treble, Field(description="the treble level")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Update the sound settings adjustments for treble - :param bass: the bass level (required) - :type bass: Bass - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + :param treble: the treble level (required) + :type treble: Treble :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() - - _all_params = ["bass"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _param = self._set_sound_settings_adjustments_treble_serialize( + treble=treble, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method set_sound_settings_adjustments_bass" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - # process the path parameters - _path_params = {} + @validate_call + async def set_sound_settings_adjustments_treble_with_http_info( + self, + treble: Annotated[Treble, Field(description="the treble level")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Update the sound settings adjustments for treble - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params["bass"] is not None: - _body_params = _params["bass"] - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + :param treble: the treble level (required) + :type treble: Treble + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), + _param = self._set_sound_settings_adjustments_treble_serialize( + treble=treble, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - return await self.api_client.call_api( - "/api/v1/sound/settings/adjustments/bass", - "PUT", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - async def set_sound_settings_adjustments_directivity( - self, - directivity: Annotated[Directivity, Field(..., description="the directivity")], - **kwargs - ) -> None: # noqa: E501 - """Update the sound settings adjustments for directivity # noqa: E501 - - - :param directivity: the directivity (required) - :type directivity: Directivity - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the set_sound_settings_adjustments_directivity_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.set_sound_settings_adjustments_directivity_with_http_info( - directivity, **kwargs - ) # noqa: E501 - - @validate_arguments - async def set_sound_settings_adjustments_directivity_with_http_info( + @validate_call + async def set_sound_settings_adjustments_treble_without_preload_content( self, - directivity: Annotated[Directivity, Field(..., description="the directivity")], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Update the sound settings adjustments for directivity # noqa: E501 + treble: Annotated[Treble, Field(description="the treble level")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the sound settings adjustments for treble - :param directivity: the directivity (required) - :type directivity: Directivity - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + :param treble: the treble level (required) + :type treble: Treble :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() + _param = self._set_sound_settings_adjustments_treble_serialize( + treble=treble, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = ["directivity"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response + + def _set_sound_settings_adjustments_treble_serialize( + self, + treble, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method set_sound_settings_adjustments_directivity" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _host = None - _collection_formats = {} + _collection_formats: Dict[str, str] = {} - # process the path parameters - _path_params = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["directivity"] is not None: - _body_params = _params["directivity"] + if treble is not None: + _body_params = treble # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/sound/settings/adjustments/directivity", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/api/v1/sound/settings/adjustments/treble", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def set_sound_settings_adjustments_loudness( + @validate_call + async def set_stand_movement( self, - loudness: Annotated[Loudness, Field(..., description="the loudness mode")], - **kwargs - ) -> None: # noqa: E501 - """Update the sound settings adjustments for loudness # noqa: E501 + stand_movement: Annotated[StandMovement, Field(description="Stand Movement")], + slow_speed: Annotated[ + Optional[StrictBool], + Field(description="Use slow speed on continuous movement"), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Set stand movement with either an angle or a movement type + + + :param stand_movement: Stand Movement (required) + :type stand_movement: StandMovement + :param slow_speed: Use slow speed on continuous movement + :type slow_speed: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + _param = self._set_stand_movement_serialize( + stand_movement=stand_movement, + slow_speed=slow_speed, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - :param loudness: the loudness mode (required) - :type loudness: Loudness - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the set_sound_settings_adjustments_loudness_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.set_sound_settings_adjustments_loudness_with_http_info( - loudness, **kwargs - ) # noqa: E501 - - @validate_arguments - async def set_sound_settings_adjustments_loudness_with_http_info( + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def set_stand_movement_with_http_info( self, - loudness: Annotated[Loudness, Field(..., description="the loudness mode")], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Update the sound settings adjustments for loudness # noqa: E501 + stand_movement: Annotated[StandMovement, Field(description="Stand Movement")], + slow_speed: Annotated[ + Optional[StrictBool], + Field(description="Use slow speed on continuous movement"), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Set stand movement with either an angle or a movement type + + + :param stand_movement: Stand Movement (required) + :type stand_movement: StandMovement + :param slow_speed: Use slow speed on continuous movement + :type slow_speed: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + _param = self._set_stand_movement_serialize( + stand_movement=stand_movement, + slow_speed=slow_speed, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - :param loudness: the loudness mode (required) - :type loudness: Loudness - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def set_stand_movement_without_preload_content( + self, + stand_movement: Annotated[StandMovement, Field(description="Stand Movement")], + slow_speed: Annotated[ + Optional[StrictBool], + Field(description="Use slow speed on continuous movement"), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Set stand movement with either an angle or a movement type + + + :param stand_movement: Stand Movement (required) + :type stand_movement: StandMovement + :param slow_speed: Use slow speed on continuous movement + :type slow_speed: bool :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() + _param = self._set_stand_movement_serialize( + stand_movement=stand_movement, + slow_speed=slow_speed, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = ["loudness"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response + + def _set_stand_movement_serialize( + self, + stand_movement, + slow_speed, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method set_sound_settings_adjustments_loudness" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _host = None - _collection_formats = {} + _collection_formats: Dict[str, str] = {} - # process the path parameters - _path_params = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters # process the query parameters - _query_params = [] + if slow_speed is not None: + + _query_params.append(("slow-speed", slow_speed)) + # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["loudness"] is not None: - _body_params = _params["loudness"] + if stand_movement is not None: + _body_params = stand_movement # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/sound/settings/adjustments/loudness", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/stand/move", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def set_sound_settings_adjustments_treble( - self, - treble: Annotated[Treble, Field(..., description="the treble level")], - **kwargs - ) -> None: # noqa: E501 - """Update the sound settings adjustments for treble # noqa: E501 - - - :param treble: the treble level (required) - :type treble: Treble - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the set_sound_settings_adjustments_treble_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.set_sound_settings_adjustments_treble_with_http_info( - treble, **kwargs - ) # noqa: E501 - - @validate_arguments - async def set_sound_settings_adjustments_treble_with_http_info( + @validate_call + async def set_volume_mute( self, - treble: Annotated[Treble, Field(..., description="the treble level")], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Update the sound settings adjustments for treble # noqa: E501 + volume_mute: Annotated[ + VolumeMute, Field(description="The mute state to apply") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Set the volume mute state - :param treble: the treble level (required) - :type treble: Treble - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + :param volume_mute: The mute state to apply (required) + :type volume_mute: VolumeMute :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() + """ # noqa: E501 - _all_params = ["treble"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _param = self._set_volume_mute_serialize( + volume_mute=volume_mute, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method set_sound_settings_adjustments_treble" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params["treble"] is not None: - _body_params = _params["treble"] - - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/sound/settings/adjustments/treble", - "PUT", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), - ) + ).data - @validate_arguments - async def set_volume_mute( + @validate_call + async def set_volume_mute_with_http_info( self, volume_mute: Annotated[ - VolumeMute, Field(..., description="The mute state to apply") + VolumeMute, Field(description="The mute state to apply") ], - **kwargs - ) -> None: # noqa: E501 - """Set the volume mute state # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Set the volume mute state :param volume_mute: The mute state to apply (required) :type volume_mute: VolumeMute - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the set_volume_mute_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.set_volume_mute_with_http_info( - volume_mute, **kwargs - ) # noqa: E501 - - @validate_arguments - async def set_volume_mute_with_http_info( + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_volume_mute_serialize( + volume_mute=volume_mute, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def set_volume_mute_without_preload_content( self, volume_mute: Annotated[ - VolumeMute, Field(..., description="The mute state to apply") + VolumeMute, Field(description="The mute state to apply") ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Set the volume mute state # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Set the volume mute state :param volume_mute: The mute state to apply (required) :type volume_mute: VolumeMute - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() + _param = self._set_volume_mute_serialize( + volume_mute=volume_mute, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = ["volume_mute"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response + + def _set_volume_mute_serialize( + self, + volume_mute, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method set_volume_mute" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _host = None - _collection_formats = {} + _collection_formats: Dict[str, str] = {} - # process the path parameters - _path_params = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["volume_mute"] is not None: - _body_params = _params["volume_mute"] + if volume_mute is not None: + _body_params = volume_mute # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/sound/volume/mute", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/api/v1/sound/volume/mute", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def set_volume_settings( self, volume_settings: Annotated[ - VolumeSettings, Field(..., description="The settings to apply") + VolumeSettings, Field(description="The settings to apply") ], - **kwargs - ) -> None: # noqa: E501 - """Set the current volume settings for default and maximum volume level # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Set the current volume settings for default and maximum volume level :param volume_settings: The settings to apply (required) :type volume_settings: VolumeSettings - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the set_volume_settings_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.set_volume_settings_with_http_info( - volume_settings, **kwargs - ) # noqa: E501 - - @validate_arguments + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_volume_settings_serialize( + volume_settings=volume_settings, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def set_volume_settings_with_http_info( self, volume_settings: Annotated[ - VolumeSettings, Field(..., description="The settings to apply") + VolumeSettings, Field(description="The settings to apply") ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Set the current volume settings for default and maximum volume level # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Set the current volume settings for default and maximum volume level :param volume_settings: The settings to apply (required) :type volume_settings: VolumeSettings - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() + _param = self._set_volume_settings_serialize( + volume_settings=volume_settings, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = ["volume_settings"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method set_volume_settings" % _key - ) - _params[_key] = _val - del _params["kwargs"] + @validate_call + async def set_volume_settings_without_preload_content( + self, + volume_settings: Annotated[ + VolumeSettings, Field(description="The settings to apply") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Set the current volume settings for default and maximum volume level - _collection_formats = {} - # process the path parameters - _path_params = {} + :param volume_settings: The settings to apply (required) + :type volume_settings: VolumeSettings + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_volume_settings_serialize( + volume_settings=volume_settings, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _set_volume_settings_serialize( + self, + volume_settings, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["volume_settings"] is not None: - _body_params = _params["volume_settings"] + if volume_settings is not None: + _body_params = volume_settings # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/sound/volume/settings", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/api/v1/sound/volume/settings", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def start_deezer_flow( self, user_flow: Annotated[ Optional[UserFlow], Field(description="Select user") ] = None, - **kwargs - ) -> None: # noqa: E501 - """Play users flow. If no provided user id it will play the flow connected to the active account # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Play users flow. If no provided user id it will play the flow connected to the active account :param user_flow: Select user :type user_flow: UserFlow - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the start_deezer_flow_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.start_deezer_flow_with_http_info( - user_flow, **kwargs - ) # noqa: E501 - - @validate_arguments + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._start_deezer_flow_serialize( + user_flow=user_flow, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def start_deezer_flow_with_http_info( self, user_flow: Annotated[ Optional[UserFlow], Field(description="Select user") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Play users flow. If no provided user id it will play the flow connected to the active account # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Play users flow. If no provided user id it will play the flow connected to the active account + + + :param user_flow: Select user + :type user_flow: UserFlow + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._start_deezer_flow_serialize( + user_flow=user_flow, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def start_deezer_flow_without_preload_content( + self, + user_flow: Annotated[ + Optional[UserFlow], Field(description="Select user") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Play users flow. If no provided user id it will play the flow connected to the active account :param user_flow: Select user :type user_flow: UserFlow - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ + """ # noqa: E501 - _params = locals() + _param = self._start_deezer_flow_serialize( + user_flow=user_flow, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _all_params = ["user_flow"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response + + def _start_deezer_flow_serialize( + self, + user_flow, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method start_deezer_flow" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _host = None - _collection_formats = {} + _collection_formats: Dict[str, str] = {} - # process the path parameters - _path_params = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["user_flow"] is not None: - _body_params = _params["user_flow"] + if user_flow is not None: + _body_params = user_flow # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/playback/deezer/flow", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/playback/deezer/flow", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/python_client/mozart_api/api/overlay_api.py b/python_client/mozart_api/api/overlay_api.py index 0115aca..200a0c4 100644 --- a/python_client/mozart_api/api/overlay_api.py +++ b/python_client/mozart_api/api/overlay_api.py @@ -12,22 +12,18 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError -from typing import overload, Optional, Union, Awaitable - +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field +from pydantic import Field +from typing_extensions import Annotated from mozart_api.models.overlay_play_request import OverlayPlayRequest -from mozart_api.api_client import ApiClient +from mozart_api.api_client import ApiClient, RequestSerialized from mozart_api.api_response import ApiResponse -from mozart_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 +from mozart_api.rest import RESTResponseType class OverlayApi: @@ -42,149 +38,260 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call async def post_overlay_play( self, overlay_play_request: Annotated[ - OverlayPlayRequest, - Field(..., description="settings to use for the overlay"), + OverlayPlayRequest, Field(description="settings to use for the overlay") ], - **kwargs - ) -> None: # noqa: E501 - """Play overlay # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Play overlay - Play some audio as an overlay. This will duck currently playing music while the audio is playing. Currently 100 unique TTS messages can be generated a day and generated messages are cached for 24 hours. # noqa: E501 + Play some audio as an overlay. This will duck currently playing music while the audio is playing. Currently 100 unique TTS messages can be generated a day and generated messages are cached for 24 hours. :param overlay_play_request: settings to use for the overlay (required) :type overlay_play_request: OverlayPlayRequest - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the post_overlay_play_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.post_overlay_play_with_http_info( - overlay_play_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._post_overlay_play_serialize( + overlay_play_request=overlay_play_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def post_overlay_play_with_http_info( self, overlay_play_request: Annotated[ - OverlayPlayRequest, - Field(..., description="settings to use for the overlay"), + OverlayPlayRequest, Field(description="settings to use for the overlay") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Play overlay + + Play some audio as an overlay. This will duck currently playing music while the audio is playing. Currently 100 unique TTS messages can be generated a day and generated messages are cached for 24 hours. + + :param overlay_play_request: settings to use for the overlay (required) + :type overlay_play_request: OverlayPlayRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_overlay_play_serialize( + overlay_play_request=overlay_play_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def post_overlay_play_without_preload_content( + self, + overlay_play_request: Annotated[ + OverlayPlayRequest, Field(description="settings to use for the overlay") ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Play overlay # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Play overlay - Play some audio as an overlay. This will duck currently playing music while the audio is playing. Currently 100 unique TTS messages can be generated a day and generated messages are cached for 24 hours. # noqa: E501 + Play some audio as an overlay. This will duck currently playing music while the audio is playing. Currently 100 unique TTS messages can be generated a day and generated messages are cached for 24 hours. :param overlay_play_request: settings to use for the overlay (required) :type overlay_play_request: OverlayPlayRequest - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["overlay_play_request"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._post_overlay_play_serialize( + overlay_play_request=overlay_play_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method post_overlay_play" % _key - ) - _params[_key] = _val - del _params["kwargs"] + def _post_overlay_play_serialize( + self, + overlay_play_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - _collection_formats = {} + _host = None - # process the path parameters - _path_params = {} + _collection_formats: Dict[str, str] = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["overlay_play_request"] is not None: - _body_params = _params["overlay_play_request"] + if overlay_play_request is not None: + _body_params = overlay_play_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} + _auth_settings: List[str] = [] - return await self.api_client.call_api( - "/api/v1/overlay/play", - "POST", - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/overlay/play", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/python_client/mozart_api/api/playback_api.py b/python_client/mozart_api/api/playback_api.py index 8e768cb..4ab9a7d 100644 --- a/python_client/mozart_api/api/playback_api.py +++ b/python_client/mozart_api/api/playback_api.py @@ -12,19 +12,14 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError -from typing import overload, Optional, Union, Awaitable - +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictBool, StrictInt, StrictStr - -from typing import Any, Dict, Optional +from pydantic import Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Optional +from typing_extensions import Annotated from mozart_api.models.play_queue_item import PlayQueueItem from mozart_api.models.play_queue_settings import PlayQueueSettings from mozart_api.models.playback_state import PlaybackState @@ -32,9 +27,9 @@ from mozart_api.models.uri import Uri from mozart_api.models.user_flow import UserFlow -from mozart_api.api_client import ApiClient +from mozart_api.api_client import ApiClient, RequestSerialized from mozart_api.api_response import ApiResponse -from mozart_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 +from mozart_api.rest import RESTResponseType class PlaybackApi: @@ -49,1601 +44,2926 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call async def activate_preset( self, id: Annotated[ - StrictInt, - Field(..., description="the id of the preset you want to trigger"), + StrictInt, Field(description="the id of the preset you want to trigger") ], - **kwargs - ) -> None: # noqa: E501 - """Trigger a preset # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Trigger a preset :param id: the id of the preset you want to trigger (required) :type id: int - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the activate_preset_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.activate_preset_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._activate_preset_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + "412": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def activate_preset_with_http_info( self, id: Annotated[ - StrictInt, - Field(..., description="the id of the preset you want to trigger"), + StrictInt, Field(description="the id of the preset you want to trigger") ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Trigger a preset # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Trigger a preset :param id: the id of the preset you want to trigger (required) :type id: int - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["id"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method activate_preset" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._activate_preset_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["id"] is not None: - _path_params["id"] = _params["id"] + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + "412": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def activate_preset_without_preload_content( + self, + id: Annotated[ + StrictInt, Field(description="the id of the preset you want to trigger") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Trigger a preset + + :param id: the id of the preset you want to trigger (required) + :type id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._activate_preset_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + "412": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _activate_preset_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params["id"] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/playback/preset/{id}/trigger", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/playback/preset/{id}/trigger", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def add_to_queue( self, play_queue_item: Annotated[ - PlayQueueItem, Field(..., description="the queue element you want to add") + PlayQueueItem, Field(description="the queue element you want to add") ], - **kwargs - ) -> None: # noqa: E501 - """Add an element to the queue # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Add an element to the queue :param play_queue_item: the queue element you want to add (required) :type play_queue_item: PlayQueueItem - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the add_to_queue_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.add_to_queue_with_http_info( - play_queue_item, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._add_to_queue_serialize( + play_queue_item=play_queue_item, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def add_to_queue_with_http_info( self, play_queue_item: Annotated[ - PlayQueueItem, Field(..., description="the queue element you want to add") + PlayQueueItem, Field(description="the queue element you want to add") ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Add an element to the queue # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Add an element to the queue :param play_queue_item: the queue element you want to add (required) :type play_queue_item: PlayQueueItem - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["play_queue_item"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method add_to_queue" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._add_to_queue_serialize( + play_queue_item=play_queue_item, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def add_to_queue_without_preload_content( + self, + play_queue_item: Annotated[ + PlayQueueItem, Field(description="the queue element you want to add") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Add an element to the queue + + + :param play_queue_item: the queue element you want to add (required) + :type play_queue_item: PlayQueueItem + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_to_queue_serialize( + play_queue_item=play_queue_item, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _add_to_queue_serialize( + self, + play_queue_item, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["play_queue_item"] is not None: - _body_params = _params["play_queue_item"] + if play_queue_item is not None: + _body_params = play_queue_item # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/playback/queue", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/playback/queue", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def get_available_sources( self, target_remote: Annotated[ Optional[StrictBool], Field(description="filter sources for remote control") ] = None, - **kwargs - ) -> SourceArray: # noqa: E501 - """Get all the available sources # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SourceArray: + """Get all the available sources :param target_remote: filter sources for remote control :type target_remote: bool - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: SourceArray - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_available_sources_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_available_sources_with_http_info( - target_remote, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_available_sources_serialize( + target_remote=target_remote, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "SourceArray", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def get_available_sources_with_http_info( self, target_remote: Annotated[ Optional[StrictBool], Field(description="filter sources for remote control") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get all the available sources # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SourceArray]: + """Get all the available sources :param target_remote: filter sources for remote control :type target_remote: bool - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(SourceArray, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["target_remote"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_available_sources" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - if _params.get("target_remote") is not None: # noqa: E501 - _query_params.append(("target-remote", _params["target_remote"])) - - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 + """ # noqa: E501 + + _param = self._get_available_sources_serialize( + target_remote=target_remote, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _response_types_map = { + _response_types_map: Dict[str, Optional[str]] = { "200": "SourceArray", "400": "ErrorModel", } - - return await self.api_client.call_api( - "/api/v1/playback/sources", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - async def get_playback_state(self, **kwargs) -> PlaybackState: # noqa: E501 - """Get the current playback state # noqa: E501 + @validate_call + async def get_available_sources_without_preload_content( + self, + target_remote: Annotated[ + Optional[StrictBool], Field(description="filter sources for remote control") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get all the available sources - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: PlaybackState - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_playback_state_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_playback_state_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def get_playback_state_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get the current playback state # noqa: E501 - - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + :param target_remote: filter sources for remote control + :type target_remote: bool :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(PlaybackState, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_playback_state" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._get_available_sources_serialize( + target_remote=target_remote, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} + _response_types_map: Dict[str, Optional[str]] = { + "200": "SourceArray", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_available_sources_serialize( + self, + target_remote, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] + if target_remote is not None: + + _query_params.append(("target-remote", target_remote)) + # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "PlaybackState", - "400": "ErrorModel", - } - - return await self.api_client.call_api( - "/api/v1/playback/state", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/playback/sources", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def get_settings_queue(self, **kwargs) -> PlayQueueSettings: # noqa: E501 - """Get the current queue settings # noqa: E501 + @validate_call + async def get_playback_state( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PlaybackState: + """Get the current playback state - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: PlayQueueSettings - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_settings_queue_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_settings_queue_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def get_settings_queue_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get the current queue settings # noqa: E501 - - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(PlayQueueSettings, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_settings_queue" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 - # process the path parameters - _path_params = {} + _param = self._get_playback_state_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + _response_types_map: Dict[str, Optional[str]] = { + "200": "PlaybackState", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - # authentication setting - _auth_settings = [] # noqa: E501 + @validate_call + async def get_playback_state_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PlaybackState]: + """Get the current playback state - _response_types_map = { - "200": "PlayQueueSettings", + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_playback_state_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "PlaybackState", "400": "ErrorModel", } - - return await self.api_client.call_api( - "/api/v1/playback/queue/settings", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - async def post_clear_queue(self, **kwargs) -> None: # noqa: E501 - """Clear the queue # noqa: E501 + @validate_call + async def get_playback_state_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the current playback state - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the post_clear_queue_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.post_clear_queue_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def post_clear_queue_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Clear the queue # noqa: E501 - - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method post_clear_queue" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 - # process the path parameters - _path_params = {} + _param = self._get_playback_state_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "PlaybackState", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_playback_state_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/playback/queue/clear", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/playback/state", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def post_playback_command( + @validate_call + async def get_settings_queue( self, - command: Annotated[ - StrictStr, Field(..., description="the named command to execute") - ], - **kwargs - ) -> None: # noqa: E501 - """Send a specific playback command to the product # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PlayQueueSettings: + """Get the current queue settings - :param command: the named command to execute (required) - :type command: str - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the post_playback_command_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.post_playback_command_with_http_info( - command, **kwargs - ) # noqa: E501 - - @validate_arguments - async def post_playback_command_with_http_info( - self, - command: Annotated[ - StrictStr, Field(..., description="the named command to execute") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Send a specific playback command to the product # noqa: E501 + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_settings_queue_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "PlayQueueSettings", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def get_settings_queue_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PlayQueueSettings]: + """Get the current queue settings - :param command: the named command to execute (required) - :type command: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["command"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method post_playback_command" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 - # process the path parameters - _path_params = {} - if _params["command"] is not None: - _path_params["command"] = _params["command"] + _param = self._get_settings_queue_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "PlayQueueSettings", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + @validate_call + async def get_settings_queue_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the current queue settings + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_settings_queue_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "PlayQueueSettings", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_settings_queue_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/playback/queue/settings", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def post_clear_queue( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Clear the queue + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_clear_queue_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def post_clear_queue_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Clear the queue + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_clear_queue_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def post_clear_queue_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Clear the queue + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_clear_queue_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _post_clear_queue_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} - _response_types_map = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None - return await self.api_client.call_api( - "/api/v1/playback/command/{command}", - "POST", - _path_params, - _query_params, - _header_params, + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/playback/queue/clear", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + async def post_playback_command( + self, + command: Annotated[ + StrictStr, Field(description="the named command to execute") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Send a specific playback command to the product + + + :param command: the named command to execute (required) + :type command: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_playback_command_serialize( + command=command, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, + ).data + + @validate_call + async def post_playback_command_with_http_info( + self, + command: Annotated[ + StrictStr, Field(description="the named command to execute") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Send a specific playback command to the product + + + :param command: the named command to execute (required) + :type command: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_playback_command_serialize( + command=command, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def post_playback_command_without_preload_content( + self, + command: Annotated[ + StrictStr, Field(description="the named command to execute") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Send a specific playback command to the product + + + :param command: the named command to execute (required) + :type command: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_playback_command_serialize( + command=command, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _post_playback_command_serialize( + self, + command, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if command is not None: + _path_params["command"] = command + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/playback/command/{command}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def post_uri_source( self, uri: Annotated[ - Uri, Field(..., description="the desired uri from which to stream data") + Uri, Field(description="the desired uri from which to stream data") ], - **kwargs - ) -> None: # noqa: E501 - """Set the URI from which sound is streamed # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Set the URI from which sound is streamed :param uri: the desired uri from which to stream data (required) :type uri: Uri - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the post_uri_source_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.post_uri_source_with_http_info(uri, **kwargs) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._post_uri_source_serialize( + uri=uri, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def post_uri_source_with_http_info( self, uri: Annotated[ - Uri, Field(..., description="the desired uri from which to stream data") + Uri, Field(description="the desired uri from which to stream data") ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Set the URI from which sound is streamed # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Set the URI from which sound is streamed :param uri: the desired uri from which to stream data (required) :type uri: Uri - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["uri"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method post_uri_source" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._post_uri_source_serialize( + uri=uri, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + @validate_call + async def post_uri_source_without_preload_content( + self, + uri: Annotated[ + Uri, Field(description="the desired uri from which to stream data") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Set the URI from which sound is streamed + + + :param uri: the desired uri from which to stream data (required) + :type uri: Uri + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_uri_source_serialize( + uri=uri, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _post_uri_source_serialize( + self, + uri, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["uri"] is not None: - _body_params = _params["uri"] + if uri is not None: + _body_params = uri # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/playback/uri", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/playback/uri", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def seek_to_position( self, position_ms: Annotated[ - StrictInt, Field(..., description="position in milliseconds") + StrictInt, Field(description="position in milliseconds") ], - **kwargs - ) -> None: # noqa: E501 - """Seek to position in stream # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Seek to position in stream :param position_ms: position in milliseconds (required) :type position_ms: int - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the seek_to_position_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.seek_to_position_with_http_info( - position_ms, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._seek_to_position_serialize( + position_ms=position_ms, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def seek_to_position_with_http_info( self, position_ms: Annotated[ - StrictInt, Field(..., description="position in milliseconds") + StrictInt, Field(description="position in milliseconds") ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Seek to position in stream # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Seek to position in stream :param position_ms: position in milliseconds (required) :type position_ms: int - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["position_ms"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method seek_to_position" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._seek_to_position_serialize( + position_ms=position_ms, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + @validate_call + async def seek_to_position_without_preload_content( + self, + position_ms: Annotated[ + StrictInt, Field(description="position in milliseconds") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Seek to position in stream + + + :param position_ms: position in milliseconds (required) + :type position_ms: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._seek_to_position_serialize( + position_ms=position_ms, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _seek_to_position_serialize( + self, + position_ms, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] - if _params.get("position_ms") is not None: # noqa: E501 - _query_params.append(("position_ms", _params["position_ms"])) + if position_ms is not None: + + _query_params.append(("position_ms", position_ms)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/playback/seek", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/api/v1/playback/seek", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def set_active_source( self, source_id: Annotated[ - StrictStr, Field(..., description="the id of the source to activate") + StrictStr, Field(description="the id of the source to activate") ], - **kwargs - ) -> None: # noqa: E501 - """Set the active source # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Set the active source :param source_id: the id of the source to activate (required) :type source_id: str - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the set_active_source_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.set_active_source_with_http_info( - source_id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._set_active_source_serialize( + source_id=source_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def set_active_source_with_http_info( self, source_id: Annotated[ - StrictStr, Field(..., description="the id of the source to activate") + StrictStr, Field(description="the id of the source to activate") ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Set the active source # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Set the active source :param source_id: the id of the source to activate (required) :type source_id: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["source_id"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method set_active_source" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._set_active_source_serialize( + source_id=source_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["source_id"] is not None: - _path_params["sourceId"] = _params["source_id"] + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def set_active_source_without_preload_content( + self, + source_id: Annotated[ + StrictStr, Field(description="the id of the source to activate") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Set the active source + + + :param source_id: the id of the source to activate (required) + :type source_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_active_source_serialize( + source_id=source_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _set_active_source_serialize( + self, + source_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if source_id is not None: + _path_params["sourceId"] = source_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/playback/sources/active/{sourceId}", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/playback/sources/active/{sourceId}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def set_settings_queue( self, play_queue_settings: Annotated[ - PlayQueueSettings, Field(..., description="the desired settings") + PlayQueueSettings, Field(description="the desired settings") ], - **kwargs - ) -> None: # noqa: E501 - """Set queue settings # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Set queue settings :param play_queue_settings: the desired settings (required) :type play_queue_settings: PlayQueueSettings - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the set_settings_queue_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.set_settings_queue_with_http_info( - play_queue_settings, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._set_settings_queue_serialize( + play_queue_settings=play_queue_settings, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def set_settings_queue_with_http_info( self, play_queue_settings: Annotated[ - PlayQueueSettings, Field(..., description="the desired settings") + PlayQueueSettings, Field(description="the desired settings") ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Set queue settings # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Set queue settings :param play_queue_settings: the desired settings (required) :type play_queue_settings: PlayQueueSettings - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["play_queue_settings"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method set_settings_queue" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._set_settings_queue_serialize( + play_queue_settings=play_queue_settings, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def set_settings_queue_without_preload_content( + self, + play_queue_settings: Annotated[ + PlayQueueSettings, Field(description="the desired settings") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Set queue settings + + + :param play_queue_settings: the desired settings (required) + :type play_queue_settings: PlayQueueSettings + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_settings_queue_serialize( + play_queue_settings=play_queue_settings, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _set_settings_queue_serialize( + self, + play_queue_settings, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["play_queue_settings"] is not None: - _body_params = _params["play_queue_settings"] + if play_queue_settings is not None: + _body_params = play_queue_settings # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/playback/queue/settings", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/api/v1/playback/queue/settings", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def start_deezer_flow( self, user_flow: Annotated[ Optional[UserFlow], Field(description="Select user") ] = None, - **kwargs - ) -> None: # noqa: E501 - """Play users flow. If no provided user id it will play the flow connected to the active account # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Play users flow. If no provided user id it will play the flow connected to the active account :param user_flow: Select user :type user_flow: UserFlow - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the start_deezer_flow_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.start_deezer_flow_with_http_info( - user_flow, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._start_deezer_flow_serialize( + user_flow=user_flow, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def start_deezer_flow_with_http_info( self, user_flow: Annotated[ Optional[UserFlow], Field(description="Select user") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Play users flow. If no provided user id it will play the flow connected to the active account # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Play users flow. If no provided user id it will play the flow connected to the active account :param user_flow: Select user :type user_flow: UserFlow - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["user_flow"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method start_deezer_flow" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._start_deezer_flow_serialize( + user_flow=user_flow, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def start_deezer_flow_without_preload_content( + self, + user_flow: Annotated[ + Optional[UserFlow], Field(description="Select user") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Play users flow. If no provided user id it will play the flow connected to the active account + + + :param user_flow: Select user + :type user_flow: UserFlow + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._start_deezer_flow_serialize( + user_flow=user_flow, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _start_deezer_flow_serialize( + self, + user_flow, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["user_flow"] is not None: - _body_params = _params["user_flow"] + if user_flow is not None: + _body_params = user_flow # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/playback/deezer/flow", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/playback/deezer/flow", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/python_client/mozart_api/api/power_api.py b/python_client/mozart_api/api/power_api.py index ee71eb1..9a5da05 100644 --- a/python_client/mozart_api/api/power_api.py +++ b/python_client/mozart_api/api/power_api.py @@ -12,20 +12,17 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError -from typing import overload, Optional, Union, Awaitable +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from mozart_api.models.battery_state import BatteryState from mozart_api.models.power_state_enum import PowerStateEnum -from mozart_api.api_client import ApiClient +from mozart_api.api_client import ApiClient, RequestSerialized from mozart_api.api_response import ApiResponse -from mozart_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 +from mozart_api.rest import RESTResponseType class PowerApi: @@ -40,352 +37,668 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments - async def get_battery_state(self, **kwargs) -> BatteryState: # noqa: E501 - """Get battery state of the product # noqa: E501 + @validate_call + async def get_battery_state( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BatteryState: + """Get battery state of the product - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: BatteryState - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_battery_state_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_battery_state_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_battery_state_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "BatteryState", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def get_battery_state_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get battery state of the product # noqa: E501 - - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BatteryState]: + """Get battery state of the product + + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(BatteryState, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._get_battery_state_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_battery_state" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "BatteryState", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} + @validate_call + async def get_battery_state_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get battery state of the product - # process the path parameters - _path_params = {} + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_battery_state_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "BatteryState", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_battery_state_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "BatteryState", - } - - return await self.api_client.call_api( - "/api/v1/battery", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/battery", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def get_power_state(self, **kwargs) -> PowerStateEnum: # noqa: E501 - """Get power state of the product # noqa: E501 + @validate_call + async def get_power_state( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PowerStateEnum: + """Get power state of the product - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: PowerStateEnum - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_power_state_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_power_state_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_power_state_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "PowerStateEnum", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def get_power_state_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get power state of the product # noqa: E501 - - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PowerStateEnum]: + """Get power state of the product + + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(PowerStateEnum, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._get_power_state_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_power_state" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "PowerStateEnum", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} + @validate_call + async def get_power_state_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get power state of the product - # process the path parameters - _path_params = {} + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_power_state_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "PowerStateEnum", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_power_state_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "PowerStateEnum", - } - - return await self.api_client.call_api( - "/api/v1/state/power", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/state/power", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def post_standby(self, **kwargs) -> None: # noqa: E501 - """Put the device in standby # noqa: E501 + @validate_call + async def post_standby( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Put the device in standby - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the post_standby_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.post_standby_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def post_standby_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """Put the device in standby # noqa: E501 - - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + """ # noqa: E501 + + _param = self._post_standby_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def post_standby_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Put the device in standby + + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._post_standby_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method post_standby" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} + @validate_call + async def post_standby_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Put the device in standby - # process the path parameters - _path_params = {} + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_standby_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _post_standby_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/state/standby", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/api/v1/state/standby", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/python_client/mozart_api/api/product_api.py b/python_client/mozart_api/api/product_api.py index 0356437..1432c04 100644 --- a/python_client/mozart_api/api/product_api.py +++ b/python_client/mozart_api/api/product_api.py @@ -12,23 +12,19 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError -from typing import overload, Optional, Union, Awaitable - +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field +from pydantic import Field +from typing_extensions import Annotated from mozart_api.models.product_friendly_name import ProductFriendlyName from mozart_api.models.product_state import ProductState -from mozart_api.api_client import ApiClient +from mozart_api.api_client import ApiClient, RequestSerialized from mozart_api.api_response import ApiResponse -from mozart_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 +from mozart_api.rest import RESTResponseType class ProductApi: @@ -43,266 +39,481 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments - async def get_product_state(self, **kwargs) -> ProductState: # noqa: E501 - """Get the overall state from the product # noqa: E501 + @validate_call + async def get_product_state( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ProductState: + """Get the overall state from the product - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ProductState - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_product_state_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_product_state_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_product_state_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ProductState", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def get_product_state_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get the overall state from the product # noqa: E501 - - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ProductState]: + """Get the overall state from the product + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_product_state_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ProductState", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def get_product_state_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the overall state from the product + + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ProductState, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._get_product_state_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ProductState", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + return response_data.response - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_product_state" % _key - ) - _params[_key] = _val - del _params["kwargs"] + def _get_product_state_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: - _collection_formats = {} + _host = None - # process the path parameters - _path_params = {} + _collection_formats: Dict[str, str] = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "ProductState", - "400": "ErrorModel", - } - - return await self.api_client.call_api( - "/api/v1/state", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/state", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def set_product_friendly_name( self, product_friendly_name: Annotated[ - ProductFriendlyName, - Field(..., description="the friendly name for the product"), + ProductFriendlyName, Field(description="the friendly name for the product") ], - **kwargs - ) -> None: # noqa: E501 - """Set the friendly name # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Set the friendly name :param product_friendly_name: the friendly name for the product (required) :type product_friendly_name: ProductFriendlyName - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the set_product_friendly_name_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.set_product_friendly_name_with_http_info( - product_friendly_name, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._set_product_friendly_name_serialize( + product_friendly_name=product_friendly_name, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def set_product_friendly_name_with_http_info( self, product_friendly_name: Annotated[ - ProductFriendlyName, - Field(..., description="the friendly name for the product"), + ProductFriendlyName, Field(description="the friendly name for the product") ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Set the friendly name # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Set the friendly name :param product_friendly_name: the friendly name for the product (required) :type product_friendly_name: ProductFriendlyName - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["product_friendly_name"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._set_product_friendly_name_serialize( + product_friendly_name=product_friendly_name, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method set_product_friendly_name" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} + @validate_call + async def set_product_friendly_name_without_preload_content( + self, + product_friendly_name: Annotated[ + ProductFriendlyName, Field(description="the friendly name for the product") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Set the friendly name - # process the path parameters - _path_params = {} + :param product_friendly_name: the friendly name for the product (required) + :type product_friendly_name: ProductFriendlyName + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_product_friendly_name_serialize( + product_friendly_name=product_friendly_name, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _set_product_friendly_name_serialize( + self, + product_friendly_name, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["product_friendly_name"] is not None: - _body_params = _params["product_friendly_name"] + if product_friendly_name is not None: + _body_params = product_friendly_name # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/product/info/friendlyname", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/api/v1/product/info/friendlyname", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/python_client/mozart_api/api/remote_api.py b/python_client/mozart_api/api/remote_api.py index 3dcdc06..e16c3c9 100644 --- a/python_client/mozart_api/api/remote_api.py +++ b/python_client/mozart_api/api/remote_api.py @@ -12,25 +12,20 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError -from typing import overload, Optional, Union, Awaitable - +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr - -from typing import Dict, Optional +from pydantic import Field, StrictStr +from typing import Optional +from typing_extensions import Annotated from mozart_api.models.remote_menu_item import RemoteMenuItem from mozart_api.models.remote_ui_key_state import RemoteUIKeyState -from mozart_api.api_client import ApiClient +from mozart_api.api_client import ApiClient, RequestSerialized from mozart_api.api_response import ApiResponse -from mozart_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 +from mozart_api.rest import RESTResponseType class RemoteApi: @@ -45,414 +40,752 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call async def get_remote_menu( self, descendants_to: Annotated[ Optional[StrictStr], Field(description="Get all descendants to this item") ] = None, - **kwargs - ) -> Dict[str, RemoteMenuItem]: # noqa: E501 - """Get all remote menu items # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Dict[str, RemoteMenuItem]: + """Get all remote menu items :param descendants_to: Get all descendants to this item :type descendants_to: str - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Dict[str, RemoteMenuItem] - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_remote_menu_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_remote_menu_with_http_info( - descendants_to, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_remote_menu_serialize( + descendants_to=descendants_to, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, RemoteMenuItem]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def get_remote_menu_with_http_info( self, descendants_to: Annotated[ Optional[StrictStr], Field(description="Get all descendants to this item") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get all remote menu items # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Dict[str, RemoteMenuItem]]: + """Get all remote menu items :param descendants_to: Get all descendants to this item :type descendants_to: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Dict[str, RemoteMenuItem], status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["descendants_to"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._get_remote_menu_serialize( + descendants_to=descendants_to, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_remote_menu" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, RemoteMenuItem]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} + @validate_call + async def get_remote_menu_without_preload_content( + self, + descendants_to: Annotated[ + Optional[StrictStr], Field(description="Get all descendants to this item") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get all remote menu items - # process the path parameters - _path_params = {} + :param descendants_to: Get all descendants to this item + :type descendants_to: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_remote_menu_serialize( + descendants_to=descendants_to, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, RemoteMenuItem]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_remote_menu_serialize( + self, + descendants_to, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] - if _params.get("descendants_to") is not None: # noqa: E501 - _query_params.append(("descendantsTo", _params["descendants_to"])) + if descendants_to is not None: + + _query_params.append(("descendantsTo", descendants_to)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "Dict[str, RemoteMenuItem]", - } - - return await self.api_client.call_api( - "/api/v1/remote", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/remote", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def post_remote_key_trigger( self, - id: Annotated[StrictStr, Field(..., description="Key identifier")], + id: Annotated[StrictStr, Field(description="Key identifier")], remote_ui_key_state: RemoteUIKeyState, - **kwargs - ) -> None: # noqa: E501 - """Remote input key press # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Remote input key press :param id: Key identifier (required) :type id: str :param remote_ui_key_state: (required) :type remote_ui_key_state: RemoteUIKeyState - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the post_remote_key_trigger_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.post_remote_key_trigger_with_http_info( - id, remote_ui_key_state, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._post_remote_key_trigger_serialize( + id=id, + remote_ui_key_state=remote_ui_key_state, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + "404": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def post_remote_key_trigger_with_http_info( self, - id: Annotated[StrictStr, Field(..., description="Key identifier")], + id: Annotated[StrictStr, Field(description="Key identifier")], remote_ui_key_state: RemoteUIKeyState, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Remote input key press # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Remote input key press :param id: Key identifier (required) :type id: str :param remote_ui_key_state: (required) :type remote_ui_key_state: RemoteUIKeyState - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["id", "remote_ui_key_state"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._post_remote_key_trigger_serialize( + id=id, + remote_ui_key_state=remote_ui_key_state, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method post_remote_key_trigger" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + "404": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} + @validate_call + async def post_remote_key_trigger_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Key identifier")], + remote_ui_key_state: RemoteUIKeyState, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Remote input key press - # process the path parameters - _path_params = {} - if _params["id"] is not None: - _path_params["id"] = _params["id"] + :param id: Key identifier (required) + :type id: str + :param remote_ui_key_state: (required) + :type remote_ui_key_state: RemoteUIKeyState + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_remote_key_trigger_serialize( + id=id, + remote_ui_key_state=remote_ui_key_state, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + "404": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _post_remote_key_trigger_serialize( + self, + id, + remote_ui_key_state, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params["id"] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["remote_ui_key_state"] is not None: - _body_params = _params["remote_ui_key_state"] + if remote_ui_key_state is not None: + _body_params = remote_ui_key_state # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/remote/key/{id}/trigger", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/remote/key/{id}/trigger", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def post_remote_trigger( self, - id: Annotated[StrictStr, Field(..., description="Remote menu item ID")], - **kwargs - ) -> None: # noqa: E501 - """Trigger a remote menu item # noqa: E501 + id: Annotated[StrictStr, Field(description="Remote menu item ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Trigger a remote menu item :param id: Remote menu item ID (required) :type id: str - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the post_remote_trigger_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.post_remote_trigger_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._post_remote_trigger_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "404": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def post_remote_trigger_with_http_info( self, - id: Annotated[StrictStr, Field(..., description="Remote menu item ID")], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Trigger a remote menu item # noqa: E501 + id: Annotated[StrictStr, Field(description="Remote menu item ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Trigger a remote menu item :param id: Remote menu item ID (required) :type id: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["id"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._post_remote_trigger_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method post_remote_trigger" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "404": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} + @validate_call + async def post_remote_trigger_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Remote menu item ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Trigger a remote menu item - # process the path parameters - _path_params = {} - if _params["id"] is not None: - _path_params["id"] = _params["id"] + :param id: Remote menu item ID (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_remote_trigger_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "404": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _post_remote_trigger_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params["id"] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/remote/{id}/trigger", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/remote/{id}/trigger", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/python_client/mozart_api/api/scenes_api.py b/python_client/mozart_api/api/scenes_api.py index d4007fc..d573086 100644 --- a/python_client/mozart_api/api/scenes_api.py +++ b/python_client/mozart_api/api/scenes_api.py @@ -12,26 +12,20 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError -from typing import overload, Optional, Union, Awaitable - +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr - -from typing import Dict +from pydantic import Field, StrictStr +from typing_extensions import Annotated from mozart_api.models.scene import Scene from mozart_api.models.scene_match import SceneMatch from mozart_api.models.scene_properties import SceneProperties -from mozart_api.api_client import ApiClient +from mozart_api.api_client import ApiClient, RequestSerialized from mozart_api.api_response import ApiResponse -from mozart_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 +from mozart_api.rest import RESTResponseType class ScenesApi: @@ -46,521 +40,964 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments - async def get_all_scenes(self, **kwargs) -> Dict[str, Scene]: # noqa: E501 - """Get a list of configured scenes # noqa: E501 + @validate_call + async def get_all_scenes( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Dict[str, Scene]: + """Get a list of configured scenes - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Dict[str, Scene] - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_all_scenes_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_all_scenes_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_all_scenes_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, Scene]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def get_all_scenes_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get a list of configured scenes # noqa: E501 - - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Dict[str, Scene]]: + """Get a list of configured scenes + + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Dict[str, Scene], status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_all_scenes" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 - # process the path parameters - _path_params = {} + _param = self._get_all_scenes_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, Scene]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def get_all_scenes_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a list of configured scenes + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_scenes_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, Scene]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_all_scenes_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "Dict[str, Scene]", - } - - return await self.api_client.call_api( - "/api/v1/scenes", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/scenes", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def post_scene_match_trigger( - self, scene_match: SceneMatch, **kwargs - ) -> None: # noqa: E501 - """Trigger the first scene with same non null objects provided in the SceneMatch object # noqa: E501 + self, + scene_match: SceneMatch, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Trigger the first scene with same non null objects provided in the SceneMatch object :param scene_match: (required) :type scene_match: SceneMatch - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the post_scene_match_trigger_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.post_scene_match_trigger_with_http_info( - scene_match, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._post_scene_match_trigger_serialize( + scene_match=scene_match, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + "404": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def post_scene_match_trigger_with_http_info( - self, scene_match: SceneMatch, **kwargs - ) -> ApiResponse: # noqa: E501 - """Trigger the first scene with same non null objects provided in the SceneMatch object # noqa: E501 + self, + scene_match: SceneMatch, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Trigger the first scene with same non null objects provided in the SceneMatch object :param scene_match: (required) :type scene_match: SceneMatch - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["scene_match"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method post_scene_match_trigger" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._post_scene_match_trigger_serialize( + scene_match=scene_match, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + "404": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def post_scene_match_trigger_without_preload_content( + self, + scene_match: SceneMatch, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Trigger the first scene with same non null objects provided in the SceneMatch object + + + :param scene_match: (required) + :type scene_match: SceneMatch + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_scene_match_trigger_serialize( + scene_match=scene_match, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + "404": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _post_scene_match_trigger_serialize( + self, + scene_match, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["scene_match"] is not None: - _body_params = _params["scene_match"] + if scene_match is not None: + _body_params = scene_match # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/scene/match-trigger", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/scene/match-trigger", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def post_scene_trigger( self, - id: Annotated[StrictStr, Field(..., description="ID of the scene")], - **kwargs - ) -> None: # noqa: E501 - """Trigger a specific scene # noqa: E501 + id: Annotated[StrictStr, Field(description="ID of the scene")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Trigger a specific scene :param id: ID of the scene (required) :type id: str - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the post_scene_trigger_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.post_scene_trigger_with_http_info(id, **kwargs) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._post_scene_trigger_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + "404": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def post_scene_trigger_with_http_info( self, - id: Annotated[StrictStr, Field(..., description="ID of the scene")], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Trigger a specific scene # noqa: E501 + id: Annotated[StrictStr, Field(description="ID of the scene")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Trigger a specific scene :param id: ID of the scene (required) :type id: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["id"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method post_scene_trigger" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._post_scene_trigger_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + "404": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def post_scene_trigger_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="ID of the scene")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Trigger a specific scene - # process the path parameters - _path_params = {} - if _params["id"] is not None: - _path_params["id"] = _params["id"] + :param id: ID of the scene (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_scene_trigger_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + "404": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _post_scene_trigger_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params["id"] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/scene/{id}/trigger", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/scene/{id}/trigger", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def run_provided_scene( self, scene_properties: Annotated[ - SceneProperties, Field(..., description="The scene you want to run") + SceneProperties, Field(description="The scene you want to run") ], - **kwargs - ) -> None: # noqa: E501 - """Run provided scene # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Run provided scene :param scene_properties: The scene you want to run (required) :type scene_properties: SceneProperties - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the run_provided_scene_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.run_provided_scene_with_http_info( - scene_properties, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._run_provided_scene_serialize( + scene_properties=scene_properties, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def run_provided_scene_with_http_info( self, scene_properties: Annotated[ - SceneProperties, Field(..., description="The scene you want to run") + SceneProperties, Field(description="The scene you want to run") ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Run provided scene # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Run provided scene :param scene_properties: The scene you want to run (required) :type scene_properties: SceneProperties - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["scene_properties"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method run_provided_scene" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._run_provided_scene_serialize( + scene_properties=scene_properties, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def run_provided_scene_without_preload_content( + self, + scene_properties: Annotated[ + SceneProperties, Field(description="The scene you want to run") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Run provided scene + + :param scene_properties: The scene you want to run (required) + :type scene_properties: SceneProperties + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._run_provided_scene_serialize( + scene_properties=scene_properties, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _run_provided_scene_serialize( + self, + scene_properties, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["scene_properties"] is not None: - _body_params = _params["scene_properties"] + if scene_properties is not None: + _body_params = scene_properties # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/scene/run", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/scene/run", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/python_client/mozart_api/api/settings_api.py b/python_client/mozart_api/api/settings_api.py index 9f2fa73..4cbfb86 100644 --- a/python_client/mozart_api/api/settings_api.py +++ b/python_client/mozart_api/api/settings_api.py @@ -12,26 +12,21 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError -from typing import overload, Optional, Union, Awaitable - +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field - -from typing import Dict +from pydantic import Field +from typing_extensions import Annotated +from mozart_api.models.home_control_ixp import HomeControlIxp from mozart_api.models.home_control_uri import HomeControlUri from mozart_api.models.paired_remote_response import PairedRemoteResponse from mozart_api.models.preset import Preset -from mozart_api.api_client import ApiClient +from mozart_api.api_client import ApiClient, RequestSerialized from mozart_api.api_response import ApiResponse -from mozart_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 +from mozart_api.rest import RESTResponseType class SettingsApi: @@ -46,505 +41,1184 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call async def get_bluetooth_remotes( - self, **kwargs - ) -> PairedRemoteResponse: # noqa: E501 - """Get a list of paired bluetooth remotes # noqa: E501 + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PairedRemoteResponse: + """Get a list of paired bluetooth remotes - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: PairedRemoteResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_bluetooth_remotes_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_bluetooth_remotes_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_bluetooth_remotes_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "PairedRemoteResponse", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def get_bluetooth_remotes_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get a list of paired bluetooth remotes # noqa: E501 - - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PairedRemoteResponse]: + """Get a list of paired bluetooth remotes + + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(PairedRemoteResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_bluetooth_remotes" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 - # process the path parameters - _path_params = {} + _param = self._get_bluetooth_remotes_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "PairedRemoteResponse", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def get_bluetooth_remotes_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a list of paired bluetooth remotes + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_bluetooth_remotes_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "PairedRemoteResponse", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_bluetooth_remotes_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "PairedRemoteResponse", - "400": "ErrorModel", - } - - return await self.api_client.call_api( - "/api/v1/setup/remotes", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/setup/remotes", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def get_presets(self, **kwargs) -> Dict[str, Preset]: # noqa: E501 - """Get the preset configuration # noqa: E501 + @validate_call + async def get_presets( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Dict[str, Preset]: + """Get the preset configuration - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Dict[str, Preset] - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_presets_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_presets_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def get_presets_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """Get the preset configuration # noqa: E501 - - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + """ # noqa: E501 + + _param = self._get_presets_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, Preset]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def get_presets_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Dict[str, Preset]]: + """Get the preset configuration + + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Dict[str, Preset], status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_presets" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 - # process the path parameters - _path_params = {} + _param = self._get_presets_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, Preset]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + @validate_call + async def get_presets_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the preset configuration + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_presets_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, Preset]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_presets_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "Dict[str, Preset]", - } - - return await self.api_client.call_api( - "/api/v1/setup/presets", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/setup/presets", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def get_remote_home_control_uri( - self, **kwargs - ) -> HomeControlUri: # noqa: E501 - """Get the HomeControl dashboard URI # noqa: E501 + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> HomeControlUri: + """Get HomeControl dashboard uri and (optional) Immersive Experience (IXP) start page - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: HomeControlUri - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_remote_home_control_uri_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_remote_home_control_uri_with_http_info( - **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_remote_home_control_uri_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "HomeControlUri", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def get_remote_home_control_uri_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get the HomeControl dashboard URI # noqa: E501 - - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[HomeControlUri]: + """Get HomeControl dashboard uri and (optional) Immersive Experience (IXP) start page + + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(HomeControlUri, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_remote_home_control_uri" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._get_remote_home_control_uri_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "HomeControlUri", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def get_remote_home_control_uri_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get HomeControl dashboard uri and (optional) Immersive Experience (IXP) start page - # process the path parameters - _path_params = {} + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_remote_home_control_uri_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "HomeControlUri", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_remote_home_control_uri_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/setup/remote/home-control-uri", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) - _response_types_map = { - "200": "HomeControlUri", + @validate_call + async def post_remote_home_control_ixp( + self, + home_control_ixp: Annotated[HomeControlIxp, Field(description="The new IXP")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Change any active Immersive Experience (IXP) + + + :param home_control_ixp: The new IXP (required) + :type home_control_ixp: HomeControlIxp + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_remote_home_control_ixp_serialize( + home_control_ixp=home_control_ixp, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": None, "400": "ErrorModel", } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - return await self.api_client.call_api( - "/api/v1/setup/remote/home-control-uri", - "GET", - _path_params, - _query_params, - _header_params, + @validate_call + async def post_remote_home_control_ixp_with_http_info( + self, + home_control_ixp: Annotated[HomeControlIxp, Field(description="The new IXP")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Change any active Immersive Experience (IXP) + + + :param home_control_ixp: The new IXP (required) + :type home_control_ixp: HomeControlIxp + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_remote_home_control_ixp_serialize( + home_control_ixp=home_control_ixp, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def post_remote_home_control_ixp_without_preload_content( + self, + home_control_ixp: Annotated[HomeControlIxp, Field(description="The new IXP")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Change any active Immersive Experience (IXP) + + + :param home_control_ixp: The new IXP (required) + :type home_control_ixp: HomeControlIxp + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_remote_home_control_ixp_serialize( + home_control_ixp=home_control_ixp, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _post_remote_home_control_ixp_serialize( + self, + home_control_ixp, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if home_control_ixp is not None: + _body_params = home_control_ixp + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/setup/remote/home-control-ixp", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def set_remote_home_control_uri( self, home_control_uri: Annotated[ - HomeControlUri, Field(..., description="the new HomeControl dashboard uri") + HomeControlUri, + Field( + description="The new uri for HomeControl dashboard and IXP start page" + ), ], - **kwargs - ) -> None: # noqa: E501 - """Set the HomeControl dashboard URI # noqa: E501 - - - :param home_control_uri: the new HomeControl dashboard uri (required) + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Set the uri for HomeControl dashboard and Immersive Experience (IXP) start page + + + :param home_control_uri: The new uri for HomeControl dashboard and IXP start page (required) :type home_control_uri: HomeControlUri - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the set_remote_home_control_uri_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.set_remote_home_control_uri_with_http_info( - home_control_uri, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._set_remote_home_control_uri_serialize( + home_control_uri=home_control_uri, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def set_remote_home_control_uri_with_http_info( self, home_control_uri: Annotated[ - HomeControlUri, Field(..., description="the new HomeControl dashboard uri") + HomeControlUri, + Field( + description="The new uri for HomeControl dashboard and IXP start page" + ), ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Set the HomeControl dashboard URI # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Set the uri for HomeControl dashboard and Immersive Experience (IXP) start page + + + :param home_control_uri: The new uri for HomeControl dashboard and IXP start page (required) + :type home_control_uri: HomeControlUri + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_remote_home_control_uri_serialize( + home_control_uri=home_control_uri, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + _response_types_map: Dict[str, Optional[str]] = { + "200": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - :param home_control_uri: the new HomeControl dashboard uri (required) + @validate_call + async def set_remote_home_control_uri_without_preload_content( + self, + home_control_uri: Annotated[ + HomeControlUri, + Field( + description="The new uri for HomeControl dashboard and IXP start page" + ), + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Set the uri for HomeControl dashboard and Immersive Experience (IXP) start page + + + :param home_control_uri: The new uri for HomeControl dashboard and IXP start page (required) :type home_control_uri: HomeControlUri - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["home_control_uri"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method set_remote_home_control_uri" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._set_remote_home_control_uri_serialize( + home_control_uri=home_control_uri, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} + _response_types_map: Dict[str, Optional[str]] = { + "200": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _set_remote_home_control_uri_serialize( + self, + home_control_uri, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["home_control_uri"] is not None: - _body_params = _params["home_control_uri"] + if home_control_uri is not None: + _body_params = home_control_uri # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/setup/remote/home-control-uri", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/api/v1/setup/remote/home-control-uri", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/python_client/mozart_api/api/software_update_api.py b/python_client/mozart_api/api/software_update_api.py index 2d20a8f..0db4b65 100644 --- a/python_client/mozart_api/api/software_update_api.py +++ b/python_client/mozart_api/api/software_update_api.py @@ -12,19 +12,16 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError -from typing import overload, Optional, Union, Awaitable +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from mozart_api.models.software_update_status import SoftwareUpdateStatus -from mozart_api.api_client import ApiClient +from mozart_api.api_client import ApiClient, RequestSerialized from mozart_api.api_response import ApiResponse -from mozart_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 +from mozart_api.rest import RESTResponseType class SoftwareUpdateApi: @@ -39,125 +36,226 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call async def get_softwareupdate_status( - self, **kwargs - ) -> SoftwareUpdateStatus: # noqa: E501 - """Get the current software update status # noqa: E501 + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SoftwareUpdateStatus: + """Get the current software update status - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: SoftwareUpdateStatus - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_softwareupdate_status_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_softwareupdate_status_with_http_info( - **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_softwareupdate_status_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "SoftwareUpdateStatus", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def get_softwareupdate_status_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get the current software update status # noqa: E501 - - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SoftwareUpdateStatus]: + """Get the current software update status + + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(SoftwareUpdateStatus, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._get_softwareupdate_status_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_softwareupdate_status" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "SoftwareUpdateStatus", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} + @validate_call + async def get_softwareupdate_status_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the current software update status - # process the path parameters - _path_params = {} + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_softwareupdate_status_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "SoftwareUpdateStatus", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_softwareupdate_status_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "SoftwareUpdateStatus", - "400": "ErrorModel", - } + _auth_settings: List[str] = [] - return await self.api_client.call_api( - "/api/v1/softwareupdate", - "GET", - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/softwareupdate", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/python_client/mozart_api/api/sound_api.py b/python_client/mozart_api/api/sound_api.py index d731b7c..46f6654 100644 --- a/python_client/mozart_api/api/sound_api.py +++ b/python_client/mozart_api/api/sound_api.py @@ -12,19 +12,13 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError -from typing import overload, Optional, Union, Awaitable - +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, conint - -from typing import Dict, List +from pydantic import Field +from typing_extensions import Annotated from mozart_api.models.bass import Bass from mozart_api.models.directivity import Directivity from mozart_api.models.listening_mode import ListeningMode @@ -37,9 +31,9 @@ from mozart_api.models.volume_settings import VolumeSettings from mozart_api.models.volume_state import VolumeState -from mozart_api.api_client import ApiClient +from mozart_api.api_client import ApiClient, RequestSerialized from mozart_api.api_response import ApiResponse -from mozart_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 +from mozart_api.rest import RESTResponseType class SoundApi: @@ -54,1699 +48,3103 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call async def activate_listening_mode( - self, id: conint(strict=True, ge=0), **kwargs - ) -> None: # noqa: E501 - """Activate a listening mode # noqa: E501 + self, + id: Annotated[int, Field(strict=True, ge=0)], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Activate a listening mode :param id: (required) :type id: int - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the activate_listening_mode_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.activate_listening_mode_with_http_info( - id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._activate_listening_mode_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def activate_listening_mode_with_http_info( - self, id: conint(strict=True, ge=0), **kwargs - ) -> ApiResponse: # noqa: E501 - """Activate a listening mode # noqa: E501 + self, + id: Annotated[int, Field(strict=True, ge=0)], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Activate a listening mode :param id: (required) :type id: int - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["id"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method activate_listening_mode" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._activate_listening_mode_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["id"] is not None: - _path_params["id"] = _params["id"] + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def activate_listening_mode_without_preload_content( + self, + id: Annotated[int, Field(strict=True, ge=0)], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Activate a listening mode + + :param id: (required) + :type id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._activate_listening_mode_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "404": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _activate_listening_mode_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params["id"] = id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - return await self.api_client.call_api( - "/api/v1/sound/listening-modes/{id}/activate", - "POST", - _path_params, - _query_params, - _header_params, + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/sound/listening-modes/{id}/activate", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def get_active_listening_mode( - self, **kwargs - ) -> ListeningModeRef: # noqa: E501 - """Get the active listening mode # noqa: E501 + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListeningModeRef: + """Get the active listening mode - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListeningModeRef - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_active_listening_mode_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_active_listening_mode_with_http_info( - **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_active_listening_mode_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListeningModeRef", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def get_active_listening_mode_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get the active listening mode # noqa: E501 - - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListeningModeRef]: + """Get the active listening mode + + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListeningModeRef, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_active_listening_mode" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._get_active_listening_mode_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListeningModeRef", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def get_active_listening_mode_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the active listening mode - # process the path parameters - _path_params = {} + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_active_listening_mode_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListeningModeRef", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_active_listening_mode_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "ListeningModeRef", - } - - return await self.api_client.call_api( - "/api/v1/sound/listening-modes/active", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/sound/listening-modes/active", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def get_current_volume(self, **kwargs) -> VolumeState: # noqa: E501 - """Get the current volume state # noqa: E501 + @validate_call + async def get_current_volume( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VolumeState: + """Get the current volume state - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: VolumeState - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_current_volume_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_current_volume_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_current_volume_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "VolumeState", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def get_current_volume_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get the current volume state # noqa: E501 - - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VolumeState]: + """Get the current volume state + + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(VolumeState, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_current_volume" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 - # process the path parameters - _path_params = {} + _param = self._get_current_volume_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "VolumeState", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def get_current_volume_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the current volume state + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_current_volume_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + _response_types_map: Dict[str, Optional[str]] = { + "200": "VolumeState", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_current_volume_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "VolumeState", - "400": "ErrorModel", - } - - return await self.api_client.call_api( - "/api/v1/sound/volume", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/sound/volume", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def get_listening_mode_set( - self, **kwargs - ) -> List[ListeningMode]: # noqa: E501 - """Get available listening modes that match the current role (standalone or multichannel). # noqa: E501 + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[ListeningMode]: + """Get available listening modes that match the current role (standalone, multichannel or both(all)). - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: List[ListeningMode] - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_listening_mode_set_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_listening_mode_set_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_listening_mode_set_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "List[ListeningMode]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def get_listening_mode_set_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get available listening modes that match the current role (standalone or multichannel). # noqa: E501 - - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[ListeningMode]]: + """Get available listening modes that match the current role (standalone, multichannel or both(all)). + + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(List[ListeningMode], status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_listening_mode_set" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 - # process the path parameters - _path_params = {} + _param = self._get_listening_mode_set_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "List[ListeningMode]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def get_listening_mode_set_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get available listening modes that match the current role (standalone, multichannel or both(all)). + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_listening_mode_set_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "List[ListeningMode]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_listening_mode_set_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "List[ListeningMode]", - } - - return await self.api_client.call_api( - "/api/v1/sound/listening-modes", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/sound/listening-modes", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def get_sound_features( - self, **kwargs - ) -> Dict[str, SoundFeatureSet]: # noqa: E501 - """Get available sound features that match the current role (standalone or multichannel). # noqa: E501 + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Dict[str, SoundFeatureSet]: + """Get available sound features that match the current role (standalone or multichannel). - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Dict[str, SoundFeatureSet] - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_sound_features_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_sound_features_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_sound_features_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, SoundFeatureSet]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def get_sound_features_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get available sound features that match the current role (standalone or multichannel). # noqa: E501 - - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Dict[str, SoundFeatureSet]]: + """Get available sound features that match the current role (standalone or multichannel). + + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Dict[str, SoundFeatureSet], status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_sound_features" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 - # process the path parameters - _path_params = {} + _param = self._get_sound_features_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, SoundFeatureSet]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def get_sound_features_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get available sound features that match the current role (standalone or multichannel). + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_sound_features_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Dict[str, SoundFeatureSet]", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_sound_features_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "Dict[str, SoundFeatureSet]", - } - - return await self.api_client.call_api( - "/api/v1/sound/features", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/sound/features", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - async def get_volume_settings(self, **kwargs) -> VolumeSettings: # noqa: E501 - """Get the current volume settings for default and maximum volume level # noqa: E501 + @validate_call + async def get_volume_settings( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VolumeSettings: + """Get the current volume settings for default and maximum volume level - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: VolumeSettings - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_volume_settings_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_volume_settings_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_volume_settings_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "VolumeSettings", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def get_volume_settings_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get the current volume settings for default and maximum volume level # noqa: E501 - - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VolumeSettings]: + """Get the current volume settings for default and maximum volume level + + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(VolumeSettings, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_volume_settings" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._get_volume_settings_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "VolumeSettings", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def get_volume_settings_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the current volume settings for default and maximum volume level - # process the path parameters - _path_params = {} + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_volume_settings_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "VolumeSettings", + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_volume_settings_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "VolumeSettings", - "400": "ErrorModel", - } - - return await self.api_client.call_api( - "/api/v1/sound/volume/settings", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/sound/volume/settings", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def set_current_volume_level( self, volume_level: Annotated[ - VolumeLevel, Field(..., description="The volume level to apply") + VolumeLevel, Field(description="The volume level to apply") ], - **kwargs - ) -> None: # noqa: E501 - """Set the current volume level # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Set the current volume level :param volume_level: The volume level to apply (required) :type volume_level: VolumeLevel - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the set_current_volume_level_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.set_current_volume_level_with_http_info( - volume_level, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._set_current_volume_level_serialize( + volume_level=volume_level, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def set_current_volume_level_with_http_info( self, volume_level: Annotated[ - VolumeLevel, Field(..., description="The volume level to apply") + VolumeLevel, Field(description="The volume level to apply") ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Set the current volume level # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Set the current volume level :param volume_level: The volume level to apply (required) :type volume_level: VolumeLevel - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["volume_level"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method set_current_volume_level" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._set_current_volume_level_serialize( + volume_level=volume_level, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def set_current_volume_level_without_preload_content( + self, + volume_level: Annotated[ + VolumeLevel, Field(description="The volume level to apply") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Set the current volume level - # process the path parameters - _path_params = {} + :param volume_level: The volume level to apply (required) + :type volume_level: VolumeLevel + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_current_volume_level_serialize( + volume_level=volume_level, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _set_current_volume_level_serialize( + self, + volume_level, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["volume_level"] is not None: - _body_params = _params["volume_level"] + if volume_level is not None: + _body_params = volume_level # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/sound/volume/level", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/api/v1/sound/volume/level", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def set_sound_settings_adjustments_bass( - self, bass: Annotated[Bass, Field(..., description="the bass level")], **kwargs - ) -> None: # noqa: E501 - """Update the sound settings adjustments for bass # noqa: E501 + self, + bass: Annotated[Bass, Field(description="the bass level")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Update the sound settings adjustments for bass :param bass: the bass level (required) :type bass: Bass - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the set_sound_settings_adjustments_bass_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.set_sound_settings_adjustments_bass_with_http_info( - bass, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._set_sound_settings_adjustments_bass_serialize( + bass=bass, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def set_sound_settings_adjustments_bass_with_http_info( - self, bass: Annotated[Bass, Field(..., description="the bass level")], **kwargs - ) -> ApiResponse: # noqa: E501 - """Update the sound settings adjustments for bass # noqa: E501 + self, + bass: Annotated[Bass, Field(description="the bass level")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Update the sound settings adjustments for bass + + + :param bass: the bass level (required) + :type bass: Bass + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_sound_settings_adjustments_bass_serialize( + bass=bass, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def set_sound_settings_adjustments_bass_without_preload_content( + self, + bass: Annotated[Bass, Field(description="the bass level")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the sound settings adjustments for bass :param bass: the bass level (required) :type bass: Bass - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["bass"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method set_sound_settings_adjustments_bass" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._set_sound_settings_adjustments_bass_serialize( + bass=bass, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - # process the path parameters - _path_params = {} + def _set_sound_settings_adjustments_bass_serialize( + self, + bass, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["bass"] is not None: - _body_params = _params["bass"] + if bass is not None: + _body_params = bass # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/sound/settings/adjustments/bass", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/api/v1/sound/settings/adjustments/bass", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def set_sound_settings_adjustments_directivity( self, - directivity: Annotated[Directivity, Field(..., description="the directivity")], - **kwargs - ) -> None: # noqa: E501 - """Update the sound settings adjustments for directivity # noqa: E501 + directivity: Annotated[Directivity, Field(description="the directivity")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Update the sound settings adjustments for directivity :param directivity: the directivity (required) :type directivity: Directivity - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the set_sound_settings_adjustments_directivity_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.set_sound_settings_adjustments_directivity_with_http_info( - directivity, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._set_sound_settings_adjustments_directivity_serialize( + directivity=directivity, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def set_sound_settings_adjustments_directivity_with_http_info( self, - directivity: Annotated[Directivity, Field(..., description="the directivity")], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Update the sound settings adjustments for directivity # noqa: E501 + directivity: Annotated[Directivity, Field(description="the directivity")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Update the sound settings adjustments for directivity :param directivity: the directivity (required) :type directivity: Directivity - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["directivity"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method set_sound_settings_adjustments_directivity" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._set_sound_settings_adjustments_directivity_serialize( + directivity=directivity, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def set_sound_settings_adjustments_directivity_without_preload_content( + self, + directivity: Annotated[Directivity, Field(description="the directivity")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the sound settings adjustments for directivity + + + :param directivity: the directivity (required) + :type directivity: Directivity + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_sound_settings_adjustments_directivity_serialize( + directivity=directivity, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _set_sound_settings_adjustments_directivity_serialize( + self, + directivity, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["directivity"] is not None: - _body_params = _params["directivity"] + if directivity is not None: + _body_params = directivity # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/sound/settings/adjustments/directivity", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/api/v1/sound/settings/adjustments/directivity", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def set_sound_settings_adjustments_loudness( self, - loudness: Annotated[Loudness, Field(..., description="the loudness mode")], - **kwargs - ) -> None: # noqa: E501 - """Update the sound settings adjustments for loudness # noqa: E501 + loudness: Annotated[Loudness, Field(description="the loudness mode")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Update the sound settings adjustments for loudness :param loudness: the loudness mode (required) :type loudness: Loudness - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the set_sound_settings_adjustments_loudness_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.set_sound_settings_adjustments_loudness_with_http_info( - loudness, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._set_sound_settings_adjustments_loudness_serialize( + loudness=loudness, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def set_sound_settings_adjustments_loudness_with_http_info( self, - loudness: Annotated[Loudness, Field(..., description="the loudness mode")], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Update the sound settings adjustments for loudness # noqa: E501 + loudness: Annotated[Loudness, Field(description="the loudness mode")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Update the sound settings adjustments for loudness :param loudness: the loudness mode (required) :type loudness: Loudness - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["loudness"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method set_sound_settings_adjustments_loudness" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._set_sound_settings_adjustments_loudness_serialize( + loudness=loudness, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def set_sound_settings_adjustments_loudness_without_preload_content( + self, + loudness: Annotated[Loudness, Field(description="the loudness mode")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the sound settings adjustments for loudness + + + :param loudness: the loudness mode (required) + :type loudness: Loudness + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_sound_settings_adjustments_loudness_serialize( + loudness=loudness, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _set_sound_settings_adjustments_loudness_serialize( + self, + loudness, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["loudness"] is not None: - _body_params = _params["loudness"] + if loudness is not None: + _body_params = loudness # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/sound/settings/adjustments/loudness", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/api/v1/sound/settings/adjustments/loudness", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def set_sound_settings_adjustments_treble( self, - treble: Annotated[Treble, Field(..., description="the treble level")], - **kwargs - ) -> None: # noqa: E501 - """Update the sound settings adjustments for treble # noqa: E501 + treble: Annotated[Treble, Field(description="the treble level")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Update the sound settings adjustments for treble :param treble: the treble level (required) :type treble: Treble - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the set_sound_settings_adjustments_treble_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.set_sound_settings_adjustments_treble_with_http_info( - treble, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._set_sound_settings_adjustments_treble_serialize( + treble=treble, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def set_sound_settings_adjustments_treble_with_http_info( self, - treble: Annotated[Treble, Field(..., description="the treble level")], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Update the sound settings adjustments for treble # noqa: E501 + treble: Annotated[Treble, Field(description="the treble level")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Update the sound settings adjustments for treble :param treble: the treble level (required) :type treble: Treble - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["treble"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method set_sound_settings_adjustments_treble" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._set_sound_settings_adjustments_treble_serialize( + treble=treble, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def set_sound_settings_adjustments_treble_without_preload_content( + self, + treble: Annotated[Treble, Field(description="the treble level")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the sound settings adjustments for treble + + + :param treble: the treble level (required) + :type treble: Treble + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_sound_settings_adjustments_treble_serialize( + treble=treble, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _set_sound_settings_adjustments_treble_serialize( + self, + treble, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["treble"] is not None: - _body_params = _params["treble"] + if treble is not None: + _body_params = treble # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/sound/settings/adjustments/treble", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/api/v1/sound/settings/adjustments/treble", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def set_volume_mute( self, volume_mute: Annotated[ - VolumeMute, Field(..., description="The mute state to apply") + VolumeMute, Field(description="The mute state to apply") ], - **kwargs - ) -> None: # noqa: E501 - """Set the volume mute state # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Set the volume mute state :param volume_mute: The mute state to apply (required) :type volume_mute: VolumeMute - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the set_volume_mute_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.set_volume_mute_with_http_info( - volume_mute, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._set_volume_mute_serialize( + volume_mute=volume_mute, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def set_volume_mute_with_http_info( self, volume_mute: Annotated[ - VolumeMute, Field(..., description="The mute state to apply") + VolumeMute, Field(description="The mute state to apply") ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Set the volume mute state # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Set the volume mute state :param volume_mute: The mute state to apply (required) :type volume_mute: VolumeMute - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["volume_mute"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method set_volume_mute" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._set_volume_mute_serialize( + volume_mute=volume_mute, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def set_volume_mute_without_preload_content( + self, + volume_mute: Annotated[ + VolumeMute, Field(description="The mute state to apply") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Set the volume mute state + + + :param volume_mute: The mute state to apply (required) + :type volume_mute: VolumeMute + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_volume_mute_serialize( + volume_mute=volume_mute, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": None, + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _set_volume_mute_serialize( + self, + volume_mute, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["volume_mute"] is not None: - _body_params = _params["volume_mute"] + if volume_mute is not None: + _body_params = volume_mute # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/sound/volume/mute", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/api/v1/sound/volume/mute", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call async def set_volume_settings( self, volume_settings: Annotated[ - VolumeSettings, Field(..., description="The settings to apply") + VolumeSettings, Field(description="The settings to apply") ], - **kwargs - ) -> None: # noqa: E501 - """Set the current volume settings for default and maximum volume level # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Set the current volume settings for default and maximum volume level :param volume_settings: The settings to apply (required) :type volume_settings: VolumeSettings - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the set_volume_settings_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.set_volume_settings_with_http_info( - volume_settings, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._set_volume_settings_serialize( + volume_settings=volume_settings, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def set_volume_settings_with_http_info( self, volume_settings: Annotated[ - VolumeSettings, Field(..., description="The settings to apply") + VolumeSettings, Field(description="The settings to apply") ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Set the current volume settings for default and maximum volume level # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Set the current volume settings for default and maximum volume level :param volume_settings: The settings to apply (required) :type volume_settings: VolumeSettings - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["volume_settings"] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method set_volume_settings" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._set_volume_settings_serialize( + volume_settings=volume_settings, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def set_volume_settings_without_preload_content( + self, + volume_settings: Annotated[ + VolumeSettings, Field(description="The settings to apply") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Set the current volume settings for default and maximum volume level + + + :param volume_settings: The settings to apply (required) + :type volume_settings: VolumeSettings + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_volume_settings_serialize( + volume_settings=volume_settings, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _set_volume_settings_serialize( + self, + volume_settings, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["volume_settings"] is not None: - _body_params = _params["volume_settings"] + if volume_settings is not None: + _body_params = volume_settings # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - "/api/v1/sound/volume/settings", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/api/v1/sound/volume/settings", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/python_client/mozart_api/api/speaker_group_api.py b/python_client/mozart_api/api/speaker_group_api.py index 3f82869..48c0f24 100644 --- a/python_client/mozart_api/api/speaker_group_api.py +++ b/python_client/mozart_api/api/speaker_group_api.py @@ -12,19 +12,16 @@ Do not edit the class manually. """ # noqa: E501 - -import re # noqa: F401 -import io import warnings - -from pydantic import validate_arguments, ValidationError -from typing import overload, Optional, Union, Awaitable +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from mozart_api.models.speaker_group_overview import SpeakerGroupOverview -from mozart_api.api_client import ApiClient +from mozart_api.api_client import ApiClient, RequestSerialized from mozart_api.api_response import ApiResponse -from mozart_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 +from mozart_api.rest import RESTResponseType class SpeakerGroupApi: @@ -39,122 +36,223 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call async def get_speakergroup_active( - self, **kwargs - ) -> SpeakerGroupOverview: # noqa: E501 - """Get the active speaker group # noqa: E501 + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SpeakerGroupOverview: + """Get the active speaker group - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: SpeakerGroupOverview - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_speakergroup_active_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_speakergroup_active_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_speakergroup_active_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "SpeakerGroupOverview", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call async def get_speakergroup_active_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """Get the active speaker group # noqa: E501 - - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SpeakerGroupOverview]: + """Get the active speaker group + + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(SpeakerGroupOverview, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._get_speakergroup_active_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_speakergroup_active" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "SpeakerGroupOverview", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} + @validate_call + async def get_speakergroup_active_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the active speaker group - # process the path parameters - _path_params = {} + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_speakergroup_active_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "SpeakerGroupOverview", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_speakergroup_active_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "SpeakerGroupOverview", - } + _auth_settings: List[str] = [] - return await self.api_client.call_api( - "/api/v1/sound/speakergroup/active", - "GET", - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/sound/speakergroup/active", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/python_client/mozart_api/api/stand_api.py b/python_client/mozart_api/api/stand_api.py new file mode 100644 index 0000000..6c1eb4a --- /dev/null +++ b/python_client/mozart_api/api/stand_api.py @@ -0,0 +1,315 @@ +# coding: utf-8 + +""" + Mozart platform API + + API for interacting with the Mozart platform. + + The version of the OpenAPI document: 0.2.0 + Contact: support@bang-olufsen.dk + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool +from typing import Optional +from typing_extensions import Annotated +from mozart_api.models.stand_movement import StandMovement + +from mozart_api.api_client import ApiClient, RequestSerialized +from mozart_api.api_response import ApiResponse +from mozart_api.rest import RESTResponseType + + +class StandApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + @validate_call + async def set_stand_movement( + self, + stand_movement: Annotated[StandMovement, Field(description="Stand Movement")], + slow_speed: Annotated[ + Optional[StrictBool], + Field(description="Use slow speed on continuous movement"), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Set stand movement with either an angle or a movement type + + + :param stand_movement: Stand Movement (required) + :type stand_movement: StandMovement + :param slow_speed: Use slow speed on continuous movement + :type slow_speed: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_stand_movement_serialize( + stand_movement=stand_movement, + slow_speed=slow_speed, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def set_stand_movement_with_http_info( + self, + stand_movement: Annotated[StandMovement, Field(description="Stand Movement")], + slow_speed: Annotated[ + Optional[StrictBool], + Field(description="Use slow speed on continuous movement"), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Set stand movement with either an angle or a movement type + + + :param stand_movement: Stand Movement (required) + :type stand_movement: StandMovement + :param slow_speed: Use slow speed on continuous movement + :type slow_speed: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_stand_movement_serialize( + stand_movement=stand_movement, + slow_speed=slow_speed, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def set_stand_movement_without_preload_content( + self, + stand_movement: Annotated[StandMovement, Field(description="Stand Movement")], + slow_speed: Annotated[ + Optional[StrictBool], + Field(description="Use slow speed on continuous movement"), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Set stand movement with either an angle or a movement type + + + :param stand_movement: Stand Movement (required) + :type stand_movement: StandMovement + :param slow_speed: Use slow speed on continuous movement + :type slow_speed: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_stand_movement_serialize( + stand_movement=stand_movement, + slow_speed=slow_speed, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "ErrorModel", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _set_stand_movement_serialize( + self, + stand_movement, + slow_speed, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if slow_speed is not None: + + _query_params.append(("slow-speed", slow_speed)) + + # process the header parameters + # process the form parameters + # process the body parameter + if stand_movement is not None: + _body_params = stand_movement + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/api/v1/stand/move", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) diff --git a/python_client/mozart_api/api_client.py b/python_client/mozart_api/api_client.py index 5d3774f..feca01e 100644 --- a/python_client/mozart_api/api_client.py +++ b/python_client/mozart_api/api_client.py @@ -13,9 +13,9 @@ """ # noqa: E501 -import atexit import datetime from dateutil.parser import parse +from enum import Enum import json import mimetypes import os @@ -23,12 +23,23 @@ import tempfile from urllib.parse import quote +from typing import Tuple, Optional, List, Dict from mozart_api.configuration import Configuration -from mozart_api.api_response import ApiResponse +from mozart_api.api_response import ApiResponse, T as ApiResponseT import mozart_api.models from mozart_api import rest -from mozart_api.exceptions import ApiValueError, ApiException +from mozart_api.exceptions import ( + ApiValueError, + ApiException, + BadRequestException, + UnauthorizedException, + ForbiddenException, + NotFoundException, + ServiceException, +) + +RequestSerialized = Tuple[str, str, Dict[str, str], Optional[str], List[str]] class ApiClient: @@ -74,7 +85,7 @@ def __init__( self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = "OpenAPI-Generator/3.2.1.150.6/python" + self.user_agent = "OpenAPI-Generator/3.4.1.8.2/python" self.client_side_validation = configuration.client_side_validation async def __aenter__(self): @@ -124,25 +135,43 @@ def set_default(cls, default): """ cls._default = default - async def __call_api( + def param_serialize( self, - resource_path, method, + resource_path, path_params=None, query_params=None, header_params=None, body=None, post_params=None, files=None, - response_types_map=None, auth_settings=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, - _request_timeout=None, _host=None, _request_auth=None, - ): + ) -> RequestSerialized: + """Builds the HTTP request params needed by the request. + :param method: Method to call. + :param resource_path: Path to method endpoint. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :return: tuple of form (path, http_method, query_params, header_params, + body, post_params, files) + """ + config = self.configuration # header parameters @@ -201,66 +230,100 @@ async def __call_api( url_query = self.parameters_to_url_query(query_params, collection_formats) url += "?" + url_query + return method, url, header_params, body, post_params + + async def call_api( + self, + method, + url, + header_params=None, + body=None, + post_params=None, + _request_timeout=None, + ) -> rest.RESTResponse: + """Makes the HTTP request (synchronous) + :param method: Method to call. + :param url: Path to method endpoint. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param _request_timeout: timeout setting for this request. + :return: RESTResponse + """ + try: # perform request and return response - response_data = await self.request( + response_data = await self.rest_client.request( method, url, - query_params=query_params, headers=header_params, - post_params=post_params, body=body, - _preload_content=_preload_content, + post_params=post_params, _request_timeout=_request_timeout, ) + except ApiException as e: - if e.body: - e.body = e.body.decode("utf-8") raise e - self.last_response = response_data - - return_data = None # assuming deserialization is not needed - # data needs deserialization or returns HTTP data (deserialized) only - if _preload_content or _return_http_data_only: - response_type = response_types_map.get(str(response_data.status), None) - if ( - not response_type - and isinstance(response_data.status, int) - and 100 <= response_data.status <= 599 - ): - # if not found, look for '1XX', '2XX', etc. - response_type = response_types_map.get( - str(response_data.status)[0] + "XX", None - ) + return response_data + + def response_deserialize( + self, + response_data: rest.RESTResponse, + response_types_map: Optional[Dict[str, ApiResponseT]] = None, + ) -> ApiResponse[ApiResponseT]: + """Deserializes response into an object. + :param response_data: RESTResponse object to be deserialized. + :param response_types_map: dict of response types. + :return: ApiResponse + """ + msg = "RESTResponse.read() must be called before passing it to response_deserialize()" + assert response_data.data is not None, msg + + response_type = response_types_map.get(str(response_data.status), None) + if ( + not response_type + and isinstance(response_data.status, int) + and 100 <= response_data.status <= 599 + ): + # if not found, look for '1XX', '2XX', etc. + response_type = response_types_map.get( + str(response_data.status)[0] + "XX", None + ) + + # deserialize response data + response_text = None + return_data = None + try: if response_type == "bytearray": - response_data.data = response_data.data - else: + return_data = response_data.data + elif response_type == "file": + return_data = self.__deserialize_file(response_data) + elif response_type is not None: match = None content_type = response_data.getheader("content-type") if content_type is not None: match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) encoding = match.group(1) if match else "utf-8" - response_data.data = response_data.data.decode(encoding) - - # deserialize response data - if response_type == "bytearray": - return_data = response_data.data - elif response_type: - return_data = self.deserialize(response_data, response_type) - else: - return_data = None + response_text = response_data.data.decode(encoding) + return_data = self.deserialize(response_text, response_type) + finally: + if not 200 <= response_data.status <= 299: + raise ApiException.from_response( + http_resp=response_data, + body=response_text, + data=return_data, + ) - if _return_http_data_only: - return return_data - else: - return ApiResponse( - status_code=response_data.status, - data=return_data, - headers=response_data.getheaders(), - raw_data=response_data.data, - ) + return ApiResponse( + status_code=response_data.status, + data=return_data, + headers=response_data.getheaders(), + raw_data=response_data.data, + ) def sanitize_for_serialization(self, obj): """Builds a JSON POST object. @@ -287,7 +350,7 @@ def sanitize_for_serialization(self, obj): elif isinstance(obj, (datetime.datetime, datetime.date)): return obj.isoformat() - if isinstance(obj, dict): + elif isinstance(obj, dict): obj_dict = obj else: # Convert model obj to dict except @@ -301,7 +364,7 @@ def sanitize_for_serialization(self, obj): key: self.sanitize_for_serialization(val) for key, val in obj_dict.items() } - def deserialize(self, response, response_type): + def deserialize(self, response_text, response_type): """Deserializes response into an object. :param response: RESTResponse object to be deserialized. @@ -310,16 +373,12 @@ def deserialize(self, response, response_type): :return: deserialized object. """ - # handle file downloading - # save response body into a tmp file and return the instance - if response_type == "file": - return self.__deserialize_file(response) # fetch data from response object try: - data = json.loads(response.data) + data = json.loads(response_text) except ValueError: - data = response.data + data = response_text return self.__deserialize(data, response_type) @@ -336,11 +395,15 @@ def __deserialize(self, data, klass): if isinstance(klass, str): if klass.startswith("List["): - sub_kls = re.match(r"List\[(.*)]", klass).group(1) + m = re.match(r"List\[(.*)]", klass) + assert m is not None, "Malformed List type definition" + sub_kls = m.group(1) return [self.__deserialize(sub_data, sub_kls) for sub_data in data] if klass.startswith("Dict["): - sub_kls = re.match(r"Dict\[([^,]*), (.*)]", klass).group(2) + m = re.match(r"Dict\[([^,]*), (.*)]", klass) + assert m is not None, "Malformed Dict type definition" + sub_kls = m.group(2) return {k: self.__deserialize(v, sub_kls) for k, v in data.items()} # convert str to class @@ -357,163 +420,11 @@ def __deserialize(self, data, klass): return self.__deserialize_date(data) elif klass == datetime.datetime: return self.__deserialize_datetime(data) + elif issubclass(klass, Enum): + return self.__deserialize_enum(data, klass) else: return self.__deserialize_model(data, klass) - async def call_api( - self, - resource_path, - method, - path_params=None, - query_params=None, - header_params=None, - body=None, - post_params=None, - files=None, - response_types_map=None, - auth_settings=None, - _return_http_data_only=None, - collection_formats=None, - _preload_content=True, - _request_timeout=None, - _host=None, - _request_auth=None, - ): - """Makes the HTTP request (synchronous) and returns deserialized data. - - :param resource_path: Path to method endpoint. - :param method: Method to call. - :param path_params: Path parameters in the url. - :param query_params: Query parameters in the url. - :param header_params: Header parameters to be - placed in the request header. - :param body: Request body. - :param post_params dict: Request post form parameters, - for `application/x-www-form-urlencoded`, `multipart/form-data`. - :param auth_settings list: Auth Settings names for the request. - :param response: Response data type. - :param files dict: key -> filename, value -> filepath, - for `multipart/form-data`. - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :param collection_formats: dict of collection formats for path, query, - header, and post parameters. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_token: dict, optional - :return: - The response. - """ - args = ( - resource_path, - method, - path_params, - query_params, - header_params, - body, - post_params, - files, - response_types_map, - auth_settings, - _return_http_data_only, - collection_formats, - _preload_content, - _request_timeout, - _host, - _request_auth, - ) - return await self.__call_api(*args) - - async def request( - self, - method, - url, - query_params=None, - headers=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - """Makes the HTTP request using RESTClient.""" - if method == "GET": - return await self.rest_client.get_request( - url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers, - ) - elif method == "HEAD": - return await self.rest_client.head_request( - url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers, - ) - elif method == "OPTIONS": - return await self.rest_client.options_request( - url, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - ) - elif method == "POST": - return await self.rest_client.post_request( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - elif method == "PUT": - return await self.rest_client.put_request( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - elif method == "PATCH": - return await self.rest_client.patch_request( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - elif method == "DELETE": - return await self.rest_client.delete_request( - url, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - else: - raise ApiValueError( - "http method must be `GET`, `HEAD`, `OPTIONS`," - " `POST`, `PATCH`, `PUT` or `DELETE`." - ) - def parameters_to_tuples(self, params, collection_formats): """Get parameters as list of tuples, formatting collections. @@ -521,12 +432,10 @@ def parameters_to_tuples(self, params, collection_formats): :param dict collection_formats: Parameter collection formats :return: Parameters as list of tuples, collections formatted """ - new_params = [] + new_params: List[Tuple[str, str]] = [] if collection_formats is None: collection_formats = {} - for k, v in ( - params.items() if isinstance(params, dict) else params - ): # noqa: E501 + for k, v in params.items() if isinstance(params, dict) else params: if k in collection_formats: collection_format = collection_formats[k] if collection_format == "multi": @@ -552,12 +461,10 @@ def parameters_to_url_query(self, params, collection_formats): :param dict collection_formats: Parameter collection formats :return: URL query string (e.g. a=Hello%20World&b=123) """ - new_params = [] + new_params: List[Tuple[str, str]] = [] if collection_formats is None: collection_formats = {} - for k, v in ( - params.items() if isinstance(params, dict) else params - ): # noqa: E501 + for k, v in params.items() if isinstance(params, dict) else params: if isinstance(v, bool): v = str(v).lower() if isinstance(v, (int, float)): @@ -568,7 +475,7 @@ def parameters_to_url_query(self, params, collection_formats): if k in collection_formats: collection_format = collection_formats[k] if collection_format == "multi": - new_params.extend((k, value) for value in v) + new_params.extend((k, str(value)) for value in v) else: if collection_format == "ssv": delimiter = " " @@ -584,7 +491,7 @@ def parameters_to_url_query(self, params, collection_formats): else: new_params.append((k, quote(str(v)))) - return "&".join(["=".join(item) for item in new_params]) + return "&".join(["=".join(map(str, item)) for item in new_params]) def files_parameters(self, files=None): """Builds form parameters. @@ -611,14 +518,14 @@ def files_parameters(self, files=None): return params - def select_header_accept(self, accepts): + def select_header_accept(self, accepts: List[str]) -> Optional[str]: """Returns `Accept` based on an array of accepts provided. :param accepts: List of headers. :return: Accept (e.g. application/json). """ if not accepts: - return + return None for accept in accepts: if re.search("json", accept, re.IGNORECASE): @@ -650,7 +557,7 @@ def update_params_for_auth( method, body, request_auth=None, - ): + ) -> None: """Updates header and query params based on authentication setting. :param headers: Header parameters dict to be updated. @@ -670,18 +577,17 @@ def update_params_for_auth( self._apply_auth_params( headers, queries, resource_path, method, body, request_auth ) - return - - for auth in auth_settings: - auth_setting = self.configuration.auth_settings().get(auth) - if auth_setting: - self._apply_auth_params( - headers, queries, resource_path, method, body, auth_setting - ) + else: + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + self._apply_auth_params( + headers, queries, resource_path, method, body, auth_setting + ) def _apply_auth_params( self, headers, queries, resource_path, method, body, auth_setting - ): + ) -> None: """Updates the request parameters based on a single auth_setting :param headers: Header parameters dict to be updated. @@ -708,6 +614,9 @@ def __deserialize_file(self, response): Saves response body into a file in a temporary folder, using the filename from the `Content-Disposition` header if provided. + handle file downloading + save response body into a tmp file and return the instance + :param response: RESTResponse. :return: file path. """ @@ -717,9 +626,9 @@ def __deserialize_file(self, response): content_disposition = response.getheader("Content-Disposition") if content_disposition: - filename = re.search( - r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition - ).group(1) + m = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition) + assert m is not None, "Unexpected 'content-disposition' header value" + filename = m.group(1) path = os.path.join(os.path.dirname(path), filename) with open(path, "wb") as f: @@ -782,6 +691,20 @@ def __deserialize_datetime(self, string): reason=("Failed to parse `{0}` as datetime object".format(string)), ) + def __deserialize_enum(self, data, klass): + """Deserializes primitive type to enum. + + :param data: primitive type. + :param klass: class literal. + :return: enum value. + """ + try: + return klass(data) + except ValueError: + raise rest.ApiException( + status=0, reason=("Failed to parse `{0}` as `{1}`".format(data, klass)) + ) + def __deserialize_model(self, data, klass): """Deserializes list or dict to model. diff --git a/python_client/mozart_api/api_response.py b/python_client/mozart_api/api_response.py index bb7e400..1ce1372 100644 --- a/python_client/mozart_api/api_response.py +++ b/python_client/mozart_api/api_response.py @@ -1,28 +1,20 @@ """API response object.""" from __future__ import annotations -from typing import Any, Dict, Optional -from pydantic import Field, StrictInt, StrictStr +from typing import Optional, Generic, Mapping, TypeVar +from pydantic import Field, StrictInt, StrictBytes, BaseModel +T = TypeVar("T") -class ApiResponse: + +class ApiResponse(BaseModel, Generic[T]): """ API response object """ - status_code: Optional[StrictInt] = Field(None, description="HTTP status code") - headers: Optional[Dict[StrictStr, StrictStr]] = Field( - None, description="HTTP headers" - ) - data: Optional[Any] = Field( - None, description="Deserialized data given the data type" - ) - raw_data: Optional[Any] = Field(None, description="Raw data (HTTP response body)") + status_code: StrictInt = Field(description="HTTP status code") + headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers") + data: T = Field(description="Deserialized data given the data type") + raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") - def __init__( - self, status_code=None, headers=None, data=None, raw_data=None - ) -> None: - self.status_code = status_code - self.headers = headers - self.data = data - self.raw_data = raw_data + model_config = {"arbitrary_types_allowed": True} diff --git a/python_client/mozart_api/configuration.py b/python_client/mozart_api/configuration.py index 7c9f837..b5980e3 100644 --- a/python_client/mozart_api/configuration.py +++ b/python_client/mozart_api/configuration.py @@ -15,7 +15,9 @@ import copy import logging +from logging import FileHandler import sys +from typing import Optional import urllib3 import http.client as httplib @@ -128,7 +130,7 @@ def __init__( self.logger_stream_handler = None """Log stream handler """ - self.logger_file_handler = None + self.logger_file_handler: Optional[FileHandler] = None """Log file handler """ self.logger_file = None @@ -165,7 +167,7 @@ def __init__( Default values is 100, None means no-limit. """ - self.proxy = None + self.proxy: Optional[str] = None """Proxy URL """ self.proxy_headers = None @@ -381,7 +383,7 @@ def to_debug_report(self): "OS: {env}\n" "Python Version: {pyversion}\n" "Version of the API: 0.2.0\n" - "SDK Package Version: 3.2.1.150.6".format( + "SDK Package Version: 3.4.1.8.2".format( env=sys.platform, pyversion=sys.version ) ) diff --git a/python_client/mozart_api/exceptions.py b/python_client/mozart_api/exceptions.py index 264ee63..641b207 100644 --- a/python_client/mozart_api/exceptions.py +++ b/python_client/mozart_api/exceptions.py @@ -12,6 +12,9 @@ Do not edit the class manually. """ # noqa: E501 +from typing import Any, Optional +from typing_extensions import Self + class OpenApiException(Exception): """The base exception class for all OpenAPIExceptions""" @@ -102,17 +105,57 @@ def __init__(self, msg, path_to_item=None) -> None: class ApiException(OpenApiException): - def __init__(self, status=None, reason=None, http_resp=None) -> None: + + def __init__( + self, + status=None, + reason=None, + http_resp=None, + *, + body: Optional[str] = None, + data: Optional[Any] = None, + ) -> None: + self.status = status + self.reason = reason + self.body = body + self.data = data + self.headers = None + if http_resp: - self.status = http_resp.status - self.reason = http_resp.reason - self.body = http_resp.data + if self.status is None: + self.status = http_resp.status + if self.reason is None: + self.reason = http_resp.reason + if self.body is None: + try: + self.body = http_resp.data.decode("utf-8") + except Exception: + pass self.headers = http_resp.getheaders() - else: - self.status = status - self.reason = reason - self.body = None - self.headers = None + + @classmethod + def from_response( + cls, + *, + http_resp, + body: Optional[str], + data: Optional[Any], + ) -> Self: + if http_resp.status == 400: + raise BadRequestException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 401: + raise UnauthorizedException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 403: + raise ForbiddenException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 404: + raise NotFoundException(http_resp=http_resp, body=body, data=data) + + if 500 <= http_resp.status <= 599: + raise ServiceException(http_resp=http_resp, body=body, data=data) + raise ApiException(http_resp=http_resp, body=body, data=data) def __str__(self): """Custom error messages for exception""" @@ -120,35 +163,30 @@ def __str__(self): if self.headers: error_message += "HTTP response headers: {0}\n".format(self.headers) - if self.body: - error_message += "HTTP response body: {0}\n".format(self.body) + if self.data or self.body: + error_message += "HTTP response body: {0}\n".format(self.data or self.body) return error_message class BadRequestException(ApiException): - def __init__(self, status=None, reason=None, http_resp=None) -> None: - super(BadRequestException, self).__init__(status, reason, http_resp) + pass class NotFoundException(ApiException): - def __init__(self, status=None, reason=None, http_resp=None) -> None: - super(NotFoundException, self).__init__(status, reason, http_resp) + pass class UnauthorizedException(ApiException): - def __init__(self, status=None, reason=None, http_resp=None) -> None: - super(UnauthorizedException, self).__init__(status, reason, http_resp) + pass class ForbiddenException(ApiException): - def __init__(self, status=None, reason=None, http_resp=None) -> None: - super(ForbiddenException, self).__init__(status, reason, http_resp) + pass class ServiceException(ApiException): - def __init__(self, status=None, reason=None, http_resp=None) -> None: - super(ServiceException, self).__init__(status, reason, http_resp) + pass def render_path(path_to_item): diff --git a/python_client/mozart_api/models/__init__.py b/python_client/mozart_api/models/__init__.py index 231e3ad..e5a7a61 100644 --- a/python_client/mozart_api/models/__init__.py +++ b/python_client/mozart_api/models/__init__.py @@ -35,7 +35,6 @@ from mozart_api.models.beo_remote_button import BeoRemoteButton from mozart_api.models.beolink_available_listener import BeolinkAvailableListener from mozart_api.models.beolink_experience import BeolinkExperience -from mozart_api.models.beolink_experiences_request import BeolinkExperiencesRequest from mozart_api.models.beolink_experiences_result import BeolinkExperiencesResult from mozart_api.models.beolink_join_request import BeolinkJoinRequest from mozart_api.models.beolink_join_result import BeolinkJoinResult @@ -58,6 +57,7 @@ from mozart_api.models.fader_range import FaderRange from mozart_api.models.hdmi_input import HdmiInput from mozart_api.models.hdmi_video_format import HdmiVideoFormat +from mozart_api.models.home_control_ixp import HomeControlIxp from mozart_api.models.home_control_uri import HomeControlUri from mozart_api.models.install_record_id_state import InstallRecordIdState from mozart_api.models.latency_profile import LatencyProfile @@ -157,11 +157,14 @@ from mozart_api.models.speaker_group_member import SpeakerGroupMember from mozart_api.models.speaker_group_member_location import SpeakerGroupMemberLocation from mozart_api.models.speaker_group_overview import SpeakerGroupOverview +from mozart_api.models.speaker_link_member_status import SpeakerLinkMemberStatus +from mozart_api.models.speaker_link_status import SpeakerLinkStatus from mozart_api.models.speaker_role_enum import SpeakerRoleEnum from mozart_api.models.speech_enhance import SpeechEnhance from mozart_api.models.speech_enhance_feature import SpeechEnhanceFeature from mozart_api.models.speech_enhance_range import SpeechEnhanceRange from mozart_api.models.stand_connected import StandConnected +from mozart_api.models.stand_movement import StandMovement from mozart_api.models.stand_position import StandPosition from mozart_api.models.tone_touch import ToneTouch from mozart_api.models.tone_touch_type import ToneTouchType @@ -249,6 +252,9 @@ from mozart_api.models.web_socket_event_speaker_group_changed import ( WebSocketEventSpeakerGroupChanged, ) +from mozart_api.models.web_socket_event_speaker_link_status_changed import ( + WebSocketEventSpeakerLinkStatusChanged, +) from mozart_api.models.web_socket_event_stand_connected import ( WebSocketEventStandConnected, ) diff --git a/python_client/mozart_api/models/action.py b/python_client/mozart_api/models/action.py index ceeb947..22c506d 100644 --- a/python_client/mozart_api/models/action.py +++ b/python_client/mozart_api/models/action.py @@ -18,69 +18,84 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr, conint, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing_extensions import Annotated from mozart_api.models.play_queue_item import PlayQueueItem from mozart_api.models.play_queue_settings import PlayQueueSettings from mozart_api.models.source_type_enum import SourceTypeEnum from mozart_api.models.stand_position import StandPosition +from typing import Optional, Set +from typing_extensions import Self class Action(BaseModel): """ - An action object. Examples: RadioAction: ```json { \"type\": \"radio\", \"radioStationId\": \"8779112938791514\" } ``` ToneAction: ```json { \"type\": \"tone\", \"toneName\": \"alarm_2\" } ``` SourcePresetAction: ```json { \"type\": \"sourcePreset\", \"source\": { \"value\": \"spotify\" }, \"presetKey\": \"Preset3\" } ``` DeezerFlowAction: ```json { \"type\": \"deezerFlow\", \"deezerUserId\": \"1234\" } ``` ActivateSourceAction: ```json { \"type\": \"activateSource\", \"source\": { \"value\": \"spotify\" } } ``` PlayQueueAction: ``` { \"type\": \"playQueue\", \"queueItem\": { \"provider\": { \"value\": \"deezer\" }, \"startNowFromPosition\": 0, \"type\": \"playlist\", \"uri\": \"playlist:8074581462\" }, \"queueSettings\": { \"consume\": false, \"repeat\": \"none\", \"shuffle\": false } } ``` StandbyAction: ```json { \"type\": \"standby\" } ``` AllStandbyAction: ```json { \"type\": \"allStandby\" } ``` TouchToJoinAction: ```json { \"type\": \"touchToJoin\" } ``` ButtonShortPressAction: ```json { \"type\": \"buttonShortPress\", \"buttonName\": \"preset1\" } ``` FallbackAction: ```json { \"type\": \"fallback\" } ``` VolumeAction: ```json { \"type\": \"volume\", \"volumeLevel\": 25 } ``` StopAction: ```json { \"type\": \"stop\", \"stopDuration\": 1300 } ``` TriggerContentAction: ```json { \"contentId\": \"tv://netflix\", \"type\": \"triggerContent\" } ``` SpeakerGroupAction: ```json { \"type\": \"speakerGroup\", \"speakerGroupId\": \"00112233-4455-6677-8899-aabbccddeeff\" } ``` ListeningModeAction: ```json { \"type\": \"listeningMode\", \"listeningModeId\": 1234 } ``` StandAction: ```json { \"type\": \"stand\", \"standPosition\": { \"angle\": 7.5 } } ``` # noqa: E501 - """ + An action object. Examples: RadioAction: ```json { \"type\": \"radio\", \"radioStationId\": \"8779112938791514\" } ``` ToneAction: ```json { \"type\": \"tone\", \"toneName\": \"alarm_2\" } ``` SourcePresetAction: ```json { \"type\": \"sourcePreset\", \"source\": { \"value\": \"spotify\" }, \"presetKey\": \"Preset3\" } ``` DeezerFlowAction: ```json { \"type\": \"deezerFlow\", \"deezerUserId\": \"1234\" } ``` ActivateSourceAction: ```json { \"type\": \"activateSource\", \"source\": { \"value\": \"spotify\" } } ``` PlayQueueAction: ``` { \"type\": \"playQueue\", \"queueItem\": { \"provider\": { \"value\": \"deezer\" }, \"startNowFromPosition\": 0, \"type\": \"playlist\", \"uri\": \"playlist:8074581462\" }, \"queueSettings\": { \"consume\": false, \"repeat\": \"none\", \"shuffle\": false } } ``` StandbyAction: ```json { \"type\": \"standby\" } ``` AllStandbyAction: ```json { \"type\": \"allStandby\" } ``` TouchToJoinAction: ```json { \"type\": \"touchToJoin\" } ``` ButtonShortPressAction: ```json { \"type\": \"buttonShortPress\", \"buttonName\": \"preset1\" } ``` FallbackAction: ```json { \"type\": \"fallback\" } ``` VolumeAction: ```json { \"type\": \"volume\", \"volumeLevel\": 25 } ``` StopAction: ```json { \"type\": \"stop\", \"stopDuration\": 1300 } ``` TriggerContentAction: ```json { \"contentId\": \"tv://netflix\", \"type\": \"triggerContent\" } ``` SpeakerGroupAction: ```json { \"type\": \"speakerGroup\", \"speakerGroupId\": \"00112233-4455-6677-8899-aabbccddeeff\" } ``` ListeningModeAction: ```json { \"type\": \"listeningMode\", \"listeningModeId\": 1234 } ``` StandAction: ```json { \"type\": \"stand\", \"standPosition\": { \"angle\": 7.5 } } ``` GainAction: ```json { \"type\": \"sourceGain\", \"source\": { \"value\": \"spotify\" }, \"gainDb\": 1.0 } ``` + """ # noqa: E501 button_name: Optional[StrictStr] = Field( - None, - alias="buttonName", + default=None, description="Name of the Button used for button-press types ('buttonShortPress')", + alias="buttonName", ) content_id: Optional[StrictStr] = Field( - None, - alias="contentId", + default=None, description="Id of content only used for 'type=triggerContent'", + alias="contentId", ) deezer_user_id: Optional[StrictStr] = Field( - None, - alias="deezerUserId", + default=None, description="Id of user only used for 'type=deezerFlow' and is optional", + alias="deezerUserId", + ) + gain_db: Optional[ + Union[ + Annotated[float, Field(le=12, strict=True, ge=-12)], + Annotated[int, Field(le=12, strict=True, ge=-12)], + ] + ] = Field( + default=None, description="Only usef for 'type=sourceGain'", alias="gainDb" ) - listening_mode_id: Optional[conint(strict=True, ge=0)] = Field( - None, alias="listeningModeId" + listening_mode_id: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field( + default=None, alias="listeningModeId" ) preset_key: Optional[StrictStr] = Field( - None, alias="presetKey", description="Only used for 'type=sourcePreset'" + default=None, description="Only used for 'type=sourcePreset'", alias="presetKey" + ) + queue_item: Optional[PlayQueueItem] = Field(default=None, alias="queueItem") + queue_settings: Optional[PlayQueueSettings] = Field( + default=None, alias="queueSettings" ) - queue_item: Optional[PlayQueueItem] = Field(None, alias="queueItem") - queue_settings: Optional[PlayQueueSettings] = Field(None, alias="queueSettings") radio_station_id: Optional[StrictStr] = Field( - None, - alias="radioStationId", + default=None, description="Id of RadioStation only used for 'type=radio'", + alias="radioStationId", ) source: Optional[SourceTypeEnum] = None - speaker_group_id: Optional[StrictStr] = Field(None, alias="speakerGroupId") - stand_position: Optional[StandPosition] = Field(None, alias="standPosition") - stop_duration: Optional[conint(strict=True, ge=0)] = Field( - None, - alias="stopDuration", + speaker_group_id: Optional[StrictStr] = Field(default=None, alias="speakerGroupId") + stand_position: Optional[StandPosition] = Field(default=None, alias="standPosition") + stop_duration: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field( + default=None, description="The duration to wait (seconds) until stopping only used for 'type=stop'", + alias="stopDuration", ) tone_name: Optional[StrictStr] = Field( - None, alias="toneName", description="Name of the tone only used for 'type=tone'" + default=None, + description="Name of the tone only used for 'type=tone'", + alias="toneName", ) - type: StrictStr = Field(..., description="The type of Action") - volume_level: Optional[conint(strict=True, le=100, ge=0)] = Field( - None, - alias="volumeLevel", + type: StrictStr = Field(description="The type of Action") + volume_level: Optional[Annotated[int, Field(le=100, strict=True, ge=0)]] = Field( + default=None, description="The volume level to configure only used for 'type=volume'", + alias="volumeLevel", ) - __properties = [ + __properties: ClassVar[List[str]] = [ "buttonName", "contentId", "deezerUserId", + "gainDb", "listeningModeId", "presetKey", "queueItem", @@ -95,77 +110,95 @@ class Action(BaseModel): "volumeLevel", ] - @validator("button_name") + @field_validator("button_name") def button_name_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("preset1", "preset2", "preset3", "preset4"): + if value not in set(["preset1", "preset2", "preset3", "preset4"]): raise ValueError( "must be one of enum values ('preset1', 'preset2', 'preset3', 'preset4')" ) return value - @validator("tone_name") + @field_validator("tone_name") def tone_name_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("alarm_1", "alarm_2"): + if value not in set(["alarm_1", "alarm_2"]): raise ValueError("must be one of enum values ('alarm_1', 'alarm_2')") return value - @validator("type") + @field_validator("type") def type_validate_enum(cls, value): """Validates the enum""" - if value not in ( - "standby", - "tone", - "radio", - "sourcePreset", - "deezerFlow", - "activateSource", - "playQueue", - "buttonShortPress", - "allStandby", - "touchToJoin", - "fallback", - "volume", - "stop", - "triggerContent", - "speakerGroup", - "listeningMode", - "stand", + if value not in set( + [ + "standby", + "tone", + "radio", + "sourcePreset", + "deezerFlow", + "activateSource", + "playQueue", + "buttonShortPress", + "allStandby", + "touchToJoin", + "fallback", + "volume", + "stop", + "triggerContent", + "speakerGroup", + "listeningMode", + "stand", + "sourceGain", + ] ): raise ValueError( - "must be one of enum values ('standby', 'tone', 'radio', 'sourcePreset', 'deezerFlow', 'activateSource', 'playQueue', 'buttonShortPress', 'allStandby', 'touchToJoin', 'fallback', 'volume', 'stop', 'triggerContent', 'speakerGroup', 'listeningMode', 'stand')" + "must be one of enum values ('standby', 'tone', 'radio', 'sourcePreset', 'deezerFlow', 'activateSource', 'playQueue', 'buttonShortPress', 'allStandby', 'touchToJoin', 'fallback', 'volume', 'stop', 'triggerContent', 'speakerGroup', 'listeningMode', 'stand', 'sourceGain')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Action: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Action from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of queue_item if self.queue_item: _dict["queueItem"] = self.queue_item.to_dict() @@ -179,81 +212,93 @@ def to_dict(self): if self.stand_position: _dict["standPosition"] = self.stand_position.to_dict() # set to None if button_name (nullable) is None - # and __fields_set__ contains the field - if self.button_name is None and "button_name" in self.__fields_set__: + # and model_fields_set contains the field + if self.button_name is None and "button_name" in self.model_fields_set: _dict["buttonName"] = None # set to None if content_id (nullable) is None - # and __fields_set__ contains the field - if self.content_id is None and "content_id" in self.__fields_set__: + # and model_fields_set contains the field + if self.content_id is None and "content_id" in self.model_fields_set: _dict["contentId"] = None # set to None if deezer_user_id (nullable) is None - # and __fields_set__ contains the field - if self.deezer_user_id is None and "deezer_user_id" in self.__fields_set__: + # and model_fields_set contains the field + if self.deezer_user_id is None and "deezer_user_id" in self.model_fields_set: _dict["deezerUserId"] = None # set to None if preset_key (nullable) is None - # and __fields_set__ contains the field - if self.preset_key is None and "preset_key" in self.__fields_set__: + # and model_fields_set contains the field + if self.preset_key is None and "preset_key" in self.model_fields_set: _dict["presetKey"] = None # set to None if radio_station_id (nullable) is None - # and __fields_set__ contains the field - if self.radio_station_id is None and "radio_station_id" in self.__fields_set__: + # and model_fields_set contains the field + if ( + self.radio_station_id is None + and "radio_station_id" in self.model_fields_set + ): _dict["radioStationId"] = None # set to None if stop_duration (nullable) is None - # and __fields_set__ contains the field - if self.stop_duration is None and "stop_duration" in self.__fields_set__: + # and model_fields_set contains the field + if self.stop_duration is None and "stop_duration" in self.model_fields_set: _dict["stopDuration"] = None # set to None if tone_name (nullable) is None - # and __fields_set__ contains the field - if self.tone_name is None and "tone_name" in self.__fields_set__: + # and model_fields_set contains the field + if self.tone_name is None and "tone_name" in self.model_fields_set: _dict["toneName"] = None # set to None if volume_level (nullable) is None - # and __fields_set__ contains the field - if self.volume_level is None and "volume_level" in self.__fields_set__: + # and model_fields_set contains the field + if self.volume_level is None and "volume_level" in self.model_fields_set: _dict["volumeLevel"] = None return _dict @classmethod - def from_dict(cls, obj: dict) -> Action: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Action from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Action.parse_obj(obj) + return cls.model_validate(obj) - _obj = Action.parse_obj( + _obj = cls.model_validate( { - "button_name": obj.get("buttonName"), - "content_id": obj.get("contentId"), - "deezer_user_id": obj.get("deezerUserId"), - "listening_mode_id": obj.get("listeningModeId"), - "preset_key": obj.get("presetKey"), - "queue_item": PlayQueueItem.from_dict(obj.get("queueItem")) - if obj.get("queueItem") is not None - else None, - "queue_settings": PlayQueueSettings.from_dict(obj.get("queueSettings")) - if obj.get("queueSettings") is not None - else None, - "radio_station_id": obj.get("radioStationId"), - "source": SourceTypeEnum.from_dict(obj.get("source")) - if obj.get("source") is not None - else None, - "speaker_group_id": obj.get("speakerGroupId"), - "stand_position": StandPosition.from_dict(obj.get("standPosition")) - if obj.get("standPosition") is not None - else None, - "stop_duration": obj.get("stopDuration"), - "tone_name": obj.get("toneName"), + "buttonName": obj.get("buttonName"), + "contentId": obj.get("contentId"), + "deezerUserId": obj.get("deezerUserId"), + "gainDb": obj.get("gainDb"), + "listeningModeId": obj.get("listeningModeId"), + "presetKey": obj.get("presetKey"), + "queueItem": ( + PlayQueueItem.from_dict(obj["queueItem"]) + if obj.get("queueItem") is not None + else None + ), + "queueSettings": ( + PlayQueueSettings.from_dict(obj["queueSettings"]) + if obj.get("queueSettings") is not None + else None + ), + "radioStationId": obj.get("radioStationId"), + "source": ( + SourceTypeEnum.from_dict(obj["source"]) + if obj.get("source") is not None + else None + ), + "speakerGroupId": obj.get("speakerGroupId"), + "standPosition": ( + StandPosition.from_dict(obj["standPosition"]) + if obj.get("standPosition") is not None + else None + ), + "stopDuration": obj.get("stopDuration"), + "toneName": obj.get("toneName"), "type": obj.get("type"), - "volume_level": obj.get("volumeLevel"), + "volumeLevel": obj.get("volumeLevel"), } ) return _obj diff --git a/python_client/mozart_api/models/alarm_timer_event_data.py b/python_client/mozart_api/models/alarm_timer_event_data.py index c69d569..939dd74 100644 --- a/python_client/mozart_api/models/alarm_timer_event_data.py +++ b/python_client/mozart_api/models/alarm_timer_event_data.py @@ -18,75 +18,91 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr, validator +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class AlarmTimerEventData(BaseModel): """ AlarmTimerEventData - """ + """ # noqa: E501 event: Optional[StrictStr] = None id: Optional[StrictStr] = None type: Optional[StrictStr] = None - __properties = ["event", "id", "type"] + __properties: ClassVar[List[str]] = ["event", "id", "type"] - @validator("event") + @field_validator("event") def event_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("add", "update", "delete"): + if value not in set(["add", "update", "delete"]): raise ValueError("must be one of enum values ('add', 'update', 'delete')") return value - @validator("type") + @field_validator("type") def type_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("alarm", "timer"): + if value not in set(["alarm", "timer"]): raise ValueError("must be one of enum values ('alarm', 'timer')") return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> AlarmTimerEventData: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of AlarmTimerEventData from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> AlarmTimerEventData: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of AlarmTimerEventData from a dict""" if obj is None: return None if not isinstance(obj, dict): - return AlarmTimerEventData.parse_obj(obj) + return cls.model_validate(obj) - _obj = AlarmTimerEventData.parse_obj( + _obj = cls.model_validate( {"event": obj.get("event"), "id": obj.get("id"), "type": obj.get("type")} ) return _obj diff --git a/python_client/mozart_api/models/alarm_triggered_info.py b/python_client/mozart_api/models/alarm_triggered_info.py index edb007e..bc26a6d 100644 --- a/python_client/mozart_api/models/alarm_triggered_info.py +++ b/python_client/mozart_api/models/alarm_triggered_info.py @@ -18,56 +18,71 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr, constr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self class AlarmTriggeredInfo(BaseModel): """ AlarmTriggeredInfo - """ + """ # noqa: E501 id: Optional[StrictStr] = None - label: Optional[constr(strict=True, max_length=128)] = Field( - None, description="Label for an alarm" + label: Optional[Annotated[str, Field(strict=True, max_length=128)]] = Field( + default=None, description="Label for an alarm" ) - __properties = ["id", "label"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["id", "label"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> AlarmTriggeredInfo: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of AlarmTriggeredInfo from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> AlarmTriggeredInfo: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of AlarmTriggeredInfo from a dict""" if obj is None: return None if not isinstance(obj, dict): - return AlarmTriggeredInfo.parse_obj(obj) + return cls.model_validate(obj) - _obj = AlarmTriggeredInfo.parse_obj( - {"id": obj.get("id"), "label": obj.get("label")} - ) + _obj = cls.model_validate({"id": obj.get("id"), "label": obj.get("label")}) return _obj diff --git a/python_client/mozart_api/models/ambience.py b/python_client/mozart_api/models/ambience.py index 70ccf97..dcf4037 100644 --- a/python_client/mozart_api/models/ambience.py +++ b/python_client/mozart_api/models/ambience.py @@ -18,53 +18,67 @@ import re # noqa: F401 import json - -from typing import Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self class Ambience(BaseModel): """ Ambience - """ - - value: Union[StrictFloat, StrictInt] = Field( - ..., description="Selected ambience value" - ) - __properties = ["value"] + """ # noqa: E501 - class Config: - """Pydantic configuration""" + value: Union[StrictFloat, StrictInt] = Field(description="Selected ambience value") + __properties: ClassVar[List[str]] = ["value"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Ambience: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Ambience from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> Ambience: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Ambience from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Ambience.parse_obj(obj) + return cls.model_validate(obj) - _obj = Ambience.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/ambience_feature.py b/python_client/mozart_api/models/ambience_feature.py index dc923fd..df9542b 100644 --- a/python_client/mozart_api/models/ambience_feature.py +++ b/python_client/mozart_api/models/ambience_feature.py @@ -18,48 +18,62 @@ import re # noqa: F401 import json - -from typing import List, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union from mozart_api.models.ambience import Ambience +from typing import Optional, Set +from typing_extensions import Self class AmbienceFeature(BaseModel): """ AmbienceFeature - """ + """ # noqa: E501 - value: Union[StrictFloat, StrictInt] = Field( - ..., description="Selected ambience value" - ) - default: Ambience = Field(...) - range: conlist(Ambience, unique_items=True) = Field( - ..., description="Product and role specific ambience range" + value: Union[StrictFloat, StrictInt] = Field(description="Selected ambience value") + default: Ambience + range: List[Ambience] = Field( + description="Product and role specific ambience range" ) - __properties = ["value", "default", "range"] + __properties: ClassVar[List[str]] = ["value", "default", "range"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> AmbienceFeature: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of AmbienceFeature from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -73,23 +87,27 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> AmbienceFeature: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of AmbienceFeature from a dict""" if obj is None: return None if not isinstance(obj, dict): - return AmbienceFeature.parse_obj(obj) + return cls.model_validate(obj) - _obj = AmbienceFeature.parse_obj( + _obj = cls.model_validate( { "value": obj.get("value"), - "default": Ambience.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [Ambience.from_dict(_item) for _item in obj.get("range")] - if obj.get("range") is not None - else None, + "default": ( + Ambience.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [Ambience.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/ambience_range.py b/python_client/mozart_api/models/ambience_range.py index 9c59315..fd64b43 100644 --- a/python_client/mozart_api/models/ambience_range.py +++ b/python_client/mozart_api/models/ambience_range.py @@ -18,45 +18,61 @@ import re # noqa: F401 import json - -from typing import List -from pydantic import BaseModel, Field, conlist +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List from mozart_api.models.ambience import Ambience +from typing import Optional, Set +from typing_extensions import Self class AmbienceRange(BaseModel): """ AmbienceRange - """ + """ # noqa: E501 - default: Ambience = Field(...) - range: conlist(Ambience, unique_items=True) = Field( - ..., description="Product and role specific ambience range" + default: Ambience + range: List[Ambience] = Field( + description="Product and role specific ambience range" ) - __properties = ["default", "range"] + __properties: ClassVar[List[str]] = ["default", "range"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> AmbienceRange: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of AmbienceRange from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -70,22 +86,26 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> AmbienceRange: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of AmbienceRange from a dict""" if obj is None: return None if not isinstance(obj, dict): - return AmbienceRange.parse_obj(obj) + return cls.model_validate(obj) - _obj = AmbienceRange.parse_obj( + _obj = cls.model_validate( { - "default": Ambience.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [Ambience.from_dict(_item) for _item in obj.get("range")] - if obj.get("range") is not None - else None, + "default": ( + Ambience.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [Ambience.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/art.py b/python_client/mozart_api/models/art.py index d429fb5..94495aa 100644 --- a/python_client/mozart_api/models/art.py +++ b/python_client/mozart_api/models/art.py @@ -18,59 +18,75 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class Art(BaseModel): """ Art - """ + """ # noqa: E501 - has_local_image: Optional[StrictBool] = Field(None, alias="hasLocalImage") + has_local_image: Optional[StrictBool] = Field(default=None, alias="hasLocalImage") key: Optional[StrictStr] = None size: Optional[StrictStr] = None type: Optional[StrictStr] = None url: Optional[StrictStr] = None - __properties = ["hasLocalImage", "key", "size", "type", "url"] + __properties: ClassVar[List[str]] = ["hasLocalImage", "key", "size", "type", "url"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Art: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Art from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> Art: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Art from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Art.parse_obj(obj) + return cls.model_validate(obj) - _obj = Art.parse_obj( + _obj = cls.model_validate( { - "has_local_image": obj.get("hasLocalImage"), + "hasLocalImage": obj.get("hasLocalImage"), "key": obj.get("key"), "size": obj.get("size"), "type": obj.get("type"), diff --git a/python_client/mozart_api/models/balance.py b/python_client/mozart_api/models/balance.py index a22556b..266e3ff 100644 --- a/python_client/mozart_api/models/balance.py +++ b/python_client/mozart_api/models/balance.py @@ -18,53 +18,67 @@ import re # noqa: F401 import json - -from typing import Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self class Balance(BaseModel): """ Balance - """ - - value: Union[StrictFloat, StrictInt] = Field( - ..., description="Selected balance value" - ) - __properties = ["value"] + """ # noqa: E501 - class Config: - """Pydantic configuration""" + value: Union[StrictFloat, StrictInt] = Field(description="Selected balance value") + __properties: ClassVar[List[str]] = ["value"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Balance: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Balance from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> Balance: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Balance from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Balance.parse_obj(obj) + return cls.model_validate(obj) - _obj = Balance.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/balance_feature.py b/python_client/mozart_api/models/balance_feature.py index 95b649c..5f10979 100644 --- a/python_client/mozart_api/models/balance_feature.py +++ b/python_client/mozart_api/models/balance_feature.py @@ -18,46 +18,60 @@ import re # noqa: F401 import json - -from typing import List, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union from mozart_api.models.balance import Balance +from typing import Optional, Set +from typing_extensions import Self class BalanceFeature(BaseModel): """ BalanceFeature - """ + """ # noqa: E501 - value: Union[StrictFloat, StrictInt] = Field( - ..., description="Selected balance value" - ) - default: Balance = Field(...) - range: conlist(Balance, unique_items=True) = Field(..., description="balance range") - __properties = ["value", "default", "range"] + value: Union[StrictFloat, StrictInt] = Field(description="Selected balance value") + default: Balance + range: List[Balance] = Field(description="balance range") + __properties: ClassVar[List[str]] = ["value", "default", "range"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> BalanceFeature: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BalanceFeature from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -71,23 +85,27 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> BalanceFeature: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BalanceFeature from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BalanceFeature.parse_obj(obj) + return cls.model_validate(obj) - _obj = BalanceFeature.parse_obj( + _obj = cls.model_validate( { "value": obj.get("value"), - "default": Balance.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [Balance.from_dict(_item) for _item in obj.get("range")] - if obj.get("range") is not None - else None, + "default": ( + Balance.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [Balance.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/balance_range.py b/python_client/mozart_api/models/balance_range.py index b2e2caf..0e9d5c1 100644 --- a/python_client/mozart_api/models/balance_range.py +++ b/python_client/mozart_api/models/balance_range.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List -from pydantic import BaseModel, Field, conlist +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List from mozart_api.models.balance import Balance +from typing import Optional, Set +from typing_extensions import Self class BalanceRange(BaseModel): """ BalanceRange - """ + """ # noqa: E501 - default: Balance = Field(...) - range: conlist(Balance, unique_items=True) = Field(..., description="balance range") - __properties = ["default", "range"] + default: Balance + range: List[Balance] = Field(description="balance range") + __properties: ClassVar[List[str]] = ["default", "range"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> BalanceRange: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BalanceRange from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -68,22 +84,26 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> BalanceRange: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BalanceRange from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BalanceRange.parse_obj(obj) + return cls.model_validate(obj) - _obj = BalanceRange.parse_obj( + _obj = cls.model_validate( { - "default": Balance.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [Balance.from_dict(_item) for _item in obj.get("range")] - if obj.get("range") is not None - else None, + "default": ( + Balance.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [Balance.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/bass.py b/python_client/mozart_api/models/bass.py index ca8f949..af68301 100644 --- a/python_client/mozart_api/models/bass.py +++ b/python_client/mozart_api/models/bass.py @@ -18,50 +18,67 @@ import re # noqa: F401 import json - -from pydantic import BaseModel, Field, StrictInt +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self class Bass(BaseModel): """ Bass - """ - - value: StrictInt = Field(..., description="Selected bass value") - __properties = ["value"] + """ # noqa: E501 - class Config: - """Pydantic configuration""" + value: StrictInt = Field(description="Selected bass value") + __properties: ClassVar[List[str]] = ["value"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Bass: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Bass from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> Bass: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Bass from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Bass.parse_obj(obj) + return cls.model_validate(obj) - _obj = Bass.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/bass_feature.py b/python_client/mozart_api/models/bass_feature.py index edad0bb..5a25baf 100644 --- a/python_client/mozart_api/models/bass_feature.py +++ b/python_client/mozart_api/models/bass_feature.py @@ -18,46 +18,60 @@ import re # noqa: F401 import json - -from typing import List -from pydantic import BaseModel, Field, StrictInt, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List from mozart_api.models.bass import Bass +from typing import Optional, Set +from typing_extensions import Self class BassFeature(BaseModel): """ BassFeature - """ + """ # noqa: E501 - value: StrictInt = Field(..., description="Selected bass value") - default: Bass = Field(...) - range: conlist(Bass, unique_items=True) = Field( - ..., description="Product and role specific bass range" - ) - __properties = ["value", "default", "range"] + value: StrictInt = Field(description="Selected bass value") + default: Bass + range: List[Bass] = Field(description="Product and role specific bass range") + __properties: ClassVar[List[str]] = ["value", "default", "range"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> BassFeature: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BassFeature from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -71,23 +85,27 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> BassFeature: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BassFeature from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BassFeature.parse_obj(obj) + return cls.model_validate(obj) - _obj = BassFeature.parse_obj( + _obj = cls.model_validate( { "value": obj.get("value"), - "default": Bass.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [Bass.from_dict(_item) for _item in obj.get("range")] - if obj.get("range") is not None - else None, + "default": ( + Bass.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [Bass.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/bass_management.py b/python_client/mozart_api/models/bass_management.py index c6db048..cfc004f 100644 --- a/python_client/mozart_api/models/bass_management.py +++ b/python_client/mozart_api/models/bass_management.py @@ -18,57 +18,74 @@ import re # noqa: F401 import json - -from pydantic import BaseModel, Field, StrictStr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self class BassManagement(BaseModel): """ BassManagement - """ + """ # noqa: E501 - value: StrictStr = Field(..., description="Selected bass-management value") - __properties = ["value"] + value: StrictStr = Field(description="Selected bass-management value") + __properties: ClassVar[List[str]] = ["value"] - @validator("value") + @field_validator("value") def value_validate_enum(cls, value): """Validates the enum""" - if value not in ("on", "off"): + if value not in set(["on", "off"]): raise ValueError("must be one of enum values ('on', 'off')") return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> BassManagement: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BassManagement from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> BassManagement: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BassManagement from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BassManagement.parse_obj(obj) + return cls.model_validate(obj) - _obj = BassManagement.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/bass_management_feature.py b/python_client/mozart_api/models/bass_management_feature.py index aba59e6..8a83e1f 100644 --- a/python_client/mozart_api/models/bass_management_feature.py +++ b/python_client/mozart_api/models/bass_management_feature.py @@ -18,53 +18,67 @@ import re # noqa: F401 import json - -from typing import List -from pydantic import BaseModel, Field, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List from mozart_api.models.bass_management import BassManagement +from typing import Optional, Set +from typing_extensions import Self class BassManagementFeature(BaseModel): """ BassManagementFeature - """ + """ # noqa: E501 - value: StrictStr = Field(..., description="Selected bass-management value") - default: BassManagement = Field(...) - range: conlist(BassManagement, unique_items=True) = Field( - ..., description="bass-management range" - ) - __properties = ["value", "default", "range"] + value: StrictStr = Field(description="Selected bass-management value") + default: BassManagement + range: List[BassManagement] = Field(description="bass-management range") + __properties: ClassVar[List[str]] = ["value", "default", "range"] - @validator("value") + @field_validator("value") def value_validate_enum(cls, value): """Validates the enum""" - if value not in ("on", "off"): + if value not in set(["on", "off"]): raise ValueError("must be one of enum values ('on', 'off')") return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> BassManagementFeature: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BassManagementFeature from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -78,23 +92,27 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> BassManagementFeature: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BassManagementFeature from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BassManagementFeature.parse_obj(obj) + return cls.model_validate(obj) - _obj = BassManagementFeature.parse_obj( + _obj = cls.model_validate( { "value": obj.get("value"), - "default": BassManagement.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [BassManagement.from_dict(_item) for _item in obj.get("range")] - if obj.get("range") is not None - else None, + "default": ( + BassManagement.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [BassManagement.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/bass_management_range.py b/python_client/mozart_api/models/bass_management_range.py index 7a538d3..d6506ae 100644 --- a/python_client/mozart_api/models/bass_management_range.py +++ b/python_client/mozart_api/models/bass_management_range.py @@ -18,45 +18,59 @@ import re # noqa: F401 import json - -from typing import List -from pydantic import BaseModel, Field, conlist +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List from mozart_api.models.bass_management import BassManagement +from typing import Optional, Set +from typing_extensions import Self class BassManagementRange(BaseModel): """ BassManagementRange - """ + """ # noqa: E501 - default: BassManagement = Field(...) - range: conlist(BassManagement, unique_items=True) = Field( - ..., description="bass-management range" - ) - __properties = ["default", "range"] + default: BassManagement + range: List[BassManagement] = Field(description="bass-management range") + __properties: ClassVar[List[str]] = ["default", "range"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> BassManagementRange: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BassManagementRange from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -70,22 +84,26 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> BassManagementRange: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BassManagementRange from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BassManagementRange.parse_obj(obj) + return cls.model_validate(obj) - _obj = BassManagementRange.parse_obj( + _obj = cls.model_validate( { - "default": BassManagement.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [BassManagement.from_dict(_item) for _item in obj.get("range")] - if obj.get("range") is not None - else None, + "default": ( + BassManagement.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [BassManagement.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/bass_range.py b/python_client/mozart_api/models/bass_range.py index 42569aa..667cb4a 100644 --- a/python_client/mozart_api/models/bass_range.py +++ b/python_client/mozart_api/models/bass_range.py @@ -18,45 +18,59 @@ import re # noqa: F401 import json - -from typing import List -from pydantic import BaseModel, Field, conlist +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List from mozart_api.models.bass import Bass +from typing import Optional, Set +from typing_extensions import Self class BassRange(BaseModel): """ BassRange - """ + """ # noqa: E501 - default: Bass = Field(...) - range: conlist(Bass, unique_items=True) = Field( - ..., description="Product and role specific bass range" - ) - __properties = ["default", "range"] + default: Bass + range: List[Bass] = Field(description="Product and role specific bass range") + __properties: ClassVar[List[str]] = ["default", "range"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> BassRange: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BassRange from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -70,22 +84,26 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> BassRange: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BassRange from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BassRange.parse_obj(obj) + return cls.model_validate(obj) - _obj = BassRange.parse_obj( + _obj = cls.model_validate( { - "default": Bass.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [Bass.from_dict(_item) for _item in obj.get("range")] - if obj.get("range") is not None - else None, + "default": ( + Bass.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [Bass.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/battery_state.py b/python_client/mozart_api/models/battery_state.py index 3217799..0ef8716 100644 --- a/python_client/mozart_api/models/battery_state.py +++ b/python_client/mozart_api/models/battery_state.py @@ -18,80 +18,92 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictBool, StrictInt +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class BatteryState(BaseModel): """ BatteryState - """ + """ # noqa: E501 battery_level: Optional[StrictInt] = Field( - None, alias="batteryLevel", description="Batterylevel in percent " + default=None, description="Batterylevel in percent ", alias="batteryLevel" ) - is_charging: Optional[StrictBool] = Field(None, alias="isCharging") + is_charging: Optional[StrictBool] = Field(default=None, alias="isCharging") remaining_charging_time_minutes: Optional[StrictInt] = Field( - None, - alias="remainingChargingTimeMinutes", + default=None, description="Remaining charging time in minutes", + alias="remainingChargingTimeMinutes", ) remaining_playing_time_minutes: Optional[StrictInt] = Field( - None, - alias="remainingPlayingTimeMinutes", + default=None, description="Remaining playing time in minutes", + alias="remainingPlayingTimeMinutes", ) - __properties = [ + __properties: ClassVar[List[str]] = [ "batteryLevel", "isCharging", "remainingChargingTimeMinutes", "remainingPlayingTimeMinutes", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> BatteryState: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BatteryState from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> BatteryState: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BatteryState from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BatteryState.parse_obj(obj) + return cls.model_validate(obj) - _obj = BatteryState.parse_obj( + _obj = cls.model_validate( { - "battery_level": obj.get("batteryLevel"), - "is_charging": obj.get("isCharging"), - "remaining_charging_time_minutes": obj.get( - "remainingChargingTimeMinutes" - ), - "remaining_playing_time_minutes": obj.get( - "remainingPlayingTimeMinutes" - ), + "batteryLevel": obj.get("batteryLevel"), + "isCharging": obj.get("isCharging"), + "remainingChargingTimeMinutes": obj.get("remainingChargingTimeMinutes"), + "remainingPlayingTimeMinutes": obj.get("remainingPlayingTimeMinutes"), } ) return _obj diff --git a/python_client/mozart_api/models/beo_remote_button.py b/python_client/mozart_api/models/beo_remote_button.py index 7cd87a9..09e00b8 100644 --- a/python_client/mozart_api/models/beo_remote_button.py +++ b/python_client/mozart_api/models/beo_remote_button.py @@ -18,64 +18,78 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class BeoRemoteButton(BaseModel): """ BeoRemoteButton - """ + """ # noqa: E501 - key: Optional[StrictStr] = Field(None, alias="Key") - type: Optional[StrictStr] = Field(None, alias="Type") - __properties = ["Key", "Type"] + key: Optional[StrictStr] = Field(default=None, alias="Key") + type: Optional[StrictStr] = Field(default=None, alias="Type") + __properties: ClassVar[List[str]] = ["Key", "Type"] - @validator("type") + @field_validator("type") def type_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("KeyPress", "KeyRelease"): + if value not in set(["KeyPress", "KeyRelease"]): raise ValueError("must be one of enum values ('KeyPress', 'KeyRelease')") return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> BeoRemoteButton: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BeoRemoteButton from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> BeoRemoteButton: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BeoRemoteButton from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BeoRemoteButton.parse_obj(obj) + return cls.model_validate(obj) - _obj = BeoRemoteButton.parse_obj( - {"key": obj.get("Key"), "type": obj.get("Type")} - ) + _obj = cls.model_validate({"Key": obj.get("Key"), "Type": obj.get("Type")}) return _obj diff --git a/python_client/mozart_api/models/beolink_available_listener.py b/python_client/mozart_api/models/beolink_available_listener.py index 39fb649..1a481ab 100644 --- a/python_client/mozart_api/models/beolink_available_listener.py +++ b/python_client/mozart_api/models/beolink_available_listener.py @@ -18,50 +18,67 @@ import re # noqa: F401 import json - -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self class BeolinkAvailableListener(BaseModel): """ BeolinkAvailableListener - """ - - jid: StrictStr = Field(..., description="Beolink peer ID") - __properties = ["jid"] + """ # noqa: E501 - class Config: - """Pydantic configuration""" + jid: StrictStr = Field(description="Beolink peer ID") + __properties: ClassVar[List[str]] = ["jid"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> BeolinkAvailableListener: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BeolinkAvailableListener from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> BeolinkAvailableListener: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BeolinkAvailableListener from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BeolinkAvailableListener.parse_obj(obj) + return cls.model_validate(obj) - _obj = BeolinkAvailableListener.parse_obj({"jid": obj.get("jid")}) + _obj = cls.model_validate({"jid": obj.get("jid")}) return _obj diff --git a/python_client/mozart_api/models/beolink_experience.py b/python_client/mozart_api/models/beolink_experience.py index ba0cb1a..036c56d 100644 --- a/python_client/mozart_api/models/beolink_experience.py +++ b/python_client/mozart_api/models/beolink_experience.py @@ -18,42 +18,50 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr, validator +from pydantic import ( + BaseModel, + ConfigDict, + Field, + StrictBool, + StrictStr, + field_validator, +) +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class BeolinkExperience(BaseModel): """ BeolinkExperience - """ + """ # noqa: E501 - category: StrictStr = Field(..., description="Source category") - id: StrictStr = Field(..., description='experience id, e.g. "RADIO" or "toslink"') + category: StrictStr = Field(description="Source category") + id: StrictStr = Field(description='experience id, e.g. "RADIO" or "toslink"') linkable: StrictBool = Field( - ..., description='Linkable means "Does pressing play on this source make sense"' + description='Linkable means "Does pressing play on this source make sense"' ) name: StrictStr = Field( - ..., description='Experience name, e.g. "Bluetooth" or "B&O Radio"' + description='Experience name, e.g. "Bluetooth" or "B&O Radio"' ) product_friendly_name: Optional[StrictStr] = Field( - None, alias="productFriendlyName", description="Optional product friendly name" + default=None, + description="Optional product friendly name", + alias="productFriendlyName", ) source_friendly_name: Optional[StrictStr] = Field( - None, - alias="sourceFriendlyName", + default=None, description="Optional friendly name for source", + alias="sourceFriendlyName", ) type: StrictStr = Field( - ..., - description="Source type. This corresponds to the exhaustive list or sources provided by the control layer", + description="Source type. This corresponds to the exhaustive list or sources provided by the control layer" ) unique_source_id: StrictStr = Field( - ..., - alias="uniqueSourceId", description="The actual device jabber id that the experience comes from", + alias="uniqueSourceId", ) - __properties = [ + __properties: ClassVar[List[str]] = [ "category", "id", "linkable", @@ -64,58 +72,73 @@ class BeolinkExperience(BaseModel): "uniqueSourceId", ] - @validator("category") + @field_validator("category") def category_validate_enum(cls, value): """Validates the enum""" - if value not in ("TV", "RADIO", "MUSIC", "MEDIA", "UNKNOWN"): + if value not in set(["TV", "RADIO", "MUSIC", "MEDIA", "UNKNOWN"]): raise ValueError( "must be one of enum values ('TV', 'RADIO', 'MUSIC', 'MEDIA', 'UNKNOWN')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> BeolinkExperience: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BeolinkExperience from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> BeolinkExperience: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BeolinkExperience from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BeolinkExperience.parse_obj(obj) + return cls.model_validate(obj) - _obj = BeolinkExperience.parse_obj( + _obj = cls.model_validate( { "category": obj.get("category"), "id": obj.get("id"), "linkable": obj.get("linkable"), "name": obj.get("name"), - "product_friendly_name": obj.get("productFriendlyName"), - "source_friendly_name": obj.get("sourceFriendlyName"), + "productFriendlyName": obj.get("productFriendlyName"), + "sourceFriendlyName": obj.get("sourceFriendlyName"), "type": obj.get("type"), - "unique_source_id": obj.get("uniqueSourceId"), + "uniqueSourceId": obj.get("uniqueSourceId"), } ) return _obj diff --git a/python_client/mozart_api/models/beolink_experiences_result.py b/python_client/mozart_api/models/beolink_experiences_result.py index 2550dc9..a2ceb99 100644 --- a/python_client/mozart_api/models/beolink_experiences_result.py +++ b/python_client/mozart_api/models/beolink_experiences_result.py @@ -18,56 +18,69 @@ import re # noqa: F401 import json - -from typing import List -from pydantic import BaseModel, Field, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List from mozart_api.models.beolink_experience import BeolinkExperience +from typing import Optional, Set +from typing_extensions import Self class BeolinkExperiencesResult(BaseModel): """ BeolinkExperiencesResult - """ + """ # noqa: E501 - experiences: conlist(BeolinkExperience) = Field(...) - request_id: StrictStr = Field( - ..., alias="requestID", description="Beolink request ID" - ) + experiences: List[BeolinkExperience] + request_id: StrictStr = Field(description="Beolink request ID", alias="requestID") status: StrictStr = Field( - ..., - description="Current scan status. * busy: there is another scan in progress * timeout: the scan timed out. The results will be partial ", + description="Current scan status. * busy: there is another scan in progress * timeout: the scan timed out. The results will be partial " ) - __properties = ["experiences", "requestID", "status"] + __properties: ClassVar[List[str]] = ["experiences", "requestID", "status"] - @validator("status") + @field_validator("status") def status_validate_enum(cls, value): """Validates the enum""" - if value not in ("ok", "busy", "timeout"): + if value not in set(["ok", "busy", "timeout"]): raise ValueError("must be one of enum values ('ok', 'busy', 'timeout')") return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> BeolinkExperiencesResult: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BeolinkExperiencesResult from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in experiences (list) _items = [] if self.experiences: @@ -78,23 +91,22 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> BeolinkExperiencesResult: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BeolinkExperiencesResult from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BeolinkExperiencesResult.parse_obj(obj) + return cls.model_validate(obj) - _obj = BeolinkExperiencesResult.parse_obj( + _obj = cls.model_validate( { - "experiences": [ - BeolinkExperience.from_dict(_item) - for _item in obj.get("experiences") - ] - if obj.get("experiences") is not None - else None, - "request_id": obj.get("requestID"), + "experiences": ( + [BeolinkExperience.from_dict(_item) for _item in obj["experiences"]] + if obj.get("experiences") is not None + else None + ), + "requestID": obj.get("requestID"), "status": obj.get("status"), } ) diff --git a/python_client/mozart_api/models/beolink_join_request.py b/python_client/mozart_api/models/beolink_join_request.py index 91a38bf..5270f8c 100644 --- a/python_client/mozart_api/models/beolink_join_request.py +++ b/python_client/mozart_api/models/beolink_join_request.py @@ -18,60 +18,74 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class BeolinkJoinRequest(BaseModel): """ BeolinkJoinRequest - """ + """ # noqa: E501 - jid: Optional[StrictStr] = Field(None, description="Beolink peer ID") - request_id: StrictStr = Field( - ..., alias="requestID", description="Beolink request ID" - ) - result: StrictStr = Field(..., description="Relative URL of the join result") - __properties = ["jid", "requestID", "result"] + jid: Optional[StrictStr] = Field(default=None, description="Beolink peer ID") + request_id: StrictStr = Field(description="Beolink request ID", alias="requestID") + result: StrictStr = Field(description="Relative URL of the join result") + __properties: ClassVar[List[str]] = ["jid", "requestID", "result"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> BeolinkJoinRequest: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BeolinkJoinRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> BeolinkJoinRequest: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BeolinkJoinRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BeolinkJoinRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = BeolinkJoinRequest.parse_obj( + _obj = cls.model_validate( { "jid": obj.get("jid"), - "request_id": obj.get("requestID"), + "requestID": obj.get("requestID"), "result": obj.get("result"), } ) diff --git a/python_client/mozart_api/models/beolink_join_result.py b/python_client/mozart_api/models/beolink_join_result.py index 5d00e2c..1b822af 100644 --- a/python_client/mozart_api/models/beolink_join_result.py +++ b/python_client/mozart_api/models/beolink_join_result.py @@ -18,102 +18,116 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class BeolinkJoinResult(BaseModel): """ BeolinkJoinResult - """ + """ # noqa: E501 - error: Optional[StrictStr] = Field(None, description="Join error") - jid: StrictStr = Field(..., description="Beolink peer ID") - request_id: StrictStr = Field( - ..., alias="requestID", description="Beolink request ID" - ) - status: StrictStr = Field(..., description="Overall join status") - type: StrictStr = Field( - ..., description="The type of join request this is a result of" - ) - __properties = ["error", "jid", "requestID", "status", "type"] + error: Optional[StrictStr] = Field(default=None, description="Join error") + jid: StrictStr = Field(description="Beolink peer ID") + request_id: StrictStr = Field(description="Beolink request ID", alias="requestID") + status: StrictStr = Field(description="Overall join status") + type: StrictStr = Field(description="The type of join request this is a result of") + __properties: ClassVar[List[str]] = ["error", "jid", "requestID", "status", "type"] - @validator("error") + @field_validator("error") def error_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ( - "ok", - "busy", - "leaderless", - "alone", - "silent", - "missing", - "rejected", - "timeout", + if value not in set( + [ + "ok", + "busy", + "leaderless", + "alone", + "silent", + "missing", + "rejected", + "timeout", + ] ): raise ValueError( "must be one of enum values ('ok', 'busy', 'leaderless', 'alone', 'silent', 'missing', 'rejected', 'timeout')" ) return value - @validator("status") + @field_validator("status") def status_validate_enum(cls, value): """Validates the enum""" - if value not in ("idle", "joined", "failed"): + if value not in set(["idle", "joined", "failed"]): raise ValueError("must be one of enum values ('idle', 'joined', 'failed')") return value - @validator("type") + @field_validator("type") def type_validate_enum(cls, value): """Validates the enum""" - if value not in ("join", "joinRequested", "expand", "expandRequested"): + if value not in set(["join", "joinRequested", "expand", "expandRequested"]): raise ValueError( "must be one of enum values ('join', 'joinRequested', 'expand', 'expandRequested')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> BeolinkJoinResult: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BeolinkJoinResult from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> BeolinkJoinResult: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BeolinkJoinResult from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BeolinkJoinResult.parse_obj(obj) + return cls.model_validate(obj) - _obj = BeolinkJoinResult.parse_obj( + _obj = cls.model_validate( { "error": obj.get("error"), "jid": obj.get("jid"), - "request_id": obj.get("requestID"), + "requestID": obj.get("requestID"), "status": obj.get("status"), "type": obj.get("type"), } diff --git a/python_client/mozart_api/models/beolink_leader.py b/python_client/mozart_api/models/beolink_leader.py index 1ca4d49..1eb3408 100644 --- a/python_client/mozart_api/models/beolink_leader.py +++ b/python_client/mozart_api/models/beolink_leader.py @@ -18,53 +18,70 @@ import re # noqa: F401 import json - -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self class BeolinkLeader(BaseModel): """ BeolinkLeader - """ + """ # noqa: E501 - friendly_name: StrictStr = Field(..., alias="friendlyName") - jid: StrictStr = Field(..., description="Beolink peer ID") - __properties = ["friendlyName", "jid"] + friendly_name: StrictStr = Field(alias="friendlyName") + jid: StrictStr = Field(description="Beolink peer ID") + __properties: ClassVar[List[str]] = ["friendlyName", "jid"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> BeolinkLeader: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BeolinkLeader from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> BeolinkLeader: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BeolinkLeader from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BeolinkLeader.parse_obj(obj) + return cls.model_validate(obj) - _obj = BeolinkLeader.parse_obj( - {"friendly_name": obj.get("friendlyName"), "jid": obj.get("jid")} + _obj = cls.model_validate( + {"friendlyName": obj.get("friendlyName"), "jid": obj.get("jid")} ) return _obj diff --git a/python_client/mozart_api/models/beolink_listener.py b/python_client/mozart_api/models/beolink_listener.py index 9266bfb..c0d2d0e 100644 --- a/python_client/mozart_api/models/beolink_listener.py +++ b/python_client/mozart_api/models/beolink_listener.py @@ -18,50 +18,67 @@ import re # noqa: F401 import json - -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self class BeolinkListener(BaseModel): """ BeolinkListener - """ - - jid: StrictStr = Field(..., description="Beolink peer ID") - __properties = ["jid"] + """ # noqa: E501 - class Config: - """Pydantic configuration""" + jid: StrictStr = Field(description="Beolink peer ID") + __properties: ClassVar[List[str]] = ["jid"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> BeolinkListener: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BeolinkListener from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> BeolinkListener: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BeolinkListener from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BeolinkListener.parse_obj(obj) + return cls.model_validate(obj) - _obj = BeolinkListener.parse_obj({"jid": obj.get("jid")}) + _obj = cls.model_validate({"jid": obj.get("jid")}) return _obj diff --git a/python_client/mozart_api/models/beolink_peer.py b/python_client/mozart_api/models/beolink_peer.py index dcb8fd5..7b6093c 100644 --- a/python_client/mozart_api/models/beolink_peer.py +++ b/python_client/mozart_api/models/beolink_peer.py @@ -18,53 +18,70 @@ import re # noqa: F401 import json - -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self class BeolinkPeer(BaseModel): """ BeolinkPeer - """ + """ # noqa: E501 - friendly_name: StrictStr = Field(..., alias="friendlyName") - jid: StrictStr = Field(..., description="Beolink peer ID") - __properties = ["friendlyName", "jid"] + friendly_name: StrictStr = Field(alias="friendlyName") + jid: StrictStr = Field(description="Beolink peer ID") + __properties: ClassVar[List[str]] = ["friendlyName", "jid"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> BeolinkPeer: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BeolinkPeer from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> BeolinkPeer: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BeolinkPeer from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BeolinkPeer.parse_obj(obj) + return cls.model_validate(obj) - _obj = BeolinkPeer.parse_obj( - {"friendly_name": obj.get("friendlyName"), "jid": obj.get("jid")} + _obj = cls.model_validate( + {"friendlyName": obj.get("friendlyName"), "jid": obj.get("jid")} ) return _obj diff --git a/python_client/mozart_api/models/bluetooth_device.py b/python_client/mozart_api/models/bluetooth_device.py index cd9c9f6..fd256df 100644 --- a/python_client/mozart_api/models/bluetooth_device.py +++ b/python_client/mozart_api/models/bluetooth_device.py @@ -18,55 +18,71 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictBool, StrictStr +from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class BluetoothDevice(BaseModel): """ BluetoothDevice - """ + """ # noqa: E501 address: Optional[StrictStr] = None connected: Optional[StrictBool] = None name: Optional[StrictStr] = None - __properties = ["address", "connected", "name"] + __properties: ClassVar[List[str]] = ["address", "connected", "name"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> BluetoothDevice: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BluetoothDevice from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> BluetoothDevice: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BluetoothDevice from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BluetoothDevice.parse_obj(obj) + return cls.model_validate(obj) - _obj = BluetoothDevice.parse_obj( + _obj = cls.model_validate( { "address": obj.get("address"), "connected": obj.get("connected"), diff --git a/python_client/mozart_api/models/bluetooth_device_list.py b/python_client/mozart_api/models/bluetooth_device_list.py index 301ce65..2d994f5 100644 --- a/python_client/mozart_api/models/bluetooth_device_list.py +++ b/python_client/mozart_api/models/bluetooth_device_list.py @@ -18,42 +18,58 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, conlist +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.bluetooth_device import BluetoothDevice +from typing import Optional, Set +from typing_extensions import Self class BluetoothDeviceList(BaseModel): """ BluetoothDeviceList - """ + """ # noqa: E501 - items: Optional[conlist(BluetoothDevice)] = None - __properties = ["items"] + items: Optional[List[BluetoothDevice]] = None + __properties: ClassVar[List[str]] = ["items"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> BluetoothDeviceList: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BluetoothDeviceList from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in items (list) _items = [] if self.items: @@ -64,21 +80,21 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> BluetoothDeviceList: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of BluetoothDeviceList from a dict""" if obj is None: return None if not isinstance(obj, dict): - return BluetoothDeviceList.parse_obj(obj) + return cls.model_validate(obj) - _obj = BluetoothDeviceList.parse_obj( + _obj = cls.model_validate( { - "items": [ - BluetoothDevice.from_dict(_item) for _item in obj.get("items") - ] - if obj.get("items") is not None - else None + "items": ( + [BluetoothDevice.from_dict(_item) for _item in obj["items"]] + if obj.get("items") is not None + else None + ) } ) return _obj diff --git a/python_client/mozart_api/models/button_event.py b/python_client/mozart_api/models/button_event.py index 796d500..f8f6ae8 100644 --- a/python_client/mozart_api/models/button_event.py +++ b/python_client/mozart_api/models/button_event.py @@ -18,54 +18,74 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class ButtonEvent(BaseModel): """ ButtonEvent - """ - - button: Optional[StrictStr] = Field(None, description="identifies the button") - state: Optional[StrictStr] = Field(None, description="identifies the state change") - __properties = ["button", "state"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + """ # noqa: E501 + + button: Optional[StrictStr] = Field( + default=None, description="identifies the button" + ) + state: Optional[StrictStr] = Field( + default=None, description="identifies the state change" + ) + __properties: ClassVar[List[str]] = ["button", "state"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ButtonEvent: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ButtonEvent from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> ButtonEvent: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ButtonEvent from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ButtonEvent.parse_obj(obj) + return cls.model_validate(obj) - _obj = ButtonEvent.parse_obj( + _obj = cls.model_validate( {"button": obj.get("button"), "state": obj.get("state")} ) return _obj diff --git a/python_client/mozart_api/models/compression.py b/python_client/mozart_api/models/compression.py index 9d61858..f0cc294 100644 --- a/python_client/mozart_api/models/compression.py +++ b/python_client/mozart_api/models/compression.py @@ -18,57 +18,74 @@ import re # noqa: F401 import json - -from pydantic import BaseModel, Field, StrictStr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self class Compression(BaseModel): """ Compression - """ + """ # noqa: E501 - value: StrictStr = Field(..., description="Selected compression value") - __properties = ["value"] + value: StrictStr = Field(description="Selected compression value") + __properties: ClassVar[List[str]] = ["value"] - @validator("value") + @field_validator("value") def value_validate_enum(cls, value): """Validates the enum""" - if value not in ("off", "medium", "maximum"): + if value not in set(["off", "medium", "maximum"]): raise ValueError("must be one of enum values ('off', 'medium', 'maximum')") return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Compression: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Compression from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> Compression: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Compression from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Compression.parse_obj(obj) + return cls.model_validate(obj) - _obj = Compression.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/compression_feature.py b/python_client/mozart_api/models/compression_feature.py index 93eac62..90268b1 100644 --- a/python_client/mozart_api/models/compression_feature.py +++ b/python_client/mozart_api/models/compression_feature.py @@ -18,53 +18,67 @@ import re # noqa: F401 import json - -from typing import List -from pydantic import BaseModel, Field, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List from mozart_api.models.compression import Compression +from typing import Optional, Set +from typing_extensions import Self class CompressionFeature(BaseModel): """ CompressionFeature - """ + """ # noqa: E501 - value: StrictStr = Field(..., description="Selected compression value") - default: Compression = Field(...) - range: conlist(Compression, unique_items=True) = Field( - ..., description="compression range" - ) - __properties = ["value", "default", "range"] + value: StrictStr = Field(description="Selected compression value") + default: Compression + range: List[Compression] = Field(description="compression range") + __properties: ClassVar[List[str]] = ["value", "default", "range"] - @validator("value") + @field_validator("value") def value_validate_enum(cls, value): """Validates the enum""" - if value not in ("off", "medium", "maximum"): + if value not in set(["off", "medium", "maximum"]): raise ValueError("must be one of enum values ('off', 'medium', 'maximum')") return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CompressionFeature: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of CompressionFeature from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -78,23 +92,27 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> CompressionFeature: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of CompressionFeature from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CompressionFeature.parse_obj(obj) + return cls.model_validate(obj) - _obj = CompressionFeature.parse_obj( + _obj = cls.model_validate( { "value": obj.get("value"), - "default": Compression.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [Compression.from_dict(_item) for _item in obj.get("range")] - if obj.get("range") is not None - else None, + "default": ( + Compression.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [Compression.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/compression_range.py b/python_client/mozart_api/models/compression_range.py index ce3acf5..39eecbc 100644 --- a/python_client/mozart_api/models/compression_range.py +++ b/python_client/mozart_api/models/compression_range.py @@ -18,45 +18,59 @@ import re # noqa: F401 import json - -from typing import List -from pydantic import BaseModel, Field, conlist +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List from mozart_api.models.compression import Compression +from typing import Optional, Set +from typing_extensions import Self class CompressionRange(BaseModel): """ CompressionRange - """ + """ # noqa: E501 - default: Compression = Field(...) - range: conlist(Compression, unique_items=True) = Field( - ..., description="compression range" - ) - __properties = ["default", "range"] + default: Compression + range: List[Compression] = Field(description="compression range") + __properties: ClassVar[List[str]] = ["default", "range"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CompressionRange: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of CompressionRange from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -70,22 +84,26 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> CompressionRange: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of CompressionRange from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CompressionRange.parse_obj(obj) + return cls.model_validate(obj) - _obj = CompressionRange.parse_obj( + _obj = cls.model_validate( { - "default": Compression.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [Compression.from_dict(_item) for _item in obj.get("range")] - if obj.get("range") is not None - else None, + "default": ( + Compression.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [Compression.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/content_item.py b/python_client/mozart_api/models/content_item.py index de364de..73abc45 100644 --- a/python_client/mozart_api/models/content_item.py +++ b/python_client/mozart_api/models/content_item.py @@ -18,85 +18,103 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.source_type_enum import SourceTypeEnum +from typing import Optional, Set +from typing_extensions import Self class ContentItem(BaseModel): """ ContentItem - """ + """ # noqa: E501 - categories: Optional[conlist(StrictStr)] = None - content_uri: StrictStr = Field(..., alias="contentUri") + categories: Optional[List[StrictStr]] = None + content_uri: StrictStr = Field(alias="contentUri") label: Optional[StrictStr] = None - source: SourceTypeEnum = Field(...) - __properties = ["categories", "contentUri", "label", "source"] + source: SourceTypeEnum + __properties: ClassVar[List[str]] = ["categories", "contentUri", "label", "source"] - @validator("categories") + @field_validator("categories") def categories_validate_enum(cls, value): """Validates the enum""" if value is None: return value for i in value: - if i not in ("music", "movie", "tv", "hdmi", "app"): + if i not in set(["music", "movie", "tv", "hdmi", "app"]): raise ValueError( "each list item must be one of ('music', 'movie', 'tv', 'hdmi', 'app')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ContentItem: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ContentItem from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of source if self.source: _dict["source"] = self.source.to_dict() # set to None if label (nullable) is None - # and __fields_set__ contains the field - if self.label is None and "label" in self.__fields_set__: + # and model_fields_set contains the field + if self.label is None and "label" in self.model_fields_set: _dict["label"] = None return _dict @classmethod - def from_dict(cls, obj: dict) -> ContentItem: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ContentItem from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ContentItem.parse_obj(obj) + return cls.model_validate(obj) - _obj = ContentItem.parse_obj( + _obj = cls.model_validate( { "categories": obj.get("categories"), - "content_uri": obj.get("contentUri"), + "contentUri": obj.get("contentUri"), "label": obj.get("label"), - "source": SourceTypeEnum.from_dict(obj.get("source")) - if obj.get("source") is not None - else None, + "source": ( + SourceTypeEnum.from_dict(obj["source"]) + if obj.get("source") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/directivity.py b/python_client/mozart_api/models/directivity.py index 544eb3d..314b948 100644 --- a/python_client/mozart_api/models/directivity.py +++ b/python_client/mozart_api/models/directivity.py @@ -18,67 +18,78 @@ import re # noqa: F401 import json - -from pydantic import BaseModel, Field, StrictStr, validator +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self class Directivity(BaseModel): """ Directivity - """ + """ # noqa: E501 - value: StrictStr = Field(...) - __properties = ["value"] + value: StrictStr + __properties: ClassVar[List[str]] = ["value"] - @validator("value") + @field_validator("value") def value_validate_enum(cls, value): """Validates the enum""" - if value not in ( - "front", - "left", - "right", - "omni", - "narrow", - "wide", - "standalone", + if value not in set( + ["front", "left", "right", "omni", "narrow", "wide", "standalone"] ): raise ValueError( "must be one of enum values ('front', 'left', 'right', 'omni', 'narrow', 'wide', 'standalone')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Directivity: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Directivity from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> Directivity: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Directivity from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Directivity.parse_obj(obj) + return cls.model_validate(obj) - _obj = Directivity.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/directivity_feature.py b/python_client/mozart_api/models/directivity_feature.py index c7b742d..df0590d 100644 --- a/python_client/mozart_api/models/directivity_feature.py +++ b/python_client/mozart_api/models/directivity_feature.py @@ -18,63 +18,73 @@ import re # noqa: F401 import json - -from typing import List -from pydantic import BaseModel, Field, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List from mozart_api.models.directivity import Directivity +from typing import Optional, Set +from typing_extensions import Self class DirectivityFeature(BaseModel): """ DirectivityFeature - """ + """ # noqa: E501 - value: StrictStr = Field(...) - default: Directivity = Field(...) - range: conlist(Directivity, unique_items=True) = Field( - ..., description="Product and role specific list of directivities" + value: StrictStr + default: Directivity + range: List[Directivity] = Field( + description="Product and role specific list of directivities" ) - __properties = ["value", "default", "range"] + __properties: ClassVar[List[str]] = ["value", "default", "range"] - @validator("value") + @field_validator("value") def value_validate_enum(cls, value): """Validates the enum""" - if value not in ( - "front", - "left", - "right", - "omni", - "narrow", - "wide", - "standalone", + if value not in set( + ["front", "left", "right", "omni", "narrow", "wide", "standalone"] ): raise ValueError( "must be one of enum values ('front', 'left', 'right', 'omni', 'narrow', 'wide', 'standalone')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> DirectivityFeature: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of DirectivityFeature from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -88,23 +98,27 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> DirectivityFeature: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of DirectivityFeature from a dict""" if obj is None: return None if not isinstance(obj, dict): - return DirectivityFeature.parse_obj(obj) + return cls.model_validate(obj) - _obj = DirectivityFeature.parse_obj( + _obj = cls.model_validate( { "value": obj.get("value"), - "default": Directivity.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [Directivity.from_dict(_item) for _item in obj.get("range")] - if obj.get("range") is not None - else None, + "default": ( + Directivity.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [Directivity.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/directivity_range.py b/python_client/mozart_api/models/directivity_range.py index d5a4aea..833051f 100644 --- a/python_client/mozart_api/models/directivity_range.py +++ b/python_client/mozart_api/models/directivity_range.py @@ -18,45 +18,61 @@ import re # noqa: F401 import json - -from typing import List -from pydantic import BaseModel, Field, conlist +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List from mozart_api.models.directivity import Directivity +from typing import Optional, Set +from typing_extensions import Self class DirectivityRange(BaseModel): """ DirectivityRange - """ + """ # noqa: E501 - default: Directivity = Field(...) - range: conlist(Directivity, unique_items=True) = Field( - ..., description="Product and role specific list of directivities" + default: Directivity + range: List[Directivity] = Field( + description="Product and role specific list of directivities" ) - __properties = ["default", "range"] + __properties: ClassVar[List[str]] = ["default", "range"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> DirectivityRange: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of DirectivityRange from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -70,22 +86,26 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> DirectivityRange: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of DirectivityRange from a dict""" if obj is None: return None if not isinstance(obj, dict): - return DirectivityRange.parse_obj(obj) + return cls.model_validate(obj) - _obj = DirectivityRange.parse_obj( + _obj = cls.model_validate( { - "default": Directivity.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [Directivity.from_dict(_item) for _item in obj.get("range")] - if obj.get("range") is not None - else None, + "default": ( + Directivity.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [Directivity.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/error_model.py b/python_client/mozart_api/models/error_model.py index 0a896c1..f88e076 100644 --- a/python_client/mozart_api/models/error_model.py +++ b/python_client/mozart_api/models/error_model.py @@ -18,71 +18,87 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class ErrorModel(BaseModel): """ - the general error model # noqa: E501 - """ + the general error model + """ # noqa: E501 error_code: Optional[StrictStr] = Field( - None, - alias="errorCode", + default=None, description="A wellknown code that signal the error, can be used by callers ", + alias="errorCode", ) error_id: Optional[StrictStr] = Field( - None, - alias="errorId", + default=None, description="A unique identifier used to e.g. quick find in logs ", + alias="errorId", ) error_message: Optional[StrictStr] = Field( - None, - alias="errorMessage", + default=None, description="A textual representation, human readable and suitable for logs ", + alias="errorMessage", ) - __properties = ["errorCode", "errorId", "errorMessage"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["errorCode", "errorId", "errorMessage"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ErrorModel: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ErrorModel from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> ErrorModel: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ErrorModel from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ErrorModel.parse_obj(obj) + return cls.model_validate(obj) - _obj = ErrorModel.parse_obj( + _obj = cls.model_validate( { - "error_code": obj.get("errorCode"), - "error_id": obj.get("errorId"), - "error_message": obj.get("errorMessage"), + "errorCode": obj.get("errorCode"), + "errorId": obj.get("errorId"), + "errorMessage": obj.get("errorMessage"), } ) return _obj diff --git a/python_client/mozart_api/models/fader.py b/python_client/mozart_api/models/fader.py index 19b3145..2ee7b9a 100644 --- a/python_client/mozart_api/models/fader.py +++ b/python_client/mozart_api/models/fader.py @@ -18,53 +18,67 @@ import re # noqa: F401 import json - -from typing import Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self class Fader(BaseModel): """ Fader - """ - - value: Union[StrictFloat, StrictInt] = Field( - ..., description="Selected fader value" - ) - __properties = ["value"] + """ # noqa: E501 - class Config: - """Pydantic configuration""" + value: Union[StrictFloat, StrictInt] = Field(description="Selected fader value") + __properties: ClassVar[List[str]] = ["value"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Fader: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Fader from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> Fader: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Fader from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Fader.parse_obj(obj) + return cls.model_validate(obj) - _obj = Fader.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/fader_feature.py b/python_client/mozart_api/models/fader_feature.py index 3271623..ffa9edd 100644 --- a/python_client/mozart_api/models/fader_feature.py +++ b/python_client/mozart_api/models/fader_feature.py @@ -18,46 +18,60 @@ import re # noqa: F401 import json - -from typing import List, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union from mozart_api.models.fader import Fader +from typing import Optional, Set +from typing_extensions import Self class FaderFeature(BaseModel): """ FaderFeature - """ + """ # noqa: E501 - value: Union[StrictFloat, StrictInt] = Field( - ..., description="Selected fader value" - ) - default: Fader = Field(...) - range: conlist(Fader, unique_items=True) = Field(..., description="fader range") - __properties = ["value", "default", "range"] + value: Union[StrictFloat, StrictInt] = Field(description="Selected fader value") + default: Fader + range: List[Fader] = Field(description="fader range") + __properties: ClassVar[List[str]] = ["value", "default", "range"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> FaderFeature: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of FaderFeature from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -71,23 +85,27 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> FaderFeature: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of FaderFeature from a dict""" if obj is None: return None if not isinstance(obj, dict): - return FaderFeature.parse_obj(obj) + return cls.model_validate(obj) - _obj = FaderFeature.parse_obj( + _obj = cls.model_validate( { "value": obj.get("value"), - "default": Fader.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [Fader.from_dict(_item) for _item in obj.get("range")] - if obj.get("range") is not None - else None, + "default": ( + Fader.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [Fader.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/fader_range.py b/python_client/mozart_api/models/fader_range.py index 2b64881..1279448 100644 --- a/python_client/mozart_api/models/fader_range.py +++ b/python_client/mozart_api/models/fader_range.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import List -from pydantic import BaseModel, Field, conlist +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List from mozart_api.models.fader import Fader +from typing import Optional, Set +from typing_extensions import Self class FaderRange(BaseModel): """ FaderRange - """ + """ # noqa: E501 - default: Fader = Field(...) - range: conlist(Fader, unique_items=True) = Field(..., description="fader range") - __properties = ["default", "range"] + default: Fader + range: List[Fader] = Field(description="fader range") + __properties: ClassVar[List[str]] = ["default", "range"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> FaderRange: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of FaderRange from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -68,22 +84,26 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> FaderRange: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of FaderRange from a dict""" if obj is None: return None if not isinstance(obj, dict): - return FaderRange.parse_obj(obj) + return cls.model_validate(obj) - _obj = FaderRange.parse_obj( + _obj = cls.model_validate( { - "default": Fader.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [Fader.from_dict(_item) for _item in obj.get("range")] - if obj.get("range") is not None - else None, + "default": ( + Fader.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [Fader.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/hdmi_input.py b/python_client/mozart_api/models/hdmi_input.py index 9b76c6b..9546d37 100644 --- a/python_client/mozart_api/models/hdmi_input.py +++ b/python_client/mozart_api/models/hdmi_input.py @@ -18,58 +18,74 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class HdmiInput(BaseModel): """ HdmiInput - """ + """ # noqa: E501 content_uri: Optional[StrictStr] = Field( - None, - alias="contentUri", + default=None, description="This points to the editable content trigger for this specific hdmi input", + alias="contentUri", ) input: Optional[StrictStr] = None - __properties = ["contentUri", "input"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["contentUri", "input"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> HdmiInput: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of HdmiInput from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> HdmiInput: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of HdmiInput from a dict""" if obj is None: return None if not isinstance(obj, dict): - return HdmiInput.parse_obj(obj) + return cls.model_validate(obj) - _obj = HdmiInput.parse_obj( - {"content_uri": obj.get("contentUri"), "input": obj.get("input")} + _obj = cls.model_validate( + {"contentUri": obj.get("contentUri"), "input": obj.get("input")} ) return _obj diff --git a/python_client/mozart_api/models/hdmi_video_format.py b/python_client/mozart_api/models/hdmi_video_format.py index 65cbf05..2a2637e 100644 --- a/python_client/mozart_api/models/hdmi_video_format.py +++ b/python_client/mozart_api/models/hdmi_video_format.py @@ -18,45 +18,64 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, conint +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated from mozart_api.models.video_pixel_format import VideoPixelFormat from mozart_api.models.video_timings import VideoTimings +from typing import Optional, Set +from typing_extensions import Self class HdmiVideoFormat(BaseModel): """ HdmiVideoFormat - """ + """ # noqa: E501 - pixel_format: Optional[VideoPixelFormat] = Field(None, alias="pixelFormat") - v_ic: Optional[conint(strict=True, ge=0)] = Field(None, alias="vIC") - video_timings: Optional[VideoTimings] = Field(None, alias="videoTimings") - __properties = ["pixelFormat", "vIC", "videoTimings"] + pixel_format: Optional[VideoPixelFormat] = Field(default=None, alias="pixelFormat") + v_ic: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field( + default=None, alias="vIC" + ) + video_timings: Optional[VideoTimings] = Field(default=None, alias="videoTimings") + __properties: ClassVar[List[str]] = ["pixelFormat", "vIC", "videoTimings"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> HdmiVideoFormat: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of HdmiVideoFormat from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of pixel_format if self.pixel_format: _dict["pixelFormat"] = self.pixel_format.to_dict() @@ -66,23 +85,27 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> HdmiVideoFormat: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of HdmiVideoFormat from a dict""" if obj is None: return None if not isinstance(obj, dict): - return HdmiVideoFormat.parse_obj(obj) + return cls.model_validate(obj) - _obj = HdmiVideoFormat.parse_obj( + _obj = cls.model_validate( { - "pixel_format": VideoPixelFormat.from_dict(obj.get("pixelFormat")) - if obj.get("pixelFormat") is not None - else None, - "v_ic": obj.get("vIC"), - "video_timings": VideoTimings.from_dict(obj.get("videoTimings")) - if obj.get("videoTimings") is not None - else None, + "pixelFormat": ( + VideoPixelFormat.from_dict(obj["pixelFormat"]) + if obj.get("pixelFormat") is not None + else None + ), + "vIC": obj.get("vIC"), + "videoTimings": ( + VideoTimings.from_dict(obj["videoTimings"]) + if obj.get("videoTimings") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/home_control_ixp.py b/python_client/mozart_api/models/home_control_ixp.py new file mode 100644 index 0000000..18e8141 --- /dev/null +++ b/python_client/mozart_api/models/home_control_ixp.py @@ -0,0 +1,84 @@ +# coding: utf-8 + +""" + Mozart platform API + + API for interacting with the Mozart platform. + + The version of the OpenAPI document: 0.2.0 + Contact: support@bang-olufsen.dk + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + + +class HomeControlIxp(BaseModel): + """ + HomeControlIxp + """ # noqa: E501 + + uri: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["uri"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of HomeControlIxp from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of HomeControlIxp from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"uri": obj.get("uri")}) + return _obj diff --git a/python_client/mozart_api/models/home_control_uri.py b/python_client/mozart_api/models/home_control_uri.py index f905cac..ee191a9 100644 --- a/python_client/mozart_api/models/home_control_uri.py +++ b/python_client/mozart_api/models/home_control_uri.py @@ -18,51 +18,73 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class HomeControlUri(BaseModel): """ HomeControlUri - """ + """ # noqa: E501 + ixp: Optional[StrictStr] = None uri: Optional[StrictStr] = None - __properties = ["uri"] + __properties: ClassVar[List[str]] = ["ixp", "uri"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> HomeControlUri: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of HomeControlUri from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if ixp (nullable) is None + # and model_fields_set contains the field + if self.ixp is None and "ixp" in self.model_fields_set: + _dict["ixp"] = None + return _dict @classmethod - def from_dict(cls, obj: dict) -> HomeControlUri: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of HomeControlUri from a dict""" if obj is None: return None if not isinstance(obj, dict): - return HomeControlUri.parse_obj(obj) + return cls.model_validate(obj) - _obj = HomeControlUri.parse_obj({"uri": obj.get("uri")}) + _obj = cls.model_validate({"ixp": obj.get("ixp"), "uri": obj.get("uri")}) return _obj diff --git a/python_client/mozart_api/models/install_record_id_state.py b/python_client/mozart_api/models/install_record_id_state.py index 896745a..a4e5832 100644 --- a/python_client/mozart_api/models/install_record_id_state.py +++ b/python_client/mozart_api/models/install_record_id_state.py @@ -18,70 +18,88 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr, validator +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class InstallRecordIdState(BaseModel): """ InstallRecordIdState - """ + """ # noqa: E501 value: Optional[StrictStr] = None - __properties = ["value"] + __properties: ClassVar[List[str]] = ["value"] - @validator("value") + @field_validator("value") def value_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ( - "idle", - "gettingUrl", - "urlInvalid", - "downloading", - "downloadFinished", - "downloadFailed", + if value not in set( + [ + "idle", + "gettingUrl", + "urlInvalid", + "downloading", + "downloadFinished", + "downloadFailed", + ] ): raise ValueError( "must be one of enum values ('idle', 'gettingUrl', 'urlInvalid', 'downloading', 'downloadFinished', 'downloadFailed')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> InstallRecordIdState: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of InstallRecordIdState from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> InstallRecordIdState: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of InstallRecordIdState from a dict""" if obj is None: return None if not isinstance(obj, dict): - return InstallRecordIdState.parse_obj(obj) + return cls.model_validate(obj) - _obj = InstallRecordIdState.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/latency_profile.py b/python_client/mozart_api/models/latency_profile.py index 5c60254..c6e6b58 100644 --- a/python_client/mozart_api/models/latency_profile.py +++ b/python_client/mozart_api/models/latency_profile.py @@ -18,61 +18,77 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr, validator +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class LatencyProfile(BaseModel): """ - The latency profile of this speaker group. Needed to handle Beolab's with latency dependant audio quality. Default is set to performance. # noqa: E501 - """ + The latency profile of this speaker group. Needed to handle Beolab's with latency dependant audio quality. Default is set to performance. + """ # noqa: E501 value: Optional[StrictStr] = None - __properties = ["value"] + __properties: ClassVar[List[str]] = ["value"] - @validator("value") + @field_validator("value") def value_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("performance", "quality"): + if value not in set(["performance", "quality"]): raise ValueError("must be one of enum values ('performance', 'quality')") return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> LatencyProfile: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of LatencyProfile from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> LatencyProfile: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of LatencyProfile from a dict""" if obj is None: return None if not isinstance(obj, dict): - return LatencyProfile.parse_obj(obj) + return cls.model_validate(obj) - _obj = LatencyProfile.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/lge_tv_sound_settings.py b/python_client/mozart_api/models/lge_tv_sound_settings.py index 18d3ce8..e97d761 100644 --- a/python_client/mozart_api/models/lge_tv_sound_settings.py +++ b/python_client/mozart_api/models/lge_tv_sound_settings.py @@ -18,95 +18,120 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr, validator +from pydantic import ( + BaseModel, + ConfigDict, + Field, + StrictBool, + StrictStr, + field_validator, +) +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class LgeTvSoundSettings(BaseModel): """ LgeTvSoundSettings - """ + """ # noqa: E501 - digital_output: Optional[StrictStr] = Field(None, alias="digitalOutput") - e_arc: Optional[StrictBool] = Field(None, alias="eArc") + digital_output: Optional[StrictStr] = Field(default=None, alias="digitalOutput") + e_arc: Optional[StrictBool] = Field(default=None, alias="eArc") output: Optional[StrictStr] = None - __properties = ["digitalOutput", "eArc", "output"] + __properties: ClassVar[List[str]] = ["digitalOutput", "eArc", "output"] - @validator("digital_output") + @field_validator("digital_output") def digital_output_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("auto", "passThrough", "pcm", "unknown"): + if value not in set(["auto", "passThrough", "pcm", "unknown"]): raise ValueError( "must be one of enum values ('auto', 'passThrough', 'pcm', 'unknown')" ) return value - @validator("output") + @field_validator("output") def output_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ( - "tvSpeaker", - "externalOptical", - "externalArc", - "bluetooth", - "wisaSpeakers", - "lineout", - "headphone", - "tvSpeakerAndExternalOptical", - "tvSpeakerAndHeadphone", - "tvSpeakerAndBluetooth", - "externalArcBno", - "unknown", + if value not in set( + [ + "tvSpeaker", + "externalOptical", + "externalArc", + "bluetooth", + "wisaSpeakers", + "lineout", + "headphone", + "tvSpeakerAndExternalOptical", + "tvSpeakerAndHeadphone", + "tvSpeakerAndBluetooth", + "externalArcBno", + "unknown", + ] ): raise ValueError( "must be one of enum values ('tvSpeaker', 'externalOptical', 'externalArc', 'bluetooth', 'wisaSpeakers', 'lineout', 'headphone', 'tvSpeakerAndExternalOptical', 'tvSpeakerAndHeadphone', 'tvSpeakerAndBluetooth', 'externalArcBno', 'unknown')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> LgeTvSoundSettings: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of LgeTvSoundSettings from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> LgeTvSoundSettings: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of LgeTvSoundSettings from a dict""" if obj is None: return None if not isinstance(obj, dict): - return LgeTvSoundSettings.parse_obj(obj) + return cls.model_validate(obj) - _obj = LgeTvSoundSettings.parse_obj( + _obj = cls.model_validate( { - "digital_output": obj.get("digitalOutput"), - "e_arc": obj.get("eArc"), + "digitalOutput": obj.get("digitalOutput"), + "eArc": obj.get("eArc"), "output": obj.get("output"), } ) diff --git a/python_client/mozart_api/models/listening_mode.py b/python_client/mozart_api/models/listening_mode.py index 4f998ef..2edce14 100644 --- a/python_client/mozart_api/models/listening_mode.py +++ b/python_client/mozart_api/models/listening_mode.py @@ -18,74 +18,105 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conint, conlist, constr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated from mozart_api.models.listening_mode_features import ListeningModeFeatures from mozart_api.models.listening_mode_trigger import ListeningModeTrigger +from typing import Optional, Set +from typing_extensions import Self class ListeningMode(BaseModel): """ ListeningMode - """ + """ # noqa: E501 - client_ctx: Optional[constr(strict=True, max_length=4096)] = Field( - None, - alias="clientCtx", + client_ctx: Optional[Annotated[str, Field(strict=True, max_length=4096)]] = Field( + default=None, description="An optional generic string property supplied from the client. If provided, it will be stored without changes. If not supplied, any current clientCtx will remain unchanged. ", + alias="clientCtx", ) - features: ListeningModeFeatures = Field(...) - id: conint(strict=True, ge=0) = Field(...) - name: StrictStr = Field(..., description="Friendly name") + features: ListeningModeFeatures + id: Annotated[int, Field(strict=True, ge=0)] + name: StrictStr = Field(description="Friendly name") origin: Optional[StrictStr] = Field( - None, description="User created, default or an edited default listening mode" + default=None, + description="User created, default or an edited default listening mode", ) - role: StrictStr = Field(..., description="Role a listening mode applies to") - triggers: conlist(ListeningModeTrigger) = Field(...) - __properties = ["clientCtx", "features", "id", "name", "origin", "role", "triggers"] - - @validator("origin") + role: Optional[StrictStr] = Field( + default=None, description="Role a listening mode applies to" + ) + triggers: List[ListeningModeTrigger] + __properties: ClassVar[List[str]] = [ + "clientCtx", + "features", + "id", + "name", + "origin", + "role", + "triggers", + ] + + @field_validator("origin") def origin_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("user", "default", "edited"): + if value not in set(["user", "default", "edited"]): raise ValueError("must be one of enum values ('user', 'default', 'edited')") return value - @validator("role") + @field_validator("role") def role_validate_enum(cls, value): """Validates the enum""" - if value not in ("standalone", "multichannel"): + if value is None: + return value + + if value not in set(["standalone", "multichannel", "all"]): raise ValueError( - "must be one of enum values ('standalone', 'multichannel')" + "must be one of enum values ('standalone', 'multichannel', 'all')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListeningMode: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ListeningMode from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of features if self.features: _dict["features"] = self.features.to_dict() @@ -97,37 +128,43 @@ def to_dict(self): _items.append(_item.to_dict()) _dict["triggers"] = _items # set to None if client_ctx (nullable) is None - # and __fields_set__ contains the field - if self.client_ctx is None and "client_ctx" in self.__fields_set__: + # and model_fields_set contains the field + if self.client_ctx is None and "client_ctx" in self.model_fields_set: _dict["clientCtx"] = None + # set to None if role (nullable) is None + # and model_fields_set contains the field + if self.role is None and "role" in self.model_fields_set: + _dict["role"] = None + return _dict @classmethod - def from_dict(cls, obj: dict) -> ListeningMode: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ListeningMode from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListeningMode.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListeningMode.parse_obj( + _obj = cls.model_validate( { - "client_ctx": obj.get("clientCtx"), - "features": ListeningModeFeatures.from_dict(obj.get("features")) - if obj.get("features") is not None - else None, + "clientCtx": obj.get("clientCtx"), + "features": ( + ListeningModeFeatures.from_dict(obj["features"]) + if obj.get("features") is not None + else None + ), "id": obj.get("id"), "name": obj.get("name"), "origin": obj.get("origin"), "role": obj.get("role"), - "triggers": [ - ListeningModeTrigger.from_dict(_item) - for _item in obj.get("triggers") - ] - if obj.get("triggers") is not None - else None, + "triggers": ( + [ListeningModeTrigger.from_dict(_item) for _item in obj["triggers"]] + if obj.get("triggers") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/listening_mode_features.py b/python_client/mozart_api/models/listening_mode_features.py index e78ad96..0d9a13a 100644 --- a/python_client/mozart_api/models/listening_mode_features.py +++ b/python_client/mozart_api/models/listening_mode_features.py @@ -18,9 +18,8 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.ambience import Ambience from mozart_api.models.balance import Balance from mozart_api.models.bass_management import BassManagement @@ -35,34 +34,40 @@ from mozart_api.models.spatial_width import SpatialWidth from mozart_api.models.speech_enhance import SpeechEnhance from mozart_api.models.tone_touch import ToneTouch +from typing import Optional, Set +from typing_extensions import Self class ListeningModeFeatures(BaseModel): """ - Sound features to apply # noqa: E501 - """ + Sound features to apply + """ # noqa: E501 ambience: Optional[Ambience] = None balance: Optional[Balance] = None - bass_management: Optional[BassManagement] = Field(None, alias="bassManagement") + bass_management: Optional[BassManagement] = Field( + default=None, alias="bassManagement" + ) compression: Optional[Compression] = None directivity: Optional[Directivity] = None fader: Optional[Fader] = None room_compensation: Optional[RoomCompensation] = Field( - None, alias="roomCompensation" + default=None, alias="roomCompensation" ) spatial_envelopment: Optional[SpatialEnvelopment] = Field( - None, alias="spatialEnvelopment" + default=None, alias="spatialEnvelopment" ) - spatial_height: Optional[SpatialHeight] = Field(None, alias="spatialHeight") + spatial_height: Optional[SpatialHeight] = Field(default=None, alias="spatialHeight") spatial_processing: Optional[SpatialProcessing] = Field( - None, alias="spatialProcessing" + default=None, alias="spatialProcessing" ) - spatial_surround: Optional[SpatialSurround] = Field(None, alias="spatialSurround") - spatial_width: Optional[SpatialWidth] = Field(None, alias="spatialWidth") - speech_enhance: Optional[SpeechEnhance] = Field(None, alias="speechEnhance") - tone_touch: Optional[ToneTouch] = Field(None, alias="toneTouch") - __properties = [ + spatial_surround: Optional[SpatialSurround] = Field( + default=None, alias="spatialSurround" + ) + spatial_width: Optional[SpatialWidth] = Field(default=None, alias="spatialWidth") + speech_enhance: Optional[SpeechEnhance] = Field(default=None, alias="speechEnhance") + tone_touch: Optional[ToneTouch] = Field(default=None, alias="toneTouch") + __properties: ClassVar[List[str]] = [ "ambience", "balance", "bassManagement", @@ -79,28 +84,43 @@ class ListeningModeFeatures(BaseModel): "toneTouch", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListeningModeFeatures: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ListeningModeFeatures from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of ambience if self.ambience: _dict["ambience"] = self.ambience.to_dict() @@ -146,66 +166,86 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListeningModeFeatures: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ListeningModeFeatures from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListeningModeFeatures.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListeningModeFeatures.parse_obj( + _obj = cls.model_validate( { - "ambience": Ambience.from_dict(obj.get("ambience")) - if obj.get("ambience") is not None - else None, - "balance": Balance.from_dict(obj.get("balance")) - if obj.get("balance") is not None - else None, - "bass_management": BassManagement.from_dict(obj.get("bassManagement")) - if obj.get("bassManagement") is not None - else None, - "compression": Compression.from_dict(obj.get("compression")) - if obj.get("compression") is not None - else None, - "directivity": Directivity.from_dict(obj.get("directivity")) - if obj.get("directivity") is not None - else None, - "fader": Fader.from_dict(obj.get("fader")) - if obj.get("fader") is not None - else None, - "room_compensation": RoomCompensation.from_dict( - obj.get("roomCompensation") - ) - if obj.get("roomCompensation") is not None - else None, - "spatial_envelopment": SpatialEnvelopment.from_dict( - obj.get("spatialEnvelopment") - ) - if obj.get("spatialEnvelopment") is not None - else None, - "spatial_height": SpatialHeight.from_dict(obj.get("spatialHeight")) - if obj.get("spatialHeight") is not None - else None, - "spatial_processing": SpatialProcessing.from_dict( - obj.get("spatialProcessing") - ) - if obj.get("spatialProcessing") is not None - else None, - "spatial_surround": SpatialSurround.from_dict( - obj.get("spatialSurround") - ) - if obj.get("spatialSurround") is not None - else None, - "spatial_width": SpatialWidth.from_dict(obj.get("spatialWidth")) - if obj.get("spatialWidth") is not None - else None, - "speech_enhance": SpeechEnhance.from_dict(obj.get("speechEnhance")) - if obj.get("speechEnhance") is not None - else None, - "tone_touch": ToneTouch.from_dict(obj.get("toneTouch")) - if obj.get("toneTouch") is not None - else None, + "ambience": ( + Ambience.from_dict(obj["ambience"]) + if obj.get("ambience") is not None + else None + ), + "balance": ( + Balance.from_dict(obj["balance"]) + if obj.get("balance") is not None + else None + ), + "bassManagement": ( + BassManagement.from_dict(obj["bassManagement"]) + if obj.get("bassManagement") is not None + else None + ), + "compression": ( + Compression.from_dict(obj["compression"]) + if obj.get("compression") is not None + else None + ), + "directivity": ( + Directivity.from_dict(obj["directivity"]) + if obj.get("directivity") is not None + else None + ), + "fader": ( + Fader.from_dict(obj["fader"]) + if obj.get("fader") is not None + else None + ), + "roomCompensation": ( + RoomCompensation.from_dict(obj["roomCompensation"]) + if obj.get("roomCompensation") is not None + else None + ), + "spatialEnvelopment": ( + SpatialEnvelopment.from_dict(obj["spatialEnvelopment"]) + if obj.get("spatialEnvelopment") is not None + else None + ), + "spatialHeight": ( + SpatialHeight.from_dict(obj["spatialHeight"]) + if obj.get("spatialHeight") is not None + else None + ), + "spatialProcessing": ( + SpatialProcessing.from_dict(obj["spatialProcessing"]) + if obj.get("spatialProcessing") is not None + else None + ), + "spatialSurround": ( + SpatialSurround.from_dict(obj["spatialSurround"]) + if obj.get("spatialSurround") is not None + else None + ), + "spatialWidth": ( + SpatialWidth.from_dict(obj["spatialWidth"]) + if obj.get("spatialWidth") is not None + else None + ), + "speechEnhance": ( + SpeechEnhance.from_dict(obj["speechEnhance"]) + if obj.get("speechEnhance") is not None + else None + ), + "toneTouch": ( + ToneTouch.from_dict(obj["toneTouch"]) + if obj.get("toneTouch") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/listening_mode_props.py b/python_client/mozart_api/models/listening_mode_props.py index e301af1..ceadbce 100644 --- a/python_client/mozart_api/models/listening_mode_props.py +++ b/python_client/mozart_api/models/listening_mode_props.py @@ -18,79 +18,105 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conint, conlist, constr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated from mozart_api.models.listening_mode_features import ListeningModeFeatures from mozart_api.models.listening_mode_trigger import ListeningModeTrigger +from typing import Optional, Set +from typing_extensions import Self class ListeningModeProps(BaseModel): """ ListeningModeProps - """ + """ # noqa: E501 - client_ctx: Optional[constr(strict=True, max_length=4096)] = Field( - None, - alias="clientCtx", + client_ctx: Optional[Annotated[str, Field(strict=True, max_length=4096)]] = Field( + default=None, description="An optional generic string property supplied from the client. If provided, it will be stored without changes. If not supplied, any current clientCtx will remain unchanged. ", + alias="clientCtx", ) features: Optional[ListeningModeFeatures] = None - id: Optional[conint(strict=True, ge=0)] = None - name: Optional[StrictStr] = Field(None, description="Friendly name") + id: Optional[Annotated[int, Field(strict=True, ge=0)]] = None + name: Optional[StrictStr] = Field(default=None, description="Friendly name") origin: Optional[StrictStr] = Field( - None, description="User created, default or an edited default listening mode" + default=None, + description="User created, default or an edited default listening mode", ) role: Optional[StrictStr] = Field( - None, description="Role a listening mode applies to" + default=None, description="Role a listening mode applies to" ) - triggers: Optional[conlist(ListeningModeTrigger)] = None - __properties = ["clientCtx", "features", "id", "name", "origin", "role", "triggers"] - - @validator("origin") + triggers: Optional[List[ListeningModeTrigger]] = None + __properties: ClassVar[List[str]] = [ + "clientCtx", + "features", + "id", + "name", + "origin", + "role", + "triggers", + ] + + @field_validator("origin") def origin_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("user", "default", "edited"): + if value not in set(["user", "default", "edited"]): raise ValueError("must be one of enum values ('user', 'default', 'edited')") return value - @validator("role") + @field_validator("role") def role_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("standalone", "multichannel"): + if value not in set(["standalone", "multichannel", "all"]): raise ValueError( - "must be one of enum values ('standalone', 'multichannel')" + "must be one of enum values ('standalone', 'multichannel', 'all')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListeningModeProps: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ListeningModeProps from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of features if self.features: _dict["features"] = self.features.to_dict() @@ -102,37 +128,43 @@ def to_dict(self): _items.append(_item.to_dict()) _dict["triggers"] = _items # set to None if client_ctx (nullable) is None - # and __fields_set__ contains the field - if self.client_ctx is None and "client_ctx" in self.__fields_set__: + # and model_fields_set contains the field + if self.client_ctx is None and "client_ctx" in self.model_fields_set: _dict["clientCtx"] = None + # set to None if role (nullable) is None + # and model_fields_set contains the field + if self.role is None and "role" in self.model_fields_set: + _dict["role"] = None + return _dict @classmethod - def from_dict(cls, obj: dict) -> ListeningModeProps: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ListeningModeProps from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListeningModeProps.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListeningModeProps.parse_obj( + _obj = cls.model_validate( { - "client_ctx": obj.get("clientCtx"), - "features": ListeningModeFeatures.from_dict(obj.get("features")) - if obj.get("features") is not None - else None, + "clientCtx": obj.get("clientCtx"), + "features": ( + ListeningModeFeatures.from_dict(obj["features"]) + if obj.get("features") is not None + else None + ), "id": obj.get("id"), "name": obj.get("name"), "origin": obj.get("origin"), "role": obj.get("role"), - "triggers": [ - ListeningModeTrigger.from_dict(_item) - for _item in obj.get("triggers") - ] - if obj.get("triggers") is not None - else None, + "triggers": ( + [ListeningModeTrigger.from_dict(_item) for _item in obj["triggers"]] + if obj.get("triggers") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/listening_mode_ref.py b/python_client/mozart_api/models/listening_mode_ref.py index 5b3f170..241734e 100644 --- a/python_client/mozart_api/models/listening_mode_ref.py +++ b/python_client/mozart_api/models/listening_mode_ref.py @@ -18,70 +18,83 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr, conint +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self class ListeningModeRef(BaseModel): """ - Reference to a listening mode # noqa: E501 - """ + Reference to a listening mode + """ # noqa: E501 href: Optional[StrictStr] = Field( - ..., - description="Host relative URI of the listening mode or `null` if there is no active listening mode. ", + description="Host relative URI of the listening mode or `null` if there is no active listening mode. " ) - id: Optional[conint(strict=True, ge=0)] = Field( - ..., - description="ID of the active listening mode or `null` if there is no active listening mode. ", + id: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field( + description="ID of the active listening mode or `null` if there is no active listening mode. " ) - __properties = ["href", "id"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["href", "id"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListeningModeRef: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ListeningModeRef from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # set to None if href (nullable) is None - # and __fields_set__ contains the field - if self.href is None and "href" in self.__fields_set__: + # and model_fields_set contains the field + if self.href is None and "href" in self.model_fields_set: _dict["href"] = None # set to None if id (nullable) is None - # and __fields_set__ contains the field - if self.id is None and "id" in self.__fields_set__: + # and model_fields_set contains the field + if self.id is None and "id" in self.model_fields_set: _dict["id"] = None return _dict @classmethod - def from_dict(cls, obj: dict) -> ListeningModeRef: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ListeningModeRef from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListeningModeRef.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListeningModeRef.parse_obj( - {"href": obj.get("href"), "id": obj.get("id")} - ) + _obj = cls.model_validate({"href": obj.get("href"), "id": obj.get("id")}) return _obj diff --git a/python_client/mozart_api/models/listening_mode_trigger.py b/python_client/mozart_api/models/listening_mode_trigger.py index 5271b5d..68d9f53 100644 --- a/python_client/mozart_api/models/listening_mode_trigger.py +++ b/python_client/mozart_api/models/listening_mode_trigger.py @@ -14,16 +14,21 @@ from __future__ import annotations -from inspect import getfullargspec import json import pprint -import re # noqa: F401 - +from pydantic import ( + BaseModel, + ConfigDict, + Field, + StrictStr, + ValidationError, + field_validator, +) from typing import Any, List, Optional -from pydantic import BaseModel, Field, StrictStr, ValidationError, validator from mozart_api.models.power_link_trigger import PowerLinkTrigger -from typing import Union, Any, List, TYPE_CHECKING from pydantic import StrictStr, Field +from typing import Union, List, Optional, Dict +from typing_extensions import Literal, Self LISTENINGMODETRIGGER_ONE_OF_SCHEMAS = ["PowerLinkTrigger"] @@ -35,14 +40,13 @@ class ListeningModeTrigger(BaseModel): # data type: PowerLinkTrigger oneof_schema_1_validator: Optional[PowerLinkTrigger] = None - if TYPE_CHECKING: - actual_instance: Union[PowerLinkTrigger] - else: - actual_instance: Any - one_of_schemas: List[str] = Field(LISTENINGMODETRIGGER_ONE_OF_SCHEMAS, const=True) + actual_instance: Optional[Union[PowerLinkTrigger]] = None + one_of_schemas: List[str] = Field(default=Literal["PowerLinkTrigger"]) - class Config: - validate_assignment = True + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) def __init__(self, *args, **kwargs) -> None: if args: @@ -58,9 +62,9 @@ def __init__(self, *args, **kwargs) -> None: else: super().__init__(**kwargs) - @validator("actual_instance") + @field_validator("actual_instance") def actual_instance_must_validate_oneof(cls, v): - instance = ListeningModeTrigger.construct() + instance = ListeningModeTrigger.model_construct() error_messages = [] match = 0 # validate data type: PowerLinkTrigger @@ -86,13 +90,13 @@ def actual_instance_must_validate_oneof(cls, v): return v @classmethod - def from_dict(cls, obj: dict) -> ListeningModeTrigger: + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: return cls.from_json(json.dumps(obj)) @classmethod - def from_json(cls, json_str: str) -> ListeningModeTrigger: + def from_json(cls, json_str: str) -> Self: """Returns the object represented by the json string""" - instance = ListeningModeTrigger.construct() + instance = cls.model_construct() error_messages = [] match = 0 @@ -123,19 +127,21 @@ def to_json(self) -> str: if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable( + self.actual_instance.to_json + ): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> dict: + def to_dict(self) -> Optional[Union[Dict[str, Any], PowerLinkTrigger]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): + if hasattr(self.actual_instance, "to_dict") and callable( + self.actual_instance.to_dict + ): return self.actual_instance.to_dict() else: # primitive type @@ -143,4 +149,4 @@ def to_dict(self) -> dict: def to_str(self) -> str: """Returns the string representation of the actual instance""" - return pprint.pformat(self.dict()) + return pprint.pformat(self.model_dump()) diff --git a/python_client/mozart_api/models/loudness.py b/python_client/mozart_api/models/loudness.py index 6c68a3d..270a094 100644 --- a/python_client/mozart_api/models/loudness.py +++ b/python_client/mozart_api/models/loudness.py @@ -18,51 +18,67 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictBool +from pydantic import BaseModel, ConfigDict, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class Loudness(BaseModel): """ Loudness - """ + """ # noqa: E501 value: Optional[StrictBool] = None - __properties = ["value"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["value"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Loudness: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Loudness from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> Loudness: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Loudness from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Loudness.parse_obj(obj) + return cls.model_validate(obj) - _obj = Loudness.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/microphone_state.py b/python_client/mozart_api/models/microphone_state.py index 4c35b37..cbe2caf 100644 --- a/python_client/mozart_api/models/microphone_state.py +++ b/python_client/mozart_api/models/microphone_state.py @@ -18,61 +18,77 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr, validator +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class MicrophoneState(BaseModel): """ MicrophoneState - """ + """ # noqa: E501 value: Optional[StrictStr] = None - __properties = ["value"] + __properties: ClassVar[List[str]] = ["value"] - @validator("value") + @field_validator("value") def value_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("on", "off"): + if value not in set(["on", "off"]): raise ValueError("must be one of enum values ('on', 'off')") return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> MicrophoneState: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of MicrophoneState from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> MicrophoneState: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of MicrophoneState from a dict""" if obj is None: return None if not isinstance(obj, dict): - return MicrophoneState.parse_obj(obj) + return cls.model_validate(obj) - _obj = MicrophoneState.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/microphones_state.py b/python_client/mozart_api/models/microphones_state.py index 0e45138..a456503 100644 --- a/python_client/mozart_api/models/microphones_state.py +++ b/python_client/mozart_api/models/microphones_state.py @@ -18,45 +18,63 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.microphone_state import MicrophoneState +from typing import Optional, Set +from typing_extensions import Self class MicrophonesState(BaseModel): """ - state of microphones, both physical switches and software state # noqa: E501 - """ + state of microphones, both physical switches and software state + """ # noqa: E501 - microphone_state: Optional[MicrophoneState] = Field(None, alias="microphoneState") + microphone_state: Optional[MicrophoneState] = Field( + default=None, alias="microphoneState" + ) microphone_switch_state: Optional[MicrophoneState] = Field( - None, alias="microphoneSwitchState" + default=None, alias="microphoneSwitchState" ) - __properties = ["microphoneState", "microphoneSwitchState"] + __properties: ClassVar[List[str]] = ["microphoneState", "microphoneSwitchState"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> MicrophonesState: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of MicrophonesState from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of microphone_state if self.microphone_state: _dict["microphoneState"] = self.microphone_state.to_dict() @@ -66,26 +84,26 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> MicrophonesState: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of MicrophonesState from a dict""" if obj is None: return None if not isinstance(obj, dict): - return MicrophonesState.parse_obj(obj) + return cls.model_validate(obj) - _obj = MicrophonesState.parse_obj( + _obj = cls.model_validate( { - "microphone_state": MicrophoneState.from_dict( - obj.get("microphoneState") - ) - if obj.get("microphoneState") is not None - else None, - "microphone_switch_state": MicrophoneState.from_dict( - obj.get("microphoneSwitchState") - ) - if obj.get("microphoneSwitchState") is not None - else None, + "microphoneState": ( + MicrophoneState.from_dict(obj["microphoneState"]) + if obj.get("microphoneState") is not None + else None + ), + "microphoneSwitchState": ( + MicrophoneState.from_dict(obj["microphoneSwitchState"]) + if obj.get("microphoneSwitchState") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/overlay_play_request.py b/python_client/mozart_api/models/overlay_play_request.py index ba55302..5583232 100644 --- a/python_client/mozart_api/models/overlay_play_request.py +++ b/python_client/mozart_api/models/overlay_play_request.py @@ -18,9 +18,9 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, conint +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated from mozart_api.models.overlay_play_request_from_usb_from_usb import ( OverlayPlayRequestFromUsbFromUsb, ) @@ -28,47 +28,71 @@ OverlayPlayRequestTextToSpeechTextToSpeech, ) from mozart_api.models.uri import Uri +from typing import Optional, Set +from typing_extensions import Self class OverlayPlayRequest(BaseModel): """ OverlayPlayRequest - """ + """ # noqa: E501 - volume_absolute: Optional[conint(strict=True, le=100, ge=0)] = Field( - None, - alias="volumeAbsolute", + volume_absolute: Optional[Annotated[int, Field(le=100, strict=True, ge=0)]] = Field( + default=None, description="An optional absolute volume level at which to play the URI. If not provided, the URI will play at the currently configured volume level on the product. The level should be provided in volume steps [0, 100] ", + alias="volumeAbsolute", ) uri: Optional[Uri] = None text_to_speech: Optional[OverlayPlayRequestTextToSpeechTextToSpeech] = Field( - None, alias="textToSpeech" + default=None, alias="textToSpeech" + ) + from_usb: Optional[OverlayPlayRequestFromUsbFromUsb] = Field( + default=None, alias="fromUsb" + ) + __properties: ClassVar[List[str]] = [ + "volumeAbsolute", + "uri", + "textToSpeech", + "fromUsb", + ] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), ) - from_usb: Optional[OverlayPlayRequestFromUsbFromUsb] = Field(None, alias="fromUsb") - __properties = ["volumeAbsolute", "uri", "textToSpeech", "fromUsb"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> OverlayPlayRequest: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of OverlayPlayRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of uri if self.uri: _dict["uri"] = self.uri.to_dict() @@ -79,37 +103,39 @@ def to_dict(self): if self.from_usb: _dict["fromUsb"] = self.from_usb.to_dict() # set to None if volume_absolute (nullable) is None - # and __fields_set__ contains the field - if self.volume_absolute is None and "volume_absolute" in self.__fields_set__: + # and model_fields_set contains the field + if self.volume_absolute is None and "volume_absolute" in self.model_fields_set: _dict["volumeAbsolute"] = None return _dict @classmethod - def from_dict(cls, obj: dict) -> OverlayPlayRequest: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of OverlayPlayRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return OverlayPlayRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = OverlayPlayRequest.parse_obj( + _obj = cls.model_validate( { - "volume_absolute": obj.get("volumeAbsolute"), - "uri": Uri.from_dict(obj.get("uri")) - if obj.get("uri") is not None - else None, - "text_to_speech": OverlayPlayRequestTextToSpeechTextToSpeech.from_dict( - obj.get("textToSpeech") - ) - if obj.get("textToSpeech") is not None - else None, - "from_usb": OverlayPlayRequestFromUsbFromUsb.from_dict( - obj.get("fromUsb") - ) - if obj.get("fromUsb") is not None - else None, + "volumeAbsolute": obj.get("volumeAbsolute"), + "uri": ( + Uri.from_dict(obj["uri"]) if obj.get("uri") is not None else None + ), + "textToSpeech": ( + OverlayPlayRequestTextToSpeechTextToSpeech.from_dict( + obj["textToSpeech"] + ) + if obj.get("textToSpeech") is not None + else None + ), + "fromUsb": ( + OverlayPlayRequestFromUsbFromUsb.from_dict(obj["fromUsb"]) + if obj.get("fromUsb") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/overlay_play_request_common.py b/python_client/mozart_api/models/overlay_play_request_common.py index 181de15..878e1a6 100644 --- a/python_client/mozart_api/models/overlay_play_request_common.py +++ b/python_client/mozart_api/models/overlay_play_request_common.py @@ -18,62 +18,77 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, conint +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self class OverlayPlayRequestCommon(BaseModel): """ OverlayPlayRequestCommon - """ + """ # noqa: E501 - volume_absolute: Optional[conint(strict=True, le=100, ge=0)] = Field( - None, - alias="volumeAbsolute", + volume_absolute: Optional[Annotated[int, Field(le=100, strict=True, ge=0)]] = Field( + default=None, description="An optional absolute volume level at which to play the URI. If not provided, the URI will play at the currently configured volume level on the product. The level should be provided in volume steps [0, 100] ", + alias="volumeAbsolute", ) - __properties = ["volumeAbsolute"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["volumeAbsolute"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> OverlayPlayRequestCommon: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of OverlayPlayRequestCommon from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # set to None if volume_absolute (nullable) is None - # and __fields_set__ contains the field - if self.volume_absolute is None and "volume_absolute" in self.__fields_set__: + # and model_fields_set contains the field + if self.volume_absolute is None and "volume_absolute" in self.model_fields_set: _dict["volumeAbsolute"] = None return _dict @classmethod - def from_dict(cls, obj: dict) -> OverlayPlayRequestCommon: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of OverlayPlayRequestCommon from a dict""" if obj is None: return None if not isinstance(obj, dict): - return OverlayPlayRequestCommon.parse_obj(obj) + return cls.model_validate(obj) - _obj = OverlayPlayRequestCommon.parse_obj( - {"volume_absolute": obj.get("volumeAbsolute")} - ) + _obj = cls.model_validate({"volumeAbsolute": obj.get("volumeAbsolute")}) return _obj diff --git a/python_client/mozart_api/models/overlay_play_request_from_usb.py b/python_client/mozart_api/models/overlay_play_request_from_usb.py index 908854a..18e51d6 100644 --- a/python_client/mozart_api/models/overlay_play_request_from_usb.py +++ b/python_client/mozart_api/models/overlay_play_request_from_usb.py @@ -18,65 +18,83 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.overlay_play_request_from_usb_from_usb import ( OverlayPlayRequestFromUsbFromUsb, ) +from typing import Optional, Set +from typing_extensions import Self class OverlayPlayRequestFromUsb(BaseModel): """ OverlayPlayRequestFromUsb - """ + """ # noqa: E501 - from_usb: Optional[OverlayPlayRequestFromUsbFromUsb] = Field(None, alias="fromUsb") - __properties = ["fromUsb"] + from_usb: Optional[OverlayPlayRequestFromUsbFromUsb] = Field( + default=None, alias="fromUsb" + ) + __properties: ClassVar[List[str]] = ["fromUsb"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> OverlayPlayRequestFromUsb: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of OverlayPlayRequestFromUsb from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of from_usb if self.from_usb: _dict["fromUsb"] = self.from_usb.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> OverlayPlayRequestFromUsb: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of OverlayPlayRequestFromUsb from a dict""" if obj is None: return None if not isinstance(obj, dict): - return OverlayPlayRequestFromUsb.parse_obj(obj) + return cls.model_validate(obj) - _obj = OverlayPlayRequestFromUsb.parse_obj( + _obj = cls.model_validate( { - "from_usb": OverlayPlayRequestFromUsbFromUsb.from_dict( - obj.get("fromUsb") + "fromUsb": ( + OverlayPlayRequestFromUsbFromUsb.from_dict(obj["fromUsb"]) + if obj.get("fromUsb") is not None + else None ) - if obj.get("fromUsb") is not None - else None } ) return _obj diff --git a/python_client/mozart_api/models/overlay_play_request_from_usb_from_usb.py b/python_client/mozart_api/models/overlay_play_request_from_usb_from_usb.py index dde987b..41c2e56 100644 --- a/python_client/mozart_api/models/overlay_play_request_from_usb_from_usb.py +++ b/python_client/mozart_api/models/overlay_play_request_from_usb_from_usb.py @@ -18,56 +18,71 @@ import re # noqa: F401 import json - -from pydantic import BaseModel, Field, constr +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self class OverlayPlayRequestFromUsbFromUsb(BaseModel): """ OverlayPlayRequestFromUsbFromUsb - """ + """ # noqa: E501 - file_location: constr(strict=True, max_length=1024) = Field( - ..., - alias="fileLocation", + file_location: Annotated[str, Field(strict=True, max_length=1024)] = Field( description="Required field containing the relative path (i.e. from the USB drive root) and file name with extension (if one exists) that will be played. A maximum length of 1024 characters is allowed. ", + alias="fileLocation", ) - __properties = ["fileLocation"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["fileLocation"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> OverlayPlayRequestFromUsbFromUsb: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of OverlayPlayRequestFromUsbFromUsb from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> OverlayPlayRequestFromUsbFromUsb: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of OverlayPlayRequestFromUsbFromUsb from a dict""" if obj is None: return None if not isinstance(obj, dict): - return OverlayPlayRequestFromUsbFromUsb.parse_obj(obj) + return cls.model_validate(obj) - _obj = OverlayPlayRequestFromUsbFromUsb.parse_obj( - {"file_location": obj.get("fileLocation")} - ) + _obj = cls.model_validate({"fileLocation": obj.get("fileLocation")}) return _obj diff --git a/python_client/mozart_api/models/overlay_play_request_text_to_speech.py b/python_client/mozart_api/models/overlay_play_request_text_to_speech.py index 1c8603a..2fc22fd 100644 --- a/python_client/mozart_api/models/overlay_play_request_text_to_speech.py +++ b/python_client/mozart_api/models/overlay_play_request_text_to_speech.py @@ -18,67 +18,85 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.overlay_play_request_text_to_speech_text_to_speech import ( OverlayPlayRequestTextToSpeechTextToSpeech, ) +from typing import Optional, Set +from typing_extensions import Self class OverlayPlayRequestTextToSpeech(BaseModel): """ OverlayPlayRequestTextToSpeech - """ + """ # noqa: E501 text_to_speech: Optional[OverlayPlayRequestTextToSpeechTextToSpeech] = Field( - None, alias="textToSpeech" + default=None, alias="textToSpeech" ) - __properties = ["textToSpeech"] + __properties: ClassVar[List[str]] = ["textToSpeech"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> OverlayPlayRequestTextToSpeech: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of OverlayPlayRequestTextToSpeech from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of text_to_speech if self.text_to_speech: _dict["textToSpeech"] = self.text_to_speech.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> OverlayPlayRequestTextToSpeech: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of OverlayPlayRequestTextToSpeech from a dict""" if obj is None: return None if not isinstance(obj, dict): - return OverlayPlayRequestTextToSpeech.parse_obj(obj) + return cls.model_validate(obj) - _obj = OverlayPlayRequestTextToSpeech.parse_obj( + _obj = cls.model_validate( { - "text_to_speech": OverlayPlayRequestTextToSpeechTextToSpeech.from_dict( - obj.get("textToSpeech") + "textToSpeech": ( + OverlayPlayRequestTextToSpeechTextToSpeech.from_dict( + obj["textToSpeech"] + ) + if obj.get("textToSpeech") is not None + else None ) - if obj.get("textToSpeech") is not None - else None } ) return _obj diff --git a/python_client/mozart_api/models/overlay_play_request_text_to_speech_text_to_speech.py b/python_client/mozart_api/models/overlay_play_request_text_to_speech_text_to_speech.py index a5ab8d9..20bddd2 100644 --- a/python_client/mozart_api/models/overlay_play_request_text_to_speech_text_to_speech.py +++ b/python_client/mozart_api/models/overlay_play_request_text_to_speech_text_to_speech.py @@ -18,65 +18,79 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr, constr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self class OverlayPlayRequestTextToSpeechTextToSpeech(BaseModel): """ - Object used for performing a text-to-speech operation on the product. # noqa: E501 - """ + Object used for performing a text-to-speech operation on the product. + """ # noqa: E501 lang: Optional[StrictStr] = Field( - None, + default=None, description="An optional specification of the language to use. The default value is ultimately decided by the BeoCloud API, but currently it defaults to `en-us`. ", ) - text: constr(strict=True, max_length=2048) = Field( - ..., - description="Required field containing the actual text that will be converted to speech (audio). A maximum length of 2048 characters is allowed. ", + text: Annotated[str, Field(strict=True, max_length=2048)] = Field( + description="Required field containing the actual text that will be converted to speech (audio). A maximum length of 2048 characters is allowed. " ) - __properties = ["lang", "text"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["lang", "text"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> OverlayPlayRequestTextToSpeechTextToSpeech: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of OverlayPlayRequestTextToSpeechTextToSpeech from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # set to None if lang (nullable) is None - # and __fields_set__ contains the field - if self.lang is None and "lang" in self.__fields_set__: + # and model_fields_set contains the field + if self.lang is None and "lang" in self.model_fields_set: _dict["lang"] = None return _dict @classmethod - def from_dict(cls, obj: dict) -> OverlayPlayRequestTextToSpeechTextToSpeech: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of OverlayPlayRequestTextToSpeechTextToSpeech from a dict""" if obj is None: return None if not isinstance(obj, dict): - return OverlayPlayRequestTextToSpeechTextToSpeech.parse_obj(obj) + return cls.model_validate(obj) - _obj = OverlayPlayRequestTextToSpeechTextToSpeech.parse_obj( - {"lang": obj.get("lang"), "text": obj.get("text")} - ) + _obj = cls.model_validate({"lang": obj.get("lang"), "text": obj.get("text")}) return _obj diff --git a/python_client/mozart_api/models/overlay_play_request_uri.py b/python_client/mozart_api/models/overlay_play_request_uri.py index 8e16238..d3bbb78 100644 --- a/python_client/mozart_api/models/overlay_play_request_uri.py +++ b/python_client/mozart_api/models/overlay_play_request_uri.py @@ -18,61 +18,73 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.uri import Uri +from typing import Optional, Set +from typing_extensions import Self class OverlayPlayRequestUri(BaseModel): """ OverlayPlayRequestUri - """ + """ # noqa: E501 uri: Optional[Uri] = None - __properties = ["uri"] + __properties: ClassVar[List[str]] = ["uri"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> OverlayPlayRequestUri: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of OverlayPlayRequestUri from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of uri if self.uri: _dict["uri"] = self.uri.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> OverlayPlayRequestUri: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of OverlayPlayRequestUri from a dict""" if obj is None: return None if not isinstance(obj, dict): - return OverlayPlayRequestUri.parse_obj(obj) - - _obj = OverlayPlayRequestUri.parse_obj( - { - "uri": Uri.from_dict(obj.get("uri")) - if obj.get("uri") is not None - else None - } + return cls.model_validate(obj) + + _obj = cls.model_validate( + {"uri": Uri.from_dict(obj["uri"]) if obj.get("uri") is not None else None} ) return _obj diff --git a/python_client/mozart_api/models/paired_remote.py b/python_client/mozart_api/models/paired_remote.py index 71e69c8..d9896ef 100644 --- a/python_client/mozart_api/models/paired_remote.py +++ b/python_client/mozart_api/models/paired_remote.py @@ -18,26 +18,28 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conint, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self class PairedRemote(BaseModel): """ PairedRemote - """ + """ # noqa: E501 - address: StrictStr = Field(...) - app_version: Optional[StrictStr] = Field(None, alias="appVersion") - battery_level: Optional[conint(strict=True, le=100, ge=0)] = Field( - None, alias="batteryLevel" + address: StrictStr + app_version: Optional[StrictStr] = Field(default=None, alias="appVersion") + battery_level: Optional[Annotated[int, Field(le=100, strict=True, ge=0)]] = Field( + default=None, alias="batteryLevel" ) - db_version: Optional[StrictStr] = Field(None, alias="dbVersion") - name: StrictStr = Field(...) - serial_number: Optional[StrictStr] = Field(None, alias="serialNumber") - updated: Optional[conlist(StrictStr)] = None - __properties = [ + db_version: Optional[StrictStr] = Field(default=None, alias="dbVersion") + name: StrictStr + serial_number: Optional[StrictStr] = Field(default=None, alias="serialNumber") + updated: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = [ "address", "appVersion", "batteryLevel", @@ -47,58 +49,73 @@ class PairedRemote(BaseModel): "updated", ] - @validator("updated") + @field_validator("updated") def updated_validate_enum(cls, value): """Validates the enum""" if value is None: return value for i in value: - if i not in ("app", "db"): + if i not in set(["app", "db"]): raise ValueError("each list item must be one of ('app', 'db')") return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> PairedRemote: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PairedRemote from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> PairedRemote: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PairedRemote from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PairedRemote.parse_obj(obj) + return cls.model_validate(obj) - _obj = PairedRemote.parse_obj( + _obj = cls.model_validate( { "address": obj.get("address"), - "app_version": obj.get("appVersion"), - "battery_level": obj.get("batteryLevel"), - "db_version": obj.get("dbVersion"), + "appVersion": obj.get("appVersion"), + "batteryLevel": obj.get("batteryLevel"), + "dbVersion": obj.get("dbVersion"), "name": obj.get("name"), - "serial_number": obj.get("serialNumber"), + "serialNumber": obj.get("serialNumber"), "updated": obj.get("updated"), } ) diff --git a/python_client/mozart_api/models/paired_remote_response.py b/python_client/mozart_api/models/paired_remote_response.py index c62b0b4..7f67499 100644 --- a/python_client/mozart_api/models/paired_remote_response.py +++ b/python_client/mozart_api/models/paired_remote_response.py @@ -18,42 +18,58 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, conlist +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.paired_remote import PairedRemote +from typing import Optional, Set +from typing_extensions import Self class PairedRemoteResponse(BaseModel): """ PairedRemoteResponse - """ + """ # noqa: E501 - items: Optional[conlist(PairedRemote)] = None - __properties = ["items"] + items: Optional[List[PairedRemote]] = None + __properties: ClassVar[List[str]] = ["items"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> PairedRemoteResponse: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PairedRemoteResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in items (list) _items = [] if self.items: @@ -64,19 +80,21 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> PairedRemoteResponse: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PairedRemoteResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PairedRemoteResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = PairedRemoteResponse.parse_obj( + _obj = cls.model_validate( { - "items": [PairedRemote.from_dict(_item) for _item in obj.get("items")] - if obj.get("items") is not None - else None + "items": ( + [PairedRemote.from_dict(_item) for _item in obj["items"]] + if obj.get("items") is not None + else None + ) } ) return _obj diff --git a/python_client/mozart_api/models/play_queue_item.py b/python_client/mozart_api/models/play_queue_item.py index 64ccf85..d6a88a9 100644 --- a/python_client/mozart_api/models/play_queue_item.py +++ b/python_client/mozart_api/models/play_queue_item.py @@ -18,31 +18,32 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.play_queue_item_type import PlayQueueItemType from mozart_api.models.playback_content_metadata import PlaybackContentMetadata +from typing import Optional, Set +from typing_extensions import Self class PlayQueueItem(BaseModel): """ PlayQueueItem - """ + """ # noqa: E501 index: Optional[StrictInt] = None metadata: Optional[PlaybackContentMetadata] = None - provider: PlayQueueItemType = Field(...) + provider: PlayQueueItemType start_now_from_position: Optional[StrictInt] = Field( - None, - alias="startNowFromPosition", + default=None, description="Start playing specified track as soon as possible. This works for any type, for `track` set to 0 and for `playlist` specify the wanted track from position 0", + alias="startNowFromPosition", ) - type: StrictStr = Field(...) + type: StrictStr uri: StrictStr = Field( - ..., description="This can be url, track id, playlist id, radio id and suchlike" + description="This can be url, track id, playlist id, radio id and suchlike" ) - __properties = [ + __properties: ClassVar[List[str]] = [ "index", "metadata", "provider", @@ -51,35 +52,50 @@ class PlayQueueItem(BaseModel): "uri", ] - @validator("type") + @field_validator("type") def type_validate_enum(cls, value): """Validates the enum""" - if value not in ("track", "playlist"): + if value not in set(["track", "playlist"]): raise ValueError("must be one of enum values ('track', 'playlist')") return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> PlayQueueItem: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PlayQueueItem from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of metadata if self.metadata: _dict["metadata"] = self.metadata.to_dict() @@ -87,34 +103,38 @@ def to_dict(self): if self.provider: _dict["provider"] = self.provider.to_dict() # set to None if start_now_from_position (nullable) is None - # and __fields_set__ contains the field + # and model_fields_set contains the field if ( self.start_now_from_position is None - and "start_now_from_position" in self.__fields_set__ + and "start_now_from_position" in self.model_fields_set ): _dict["startNowFromPosition"] = None return _dict @classmethod - def from_dict(cls, obj: dict) -> PlayQueueItem: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PlayQueueItem from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PlayQueueItem.parse_obj(obj) + return cls.model_validate(obj) - _obj = PlayQueueItem.parse_obj( + _obj = cls.model_validate( { "index": obj.get("index"), - "metadata": PlaybackContentMetadata.from_dict(obj.get("metadata")) - if obj.get("metadata") is not None - else None, - "provider": PlayQueueItemType.from_dict(obj.get("provider")) - if obj.get("provider") is not None - else None, - "start_now_from_position": obj.get("startNowFromPosition"), + "metadata": ( + PlaybackContentMetadata.from_dict(obj["metadata"]) + if obj.get("metadata") is not None + else None + ), + "provider": ( + PlayQueueItemType.from_dict(obj["provider"]) + if obj.get("provider") is not None + else None + ), + "startNowFromPosition": obj.get("startNowFromPosition"), "type": obj.get("type"), "uri": obj.get("uri"), } diff --git a/python_client/mozart_api/models/play_queue_item_type.py b/python_client/mozart_api/models/play_queue_item_type.py index b855811..55f8ef1 100644 --- a/python_client/mozart_api/models/play_queue_item_type.py +++ b/python_client/mozart_api/models/play_queue_item_type.py @@ -18,59 +18,76 @@ import re # noqa: F401 import json - -from pydantic import BaseModel, Field, StrictStr, validator +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self class PlayQueueItemType(BaseModel): """ PlayQueueItemType - """ + """ # noqa: E501 - value: StrictStr = Field(...) - __properties = ["value"] + value: StrictStr + __properties: ClassVar[List[str]] = ["value"] - @validator("value") + @field_validator("value") def value_validate_enum(cls, value): """Validates the enum""" - if value not in ("uri", "dlna", "radio", "deezer", "beoCloud"): + if value not in set(["uri", "dlna", "radio", "deezer", "beoCloud", "tidal"]): raise ValueError( - "must be one of enum values ('uri', 'dlna', 'radio', 'deezer', 'beoCloud')" + "must be one of enum values ('uri', 'dlna', 'radio', 'deezer', 'beoCloud', 'tidal')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> PlayQueueItemType: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PlayQueueItemType from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> PlayQueueItemType: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PlayQueueItemType from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PlayQueueItemType.parse_obj(obj) + return cls.model_validate(obj) - _obj = PlayQueueItemType.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/play_queue_settings.py b/python_client/mozart_api/models/play_queue_settings.py index 215c155..24dbd18 100644 --- a/python_client/mozart_api/models/play_queue_settings.py +++ b/python_client/mozart_api/models/play_queue_settings.py @@ -18,66 +18,82 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictBool, StrictStr, validator +from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class PlayQueueSettings(BaseModel): """ PlayQueueSettings - """ + """ # noqa: E501 consume: Optional[StrictBool] = None gapless: Optional[StrictBool] = None repeat: Optional[StrictStr] = None shuffle: Optional[StrictBool] = None - __properties = ["consume", "gapless", "repeat", "shuffle"] + __properties: ClassVar[List[str]] = ["consume", "gapless", "repeat", "shuffle"] - @validator("repeat") + @field_validator("repeat") def repeat_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("all", "track", "none"): + if value not in set(["all", "track", "none"]): raise ValueError("must be one of enum values ('all', 'track', 'none')") return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> PlayQueueSettings: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PlayQueueSettings from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> PlayQueueSettings: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PlayQueueSettings from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PlayQueueSettings.parse_obj(obj) + return cls.model_validate(obj) - _obj = PlayQueueSettings.parse_obj( + _obj = cls.model_validate( { "consume": obj.get("consume"), "gapless": obj.get("gapless"), diff --git a/python_client/mozart_api/models/playback_content_metadata.py b/python_client/mozart_api/models/playback_content_metadata.py index 40536e1..bf04b0a 100644 --- a/python_client/mozart_api/models/playback_content_metadata.py +++ b/python_client/mozart_api/models/playback_content_metadata.py @@ -18,64 +18,67 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.art import Art from mozart_api.models.beolink_leader import BeolinkLeader +from typing import Optional, Set +from typing_extensions import Self class PlaybackContentMetadata(BaseModel): """ PlaybackContentMetadata - """ + """ # noqa: E501 - album_name: Optional[StrictStr] = Field(None, alias="albumName") - art: Optional[conlist(Art)] = None - artist_name: Optional[StrictStr] = Field(None, alias="artistName") + album_name: Optional[StrictStr] = Field(default=None, alias="albumName") + art: Optional[List[Art]] = None + artist_name: Optional[StrictStr] = Field(default=None, alias="artistName") bitdepth: Optional[StrictInt] = None bitrate: Optional[StrictInt] = None - container_name: Optional[StrictStr] = Field(None, alias="containerName") + container_name: Optional[StrictStr] = Field(default=None, alias="containerName") encoding: Optional[StrictStr] = None genre: Optional[StrictStr] = None id: Optional[StrictInt] = None input_channel_processing: Optional[StrictStr] = Field( - None, - alias="inputChannelProcessing", + default=None, description="Input processing/decoding on top of the base codec indicated in encoding. E.g. Dolby Atmos on top of Dolby TrueHD or Dolby Surround on top of PCM. For Dolby, this value has priority over encoding, meaning that if inputChannelProcessing has a value, it must be indicated in the app, and optionally the encoding value can be indicated as well. If inputChannelProcessing does not have value the encoding value must be indicated. ", + alias="inputChannelProcessing", ) input_channels: Optional[StrictStr] = Field( - None, alias="inputChannels", description="e.g. 5.1" + default=None, description="e.g. 5.1", alias="inputChannels" ) organization: Optional[StrictStr] = Field( - None, + default=None, description='This can be filled by gstreamer\'s GST_TAG_ORGANIZATION. Mozart can also fill this with netradio station name like "P3" and TV content like "Netflix". This is needed so it\'s possible to show who the provider is for the playing audio track/content. ', ) output_channel_processing: Optional[StrictStr] = Field( - None, alias="outputChannelProcessing", description="e.g. downmix" + default=None, description="e.g. downmix", alias="outputChannelProcessing" ) output_channels: Optional[StrictStr] = Field( - None, alias="outputChannels", description="e.g. 7.1" + default=None, description="e.g. 7.1", alias="outputChannels" ) - queue_id: Optional[StrictStr] = Field(None, alias="queueId") - remote_leader: Optional[BeolinkLeader] = Field(None, alias="remoteLeader") - remote_source: Optional[StrictStr] = Field(None, alias="remoteSource") + queue_id: Optional[StrictStr] = Field(default=None, alias="queueId") + remote_leader: Optional[BeolinkLeader] = Field(default=None, alias="remoteLeader") + remote_source: Optional[StrictStr] = Field(default=None, alias="remoteSource") samplerate: Optional[StrictInt] = None source: Optional[StrictStr] = None - source_internal_id: Optional[StrictStr] = Field(None, alias="sourceInternalId") + source_internal_id: Optional[StrictStr] = Field( + default=None, alias="sourceInternalId" + ) title: Optional[StrictStr] = None total_duration: Optional[StrictInt] = Field( - None, - alias="totalDuration", + default=None, description="to be removed once all devices and apps are updated", + alias="totalDuration", ) total_duration_seconds: Optional[StrictInt] = Field( - None, alias="totalDurationSeconds" + default=None, alias="totalDurationSeconds" ) track: Optional[StrictInt] = None - track_count: Optional[StrictInt] = Field(None, alias="trackCount") + track_count: Optional[StrictInt] = Field(default=None, alias="trackCount") uri: Optional[StrictStr] = None - __properties = [ + __properties: ClassVar[List[str]] = [ "albumName", "art", "artistName", @@ -104,78 +107,95 @@ class PlaybackContentMetadata(BaseModel): "uri", ] - @validator("encoding") + @field_validator("encoding") def encoding_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ( - "pcm", - "wav", - "mp3", - "oggvorbis", - "aac", - "flac", - "sbc", - "alac", - "opus", - "DolbyDigital", - "DolbyDigitalPlus", - "DolbyTrueHD", - "unknown", + if value not in set( + [ + "pcm", + "wav", + "mp3", + "oggvorbis", + "aac", + "flac", + "sbc", + "alac", + "opus", + "DolbyDigital", + "DolbyDigitalPlus", + "DolbyTrueHD", + "unknown", + ] ): raise ValueError( "must be one of enum values ('pcm', 'wav', 'mp3', 'oggvorbis', 'aac', 'flac', 'sbc', 'alac', 'opus', 'DolbyDigital', 'DolbyDigitalPlus', 'DolbyTrueHD', 'unknown')" ) return value - @validator("input_channel_processing") + @field_validator("input_channel_processing") def input_channel_processing_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("dolbySurround", "dolbyAtmos"): + if value not in set(["dolbySurround", "dolbyAtmos"]): raise ValueError( "must be one of enum values ('dolbySurround', 'dolbyAtmos')" ) return value - @validator("output_channel_processing") + @field_validator("output_channel_processing") def output_channel_processing_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("Direct", "Downmix", "TrueImage"): + if value not in set(["Direct", "Downmix", "TrueImage"]): raise ValueError( "must be one of enum values ('Direct', 'Downmix', 'TrueImage')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> PlaybackContentMetadata: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PlaybackContentMetadata from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in art (list) _items = [] if self.art: @@ -187,91 +207,95 @@ def to_dict(self): if self.remote_leader: _dict["remoteLeader"] = self.remote_leader.to_dict() # set to None if input_channel_processing (nullable) is None - # and __fields_set__ contains the field + # and model_fields_set contains the field if ( self.input_channel_processing is None - and "input_channel_processing" in self.__fields_set__ + and "input_channel_processing" in self.model_fields_set ): _dict["inputChannelProcessing"] = None # set to None if input_channels (nullable) is None - # and __fields_set__ contains the field - if self.input_channels is None and "input_channels" in self.__fields_set__: + # and model_fields_set contains the field + if self.input_channels is None and "input_channels" in self.model_fields_set: _dict["inputChannels"] = None # set to None if output_channel_processing (nullable) is None - # and __fields_set__ contains the field + # and model_fields_set contains the field if ( self.output_channel_processing is None - and "output_channel_processing" in self.__fields_set__ + and "output_channel_processing" in self.model_fields_set ): _dict["outputChannelProcessing"] = None # set to None if output_channels (nullable) is None - # and __fields_set__ contains the field - if self.output_channels is None and "output_channels" in self.__fields_set__: + # and model_fields_set contains the field + if self.output_channels is None and "output_channels" in self.model_fields_set: _dict["outputChannels"] = None # set to None if remote_source (nullable) is None - # and __fields_set__ contains the field - if self.remote_source is None and "remote_source" in self.__fields_set__: + # and model_fields_set contains the field + if self.remote_source is None and "remote_source" in self.model_fields_set: _dict["remoteSource"] = None # set to None if total_duration (nullable) is None - # and __fields_set__ contains the field - if self.total_duration is None and "total_duration" in self.__fields_set__: + # and model_fields_set contains the field + if self.total_duration is None and "total_duration" in self.model_fields_set: _dict["totalDuration"] = None # set to None if total_duration_seconds (nullable) is None - # and __fields_set__ contains the field + # and model_fields_set contains the field if ( self.total_duration_seconds is None - and "total_duration_seconds" in self.__fields_set__ + and "total_duration_seconds" in self.model_fields_set ): _dict["totalDurationSeconds"] = None return _dict @classmethod - def from_dict(cls, obj: dict) -> PlaybackContentMetadata: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PlaybackContentMetadata from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PlaybackContentMetadata.parse_obj(obj) + return cls.model_validate(obj) - _obj = PlaybackContentMetadata.parse_obj( + _obj = cls.model_validate( { - "album_name": obj.get("albumName"), - "art": [Art.from_dict(_item) for _item in obj.get("art")] - if obj.get("art") is not None - else None, - "artist_name": obj.get("artistName"), + "albumName": obj.get("albumName"), + "art": ( + [Art.from_dict(_item) for _item in obj["art"]] + if obj.get("art") is not None + else None + ), + "artistName": obj.get("artistName"), "bitdepth": obj.get("bitdepth"), "bitrate": obj.get("bitrate"), - "container_name": obj.get("containerName"), + "containerName": obj.get("containerName"), "encoding": obj.get("encoding"), "genre": obj.get("genre"), "id": obj.get("id"), - "input_channel_processing": obj.get("inputChannelProcessing"), - "input_channels": obj.get("inputChannels"), + "inputChannelProcessing": obj.get("inputChannelProcessing"), + "inputChannels": obj.get("inputChannels"), "organization": obj.get("organization"), - "output_channel_processing": obj.get("outputChannelProcessing"), - "output_channels": obj.get("outputChannels"), - "queue_id": obj.get("queueId"), - "remote_leader": BeolinkLeader.from_dict(obj.get("remoteLeader")) - if obj.get("remoteLeader") is not None - else None, - "remote_source": obj.get("remoteSource"), + "outputChannelProcessing": obj.get("outputChannelProcessing"), + "outputChannels": obj.get("outputChannels"), + "queueId": obj.get("queueId"), + "remoteLeader": ( + BeolinkLeader.from_dict(obj["remoteLeader"]) + if obj.get("remoteLeader") is not None + else None + ), + "remoteSource": obj.get("remoteSource"), "samplerate": obj.get("samplerate"), "source": obj.get("source"), - "source_internal_id": obj.get("sourceInternalId"), + "sourceInternalId": obj.get("sourceInternalId"), "title": obj.get("title"), - "total_duration": obj.get("totalDuration"), - "total_duration_seconds": obj.get("totalDurationSeconds"), + "totalDuration": obj.get("totalDuration"), + "totalDurationSeconds": obj.get("totalDurationSeconds"), "track": obj.get("track"), - "track_count": obj.get("trackCount"), + "trackCount": obj.get("trackCount"), "uri": obj.get("uri"), } ) diff --git a/python_client/mozart_api/models/playback_error.py b/python_client/mozart_api/models/playback_error.py index 024ad80..c1a2529 100644 --- a/python_client/mozart_api/models/playback_error.py +++ b/python_client/mozart_api/models/playback_error.py @@ -18,63 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.playback_content_metadata import PlaybackContentMetadata +from typing import Optional, Set +from typing_extensions import Self class PlaybackError(BaseModel): """ PlaybackError - """ + """ # noqa: E501 error: Optional[StrictStr] = None item: Optional[PlaybackContentMetadata] = None - __properties = ["error", "item"] + __properties: ClassVar[List[str]] = ["error", "item"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> PlaybackError: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PlaybackError from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of item if self.item: _dict["item"] = self.item.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> PlaybackError: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PlaybackError from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PlaybackError.parse_obj(obj) + return cls.model_validate(obj) - _obj = PlaybackError.parse_obj( + _obj = cls.model_validate( { "error": obj.get("error"), - "item": PlaybackContentMetadata.from_dict(obj.get("item")) - if obj.get("item") is not None - else None, + "item": ( + PlaybackContentMetadata.from_dict(obj["item"]) + if obj.get("item") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/playback_progress.py b/python_client/mozart_api/models/playback_progress.py index a252634..1c1353c 100644 --- a/python_client/mozart_api/models/playback_progress.py +++ b/python_client/mozart_api/models/playback_progress.py @@ -18,64 +18,80 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class PlaybackProgress(BaseModel): """ PlaybackProgress - """ + """ # noqa: E501 id: Optional[StrictStr] = None progress: Optional[StrictInt] = None - total_duration: Optional[StrictInt] = Field(None, alias="totalDuration") - __properties = ["id", "progress", "totalDuration"] + total_duration: Optional[StrictInt] = Field(default=None, alias="totalDuration") + __properties: ClassVar[List[str]] = ["id", "progress", "totalDuration"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> PlaybackProgress: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PlaybackProgress from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # set to None if total_duration (nullable) is None - # and __fields_set__ contains the field - if self.total_duration is None and "total_duration" in self.__fields_set__: + # and model_fields_set contains the field + if self.total_duration is None and "total_duration" in self.model_fields_set: _dict["totalDuration"] = None return _dict @classmethod - def from_dict(cls, obj: dict) -> PlaybackProgress: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PlaybackProgress from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PlaybackProgress.parse_obj(obj) + return cls.model_validate(obj) - _obj = PlaybackProgress.parse_obj( + _obj = cls.model_validate( { "id": obj.get("id"), "progress": obj.get("progress"), - "total_duration": obj.get("totalDuration"), + "totalDuration": obj.get("totalDuration"), } ) return _obj diff --git a/python_client/mozart_api/models/playback_state.py b/python_client/mozart_api/models/playback_state.py index e549efb..c229485 100644 --- a/python_client/mozart_api/models/playback_state.py +++ b/python_client/mozart_api/models/playback_state.py @@ -18,48 +18,64 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.playback_content_metadata import PlaybackContentMetadata from mozart_api.models.playback_progress import PlaybackProgress from mozart_api.models.rendering_state import RenderingState from mozart_api.models.source import Source +from typing import Optional, Set +from typing_extensions import Self class PlaybackState(BaseModel): """ PlaybackState - """ + """ # noqa: E501 metadata: Optional[PlaybackContentMetadata] = None progress: Optional[PlaybackProgress] = None source: Optional[Source] = None state: Optional[RenderingState] = None - __properties = ["metadata", "progress", "source", "state"] + __properties: ClassVar[List[str]] = ["metadata", "progress", "source", "state"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> PlaybackState: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PlaybackState from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of metadata if self.metadata: _dict["metadata"] = self.metadata.to_dict() @@ -75,28 +91,36 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> PlaybackState: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PlaybackState from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PlaybackState.parse_obj(obj) + return cls.model_validate(obj) - _obj = PlaybackState.parse_obj( + _obj = cls.model_validate( { - "metadata": PlaybackContentMetadata.from_dict(obj.get("metadata")) - if obj.get("metadata") is not None - else None, - "progress": PlaybackProgress.from_dict(obj.get("progress")) - if obj.get("progress") is not None - else None, - "source": Source.from_dict(obj.get("source")) - if obj.get("source") is not None - else None, - "state": RenderingState.from_dict(obj.get("state")) - if obj.get("state") is not None - else None, + "metadata": ( + PlaybackContentMetadata.from_dict(obj["metadata"]) + if obj.get("metadata") is not None + else None + ), + "progress": ( + PlaybackProgress.from_dict(obj["progress"]) + if obj.get("progress") is not None + else None + ), + "source": ( + Source.from_dict(obj["source"]) + if obj.get("source") is not None + else None + ), + "state": ( + RenderingState.from_dict(obj["state"]) + if obj.get("state") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/power_link_trigger.py b/python_client/mozart_api/models/power_link_trigger.py index b33cacb..d35ce30 100644 --- a/python_client/mozart_api/models/power_link_trigger.py +++ b/python_client/mozart_api/models/power_link_trigger.py @@ -18,55 +18,71 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictInt +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class PowerLinkTrigger(BaseModel): """ PowerLinkTrigger - """ + """ # noqa: E501 power_link_preset: Optional[StrictInt] = Field( - None, alias="powerLinkPreset", description="PowerLink preset" + default=None, + description="Despite the name, this preset is used anytime a speaker is used as a secondary as a way for the primary to indicate which directivity (and possibly other caracteristics in the future) should be used on a speaker by speaker basis. It is used when a speaker is a powerlink speaker (hence the name), WISA speaker or a speakerlink secondary in multichannel. ", + alias="powerLinkPreset", ) - __properties = ["powerLinkPreset"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["powerLinkPreset"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> PowerLinkTrigger: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PowerLinkTrigger from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> PowerLinkTrigger: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PowerLinkTrigger from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PowerLinkTrigger.parse_obj(obj) + return cls.model_validate(obj) - _obj = PowerLinkTrigger.parse_obj( - {"power_link_preset": obj.get("powerLinkPreset")} - ) + _obj = cls.model_validate({"powerLinkPreset": obj.get("powerLinkPreset")}) return _obj diff --git a/python_client/mozart_api/models/power_state_enum.py b/python_client/mozart_api/models/power_state_enum.py index e524d10..14a39be 100644 --- a/python_client/mozart_api/models/power_state_enum.py +++ b/python_client/mozart_api/models/power_state_enum.py @@ -18,63 +18,79 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr, validator +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class PowerStateEnum(BaseModel): """ PowerStateEnum - """ + """ # noqa: E501 value: Optional[StrictStr] = None - __properties = ["value"] + __properties: ClassVar[List[str]] = ["value"] - @validator("value") + @field_validator("value") def value_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("networkStandby", "on", "standby", "shutdown", "storage"): + if value not in set(["networkStandby", "on", "standby", "shutdown", "storage"]): raise ValueError( "must be one of enum values ('networkStandby', 'on', 'standby', 'shutdown', 'storage')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> PowerStateEnum: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PowerStateEnum from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> PowerStateEnum: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of PowerStateEnum from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PowerStateEnum.parse_obj(obj) + return cls.model_validate(obj) - _obj = PowerStateEnum.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/preset.py b/python_client/mozart_api/models/preset.py index 827acd3..5bbfa99 100644 --- a/python_client/mozart_api/models/preset.py +++ b/python_client/mozart_api/models/preset.py @@ -18,33 +18,34 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.action import Action from mozart_api.models.content_item import ContentItem from mozart_api.models.source_type_enum import SourceTypeEnum +from typing import Optional, Set +from typing_extensions import Self class Preset(BaseModel): """ Preset - """ + """ # noqa: E501 - action_list: Optional[conlist(Action)] = Field( - None, - alias="actionList", + action_list: Optional[List[Action]] = Field( + default=None, description="An ordered list of Actions to run on the product", + alias="actionList", ) - scene_list: Optional[conlist(StrictStr)] = Field( - None, alias="sceneList", description="A list of scenes" + scene_list: Optional[List[StrictStr]] = Field( + default=None, description="A list of scenes", alias="sceneList" ) content: Optional[ContentItem] = None id: Optional[StrictStr] = None name: Optional[StrictStr] = None source: Optional[SourceTypeEnum] = None title: Optional[StrictStr] = None - __properties = [ + __properties: ClassVar[List[str]] = [ "actionList", "sceneList", "content", @@ -54,28 +55,43 @@ class Preset(BaseModel): "title", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Preset: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Preset from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in action_list (list) _items = [] if self.action_list: @@ -90,37 +106,41 @@ def to_dict(self): if self.source: _dict["source"] = self.source.to_dict() # set to None if name (nullable) is None - # and __fields_set__ contains the field - if self.name is None and "name" in self.__fields_set__: + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: _dict["name"] = None return _dict @classmethod - def from_dict(cls, obj: dict) -> Preset: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Preset from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Preset.parse_obj(obj) + return cls.model_validate(obj) - _obj = Preset.parse_obj( + _obj = cls.model_validate( { - "action_list": [ - Action.from_dict(_item) for _item in obj.get("actionList") - ] - if obj.get("actionList") is not None - else None, - "scene_list": obj.get("sceneList"), - "content": ContentItem.from_dict(obj.get("content")) - if obj.get("content") is not None - else None, + "actionList": ( + [Action.from_dict(_item) for _item in obj["actionList"]] + if obj.get("actionList") is not None + else None + ), + "sceneList": obj.get("sceneList"), + "content": ( + ContentItem.from_dict(obj["content"]) + if obj.get("content") is not None + else None + ), "id": obj.get("id"), "name": obj.get("name"), - "source": SourceTypeEnum.from_dict(obj.get("source")) - if obj.get("source") is not None - else None, + "source": ( + SourceTypeEnum.from_dict(obj["source"]) + if obj.get("source") is not None + else None + ), "title": obj.get("title"), } ) diff --git a/python_client/mozart_api/models/product_curtain_status.py b/python_client/mozart_api/models/product_curtain_status.py index 7082a35..10b9272 100644 --- a/python_client/mozart_api/models/product_curtain_status.py +++ b/python_client/mozart_api/models/product_curtain_status.py @@ -18,66 +18,82 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictBool, StrictStr, validator +from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class ProductCurtainStatus(BaseModel): """ ProductCurtainStatus - """ + """ # noqa: E501 moving: Optional[StrictBool] = None position: Optional[StrictStr] = None - __properties = ["moving", "position"] + __properties: ClassVar[List[str]] = ["moving", "position"] - @validator("position") + @field_validator("position") def position_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("unknown", "closed", "narrow", "wide"): + if value not in set(["unknown", "closed", "narrow", "wide"]): raise ValueError( "must be one of enum values ('unknown', 'closed', 'narrow', 'wide')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ProductCurtainStatus: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ProductCurtainStatus from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> ProductCurtainStatus: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ProductCurtainStatus from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ProductCurtainStatus.parse_obj(obj) + return cls.model_validate(obj) - _obj = ProductCurtainStatus.parse_obj( + _obj = cls.model_validate( {"moving": obj.get("moving"), "position": obj.get("position")} ) return _obj diff --git a/python_client/mozart_api/models/product_friendly_name.py b/python_client/mozart_api/models/product_friendly_name.py index aca474b..06aa5fc 100644 --- a/python_client/mozart_api/models/product_friendly_name.py +++ b/python_client/mozart_api/models/product_friendly_name.py @@ -18,55 +18,71 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class ProductFriendlyName(BaseModel): """ ProductFriendlyName - """ + """ # noqa: E501 friendly_name: Optional[StrictStr] = Field( - None, - alias="friendlyName", + default=None, description="The friendly name of the product, assignable by the end user, e.g. 'Kitchen speaker ", + alias="friendlyName", ) - __properties = ["friendlyName"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["friendlyName"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ProductFriendlyName: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ProductFriendlyName from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> ProductFriendlyName: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ProductFriendlyName from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ProductFriendlyName.parse_obj(obj) + return cls.model_validate(obj) - _obj = ProductFriendlyName.parse_obj({"friendly_name": obj.get("friendlyName")}) + _obj = cls.model_validate({"friendlyName": obj.get("friendlyName")}) return _obj diff --git a/python_client/mozart_api/models/product_state.py b/python_client/mozart_api/models/product_state.py index 4190050..9decfee 100644 --- a/python_client/mozart_api/models/product_state.py +++ b/python_client/mozart_api/models/product_state.py @@ -18,9 +18,8 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.microphones_state import MicrophonesState from mozart_api.models.playback_state import PlaybackState from mozart_api.models.power_state_enum import PowerStateEnum @@ -29,24 +28,26 @@ from mozart_api.models.source import Source from mozart_api.models.tv_state import TvState from mozart_api.models.volume_state import VolumeState +from typing import Optional, Set +from typing_extensions import Self class ProductState(BaseModel): """ ProductState - """ + """ # noqa: E501 microphones: Optional[MicrophonesState] = None playback: Optional[PlaybackState] = None - power_state: Optional[PowerStateEnum] = Field(None, alias="powerState") + power_state: Optional[PowerStateEnum] = Field(default=None, alias="powerState") software_update_state: Optional[SoftwareUpdateState] = Field( - None, alias="softwareUpdateState" + default=None, alias="softwareUpdateState" ) - sound_settings: Optional[SoundSettings] = Field(None, alias="soundSettings") + sound_settings: Optional[SoundSettings] = Field(default=None, alias="soundSettings") source: Optional[Source] = None tv: Optional[TvState] = None volume: Optional[VolumeState] = None - __properties = [ + __properties: ClassVar[List[str]] = [ "microphones", "playback", "powerState", @@ -57,28 +58,43 @@ class ProductState(BaseModel): "volume", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ProductState: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ProductState from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of microphones if self.microphones: _dict["microphones"] = self.microphones.to_dict() @@ -106,42 +122,54 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ProductState: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ProductState from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ProductState.parse_obj(obj) + return cls.model_validate(obj) - _obj = ProductState.parse_obj( + _obj = cls.model_validate( { - "microphones": MicrophonesState.from_dict(obj.get("microphones")) - if obj.get("microphones") is not None - else None, - "playback": PlaybackState.from_dict(obj.get("playback")) - if obj.get("playback") is not None - else None, - "power_state": PowerStateEnum.from_dict(obj.get("powerState")) - if obj.get("powerState") is not None - else None, - "software_update_state": SoftwareUpdateState.from_dict( - obj.get("softwareUpdateState") - ) - if obj.get("softwareUpdateState") is not None - else None, - "sound_settings": SoundSettings.from_dict(obj.get("soundSettings")) - if obj.get("soundSettings") is not None - else None, - "source": Source.from_dict(obj.get("source")) - if obj.get("source") is not None - else None, - "tv": TvState.from_dict(obj.get("tv")) - if obj.get("tv") is not None - else None, - "volume": VolumeState.from_dict(obj.get("volume")) - if obj.get("volume") is not None - else None, + "microphones": ( + MicrophonesState.from_dict(obj["microphones"]) + if obj.get("microphones") is not None + else None + ), + "playback": ( + PlaybackState.from_dict(obj["playback"]) + if obj.get("playback") is not None + else None + ), + "powerState": ( + PowerStateEnum.from_dict(obj["powerState"]) + if obj.get("powerState") is not None + else None + ), + "softwareUpdateState": ( + SoftwareUpdateState.from_dict(obj["softwareUpdateState"]) + if obj.get("softwareUpdateState") is not None + else None + ), + "soundSettings": ( + SoundSettings.from_dict(obj["soundSettings"]) + if obj.get("soundSettings") is not None + else None + ), + "source": ( + Source.from_dict(obj["source"]) + if obj.get("source") is not None + else None + ), + "tv": ( + TvState.from_dict(obj["tv"]) if obj.get("tv") is not None else None + ), + "volume": ( + VolumeState.from_dict(obj["volume"]) + if obj.get("volume") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/remote_menu_item.py b/python_client/mozart_api/models/remote_menu_item.py index 901955d..333c625 100644 --- a/python_client/mozart_api/models/remote_menu_item.py +++ b/python_client/mozart_api/models/remote_menu_item.py @@ -18,56 +18,64 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr, conlist, validator +from pydantic import ( + BaseModel, + ConfigDict, + Field, + StrictBool, + StrictStr, + field_validator, +) +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.action import Action from mozart_api.models.content_item import ContentItem +from typing import Optional, Set +from typing_extensions import Self class RemoteMenuItem(BaseModel): """ RemoteMenuItem - """ + """ # noqa: E501 - action_list: Optional[conlist(Action)] = Field( - None, - alias="actionList", + action_list: Optional[List[Action]] = Field( + default=None, description="An ordered list of Actions to run on the product", + alias="actionList", ) - scene_list: Optional[conlist(StrictStr)] = Field( - None, alias="sceneList", description="A list of scenes" + scene_list: Optional[List[StrictStr]] = Field( + default=None, description="A list of scenes", alias="sceneList" ) disabled: Optional[StrictBool] = None dynamic_list: Optional[StrictStr] = Field( - None, - alias="dynamicList", + default=None, description="Let mozart create a dynamic list. This list will be attached as children to the menu item. If dynamicList is set it's not possible to change or manipulate any of the children because mozart can alter them at any given time ", + alias="dynamicList", ) first_child_menu_item_id: Optional[StrictStr] = Field( - None, - alias="firstChildMenuItemId", + default=None, description="ID of the first child menu item", + alias="firstChildMenuItemId", ) label: Optional[StrictStr] = Field( - None, description="Alternative label, if omitted mozart will try its best" + default=None, + description="Alternative label, if omitted mozart will try its best", ) next_sibling_menu_item_id: Optional[StrictStr] = Field( - None, - alias="nextSiblingMenuItemId", + default=None, description="ID of the next sibling menu item", + alias="nextSiblingMenuItemId", ) parent_menu_item_id: Optional[StrictStr] = Field( - None, alias="parentMenuItemId", description="ID of the parent menu item" + default=None, description="ID of the parent menu item", alias="parentMenuItemId" ) available: Optional[StrictBool] = None content: Optional[ContentItem] = None fixed: StrictBool = Field( - ..., - description="True if this is a fixed menu item. A fixed item can't be deleted or moved", + description="True if this is a fixed menu item. A fixed item can't be deleted or moved" ) - id: StrictStr = Field(..., description="Unique ID for this menu item") - __properties = [ + id: StrictStr = Field(description="Unique ID for this menu item") + __properties: ClassVar[List[str]] = [ "actionList", "sceneList", "disabled", @@ -82,38 +90,53 @@ class RemoteMenuItem(BaseModel): "id", ] - @validator("dynamic_list") + @field_validator("dynamic_list") def dynamic_list_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("none", "radioFavorites"): + if value not in set(["none", "radioFavorites"]): raise ValueError("must be one of enum values ('none', 'radioFavorites')") return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> RemoteMenuItem: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of RemoteMenuItem from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in action_list (list) _items = [] if self.action_list: @@ -125,78 +148,80 @@ def to_dict(self): if self.content: _dict["content"] = self.content.to_dict() # set to None if disabled (nullable) is None - # and __fields_set__ contains the field - if self.disabled is None and "disabled" in self.__fields_set__: + # and model_fields_set contains the field + if self.disabled is None and "disabled" in self.model_fields_set: _dict["disabled"] = None # set to None if dynamic_list (nullable) is None - # and __fields_set__ contains the field - if self.dynamic_list is None and "dynamic_list" in self.__fields_set__: + # and model_fields_set contains the field + if self.dynamic_list is None and "dynamic_list" in self.model_fields_set: _dict["dynamicList"] = None # set to None if first_child_menu_item_id (nullable) is None - # and __fields_set__ contains the field + # and model_fields_set contains the field if ( self.first_child_menu_item_id is None - and "first_child_menu_item_id" in self.__fields_set__ + and "first_child_menu_item_id" in self.model_fields_set ): _dict["firstChildMenuItemId"] = None # set to None if label (nullable) is None - # and __fields_set__ contains the field - if self.label is None and "label" in self.__fields_set__: + # and model_fields_set contains the field + if self.label is None and "label" in self.model_fields_set: _dict["label"] = None # set to None if next_sibling_menu_item_id (nullable) is None - # and __fields_set__ contains the field + # and model_fields_set contains the field if ( self.next_sibling_menu_item_id is None - and "next_sibling_menu_item_id" in self.__fields_set__ + and "next_sibling_menu_item_id" in self.model_fields_set ): _dict["nextSiblingMenuItemId"] = None # set to None if parent_menu_item_id (nullable) is None - # and __fields_set__ contains the field + # and model_fields_set contains the field if ( self.parent_menu_item_id is None - and "parent_menu_item_id" in self.__fields_set__ + and "parent_menu_item_id" in self.model_fields_set ): _dict["parentMenuItemId"] = None # set to None if available (nullable) is None - # and __fields_set__ contains the field - if self.available is None and "available" in self.__fields_set__: + # and model_fields_set contains the field + if self.available is None and "available" in self.model_fields_set: _dict["available"] = None return _dict @classmethod - def from_dict(cls, obj: dict) -> RemoteMenuItem: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of RemoteMenuItem from a dict""" if obj is None: return None if not isinstance(obj, dict): - return RemoteMenuItem.parse_obj(obj) + return cls.model_validate(obj) - _obj = RemoteMenuItem.parse_obj( + _obj = cls.model_validate( { - "action_list": [ - Action.from_dict(_item) for _item in obj.get("actionList") - ] - if obj.get("actionList") is not None - else None, - "scene_list": obj.get("sceneList"), + "actionList": ( + [Action.from_dict(_item) for _item in obj["actionList"]] + if obj.get("actionList") is not None + else None + ), + "sceneList": obj.get("sceneList"), "disabled": obj.get("disabled"), - "dynamic_list": obj.get("dynamicList"), - "first_child_menu_item_id": obj.get("firstChildMenuItemId"), + "dynamicList": obj.get("dynamicList"), + "firstChildMenuItemId": obj.get("firstChildMenuItemId"), "label": obj.get("label"), - "next_sibling_menu_item_id": obj.get("nextSiblingMenuItemId"), - "parent_menu_item_id": obj.get("parentMenuItemId"), + "nextSiblingMenuItemId": obj.get("nextSiblingMenuItemId"), + "parentMenuItemId": obj.get("parentMenuItemId"), "available": obj.get("available"), - "content": ContentItem.from_dict(obj.get("content")) - if obj.get("content") is not None - else None, + "content": ( + ContentItem.from_dict(obj["content"]) + if obj.get("content") is not None + else None + ), "fixed": obj.get("fixed"), "id": obj.get("id"), } diff --git a/python_client/mozart_api/models/remote_menu_item_properties.py b/python_client/mozart_api/models/remote_menu_item_properties.py index 2dd2c03..4f90008 100644 --- a/python_client/mozart_api/models/remote_menu_item_properties.py +++ b/python_client/mozart_api/models/remote_menu_item_properties.py @@ -18,48 +18,57 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr, conlist, validator +from pydantic import ( + BaseModel, + ConfigDict, + Field, + StrictBool, + StrictStr, + field_validator, +) +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.action import Action +from typing import Optional, Set +from typing_extensions import Self class RemoteMenuItemProperties(BaseModel): """ RemoteMenuItemProperties - """ + """ # noqa: E501 - action_list: Optional[conlist(Action)] = Field( - None, - alias="actionList", + action_list: Optional[List[Action]] = Field( + default=None, description="An ordered list of Actions to run on the product", + alias="actionList", ) - scene_list: Optional[conlist(StrictStr)] = Field( - None, alias="sceneList", description="A list of scenes" + scene_list: Optional[List[StrictStr]] = Field( + default=None, description="A list of scenes", alias="sceneList" ) disabled: Optional[StrictBool] = None dynamic_list: Optional[StrictStr] = Field( - None, - alias="dynamicList", + default=None, description="Let mozart create a dynamic list. This list will be attached as children to the menu item. If dynamicList is set it's not possible to change or manipulate any of the children because mozart can alter them at any given time ", + alias="dynamicList", ) first_child_menu_item_id: Optional[StrictStr] = Field( - None, - alias="firstChildMenuItemId", + default=None, description="ID of the first child menu item", + alias="firstChildMenuItemId", ) label: Optional[StrictStr] = Field( - None, description="Alternative label, if omitted mozart will try its best" + default=None, + description="Alternative label, if omitted mozart will try its best", ) next_sibling_menu_item_id: Optional[StrictStr] = Field( - None, - alias="nextSiblingMenuItemId", + default=None, description="ID of the next sibling menu item", + alias="nextSiblingMenuItemId", ) parent_menu_item_id: Optional[StrictStr] = Field( - None, alias="parentMenuItemId", description="ID of the parent menu item" + default=None, description="ID of the parent menu item", alias="parentMenuItemId" ) - __properties = [ + __properties: ClassVar[List[str]] = [ "actionList", "sceneList", "disabled", @@ -70,38 +79,53 @@ class RemoteMenuItemProperties(BaseModel): "parentMenuItemId", ] - @validator("dynamic_list") + @field_validator("dynamic_list") def dynamic_list_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("none", "radioFavorites"): + if value not in set(["none", "radioFavorites"]): raise ValueError("must be one of enum values ('none', 'radioFavorites')") return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> RemoteMenuItemProperties: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of RemoteMenuItemProperties from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in action_list (list) _items = [] if self.action_list: @@ -110,69 +134,69 @@ def to_dict(self): _items.append(_item.to_dict()) _dict["actionList"] = _items # set to None if disabled (nullable) is None - # and __fields_set__ contains the field - if self.disabled is None and "disabled" in self.__fields_set__: + # and model_fields_set contains the field + if self.disabled is None and "disabled" in self.model_fields_set: _dict["disabled"] = None # set to None if dynamic_list (nullable) is None - # and __fields_set__ contains the field - if self.dynamic_list is None and "dynamic_list" in self.__fields_set__: + # and model_fields_set contains the field + if self.dynamic_list is None and "dynamic_list" in self.model_fields_set: _dict["dynamicList"] = None # set to None if first_child_menu_item_id (nullable) is None - # and __fields_set__ contains the field + # and model_fields_set contains the field if ( self.first_child_menu_item_id is None - and "first_child_menu_item_id" in self.__fields_set__ + and "first_child_menu_item_id" in self.model_fields_set ): _dict["firstChildMenuItemId"] = None # set to None if label (nullable) is None - # and __fields_set__ contains the field - if self.label is None and "label" in self.__fields_set__: + # and model_fields_set contains the field + if self.label is None and "label" in self.model_fields_set: _dict["label"] = None # set to None if next_sibling_menu_item_id (nullable) is None - # and __fields_set__ contains the field + # and model_fields_set contains the field if ( self.next_sibling_menu_item_id is None - and "next_sibling_menu_item_id" in self.__fields_set__ + and "next_sibling_menu_item_id" in self.model_fields_set ): _dict["nextSiblingMenuItemId"] = None # set to None if parent_menu_item_id (nullable) is None - # and __fields_set__ contains the field + # and model_fields_set contains the field if ( self.parent_menu_item_id is None - and "parent_menu_item_id" in self.__fields_set__ + and "parent_menu_item_id" in self.model_fields_set ): _dict["parentMenuItemId"] = None return _dict @classmethod - def from_dict(cls, obj: dict) -> RemoteMenuItemProperties: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of RemoteMenuItemProperties from a dict""" if obj is None: return None if not isinstance(obj, dict): - return RemoteMenuItemProperties.parse_obj(obj) + return cls.model_validate(obj) - _obj = RemoteMenuItemProperties.parse_obj( + _obj = cls.model_validate( { - "action_list": [ - Action.from_dict(_item) for _item in obj.get("actionList") - ] - if obj.get("actionList") is not None - else None, - "scene_list": obj.get("sceneList"), + "actionList": ( + [Action.from_dict(_item) for _item in obj["actionList"]] + if obj.get("actionList") is not None + else None + ), + "sceneList": obj.get("sceneList"), "disabled": obj.get("disabled"), - "dynamic_list": obj.get("dynamicList"), - "first_child_menu_item_id": obj.get("firstChildMenuItemId"), + "dynamicList": obj.get("dynamicList"), + "firstChildMenuItemId": obj.get("firstChildMenuItemId"), "label": obj.get("label"), - "next_sibling_menu_item_id": obj.get("nextSiblingMenuItemId"), - "parent_menu_item_id": obj.get("parentMenuItemId"), + "nextSiblingMenuItemId": obj.get("nextSiblingMenuItemId"), + "parentMenuItemId": obj.get("parentMenuItemId"), } ) return _obj diff --git a/python_client/mozart_api/models/remote_ui_key_state.py b/python_client/mozart_api/models/remote_ui_key_state.py index 91239c9..6722a16 100644 --- a/python_client/mozart_api/models/remote_ui_key_state.py +++ b/python_client/mozart_api/models/remote_ui_key_state.py @@ -18,66 +18,82 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class RemoteUIKeyState(BaseModel): """ RemoteUIKeyState - """ + """ # noqa: E501 state: Optional[StrictStr] = Field( - None, + default=None, description="The state of the pressed key. ShortPress and LongPress's duration are determined by the remote. Whereas Down, Continue, and Release reflect the state of the key and press duration is the time between a Down and a Release state. Continue indicates that a button is pressed and the key event should be handled multiple times until a release is received. ", ) - __properties = ["state"] + __properties: ClassVar[List[str]] = ["state"] - @validator("state") + @field_validator("state") def state_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("ShortPress", "LongPress", "Down", "Continue", "Release"): + if value not in set(["ShortPress", "LongPress", "Down", "Continue", "Release"]): raise ValueError( "must be one of enum values ('ShortPress', 'LongPress', 'Down', 'Continue', 'Release')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> RemoteUIKeyState: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of RemoteUIKeyState from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> RemoteUIKeyState: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of RemoteUIKeyState from a dict""" if obj is None: return None if not isinstance(obj, dict): - return RemoteUIKeyState.parse_obj(obj) + return cls.model_validate(obj) - _obj = RemoteUIKeyState.parse_obj({"state": obj.get("state")}) + _obj = cls.model_validate({"state": obj.get("state")}) return _obj diff --git a/python_client/mozart_api/models/rendering_state.py b/python_client/mozart_api/models/rendering_state.py index cc10b53..9ceeaa6 100644 --- a/python_client/mozart_api/models/rendering_state.py +++ b/python_client/mozart_api/models/rendering_state.py @@ -18,72 +18,90 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr, validator +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class RenderingState(BaseModel): """ RenderingState - """ + """ # noqa: E501 value: Optional[StrictStr] = None - __properties = ["value"] + __properties: ClassVar[List[str]] = ["value"] - @validator("value") + @field_validator("value") def value_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ( - "idle", - "buffering", - "started", - "paused", - "stopped", - "ended", - "error", - "unknown", + if value not in set( + [ + "idle", + "buffering", + "started", + "paused", + "stopped", + "ended", + "error", + "unknown", + ] ): raise ValueError( "must be one of enum values ('idle', 'buffering', 'started', 'paused', 'stopped', 'ended', 'error', 'unknown')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> RenderingState: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of RenderingState from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> RenderingState: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of RenderingState from a dict""" if obj is None: return None if not isinstance(obj, dict): - return RenderingState.parse_obj(obj) + return cls.model_validate(obj) - _obj = RenderingState.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/room_compensation.py b/python_client/mozart_api/models/room_compensation.py index 6421975..1490044 100644 --- a/python_client/mozart_api/models/room_compensation.py +++ b/python_client/mozart_api/models/room_compensation.py @@ -18,54 +18,69 @@ import re # noqa: F401 import json - -from typing import List -from pydantic import BaseModel, Field, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self class RoomCompensation(BaseModel): """ RoomCompensation - """ + """ # noqa: E501 - value: conlist(StrictStr) = Field( - ..., - description="List of room compensation sweeps to combine. No room compensation is done if this list is empty. The maximum length of this list is product specific. ", + value: List[StrictStr] = Field( + description="List of room compensation sweeps to combine. No room compensation is done if this list is empty. The maximum length of this list is product specific. " ) - __properties = ["value"] + __properties: ClassVar[List[str]] = ["value"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> RoomCompensation: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of RoomCompensation from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> RoomCompensation: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of RoomCompensation from a dict""" if obj is None: return None if not isinstance(obj, dict): - return RoomCompensation.parse_obj(obj) + return cls.model_validate(obj) - _obj = RoomCompensation.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/room_compensation_current_measurement.py b/python_client/mozart_api/models/room_compensation_current_measurement.py index a405d79..5eb235b 100644 --- a/python_client/mozart_api/models/room_compensation_current_measurement.py +++ b/python_client/mozart_api/models/room_compensation_current_measurement.py @@ -18,69 +18,85 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class RoomCompensationCurrentMeasurement(BaseModel): """ - State and speaker ID of the currently running measurement. Is only relevant for advanced room compensation. # noqa: E501 - """ + State and speaker ID of the currently running measurement. Is only relevant for advanced room compensation. + """ # noqa: E501 - speaker_id: Optional[StrictStr] = Field(None, alias="speakerId") + speaker_id: Optional[StrictStr] = Field(default=None, alias="speakerId") state: Optional[StrictStr] = Field( - None, + default=None, description="State of the measurement for the speaker. started: The measurement has started. done: The measurement has ended successfully. lastDone: The last measurement in the run has ended successfully. error: An error occurred during measurement. ", ) - __properties = ["speakerId", "state"] + __properties: ClassVar[List[str]] = ["speakerId", "state"] - @validator("state") + @field_validator("state") def state_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("started", "done", "lastDone", "error"): + if value not in set(["started", "done", "lastDone", "error"]): raise ValueError( "must be one of enum values ('started', 'done', 'lastDone', 'error')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> RoomCompensationCurrentMeasurement: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of RoomCompensationCurrentMeasurement from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> RoomCompensationCurrentMeasurement: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of RoomCompensationCurrentMeasurement from a dict""" if obj is None: return None if not isinstance(obj, dict): - return RoomCompensationCurrentMeasurement.parse_obj(obj) + return cls.model_validate(obj) - _obj = RoomCompensationCurrentMeasurement.parse_obj( - {"speaker_id": obj.get("speakerId"), "state": obj.get("state")} + _obj = cls.model_validate( + {"speakerId": obj.get("speakerId"), "state": obj.get("state")} ) return _obj diff --git a/python_client/mozart_api/models/room_compensation_debug.py b/python_client/mozart_api/models/room_compensation_debug.py index 1e94710..1a6f42b 100644 --- a/python_client/mozart_api/models/room_compensation_debug.py +++ b/python_client/mozart_api/models/room_compensation_debug.py @@ -18,51 +18,67 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictBool +from pydantic import BaseModel, ConfigDict, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class RoomCompensationDebug(BaseModel): """ RoomCompensationDebug - """ + """ # noqa: E501 value: Optional[StrictBool] = None - __properties = ["value"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["value"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> RoomCompensationDebug: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of RoomCompensationDebug from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> RoomCompensationDebug: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of RoomCompensationDebug from a dict""" if obj is None: return None if not isinstance(obj, dict): - return RoomCompensationDebug.parse_obj(obj) + return cls.model_validate(obj) - _obj = RoomCompensationDebug.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/room_compensation_enabled.py b/python_client/mozart_api/models/room_compensation_enabled.py index 3da4899..56202af 100644 --- a/python_client/mozart_api/models/room_compensation_enabled.py +++ b/python_client/mozart_api/models/room_compensation_enabled.py @@ -18,51 +18,67 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictBool +from pydantic import BaseModel, ConfigDict, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class RoomCompensationEnabled(BaseModel): """ RoomCompensationEnabled - """ + """ # noqa: E501 value: Optional[StrictBool] = None - __properties = ["value"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["value"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> RoomCompensationEnabled: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of RoomCompensationEnabled from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> RoomCompensationEnabled: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of RoomCompensationEnabled from a dict""" if obj is None: return None if not isinstance(obj, dict): - return RoomCompensationEnabled.parse_obj(obj) + return cls.model_validate(obj) - _obj = RoomCompensationEnabled.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/room_compensation_error_details.py b/python_client/mozart_api/models/room_compensation_error_details.py index 9700f82..47a4e8e 100644 --- a/python_client/mozart_api/models/room_compensation_error_details.py +++ b/python_client/mozart_api/models/room_compensation_error_details.py @@ -18,48 +18,64 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, conlist +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.room_compensation_measurement_error import ( RoomCompensationMeasurementError, ) +from typing import Optional, Set +from typing_extensions import Self class RoomCompensationErrorDetails(BaseModel): """ RoomCompensationErrorDetails - """ + """ # noqa: E501 - error_list: Optional[conlist(RoomCompensationMeasurementError)] = Field( - None, - alias="errorList", + error_list: Optional[List[RoomCompensationMeasurementError]] = Field( + default=None, description="List of the speakers where measurement failed, including error type.", + alias="errorList", ) - __properties = ["errorList"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["errorList"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> RoomCompensationErrorDetails: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of RoomCompensationErrorDetails from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in error_list (list) _items = [] if self.error_list: @@ -70,22 +86,24 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> RoomCompensationErrorDetails: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of RoomCompensationErrorDetails from a dict""" if obj is None: return None if not isinstance(obj, dict): - return RoomCompensationErrorDetails.parse_obj(obj) + return cls.model_validate(obj) - _obj = RoomCompensationErrorDetails.parse_obj( + _obj = cls.model_validate( { - "error_list": [ - RoomCompensationMeasurementError.from_dict(_item) - for _item in obj.get("errorList") - ] - if obj.get("errorList") is not None - else None + "errorList": ( + [ + RoomCompensationMeasurementError.from_dict(_item) + for _item in obj["errorList"] + ] + if obj.get("errorList") is not None + else None + ) } ) return _obj diff --git a/python_client/mozart_api/models/room_compensation_feature.py b/python_client/mozart_api/models/room_compensation_feature.py index b871f5a..b0d6d93 100644 --- a/python_client/mozart_api/models/room_compensation_feature.py +++ b/python_client/mozart_api/models/room_compensation_feature.py @@ -18,72 +18,85 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conint, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self class RoomCompensationFeature(BaseModel): """ RoomCompensationFeature - """ + """ # noqa: E501 - value: conlist(StrictStr) = Field( - ..., - description="List of room compensation sweeps to combine. No room compensation is done if this list is empty. The maximum length of this list is product specific. ", + value: List[StrictStr] = Field( + description="List of room compensation sweeps to combine. No room compensation is done if this list is empty. The maximum length of this list is product specific. " ) - default: conlist(StrictStr) = Field( - ..., - description="List of room compensation sweeps to combine. No room compensation is done if this list is empty. The maximum length of this list is product specific. ", + default: List[StrictStr] = Field( + description="List of room compensation sweeps to combine. No room compensation is done if this list is empty. The maximum length of this list is product specific. " ) - max_items: Optional[conint(strict=True, le=20, ge=1)] = Field( - None, - alias="maxItems", + max_items: Optional[Annotated[int, Field(le=20, strict=True, ge=1)]] = Field( + default=None, description="Maximum number of items in the `value` field", + alias="maxItems", ) - range: conlist(StrictStr) = Field( - ..., description="Possible values for the `value` field" - ) - __properties = ["value", "default", "maxItems", "range"] - - class Config: - """Pydantic configuration""" + range: List[StrictStr] = Field(description="Possible values for the `value` field") + __properties: ClassVar[List[str]] = ["value", "default", "maxItems", "range"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> RoomCompensationFeature: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of RoomCompensationFeature from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> RoomCompensationFeature: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of RoomCompensationFeature from a dict""" if obj is None: return None if not isinstance(obj, dict): - return RoomCompensationFeature.parse_obj(obj) + return cls.model_validate(obj) - _obj = RoomCompensationFeature.parse_obj( + _obj = cls.model_validate( { "value": obj.get("value"), "default": obj.get("default"), - "max_items": obj.get("maxItems"), + "maxItems": obj.get("maxItems"), "range": obj.get("range"), } ) diff --git a/python_client/mozart_api/models/room_compensation_info.py b/python_client/mozart_api/models/room_compensation_info.py index 69e8ff9..4f71318 100644 --- a/python_client/mozart_api/models/room_compensation_info.py +++ b/python_client/mozart_api/models/room_compensation_info.py @@ -18,52 +18,77 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.room_compensation_debug import RoomCompensationDebug from mozart_api.models.room_compensation_enabled import RoomCompensationEnabled from mozart_api.models.room_compensation_result import RoomCompensationResult from mozart_api.models.room_compensation_state import RoomCompensationState from mozart_api.models.room_compensation_type import RoomCompensationType from mozart_api.models.room_compensation_version import RoomCompensationVersion +from typing import Optional, Set +from typing_extensions import Self class RoomCompensationInfo(BaseModel): """ RoomCompensationInfo - """ + """ # noqa: E501 debug: Optional[RoomCompensationDebug] = None enabled: Optional[RoomCompensationEnabled] = None - last_result: Optional[RoomCompensationResult] = Field(None, alias="lastResult") - last_run: Optional[RoomCompensationState] = Field(None, alias="lastRun") + last_result: Optional[RoomCompensationResult] = Field( + default=None, alias="lastResult" + ) + last_run: Optional[RoomCompensationState] = Field(default=None, alias="lastRun") type: Optional[RoomCompensationType] = None version: Optional[RoomCompensationVersion] = None - __properties = ["debug", "enabled", "lastResult", "lastRun", "type", "version"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + __properties: ClassVar[List[str]] = [ + "debug", + "enabled", + "lastResult", + "lastRun", + "type", + "version", + ] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> RoomCompensationInfo: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of RoomCompensationInfo from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of debug if self.debug: _dict["debug"] = self.debug.to_dict() @@ -85,34 +110,46 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> RoomCompensationInfo: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of RoomCompensationInfo from a dict""" if obj is None: return None if not isinstance(obj, dict): - return RoomCompensationInfo.parse_obj(obj) + return cls.model_validate(obj) - _obj = RoomCompensationInfo.parse_obj( + _obj = cls.model_validate( { - "debug": RoomCompensationDebug.from_dict(obj.get("debug")) - if obj.get("debug") is not None - else None, - "enabled": RoomCompensationEnabled.from_dict(obj.get("enabled")) - if obj.get("enabled") is not None - else None, - "last_result": RoomCompensationResult.from_dict(obj.get("lastResult")) - if obj.get("lastResult") is not None - else None, - "last_run": RoomCompensationState.from_dict(obj.get("lastRun")) - if obj.get("lastRun") is not None - else None, - "type": RoomCompensationType.from_dict(obj.get("type")) - if obj.get("type") is not None - else None, - "version": RoomCompensationVersion.from_dict(obj.get("version")) - if obj.get("version") is not None - else None, + "debug": ( + RoomCompensationDebug.from_dict(obj["debug"]) + if obj.get("debug") is not None + else None + ), + "enabled": ( + RoomCompensationEnabled.from_dict(obj["enabled"]) + if obj.get("enabled") is not None + else None + ), + "lastResult": ( + RoomCompensationResult.from_dict(obj["lastResult"]) + if obj.get("lastResult") is not None + else None + ), + "lastRun": ( + RoomCompensationState.from_dict(obj["lastRun"]) + if obj.get("lastRun") is not None + else None + ), + "type": ( + RoomCompensationType.from_dict(obj["type"]) + if obj.get("type") is not None + else None + ), + "version": ( + RoomCompensationVersion.from_dict(obj["version"]) + if obj.get("version") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/room_compensation_measurement_error.py b/python_client/mozart_api/models/room_compensation_measurement_error.py index f19eabf..5549734 100644 --- a/python_client/mozart_api/models/room_compensation_measurement_error.py +++ b/python_client/mozart_api/models/room_compensation_measurement_error.py @@ -18,81 +18,99 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class RoomCompensationMeasurementError(BaseModel): """ RoomCompensationMeasurementError - """ + """ # noqa: E501 error: Optional[StrictStr] = Field( - None, + default=None, description="noError: The measurement went OK. lowSignal: When there is too low signal in the recording, e.g. due to a loudspeaker being placed at too great a distance from the microphone. speakerSilent: No signal could be measured. Could be because: - The speaker is powered off or not connected. - The left/right switch on a wired powerlink speaker is set in the wrong position. - The speaker is placed in another room behind closed doors. noisyMicrophone: When the recording of the given microphone is too noisy. Could be because: - Something is blocking the microphone externalMicrophoneLocation: When the location of the external microphone is invalid. externalMicrophoneMissing: If the external microphone was missing/disconnected during a measurement. microphonesDisabled: If the microphones are either muted or disabled. noisyMeasurement: When too much background noise has been detected during the measurement internalError: Something went wrong internally - can not be fixed by the user. Try again. ", ) - speaker_id: Optional[StrictStr] = Field(None, alias="speakerId") - __properties = ["error", "speakerId"] + speaker_id: Optional[StrictStr] = Field(default=None, alias="speakerId") + __properties: ClassVar[List[str]] = ["error", "speakerId"] - @validator("error") + @field_validator("error") def error_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ( - "noError", - "lowSignal", - "speakerSilent", - "noisyLeftMicrophone", - "noisyRightMicrophone", - "noisyExternalMicrophone", - "externalMicrophoneLocation", - "externalMicrophoneMissing", - "microphonesDisabled", - "noisyMeasurement", - "internalError", + if value not in set( + [ + "noError", + "lowSignal", + "speakerSilent", + "noisyLeftMicrophone", + "noisyRightMicrophone", + "noisyExternalMicrophone", + "externalMicrophoneLocation", + "externalMicrophoneMissing", + "microphonesDisabled", + "noisyMeasurement", + "internalError", + ] ): raise ValueError( "must be one of enum values ('noError', 'lowSignal', 'speakerSilent', 'noisyLeftMicrophone', 'noisyRightMicrophone', 'noisyExternalMicrophone', 'externalMicrophoneLocation', 'externalMicrophoneMissing', 'microphonesDisabled', 'noisyMeasurement', 'internalError')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> RoomCompensationMeasurementError: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of RoomCompensationMeasurementError from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> RoomCompensationMeasurementError: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of RoomCompensationMeasurementError from a dict""" if obj is None: return None if not isinstance(obj, dict): - return RoomCompensationMeasurementError.parse_obj(obj) + return cls.model_validate(obj) - _obj = RoomCompensationMeasurementError.parse_obj( - {"error": obj.get("error"), "speaker_id": obj.get("speakerId")} + _obj = cls.model_validate( + {"error": obj.get("error"), "speakerId": obj.get("speakerId")} ) return _obj diff --git a/python_client/mozart_api/models/room_compensation_properties.py b/python_client/mozart_api/models/room_compensation_properties.py index 9ab6083..2735f97 100644 --- a/python_client/mozart_api/models/room_compensation_properties.py +++ b/python_client/mozart_api/models/room_compensation_properties.py @@ -18,47 +18,58 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr, conint, conlist, validator +from pydantic import ( + BaseModel, + ConfigDict, + Field, + StrictBool, + StrictStr, + field_validator, +) +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated from mozart_api.models.latency_profile import LatencyProfile +from typing import Optional, Set +from typing_extensions import Self class RoomCompensationProperties(BaseModel): """ RoomCompensationProperties - """ + """ # noqa: E501 value: Optional[StrictStr] = Field( - None, + default=None, description="The type of roomcompensation used / to use. simple: For speakers without external speakers. advanced: For products with external speakers or other advanced multichannel capabilities. This requires that at least action in the other properties of RoomCompensationProperties is set. ", ) action: Optional[StrictStr] = Field( - None, + default=None, description="Must be set if room compensation type is advanced. runAll: Do measurements on all connected speakers. continue: Continue from and including the speaker where last interrupted (stopped or failed). useSpeakerList: Do measurements on the speakers in the list property. ", ) continue_on_error: Optional[StrictBool] = Field( - None, - alias="continueOnError", + default=None, description="On failing measurement on a speaker, default behavior is to stop measurement and skip the remaining speakers. Setting continueOnError to true will make the measurement process continue and finish measurement on all speakers, even though an error ocurred on one of the speakers. ", + alias="continueOnError", + ) + latency_profile: Optional[LatencyProfile] = Field( + default=None, alias="latencyProfile" ) - latency_profile: Optional[LatencyProfile] = Field(None, alias="latencyProfile") skip_automatic_role_assignment: Optional[StrictBool] = Field( - None, - alias="skipAutomaticRoleAssignment", + default=None, description="Skip calculation of automatic role assignment.", + alias="skipAutomaticRoleAssignment", ) - speaker_list: Optional[conlist(StrictStr)] = Field( - None, - alias="speakerList", + speaker_list: Optional[List[StrictStr]] = Field( + default=None, description="List of speaker IDs to include in room compensation / automatic role assignment measurement. Relevant e.g. if you want to create a speaker group without the external speakers included. This can not be used for doing measurements on a partial speaker group, only on all speakers in an existing group or for all speakers in a new group. ", + alias="speakerList", ) - speaker_preset: Optional[conint(strict=True, le=255, ge=0)] = Field( - None, - alias="speakerPreset", + speaker_preset: Optional[Annotated[int, Field(le=255, strict=True, ge=0)]] = Field( + default=None, description="The Powerlink preset to use for the external PL/WPL speakers.", + alias="speakerPreset", ) - __properties = [ + __properties: ClassVar[List[str]] = [ "value", "action", "continueOnError", @@ -68,108 +79,123 @@ class RoomCompensationProperties(BaseModel): "speakerPreset", ] - @validator("value") + @field_validator("value") def value_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("simple", "advanced"): + if value not in set(["simple", "advanced"]): raise ValueError("must be one of enum values ('simple', 'advanced')") return value - @validator("action") + @field_validator("action") def action_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("runAll", "continue", "useSpeakerList"): + if value not in set(["runAll", "continue", "useSpeakerList"]): raise ValueError( "must be one of enum values ('runAll', 'continue', 'useSpeakerList')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> RoomCompensationProperties: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of RoomCompensationProperties from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of latency_profile if self.latency_profile: _dict["latencyProfile"] = self.latency_profile.to_dict() # set to None if action (nullable) is None - # and __fields_set__ contains the field - if self.action is None and "action" in self.__fields_set__: + # and model_fields_set contains the field + if self.action is None and "action" in self.model_fields_set: _dict["action"] = None # set to None if continue_on_error (nullable) is None - # and __fields_set__ contains the field + # and model_fields_set contains the field if ( self.continue_on_error is None - and "continue_on_error" in self.__fields_set__ + and "continue_on_error" in self.model_fields_set ): _dict["continueOnError"] = None # set to None if skip_automatic_role_assignment (nullable) is None - # and __fields_set__ contains the field + # and model_fields_set contains the field if ( self.skip_automatic_role_assignment is None - and "skip_automatic_role_assignment" in self.__fields_set__ + and "skip_automatic_role_assignment" in self.model_fields_set ): _dict["skipAutomaticRoleAssignment"] = None # set to None if speaker_list (nullable) is None - # and __fields_set__ contains the field - if self.speaker_list is None and "speaker_list" in self.__fields_set__: + # and model_fields_set contains the field + if self.speaker_list is None and "speaker_list" in self.model_fields_set: _dict["speakerList"] = None # set to None if speaker_preset (nullable) is None - # and __fields_set__ contains the field - if self.speaker_preset is None and "speaker_preset" in self.__fields_set__: + # and model_fields_set contains the field + if self.speaker_preset is None and "speaker_preset" in self.model_fields_set: _dict["speakerPreset"] = None return _dict @classmethod - def from_dict(cls, obj: dict) -> RoomCompensationProperties: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of RoomCompensationProperties from a dict""" if obj is None: return None if not isinstance(obj, dict): - return RoomCompensationProperties.parse_obj(obj) + return cls.model_validate(obj) - _obj = RoomCompensationProperties.parse_obj( + _obj = cls.model_validate( { "value": obj.get("value"), "action": obj.get("action"), - "continue_on_error": obj.get("continueOnError"), - "latency_profile": LatencyProfile.from_dict(obj.get("latencyProfile")) - if obj.get("latencyProfile") is not None - else None, - "skip_automatic_role_assignment": obj.get( - "skipAutomaticRoleAssignment" + "continueOnError": obj.get("continueOnError"), + "latencyProfile": ( + LatencyProfile.from_dict(obj["latencyProfile"]) + if obj.get("latencyProfile") is not None + else None ), - "speaker_list": obj.get("speakerList"), - "speaker_preset": obj.get("speakerPreset"), + "skipAutomaticRoleAssignment": obj.get("skipAutomaticRoleAssignment"), + "speakerList": obj.get("speakerList"), + "speakerPreset": obj.get("speakerPreset"), } ) return _obj diff --git a/python_client/mozart_api/models/room_compensation_range.py b/python_client/mozart_api/models/room_compensation_range.py index 81ff8b3..eb8175f 100644 --- a/python_client/mozart_api/models/room_compensation_range.py +++ b/python_client/mozart_api/models/room_compensation_range.py @@ -18,67 +18,81 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conint, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self class RoomCompensationRange(BaseModel): """ RoomCompensationRange - """ + """ # noqa: E501 - default: conlist(StrictStr) = Field( - ..., - description="List of room compensation sweeps to combine. No room compensation is done if this list is empty. The maximum length of this list is product specific. ", + default: List[StrictStr] = Field( + description="List of room compensation sweeps to combine. No room compensation is done if this list is empty. The maximum length of this list is product specific. " ) - max_items: Optional[conint(strict=True, le=20, ge=1)] = Field( - None, - alias="maxItems", + max_items: Optional[Annotated[int, Field(le=20, strict=True, ge=1)]] = Field( + default=None, description="Maximum number of items in the `value` field", + alias="maxItems", ) - range: conlist(StrictStr) = Field( - ..., description="Possible values for the `value` field" - ) - __properties = ["default", "maxItems", "range"] - - class Config: - """Pydantic configuration""" + range: List[StrictStr] = Field(description="Possible values for the `value` field") + __properties: ClassVar[List[str]] = ["default", "maxItems", "range"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> RoomCompensationRange: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of RoomCompensationRange from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> RoomCompensationRange: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of RoomCompensationRange from a dict""" if obj is None: return None if not isinstance(obj, dict): - return RoomCompensationRange.parse_obj(obj) + return cls.model_validate(obj) - _obj = RoomCompensationRange.parse_obj( + _obj = cls.model_validate( { "default": obj.get("default"), - "max_items": obj.get("maxItems"), + "maxItems": obj.get("maxItems"), "range": obj.get("range"), } ) diff --git a/python_client/mozart_api/models/room_compensation_response.py b/python_client/mozart_api/models/room_compensation_response.py index 3461231..c15864e 100644 --- a/python_client/mozart_api/models/room_compensation_response.py +++ b/python_client/mozart_api/models/room_compensation_response.py @@ -18,54 +18,70 @@ import re # noqa: F401 import json - -from typing import Optional, Union -from pydantic import BaseModel, StrictFloat, StrictInt +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self class RoomCompensationResponse(BaseModel): """ RoomCompensationResponse - """ + """ # noqa: E501 frequency: Optional[StrictInt] = None gain: Optional[Union[StrictFloat, StrictInt]] = None - __properties = ["frequency", "gain"] + __properties: ClassVar[List[str]] = ["frequency", "gain"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> RoomCompensationResponse: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of RoomCompensationResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> RoomCompensationResponse: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of RoomCompensationResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return RoomCompensationResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = RoomCompensationResponse.parse_obj( + _obj = cls.model_validate( {"frequency": obj.get("frequency"), "gain": obj.get("gain")} ) return _obj diff --git a/python_client/mozart_api/models/room_compensation_result.py b/python_client/mozart_api/models/room_compensation_result.py index 28cb12c..1ff5bee 100644 --- a/python_client/mozart_api/models/room_compensation_result.py +++ b/python_client/mozart_api/models/room_compensation_result.py @@ -19,30 +19,32 @@ import json from datetime import datetime -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.room_compensation_response import RoomCompensationResponse from mozart_api.models.speaker_group import SpeakerGroup +from typing import Optional, Set +from typing_extensions import Self class RoomCompensationResult(BaseModel): """ RoomCompensationResult - """ + """ # noqa: E501 - compensation: Optional[conlist(RoomCompensationResponse)] = None - measured_response: Optional[conlist(RoomCompensationResponse)] = Field( - None, alias="measuredResponse" + compensation: Optional[List[RoomCompensationResponse]] = None + measured_response: Optional[List[RoomCompensationResponse]] = Field( + default=None, alias="measuredResponse" ) placement: Optional[StrictStr] = None - reference_response: Optional[conlist(RoomCompensationResponse)] = Field( - None, alias="referenceResponse" + reference_response: Optional[List[RoomCompensationResponse]] = Field( + default=None, alias="referenceResponse" ) speaker_group_suggestion: Optional[SpeakerGroup] = Field( - None, alias="speakerGroupSuggestion" + default=None, alias="speakerGroupSuggestion" ) - time_stamp: Optional[datetime] = Field(None, alias="timeStamp") - __properties = [ + time_stamp: Optional[datetime] = Field(default=None, alias="timeStamp") + __properties: ClassVar[List[str]] = [ "compensation", "measuredResponse", "placement", @@ -51,40 +53,55 @@ class RoomCompensationResult(BaseModel): "timeStamp", ] - @validator("placement") + @field_validator("placement") def placement_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("free", "nearWall", "unknown"): + if value not in set(["free", "nearWall", "unknown"]): raise ValueError( "must be one of enum values ('free', 'nearWall', 'unknown')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> RoomCompensationResult: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of RoomCompensationResult from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in compensation (list) _items = [] if self.compensation: @@ -112,41 +129,47 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> RoomCompensationResult: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of RoomCompensationResult from a dict""" if obj is None: return None if not isinstance(obj, dict): - return RoomCompensationResult.parse_obj(obj) + return cls.model_validate(obj) - _obj = RoomCompensationResult.parse_obj( + _obj = cls.model_validate( { - "compensation": [ - RoomCompensationResponse.from_dict(_item) - for _item in obj.get("compensation") - ] - if obj.get("compensation") is not None - else None, - "measured_response": [ - RoomCompensationResponse.from_dict(_item) - for _item in obj.get("measuredResponse") - ] - if obj.get("measuredResponse") is not None - else None, + "compensation": ( + [ + RoomCompensationResponse.from_dict(_item) + for _item in obj["compensation"] + ] + if obj.get("compensation") is not None + else None + ), + "measuredResponse": ( + [ + RoomCompensationResponse.from_dict(_item) + for _item in obj["measuredResponse"] + ] + if obj.get("measuredResponse") is not None + else None + ), "placement": obj.get("placement"), - "reference_response": [ - RoomCompensationResponse.from_dict(_item) - for _item in obj.get("referenceResponse") - ] - if obj.get("referenceResponse") is not None - else None, - "speaker_group_suggestion": SpeakerGroup.from_dict( - obj.get("speakerGroupSuggestion") - ) - if obj.get("speakerGroupSuggestion") is not None - else None, - "time_stamp": obj.get("timeStamp"), + "referenceResponse": ( + [ + RoomCompensationResponse.from_dict(_item) + for _item in obj["referenceResponse"] + ] + if obj.get("referenceResponse") is not None + else None + ), + "speakerGroupSuggestion": ( + SpeakerGroup.from_dict(obj["speakerGroupSuggestion"]) + if obj.get("speakerGroupSuggestion") is not None + else None + ), + "timeStamp": obj.get("timeStamp"), } ) return _obj diff --git a/python_client/mozart_api/models/room_compensation_state.py b/python_client/mozart_api/models/room_compensation_state.py index 52af9ee..3150876 100644 --- a/python_client/mozart_api/models/room_compensation_state.py +++ b/python_client/mozart_api/models/room_compensation_state.py @@ -19,35 +19,44 @@ import json from datetime import datetime -from typing import Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr, validator +from pydantic import ( + BaseModel, + ConfigDict, + Field, + StrictBool, + StrictStr, + field_validator, +) +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.room_compensation_error_details import ( RoomCompensationErrorDetails, ) from mozart_api.models.room_compensation_properties import RoomCompensationProperties +from typing import Optional, Set +from typing_extensions import Self class RoomCompensationState(BaseModel): """ RoomCompensationState - """ + """ # noqa: E501 state: Optional[StrictStr] = None error: Optional[StrictStr] = Field( - None, + default=None, description="microphoneMuted: The microphone is muted (soft-off, using touch button). microphoneSwitchOff: The microphone switch is set in its off position. microphoneSignalMissing: No signal was detected. Is the microphone blocked? externalMicrophoneMissing: The external microphone is not connected. Is only relevant for advanced room compensation. externalMicrophoneInvalidPosition: The external microphone is placed in an invalid position, e.g. placed too close or in an extreme angle to the internal speakers. Is only relevant for advanced room compensation. noisyEnvironment: Too much environment noise to get a valid measurement. speakerMeasurementFailed: A measurement failed, related to one of the individual speakers. See the errorDetails property for details about the error and which speaker measurement failed. Is only relevant for advanced room compensation. invalidSpeakerList: The speaker list contains invalid speakers. Valid speakers are: all external speakers and non-virtual internal speakers. Is only relevant for advanced room compensation. invalidAction: Could not start with given action. Eg. can't run from last failed speaker if there isn't any failed run. Is only relevant for advanced room compensation. internalError: Internal product error. ", ) error_details: Optional[RoomCompensationErrorDetails] = Field( - None, alias="errorDetails" + default=None, alias="errorDetails" ) last_run_available: Optional[StrictBool] = Field( - None, - alias="lastRunAvailable", + default=None, description='When true, measurements have been cached due to manual interrupt or failure, making it possible to use the action "continue" where the system will continue from the speaker where interrupted. The cached measurements are only temporary and will be cleared after some time (default 15min), in which case lastRunAvailable becomes false. ', + alias="lastRunAvailable", ) properties: Optional[RoomCompensationProperties] = None - time_stamp: Optional[datetime] = Field(None, alias="timeStamp") - __properties = [ + time_stamp: Optional[datetime] = Field(default=None, alias="timeStamp") + __properties: ClassVar[List[str]] = [ "state", "error", "errorDetails", @@ -56,64 +65,81 @@ class RoomCompensationState(BaseModel): "timeStamp", ] - @validator("state") + @field_validator("state") def state_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("notStarted", "running", "done", "error", "stopped"): + if value not in set(["notStarted", "running", "done", "error", "stopped"]): raise ValueError( "must be one of enum values ('notStarted', 'running', 'done', 'error', 'stopped')" ) return value - @validator("error") + @field_validator("error") def error_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ( - "noError", - "microphoneMuted", - "microphoneSwitchOff", - "microphoneSignalMissing", - "externalMicrophoneMissing", - "externalMicrophoneInvalidPosition", - "noisyEnvironment", - "speakerMeasurementFailed", - "invalidSpeakerList", - "invalidAction", - "internalError", + if value not in set( + [ + "noError", + "microphoneMuted", + "microphoneSwitchOff", + "microphoneSignalMissing", + "externalMicrophoneMissing", + "externalMicrophoneInvalidPosition", + "noisyEnvironment", + "speakerMeasurementFailed", + "invalidSpeakerList", + "invalidAction", + "internalError", + ] ): raise ValueError( "must be one of enum values ('noError', 'microphoneMuted', 'microphoneSwitchOff', 'microphoneSignalMissing', 'externalMicrophoneMissing', 'externalMicrophoneInvalidPosition', 'noisyEnvironment', 'speakerMeasurementFailed', 'invalidSpeakerList', 'invalidAction', 'internalError')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> RoomCompensationState: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of RoomCompensationState from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of error_details if self.error_details: _dict["errorDetails"] = self.error_details.to_dict() @@ -123,30 +149,30 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> RoomCompensationState: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of RoomCompensationState from a dict""" if obj is None: return None if not isinstance(obj, dict): - return RoomCompensationState.parse_obj(obj) + return cls.model_validate(obj) - _obj = RoomCompensationState.parse_obj( + _obj = cls.model_validate( { "state": obj.get("state"), "error": obj.get("error"), - "error_details": RoomCompensationErrorDetails.from_dict( - obj.get("errorDetails") - ) - if obj.get("errorDetails") is not None - else None, - "last_run_available": obj.get("lastRunAvailable"), - "properties": RoomCompensationProperties.from_dict( - obj.get("properties") - ) - if obj.get("properties") is not None - else None, - "time_stamp": obj.get("timeStamp"), + "errorDetails": ( + RoomCompensationErrorDetails.from_dict(obj["errorDetails"]) + if obj.get("errorDetails") is not None + else None + ), + "lastRunAvailable": obj.get("lastRunAvailable"), + "properties": ( + RoomCompensationProperties.from_dict(obj["properties"]) + if obj.get("properties") is not None + else None + ), + "timeStamp": obj.get("timeStamp"), } ) return _obj diff --git a/python_client/mozart_api/models/room_compensation_state_value.py b/python_client/mozart_api/models/room_compensation_state_value.py index 839d989..b5dc622 100644 --- a/python_client/mozart_api/models/room_compensation_state_value.py +++ b/python_client/mozart_api/models/room_compensation_state_value.py @@ -18,63 +18,79 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr, validator +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class RoomCompensationStateValue(BaseModel): """ RoomCompensationStateValue - """ + """ # noqa: E501 state: Optional[StrictStr] = None - __properties = ["state"] + __properties: ClassVar[List[str]] = ["state"] - @validator("state") + @field_validator("state") def state_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("notStarted", "running", "done", "error", "stopped"): + if value not in set(["notStarted", "running", "done", "error", "stopped"]): raise ValueError( "must be one of enum values ('notStarted', 'running', 'done', 'error', 'stopped')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> RoomCompensationStateValue: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of RoomCompensationStateValue from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> RoomCompensationStateValue: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of RoomCompensationStateValue from a dict""" if obj is None: return None if not isinstance(obj, dict): - return RoomCompensationStateValue.parse_obj(obj) + return cls.model_validate(obj) - _obj = RoomCompensationStateValue.parse_obj({"state": obj.get("state")}) + _obj = cls.model_validate({"state": obj.get("state")}) return _obj diff --git a/python_client/mozart_api/models/room_compensation_type.py b/python_client/mozart_api/models/room_compensation_type.py index e2787f0..f2fb488 100644 --- a/python_client/mozart_api/models/room_compensation_type.py +++ b/python_client/mozart_api/models/room_compensation_type.py @@ -18,64 +18,80 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class RoomCompensationType(BaseModel): """ RoomCompensationType - """ + """ # noqa: E501 value: Optional[StrictStr] = Field( - None, + default=None, description="The type of roomcompensation used / to use. simple: For speakers without external speakers. advanced: For products with external speakers or other advanced multichannel capabilities. This requires that at least action in the other properties of RoomCompensationProperties is set. ", ) - __properties = ["value"] + __properties: ClassVar[List[str]] = ["value"] - @validator("value") + @field_validator("value") def value_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("simple", "advanced"): + if value not in set(["simple", "advanced"]): raise ValueError("must be one of enum values ('simple', 'advanced')") return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> RoomCompensationType: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of RoomCompensationType from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> RoomCompensationType: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of RoomCompensationType from a dict""" if obj is None: return None if not isinstance(obj, dict): - return RoomCompensationType.parse_obj(obj) + return cls.model_validate(obj) - _obj = RoomCompensationType.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/room_compensation_version.py b/python_client/mozart_api/models/room_compensation_version.py index c66583e..46563f8 100644 --- a/python_client/mozart_api/models/room_compensation_version.py +++ b/python_client/mozart_api/models/room_compensation_version.py @@ -18,54 +18,71 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, conint +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self class RoomCompensationVersion(BaseModel): """ RoomCompensationVersion - """ + """ # noqa: E501 - algorithm: Optional[conint(strict=True, ge=0)] = None - coefficients: Optional[conint(strict=True, ge=0)] = None - __properties = ["algorithm", "coefficients"] + algorithm: Optional[Annotated[int, Field(strict=True, ge=0)]] = None + coefficients: Optional[Annotated[int, Field(strict=True, ge=0)]] = None + __properties: ClassVar[List[str]] = ["algorithm", "coefficients"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> RoomCompensationVersion: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of RoomCompensationVersion from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> RoomCompensationVersion: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of RoomCompensationVersion from a dict""" if obj is None: return None if not isinstance(obj, dict): - return RoomCompensationVersion.parse_obj(obj) + return cls.model_validate(obj) - _obj = RoomCompensationVersion.parse_obj( + _obj = cls.model_validate( {"algorithm": obj.get("algorithm"), "coefficients": obj.get("coefficients")} ) return _obj diff --git a/python_client/mozart_api/models/scene.py b/python_client/mozart_api/models/scene.py index 30393e4..2f127f9 100644 --- a/python_client/mozart_api/models/scene.py +++ b/python_client/mozart_api/models/scene.py @@ -18,69 +18,93 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist, constr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated from mozart_api.models.action import Action +from typing import Optional, Set +from typing_extensions import Self class Scene(BaseModel): """ Scene - """ + """ # noqa: E501 - action_list: conlist(Action) = Field( - ..., - alias="actionList", + action_list: List[Action] = Field( description="An ordered list of Actions to run on the product", + alias="actionList", ) - client_context: Optional[constr(strict=True, max_length=4096)] = Field( - None, - alias="clientContext", - description="An optional generic string property supplied from the client. If supplied it will overwrite any currently stored clientContext. If not supplied any stored clientContext will be left unchanged. ", + client_context: Optional[Annotated[str, Field(strict=True, max_length=4096)]] = ( + Field( + default=None, + description="An optional generic string property supplied from the client. If supplied it will overwrite any currently stored clientContext. If not supplied any stored clientContext will be left unchanged. ", + alias="clientContext", + ) ) label: Optional[StrictStr] = None - tags: Optional[conlist(StrictStr)] = Field( - None, + tags: Optional[List[StrictStr]] = Field( + default=None, description="A list of user defined tags. This allows a client to create virtual lists", ) classification: Optional[StrictStr] = Field( - None, description="The classification of Scene" + default=None, description="The classification of Scene" ) - __properties = ["actionList", "clientContext", "label", "tags", "classification"] - - @validator("classification") + __properties: ClassVar[List[str]] = [ + "actionList", + "clientContext", + "label", + "tags", + "classification", + ] + + @field_validator("classification") def classification_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("system", "userDefined"): + if value not in set(["system", "userDefined"]): raise ValueError("must be one of enum values ('system', 'userDefined')") return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Scene: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Scene from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in action_list (list) _items = [] if self.action_list: @@ -89,39 +113,39 @@ def to_dict(self): _items.append(_item.to_dict()) _dict["actionList"] = _items # set to None if client_context (nullable) is None - # and __fields_set__ contains the field - if self.client_context is None and "client_context" in self.__fields_set__: + # and model_fields_set contains the field + if self.client_context is None and "client_context" in self.model_fields_set: _dict["clientContext"] = None # set to None if label (nullable) is None - # and __fields_set__ contains the field - if self.label is None and "label" in self.__fields_set__: + # and model_fields_set contains the field + if self.label is None and "label" in self.model_fields_set: _dict["label"] = None # set to None if classification (nullable) is None - # and __fields_set__ contains the field - if self.classification is None and "classification" in self.__fields_set__: + # and model_fields_set contains the field + if self.classification is None and "classification" in self.model_fields_set: _dict["classification"] = None return _dict @classmethod - def from_dict(cls, obj: dict) -> Scene: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Scene from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Scene.parse_obj(obj) + return cls.model_validate(obj) - _obj = Scene.parse_obj( + _obj = cls.model_validate( { - "action_list": [ - Action.from_dict(_item) for _item in obj.get("actionList") - ] - if obj.get("actionList") is not None - else None, - "client_context": obj.get("clientContext"), + "actionList": ( + [Action.from_dict(_item) for _item in obj["actionList"]] + if obj.get("actionList") is not None + else None + ), + "clientContext": obj.get("clientContext"), "label": obj.get("label"), "tags": obj.get("tags"), "classification": obj.get("classification"), diff --git a/python_client/mozart_api/models/scene_classification.py b/python_client/mozart_api/models/scene_classification.py index c59917c..2e9e03d 100644 --- a/python_client/mozart_api/models/scene_classification.py +++ b/python_client/mozart_api/models/scene_classification.py @@ -18,70 +18,84 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class SceneClassification(BaseModel): """ SceneClassification - """ + """ # noqa: E501 classification: Optional[StrictStr] = Field( - None, description="The classification of Scene" + default=None, description="The classification of Scene" ) - __properties = ["classification"] + __properties: ClassVar[List[str]] = ["classification"] - @validator("classification") + @field_validator("classification") def classification_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("system", "userDefined"): + if value not in set(["system", "userDefined"]): raise ValueError("must be one of enum values ('system', 'userDefined')") return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SceneClassification: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SceneClassification from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # set to None if classification (nullable) is None - # and __fields_set__ contains the field - if self.classification is None and "classification" in self.__fields_set__: + # and model_fields_set contains the field + if self.classification is None and "classification" in self.model_fields_set: _dict["classification"] = None return _dict @classmethod - def from_dict(cls, obj: dict) -> SceneClassification: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SceneClassification from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SceneClassification.parse_obj(obj) + return cls.model_validate(obj) - _obj = SceneClassification.parse_obj( - {"classification": obj.get("classification")} - ) + _obj = cls.model_validate({"classification": obj.get("classification")}) return _obj diff --git a/python_client/mozart_api/models/scene_match.py b/python_client/mozart_api/models/scene_match.py index a507813..b19d6d1 100644 --- a/python_client/mozart_api/models/scene_match.py +++ b/python_client/mozart_api/models/scene_match.py @@ -18,62 +18,76 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class SceneMatch(BaseModel): """ SceneMatch - """ + """ # noqa: E501 label: Optional[StrictStr] = None - tags: Optional[conlist(StrictStr)] = Field( - None, + tags: Optional[List[StrictStr]] = Field( + default=None, description="A list of user defined tags. This allows a client to create virtual lists", ) - __properties = ["label", "tags"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["label", "tags"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SceneMatch: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SceneMatch from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # set to None if label (nullable) is None - # and __fields_set__ contains the field - if self.label is None and "label" in self.__fields_set__: + # and model_fields_set contains the field + if self.label is None and "label" in self.model_fields_set: _dict["label"] = None return _dict @classmethod - def from_dict(cls, obj: dict) -> SceneMatch: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SceneMatch from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SceneMatch.parse_obj(obj) + return cls.model_validate(obj) - _obj = SceneMatch.parse_obj( - {"label": obj.get("label"), "tags": obj.get("tags")} - ) + _obj = cls.model_validate({"label": obj.get("label"), "tags": obj.get("tags")}) return _obj diff --git a/python_client/mozart_api/models/scene_properties.py b/python_client/mozart_api/models/scene_properties.py index ca0b598..20624f5 100644 --- a/python_client/mozart_api/models/scene_properties.py +++ b/python_client/mozart_api/models/scene_properties.py @@ -18,56 +18,74 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist, constr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated from mozart_api.models.action import Action +from typing import Optional, Set +from typing_extensions import Self class SceneProperties(BaseModel): """ SceneProperties - """ + """ # noqa: E501 - action_list: conlist(Action) = Field( - ..., - alias="actionList", + action_list: List[Action] = Field( description="An ordered list of Actions to run on the product", + alias="actionList", ) - client_context: Optional[constr(strict=True, max_length=4096)] = Field( - None, - alias="clientContext", - description="An optional generic string property supplied from the client. If supplied it will overwrite any currently stored clientContext. If not supplied any stored clientContext will be left unchanged. ", + client_context: Optional[Annotated[str, Field(strict=True, max_length=4096)]] = ( + Field( + default=None, + description="An optional generic string property supplied from the client. If supplied it will overwrite any currently stored clientContext. If not supplied any stored clientContext will be left unchanged. ", + alias="clientContext", + ) ) label: Optional[StrictStr] = None - tags: Optional[conlist(StrictStr)] = Field( - None, + tags: Optional[List[StrictStr]] = Field( + default=None, description="A list of user defined tags. This allows a client to create virtual lists", ) - __properties = ["actionList", "clientContext", "label", "tags"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["actionList", "clientContext", "label", "tags"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SceneProperties: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SceneProperties from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in action_list (list) _items = [] if self.action_list: @@ -76,34 +94,34 @@ def to_dict(self): _items.append(_item.to_dict()) _dict["actionList"] = _items # set to None if client_context (nullable) is None - # and __fields_set__ contains the field - if self.client_context is None and "client_context" in self.__fields_set__: + # and model_fields_set contains the field + if self.client_context is None and "client_context" in self.model_fields_set: _dict["clientContext"] = None # set to None if label (nullable) is None - # and __fields_set__ contains the field - if self.label is None and "label" in self.__fields_set__: + # and model_fields_set contains the field + if self.label is None and "label" in self.model_fields_set: _dict["label"] = None return _dict @classmethod - def from_dict(cls, obj: dict) -> SceneProperties: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SceneProperties from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SceneProperties.parse_obj(obj) + return cls.model_validate(obj) - _obj = SceneProperties.parse_obj( + _obj = cls.model_validate( { - "action_list": [ - Action.from_dict(_item) for _item in obj.get("actionList") - ] - if obj.get("actionList") is not None - else None, - "client_context": obj.get("clientContext"), + "actionList": ( + [Action.from_dict(_item) for _item in obj["actionList"]] + if obj.get("actionList") is not None + else None + ), + "clientContext": obj.get("clientContext"), "label": obj.get("label"), "tags": obj.get("tags"), } diff --git a/python_client/mozart_api/models/scene_trigger_base_properties.py b/python_client/mozart_api/models/scene_trigger_base_properties.py index 489b2eb..955a1cd 100644 --- a/python_client/mozart_api/models/scene_trigger_base_properties.py +++ b/python_client/mozart_api/models/scene_trigger_base_properties.py @@ -18,49 +18,65 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.action import Action +from typing import Optional, Set +from typing_extensions import Self class SceneTriggerBaseProperties(BaseModel): """ - Base properties for a scene trigger # noqa: E501 - """ + Base properties for a scene trigger + """ # noqa: E501 - action_list: Optional[conlist(Action)] = Field( - None, - alias="actionList", + action_list: Optional[List[Action]] = Field( + default=None, description="An ordered list of Actions to run on the product", + alias="actionList", ) - scene_list: Optional[conlist(StrictStr)] = Field( - None, alias="sceneList", description="A list of scenes" + scene_list: Optional[List[StrictStr]] = Field( + default=None, description="A list of scenes", alias="sceneList" ) - __properties = ["actionList", "sceneList"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["actionList", "sceneList"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SceneTriggerBaseProperties: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SceneTriggerBaseProperties from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in action_list (list) _items = [] if self.action_list: @@ -71,22 +87,22 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> SceneTriggerBaseProperties: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SceneTriggerBaseProperties from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SceneTriggerBaseProperties.parse_obj(obj) + return cls.model_validate(obj) - _obj = SceneTriggerBaseProperties.parse_obj( + _obj = cls.model_validate( { - "action_list": [ - Action.from_dict(_item) for _item in obj.get("actionList") - ] - if obj.get("actionList") is not None - else None, - "scene_list": obj.get("sceneList"), + "actionList": ( + [Action.from_dict(_item) for _item in obj["actionList"]] + if obj.get("actionList") is not None + else None + ), + "sceneList": obj.get("sceneList"), } ) return _obj diff --git a/python_client/mozart_api/models/software_update_state.py b/python_client/mozart_api/models/software_update_state.py index 56ed0c2..5aba6cc 100644 --- a/python_client/mozart_api/models/software_update_state.py +++ b/python_client/mozart_api/models/software_update_state.py @@ -18,83 +18,101 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class SoftwareUpdateState(BaseModel): """ SoftwareUpdateState - """ + """ # noqa: E501 - seconds_remaining: Optional[StrictInt] = Field(None, alias="secondsRemaining") + seconds_remaining: Optional[StrictInt] = Field( + default=None, alias="secondsRemaining" + ) value: Optional[StrictStr] = None - __properties = ["secondsRemaining", "value"] + __properties: ClassVar[List[str]] = ["secondsRemaining", "value"] - @validator("value") + @field_validator("value") def value_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ( - "idle", - "checking", - "updateCheckFailed", - "noUpdatesAvailable", - "updateAvailable", - "downloadingUpdate", - "updateDownloaded", - "downloadFailed", - "installingUpdate", - "installationFailed", - "installationDonePendingReboot", - "schedulerFailed", - "rebooting", + if value not in set( + [ + "idle", + "checking", + "updateCheckFailed", + "noUpdatesAvailable", + "updateAvailable", + "downloadingUpdate", + "updateDownloaded", + "downloadFailed", + "installingUpdate", + "installingAutomaticUpdate", + "installationFailed", + "installationDonePendingReboot", + "schedulerFailed", + "rebooting", + ] ): raise ValueError( - "must be one of enum values ('idle', 'checking', 'updateCheckFailed', 'noUpdatesAvailable', 'updateAvailable', 'downloadingUpdate', 'updateDownloaded', 'downloadFailed', 'installingUpdate', 'installationFailed', 'installationDonePendingReboot', 'schedulerFailed', 'rebooting')" + "must be one of enum values ('idle', 'checking', 'updateCheckFailed', 'noUpdatesAvailable', 'updateAvailable', 'downloadingUpdate', 'updateDownloaded', 'downloadFailed', 'installingUpdate', 'installingAutomaticUpdate', 'installationFailed', 'installationDonePendingReboot', 'schedulerFailed', 'rebooting')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SoftwareUpdateState: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SoftwareUpdateState from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> SoftwareUpdateState: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SoftwareUpdateState from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SoftwareUpdateState.parse_obj(obj) + return cls.model_validate(obj) - _obj = SoftwareUpdateState.parse_obj( - { - "seconds_remaining": obj.get("secondsRemaining"), - "value": obj.get("value"), - } + _obj = cls.model_validate( + {"secondsRemaining": obj.get("secondsRemaining"), "value": obj.get("value")} ) return _obj diff --git a/python_client/mozart_api/models/software_update_status.py b/python_client/mozart_api/models/software_update_status.py index f202311..7a00f60 100644 --- a/python_client/mozart_api/models/software_update_status.py +++ b/python_client/mozart_api/models/software_update_status.py @@ -19,77 +19,111 @@ import json from datetime import datetime -from typing import Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.software_update_state import SoftwareUpdateState +from typing import Optional, Set +from typing_extensions import Self class SoftwareUpdateStatus(BaseModel): """ SoftwareUpdateStatus - """ - - available_update: Optional[StrictStr] = Field(None, alias="availableUpdate") - last_check: Optional[datetime] = Field(None, alias="lastCheck") - last_update: Optional[datetime] = Field(None, alias="lastUpdate") - software_version: StrictStr = Field(..., alias="softwareVersion") - state: SoftwareUpdateState = Field(...) - update_progress: Optional[StrictInt] = Field(None, alias="updateProgress") - __properties = [ + """ # noqa: E501 + + available_update: Optional[StrictStr] = Field(default=None, alias="availableUpdate") + last_check: Optional[datetime] = Field(default=None, alias="lastCheck") + last_update: Optional[datetime] = Field(default=None, alias="lastUpdate") + software_version: StrictStr = Field(alias="softwareVersion") + state: SoftwareUpdateState + update_progress: Optional[StrictInt] = Field(default=None, alias="updateProgress") + update_type: Optional[StrictStr] = Field(default=None, alias="updateType") + __properties: ClassVar[List[str]] = [ "availableUpdate", "lastCheck", "lastUpdate", "softwareVersion", "state", "updateProgress", + "updateType", ] - class Config: - """Pydantic configuration""" + @field_validator("update_type") + def update_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - allow_population_by_field_name = True - validate_assignment = True + if value not in set(["none", "normal", "critical", "forced"]): + raise ValueError( + "must be one of enum values ('none', 'normal', 'critical', 'forced')" + ) + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SoftwareUpdateStatus: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SoftwareUpdateStatus from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of state if self.state: _dict["state"] = self.state.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> SoftwareUpdateStatus: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SoftwareUpdateStatus from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SoftwareUpdateStatus.parse_obj(obj) + return cls.model_validate(obj) - _obj = SoftwareUpdateStatus.parse_obj( + _obj = cls.model_validate( { - "available_update": obj.get("availableUpdate"), - "last_check": obj.get("lastCheck"), - "last_update": obj.get("lastUpdate"), - "software_version": obj.get("softwareVersion"), - "state": SoftwareUpdateState.from_dict(obj.get("state")) - if obj.get("state") is not None - else None, - "update_progress": obj.get("updateProgress"), + "availableUpdate": obj.get("availableUpdate"), + "lastCheck": obj.get("lastCheck"), + "lastUpdate": obj.get("lastUpdate"), + "softwareVersion": obj.get("softwareVersion"), + "state": ( + SoftwareUpdateState.from_dict(obj["state"]) + if obj.get("state") is not None + else None + ), + "updateProgress": obj.get("updateProgress"), + "updateType": obj.get("updateType"), } ) return _obj diff --git a/python_client/mozart_api/models/sound_adjustments.py b/python_client/mozart_api/models/sound_adjustments.py index 16cd0a1..f7d35e9 100644 --- a/python_client/mozart_api/models/sound_adjustments.py +++ b/python_client/mozart_api/models/sound_adjustments.py @@ -18,24 +18,33 @@ import re # noqa: F401 import json - -from typing import Optional, Union -from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr +from pydantic import ( + BaseModel, + ConfigDict, + Field, + StrictBool, + StrictFloat, + StrictInt, + StrictStr, +) +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self class SoundAdjustments(BaseModel): """ SoundAdjustments - """ + """ # noqa: E501 ambience: Optional[Union[StrictFloat, StrictInt]] = None bass: Optional[StrictInt] = None directivity: Optional[StrictStr] = None - eco_mode: Optional[StrictBool] = Field(None, alias="ecoMode") + eco_mode: Optional[StrictBool] = Field(default=None, alias="ecoMode") fadein: Optional[StrictBool] = None loudness: Optional[StrictBool] = None treble: Optional[StrictInt] = None - __properties = [ + __properties: ClassVar[List[str]] = [ "ambience", "bass", "directivity", @@ -45,45 +54,60 @@ class SoundAdjustments(BaseModel): "treble", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SoundAdjustments: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SoundAdjustments from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> SoundAdjustments: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SoundAdjustments from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SoundAdjustments.parse_obj(obj) + return cls.model_validate(obj) - _obj = SoundAdjustments.parse_obj( + _obj = cls.model_validate( { "ambience": obj.get("ambience"), "bass": obj.get("bass"), "directivity": obj.get("directivity"), - "eco_mode": obj.get("ecoMode"), + "ecoMode": obj.get("ecoMode"), "fadein": obj.get("fadein"), "loudness": obj.get("loudness"), "treble": obj.get("treble"), diff --git a/python_client/mozart_api/models/sound_feature_set.py b/python_client/mozart_api/models/sound_feature_set.py index 07b72d5..3f0581f 100644 --- a/python_client/mozart_api/models/sound_feature_set.py +++ b/python_client/mozart_api/models/sound_feature_set.py @@ -18,9 +18,8 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.ambience_feature import AmbienceFeature from mozart_api.models.balance_feature import BalanceFeature from mozart_api.models.bass_feature import BassFeature @@ -38,41 +37,49 @@ from mozart_api.models.tone_touch_x_feature import ToneTouchXFeature from mozart_api.models.tone_touch_y_feature import ToneTouchYFeature from mozart_api.models.treble_feature import TrebleFeature +from typing import Optional, Set +from typing_extensions import Self class SoundFeatureSet(BaseModel): """ SoundFeatureSet - """ + """ # noqa: E501 ambience: Optional[AmbienceFeature] = None balance: Optional[BalanceFeature] = None bass: Optional[BassFeature] = None bass_management: Optional[BassManagementFeature] = Field( - None, alias="bass-management" + default=None, alias="bass-management" ) compression: Optional[CompressionFeature] = None directivity: Optional[DirectivityFeature] = None fader: Optional[FaderFeature] = None room_compensation: Optional[RoomCompensationFeature] = Field( - None, alias="roomCompensation" + default=None, alias="roomCompensation" ) spatial_envelopment: Optional[SpatialEnvelopmentFeature] = Field( - None, alias="spatial-envelopment" + default=None, alias="spatial-envelopment" + ) + spatial_height: Optional[SpatialHeightFeature] = Field( + default=None, alias="spatial-height" ) - spatial_height: Optional[SpatialHeightFeature] = Field(None, alias="spatial-height") spatial_processing: Optional[SpatialProcessingFeature] = Field( - None, alias="spatial-processing" + default=None, alias="spatial-processing" ) spatial_surround: Optional[SpatialSurroundFeature] = Field( - None, alias="spatial-surround" + default=None, alias="spatial-surround" ) - spatial_width: Optional[SpatialWidthFeature] = Field(None, alias="spatial-width") - speech_enhance: Optional[SpeechEnhanceFeature] = Field(None, alias="speech-enhance") - tone_touch_x: Optional[ToneTouchXFeature] = Field(None, alias="toneTouchX") - tone_touch_y: Optional[ToneTouchYFeature] = Field(None, alias="toneTouchY") + spatial_width: Optional[SpatialWidthFeature] = Field( + default=None, alias="spatial-width" + ) + speech_enhance: Optional[SpeechEnhanceFeature] = Field( + default=None, alias="speech-enhance" + ) + tone_touch_x: Optional[ToneTouchXFeature] = Field(default=None, alias="toneTouchX") + tone_touch_y: Optional[ToneTouchYFeature] = Field(default=None, alias="toneTouchY") treble: Optional[TrebleFeature] = None - __properties = [ + __properties: ClassVar[List[str]] = [ "ambience", "balance", "bass", @@ -92,28 +99,43 @@ class SoundFeatureSet(BaseModel): "treble", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SoundFeatureSet: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SoundFeatureSet from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of ambience if self.ambience: _dict["ambience"] = self.ambience.to_dict() @@ -168,81 +190,101 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> SoundFeatureSet: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SoundFeatureSet from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SoundFeatureSet.parse_obj(obj) + return cls.model_validate(obj) - _obj = SoundFeatureSet.parse_obj( + _obj = cls.model_validate( { - "ambience": AmbienceFeature.from_dict(obj.get("ambience")) - if obj.get("ambience") is not None - else None, - "balance": BalanceFeature.from_dict(obj.get("balance")) - if obj.get("balance") is not None - else None, - "bass": BassFeature.from_dict(obj.get("bass")) - if obj.get("bass") is not None - else None, - "bass_management": BassManagementFeature.from_dict( - obj.get("bass-management") - ) - if obj.get("bass-management") is not None - else None, - "compression": CompressionFeature.from_dict(obj.get("compression")) - if obj.get("compression") is not None - else None, - "directivity": DirectivityFeature.from_dict(obj.get("directivity")) - if obj.get("directivity") is not None - else None, - "fader": FaderFeature.from_dict(obj.get("fader")) - if obj.get("fader") is not None - else None, - "room_compensation": RoomCompensationFeature.from_dict( - obj.get("roomCompensation") - ) - if obj.get("roomCompensation") is not None - else None, - "spatial_envelopment": SpatialEnvelopmentFeature.from_dict( - obj.get("spatial-envelopment") - ) - if obj.get("spatial-envelopment") is not None - else None, - "spatial_height": SpatialHeightFeature.from_dict( - obj.get("spatial-height") - ) - if obj.get("spatial-height") is not None - else None, - "spatial_processing": SpatialProcessingFeature.from_dict( - obj.get("spatial-processing") - ) - if obj.get("spatial-processing") is not None - else None, - "spatial_surround": SpatialSurroundFeature.from_dict( - obj.get("spatial-surround") - ) - if obj.get("spatial-surround") is not None - else None, - "spatial_width": SpatialWidthFeature.from_dict(obj.get("spatial-width")) - if obj.get("spatial-width") is not None - else None, - "speech_enhance": SpeechEnhanceFeature.from_dict( - obj.get("speech-enhance") - ) - if obj.get("speech-enhance") is not None - else None, - "tone_touch_x": ToneTouchXFeature.from_dict(obj.get("toneTouchX")) - if obj.get("toneTouchX") is not None - else None, - "tone_touch_y": ToneTouchYFeature.from_dict(obj.get("toneTouchY")) - if obj.get("toneTouchY") is not None - else None, - "treble": TrebleFeature.from_dict(obj.get("treble")) - if obj.get("treble") is not None - else None, + "ambience": ( + AmbienceFeature.from_dict(obj["ambience"]) + if obj.get("ambience") is not None + else None + ), + "balance": ( + BalanceFeature.from_dict(obj["balance"]) + if obj.get("balance") is not None + else None + ), + "bass": ( + BassFeature.from_dict(obj["bass"]) + if obj.get("bass") is not None + else None + ), + "bass-management": ( + BassManagementFeature.from_dict(obj["bass-management"]) + if obj.get("bass-management") is not None + else None + ), + "compression": ( + CompressionFeature.from_dict(obj["compression"]) + if obj.get("compression") is not None + else None + ), + "directivity": ( + DirectivityFeature.from_dict(obj["directivity"]) + if obj.get("directivity") is not None + else None + ), + "fader": ( + FaderFeature.from_dict(obj["fader"]) + if obj.get("fader") is not None + else None + ), + "roomCompensation": ( + RoomCompensationFeature.from_dict(obj["roomCompensation"]) + if obj.get("roomCompensation") is not None + else None + ), + "spatial-envelopment": ( + SpatialEnvelopmentFeature.from_dict(obj["spatial-envelopment"]) + if obj.get("spatial-envelopment") is not None + else None + ), + "spatial-height": ( + SpatialHeightFeature.from_dict(obj["spatial-height"]) + if obj.get("spatial-height") is not None + else None + ), + "spatial-processing": ( + SpatialProcessingFeature.from_dict(obj["spatial-processing"]) + if obj.get("spatial-processing") is not None + else None + ), + "spatial-surround": ( + SpatialSurroundFeature.from_dict(obj["spatial-surround"]) + if obj.get("spatial-surround") is not None + else None + ), + "spatial-width": ( + SpatialWidthFeature.from_dict(obj["spatial-width"]) + if obj.get("spatial-width") is not None + else None + ), + "speech-enhance": ( + SpeechEnhanceFeature.from_dict(obj["speech-enhance"]) + if obj.get("speech-enhance") is not None + else None + ), + "toneTouchX": ( + ToneTouchXFeature.from_dict(obj["toneTouchX"]) + if obj.get("toneTouchX") is not None + else None + ), + "toneTouchY": ( + ToneTouchYFeature.from_dict(obj["toneTouchY"]) + if obj.get("toneTouchY") is not None + else None + ), + "treble": ( + TrebleFeature.from_dict(obj["treble"]) + if obj.get("treble") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/sound_settings.py b/python_client/mozart_api/models/sound_settings.py index 516c788..f3ca26f 100644 --- a/python_client/mozart_api/models/sound_settings.py +++ b/python_client/mozart_api/models/sound_settings.py @@ -18,48 +18,64 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.room_compensation_info import RoomCompensationInfo from mozart_api.models.sound_adjustments import SoundAdjustments from mozart_api.models.sound_tone_touch import SoundToneTouch +from typing import Optional, Set +from typing_extensions import Self class SoundSettings(BaseModel): """ SoundSettings - """ + """ # noqa: E501 adjustments: Optional[SoundAdjustments] = None room_compensation: Optional[RoomCompensationInfo] = Field( - None, alias="roomCompensation" + default=None, alias="roomCompensation" ) - tone_touch: Optional[SoundToneTouch] = Field(None, alias="toneTouch") - __properties = ["adjustments", "roomCompensation", "toneTouch"] + tone_touch: Optional[SoundToneTouch] = Field(default=None, alias="toneTouch") + __properties: ClassVar[List[str]] = ["adjustments", "roomCompensation", "toneTouch"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SoundSettings: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SoundSettings from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of adjustments if self.adjustments: _dict["adjustments"] = self.adjustments.to_dict() @@ -72,27 +88,31 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> SoundSettings: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SoundSettings from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SoundSettings.parse_obj(obj) + return cls.model_validate(obj) - _obj = SoundSettings.parse_obj( + _obj = cls.model_validate( { - "adjustments": SoundAdjustments.from_dict(obj.get("adjustments")) - if obj.get("adjustments") is not None - else None, - "room_compensation": RoomCompensationInfo.from_dict( - obj.get("roomCompensation") - ) - if obj.get("roomCompensation") is not None - else None, - "tone_touch": SoundToneTouch.from_dict(obj.get("toneTouch")) - if obj.get("toneTouch") is not None - else None, + "adjustments": ( + SoundAdjustments.from_dict(obj["adjustments"]) + if obj.get("adjustments") is not None + else None + ), + "roomCompensation": ( + RoomCompensationInfo.from_dict(obj["roomCompensation"]) + if obj.get("roomCompensation") is not None + else None + ), + "toneTouch": ( + SoundToneTouch.from_dict(obj["toneTouch"]) + if obj.get("toneTouch") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/sound_tone_touch.py b/python_client/mozart_api/models/sound_tone_touch.py index 5e7f8bc..8e50cfe 100644 --- a/python_client/mozart_api/models/sound_tone_touch.py +++ b/python_client/mozart_api/models/sound_tone_touch.py @@ -18,55 +18,71 @@ import re # noqa: F401 import json - -from typing import Optional, Union -from pydantic import BaseModel, StrictFloat, StrictInt +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self class SoundToneTouch(BaseModel): """ SoundToneTouch - """ + """ # noqa: E501 x: Optional[Union[StrictFloat, StrictInt]] = None y: Optional[Union[StrictFloat, StrictInt]] = None z: Optional[Union[StrictFloat, StrictInt]] = None - __properties = ["x", "y", "z"] + __properties: ClassVar[List[str]] = ["x", "y", "z"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SoundToneTouch: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SoundToneTouch from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> SoundToneTouch: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SoundToneTouch from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SoundToneTouch.parse_obj(obj) + return cls.model_validate(obj) - _obj = SoundToneTouch.parse_obj( + _obj = cls.model_validate( {"x": obj.get("x"), "y": obj.get("y"), "z": obj.get("z")} ) return _obj diff --git a/python_client/mozart_api/models/source.py b/python_client/mozart_api/models/source.py index c1fa113..d2e385d 100644 --- a/python_client/mozart_api/models/source.py +++ b/python_client/mozart_api/models/source.py @@ -18,73 +18,102 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.source_type_enum import SourceTypeEnum +from typing import Optional, Set +from typing_extensions import Self class Source(BaseModel): """ Source - """ + """ # noqa: E501 id: Optional[StrictStr] = None is_enabled: Optional[StrictBool] = Field( - None, - alias="isEnabled", + default=None, description="some sources require an explicit activation or accept of terms before being enabled", + alias="isEnabled", + ) + is_multiroom_available: Optional[StrictBool] = Field( + default=None, alias="isMultiroomAvailable" ) - is_playable: Optional[StrictBool] = Field(None, alias="isPlayable") + is_playable: Optional[StrictBool] = Field(default=None, alias="isPlayable") name: Optional[StrictStr] = None type: Optional[SourceTypeEnum] = None - __properties = ["id", "isEnabled", "isPlayable", "name", "type"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + __properties: ClassVar[List[str]] = [ + "id", + "isEnabled", + "isMultiroomAvailable", + "isPlayable", + "name", + "type", + ] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Source: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Source from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of type if self.type: _dict["type"] = self.type.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> Source: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Source from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Source.parse_obj(obj) + return cls.model_validate(obj) - _obj = Source.parse_obj( + _obj = cls.model_validate( { "id": obj.get("id"), - "is_enabled": obj.get("isEnabled"), - "is_playable": obj.get("isPlayable"), + "isEnabled": obj.get("isEnabled"), + "isMultiroomAvailable": obj.get("isMultiroomAvailable"), + "isPlayable": obj.get("isPlayable"), "name": obj.get("name"), - "type": SourceTypeEnum.from_dict(obj.get("type")) - if obj.get("type") is not None - else None, + "type": ( + SourceTypeEnum.from_dict(obj["type"]) + if obj.get("type") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/source_array.py b/python_client/mozart_api/models/source_array.py index 4d0fe00..6fb5553 100644 --- a/python_client/mozart_api/models/source_array.py +++ b/python_client/mozart_api/models/source_array.py @@ -18,42 +18,58 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, conlist +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.source import Source +from typing import Optional, Set +from typing_extensions import Self class SourceArray(BaseModel): """ SourceArray - """ + """ # noqa: E501 - items: Optional[conlist(Source)] = None - __properties = ["items"] + items: Optional[List[Source]] = None + __properties: ClassVar[List[str]] = ["items"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SourceArray: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SourceArray from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in items (list) _items = [] if self.items: @@ -64,19 +80,21 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> SourceArray: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SourceArray from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SourceArray.parse_obj(obj) + return cls.model_validate(obj) - _obj = SourceArray.parse_obj( + _obj = cls.model_validate( { - "items": [Source.from_dict(_item) for _item in obj.get("items")] - if obj.get("items") is not None - else None + "items": ( + [Source.from_dict(_item) for _item in obj["items"]] + if obj.get("items") is not None + else None + ) } ) return _obj diff --git a/python_client/mozart_api/models/source_type_enum.py b/python_client/mozart_api/models/source_type_enum.py index 5b9e234..01ce6ef 100644 --- a/python_client/mozart_api/models/source_type_enum.py +++ b/python_client/mozart_api/models/source_type_enum.py @@ -18,54 +18,70 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class SourceTypeEnum(BaseModel): """ SourceTypeEnum - """ + """ # noqa: E501 value: Optional[StrictStr] = Field( - None, - description="- beolink - bluetooth - dlna - qplay - airPlay - lineIn - chromeCast - uriStreamer - netRadio - local - generator - spotify - spdif - pl - wpl - tv - deezer - usbIn - tidalConnect - unknown", + default=None, + description="- beolink - bluetooth - dlna - qplay - airPlay - lineIn - chromeCast - uriStreamer - netRadio - local - generator - spotify - spdif - pl - wpl - tv - deezer - usbIn - tidal - tidalConnect - unknown", ) - __properties = ["value"] + __properties: ClassVar[List[str]] = ["value"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SourceTypeEnum: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SourceTypeEnum from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> SourceTypeEnum: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SourceTypeEnum from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SourceTypeEnum.parse_obj(obj) + return cls.model_validate(obj) - _obj = SourceTypeEnum.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/spatial_envelopment.py b/python_client/mozart_api/models/spatial_envelopment.py index beff13d..a695ea9 100644 --- a/python_client/mozart_api/models/spatial_envelopment.py +++ b/python_client/mozart_api/models/spatial_envelopment.py @@ -18,53 +18,69 @@ import re # noqa: F401 import json - -from typing import Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self class SpatialEnvelopment(BaseModel): """ SpatialEnvelopment - """ + """ # noqa: E501 value: Union[StrictFloat, StrictInt] = Field( - ..., description="Selected spatial-envelopment value" + description="Selected spatial-envelopment value" ) - __properties = ["value"] + __properties: ClassVar[List[str]] = ["value"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SpatialEnvelopment: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpatialEnvelopment from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> SpatialEnvelopment: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpatialEnvelopment from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpatialEnvelopment.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpatialEnvelopment.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/spatial_envelopment_feature.py b/python_client/mozart_api/models/spatial_envelopment_feature.py index c3c9126..c8af73b 100644 --- a/python_client/mozart_api/models/spatial_envelopment_feature.py +++ b/python_client/mozart_api/models/spatial_envelopment_feature.py @@ -18,48 +18,62 @@ import re # noqa: F401 import json - -from typing import List, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union from mozart_api.models.spatial_envelopment import SpatialEnvelopment +from typing import Optional, Set +from typing_extensions import Self class SpatialEnvelopmentFeature(BaseModel): """ SpatialEnvelopmentFeature - """ + """ # noqa: E501 value: Union[StrictFloat, StrictInt] = Field( - ..., description="Selected spatial-envelopment value" + description="Selected spatial-envelopment value" ) - default: SpatialEnvelopment = Field(...) - range: conlist(SpatialEnvelopment, unique_items=True) = Field( - ..., description="spatial-envelopment range" + default: SpatialEnvelopment + range: List[SpatialEnvelopment] = Field(description="spatial-envelopment range") + __properties: ClassVar[List[str]] = ["value", "default", "range"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), ) - __properties = ["value", "default", "range"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SpatialEnvelopmentFeature: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpatialEnvelopmentFeature from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -73,25 +87,27 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> SpatialEnvelopmentFeature: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpatialEnvelopmentFeature from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpatialEnvelopmentFeature.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpatialEnvelopmentFeature.parse_obj( + _obj = cls.model_validate( { "value": obj.get("value"), - "default": SpatialEnvelopment.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [ - SpatialEnvelopment.from_dict(_item) for _item in obj.get("range") - ] - if obj.get("range") is not None - else None, + "default": ( + SpatialEnvelopment.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [SpatialEnvelopment.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/spatial_envelopment_range.py b/python_client/mozart_api/models/spatial_envelopment_range.py index b5e87e6..dc9aab0 100644 --- a/python_client/mozart_api/models/spatial_envelopment_range.py +++ b/python_client/mozart_api/models/spatial_envelopment_range.py @@ -18,45 +18,59 @@ import re # noqa: F401 import json - -from typing import List -from pydantic import BaseModel, Field, conlist +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List from mozart_api.models.spatial_envelopment import SpatialEnvelopment +from typing import Optional, Set +from typing_extensions import Self class SpatialEnvelopmentRange(BaseModel): """ SpatialEnvelopmentRange - """ + """ # noqa: E501 - default: SpatialEnvelopment = Field(...) - range: conlist(SpatialEnvelopment, unique_items=True) = Field( - ..., description="spatial-envelopment range" - ) - __properties = ["default", "range"] + default: SpatialEnvelopment + range: List[SpatialEnvelopment] = Field(description="spatial-envelopment range") + __properties: ClassVar[List[str]] = ["default", "range"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SpatialEnvelopmentRange: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpatialEnvelopmentRange from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -70,24 +84,26 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> SpatialEnvelopmentRange: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpatialEnvelopmentRange from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpatialEnvelopmentRange.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpatialEnvelopmentRange.parse_obj( + _obj = cls.model_validate( { - "default": SpatialEnvelopment.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [ - SpatialEnvelopment.from_dict(_item) for _item in obj.get("range") - ] - if obj.get("range") is not None - else None, + "default": ( + SpatialEnvelopment.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [SpatialEnvelopment.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/spatial_height.py b/python_client/mozart_api/models/spatial_height.py index be6afd7..2a4d3e0 100644 --- a/python_client/mozart_api/models/spatial_height.py +++ b/python_client/mozart_api/models/spatial_height.py @@ -18,53 +18,69 @@ import re # noqa: F401 import json - -from typing import Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self class SpatialHeight(BaseModel): """ SpatialHeight - """ + """ # noqa: E501 value: Union[StrictFloat, StrictInt] = Field( - ..., description="Selected spatial-height value" + description="Selected spatial-height value" ) - __properties = ["value"] + __properties: ClassVar[List[str]] = ["value"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SpatialHeight: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpatialHeight from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> SpatialHeight: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpatialHeight from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpatialHeight.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpatialHeight.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/spatial_height_feature.py b/python_client/mozart_api/models/spatial_height_feature.py index 1186a41..bdc441b 100644 --- a/python_client/mozart_api/models/spatial_height_feature.py +++ b/python_client/mozart_api/models/spatial_height_feature.py @@ -18,48 +18,62 @@ import re # noqa: F401 import json - -from typing import List, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union from mozart_api.models.spatial_height import SpatialHeight +from typing import Optional, Set +from typing_extensions import Self class SpatialHeightFeature(BaseModel): """ SpatialHeightFeature - """ + """ # noqa: E501 value: Union[StrictFloat, StrictInt] = Field( - ..., description="Selected spatial-height value" + description="Selected spatial-height value" ) - default: SpatialHeight = Field(...) - range: conlist(SpatialHeight, unique_items=True) = Field( - ..., description="spatial-height range" + default: SpatialHeight + range: List[SpatialHeight] = Field(description="spatial-height range") + __properties: ClassVar[List[str]] = ["value", "default", "range"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), ) - __properties = ["value", "default", "range"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SpatialHeightFeature: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpatialHeightFeature from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -73,23 +87,27 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> SpatialHeightFeature: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpatialHeightFeature from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpatialHeightFeature.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpatialHeightFeature.parse_obj( + _obj = cls.model_validate( { "value": obj.get("value"), - "default": SpatialHeight.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [SpatialHeight.from_dict(_item) for _item in obj.get("range")] - if obj.get("range") is not None - else None, + "default": ( + SpatialHeight.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [SpatialHeight.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/spatial_height_range.py b/python_client/mozart_api/models/spatial_height_range.py index 840684c..27b65e2 100644 --- a/python_client/mozart_api/models/spatial_height_range.py +++ b/python_client/mozart_api/models/spatial_height_range.py @@ -18,45 +18,59 @@ import re # noqa: F401 import json - -from typing import List -from pydantic import BaseModel, Field, conlist +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List from mozart_api.models.spatial_height import SpatialHeight +from typing import Optional, Set +from typing_extensions import Self class SpatialHeightRange(BaseModel): """ SpatialHeightRange - """ + """ # noqa: E501 - default: SpatialHeight = Field(...) - range: conlist(SpatialHeight, unique_items=True) = Field( - ..., description="spatial-height range" - ) - __properties = ["default", "range"] + default: SpatialHeight + range: List[SpatialHeight] = Field(description="spatial-height range") + __properties: ClassVar[List[str]] = ["default", "range"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SpatialHeightRange: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpatialHeightRange from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -70,22 +84,26 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> SpatialHeightRange: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpatialHeightRange from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpatialHeightRange.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpatialHeightRange.parse_obj( + _obj = cls.model_validate( { - "default": SpatialHeight.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [SpatialHeight.from_dict(_item) for _item in obj.get("range")] - if obj.get("range") is not None - else None, + "default": ( + SpatialHeight.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [SpatialHeight.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/spatial_processing.py b/python_client/mozart_api/models/spatial_processing.py index d10e7d4..21c6812 100644 --- a/python_client/mozart_api/models/spatial_processing.py +++ b/python_client/mozart_api/models/spatial_processing.py @@ -18,59 +18,76 @@ import re # noqa: F401 import json - -from pydantic import BaseModel, Field, StrictStr, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self class SpatialProcessing(BaseModel): """ SpatialProcessing - """ + """ # noqa: E501 - value: StrictStr = Field(..., description="Selected spatial-processing value") - __properties = ["value"] + value: StrictStr = Field(description="Selected spatial-processing value") + __properties: ClassVar[List[str]] = ["value"] - @validator("value") + @field_validator("value") def value_validate_enum(cls, value): """Validates the enum""" - if value not in ("direct", "trueimage", "downmix"): + if value not in set(["direct", "trueimage", "downmix"]): raise ValueError( "must be one of enum values ('direct', 'trueimage', 'downmix')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SpatialProcessing: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpatialProcessing from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> SpatialProcessing: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpatialProcessing from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpatialProcessing.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpatialProcessing.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/spatial_processing_feature.py b/python_client/mozart_api/models/spatial_processing_feature.py index 4e17f2e..274ac90 100644 --- a/python_client/mozart_api/models/spatial_processing_feature.py +++ b/python_client/mozart_api/models/spatial_processing_feature.py @@ -18,55 +18,69 @@ import re # noqa: F401 import json - -from typing import List -from pydantic import BaseModel, Field, StrictStr, conlist, validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List from mozart_api.models.spatial_processing import SpatialProcessing +from typing import Optional, Set +from typing_extensions import Self class SpatialProcessingFeature(BaseModel): """ SpatialProcessingFeature - """ + """ # noqa: E501 - value: StrictStr = Field(..., description="Selected spatial-processing value") - default: SpatialProcessing = Field(...) - range: conlist(SpatialProcessing, unique_items=True) = Field( - ..., description="spatial-processing range" - ) - __properties = ["value", "default", "range"] + value: StrictStr = Field(description="Selected spatial-processing value") + default: SpatialProcessing + range: List[SpatialProcessing] = Field(description="spatial-processing range") + __properties: ClassVar[List[str]] = ["value", "default", "range"] - @validator("value") + @field_validator("value") def value_validate_enum(cls, value): """Validates the enum""" - if value not in ("direct", "trueimage", "downmix"): + if value not in set(["direct", "trueimage", "downmix"]): raise ValueError( "must be one of enum values ('direct', 'trueimage', 'downmix')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SpatialProcessingFeature: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpatialProcessingFeature from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -80,25 +94,27 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> SpatialProcessingFeature: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpatialProcessingFeature from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpatialProcessingFeature.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpatialProcessingFeature.parse_obj( + _obj = cls.model_validate( { "value": obj.get("value"), - "default": SpatialProcessing.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [ - SpatialProcessing.from_dict(_item) for _item in obj.get("range") - ] - if obj.get("range") is not None - else None, + "default": ( + SpatialProcessing.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [SpatialProcessing.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/spatial_processing_range.py b/python_client/mozart_api/models/spatial_processing_range.py index 8b08084..31cb7fa 100644 --- a/python_client/mozart_api/models/spatial_processing_range.py +++ b/python_client/mozart_api/models/spatial_processing_range.py @@ -18,45 +18,59 @@ import re # noqa: F401 import json - -from typing import List -from pydantic import BaseModel, Field, conlist +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List from mozart_api.models.spatial_processing import SpatialProcessing +from typing import Optional, Set +from typing_extensions import Self class SpatialProcessingRange(BaseModel): """ SpatialProcessingRange - """ + """ # noqa: E501 - default: SpatialProcessing = Field(...) - range: conlist(SpatialProcessing, unique_items=True) = Field( - ..., description="spatial-processing range" - ) - __properties = ["default", "range"] + default: SpatialProcessing + range: List[SpatialProcessing] = Field(description="spatial-processing range") + __properties: ClassVar[List[str]] = ["default", "range"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SpatialProcessingRange: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpatialProcessingRange from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -70,24 +84,26 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> SpatialProcessingRange: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpatialProcessingRange from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpatialProcessingRange.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpatialProcessingRange.parse_obj( + _obj = cls.model_validate( { - "default": SpatialProcessing.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [ - SpatialProcessing.from_dict(_item) for _item in obj.get("range") - ] - if obj.get("range") is not None - else None, + "default": ( + SpatialProcessing.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [SpatialProcessing.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/spatial_surround.py b/python_client/mozart_api/models/spatial_surround.py index df402bd..979b0fd 100644 --- a/python_client/mozart_api/models/spatial_surround.py +++ b/python_client/mozart_api/models/spatial_surround.py @@ -18,53 +18,69 @@ import re # noqa: F401 import json - -from typing import Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self class SpatialSurround(BaseModel): """ SpatialSurround - """ + """ # noqa: E501 value: Union[StrictFloat, StrictInt] = Field( - ..., description="Selected spatial-surround value" + description="Selected spatial-surround value" ) - __properties = ["value"] + __properties: ClassVar[List[str]] = ["value"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SpatialSurround: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpatialSurround from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> SpatialSurround: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpatialSurround from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpatialSurround.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpatialSurround.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/spatial_surround_feature.py b/python_client/mozart_api/models/spatial_surround_feature.py index b6aff51..ef28d5b 100644 --- a/python_client/mozart_api/models/spatial_surround_feature.py +++ b/python_client/mozart_api/models/spatial_surround_feature.py @@ -18,48 +18,62 @@ import re # noqa: F401 import json - -from typing import List, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union from mozart_api.models.spatial_surround import SpatialSurround +from typing import Optional, Set +from typing_extensions import Self class SpatialSurroundFeature(BaseModel): """ SpatialSurroundFeature - """ + """ # noqa: E501 value: Union[StrictFloat, StrictInt] = Field( - ..., description="Selected spatial-surround value" + description="Selected spatial-surround value" ) - default: SpatialSurround = Field(...) - range: conlist(SpatialSurround, unique_items=True) = Field( - ..., description="spatial-surround range" + default: SpatialSurround + range: List[SpatialSurround] = Field(description="spatial-surround range") + __properties: ClassVar[List[str]] = ["value", "default", "range"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), ) - __properties = ["value", "default", "range"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SpatialSurroundFeature: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpatialSurroundFeature from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -73,25 +87,27 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> SpatialSurroundFeature: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpatialSurroundFeature from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpatialSurroundFeature.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpatialSurroundFeature.parse_obj( + _obj = cls.model_validate( { "value": obj.get("value"), - "default": SpatialSurround.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [ - SpatialSurround.from_dict(_item) for _item in obj.get("range") - ] - if obj.get("range") is not None - else None, + "default": ( + SpatialSurround.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [SpatialSurround.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/spatial_surround_range.py b/python_client/mozart_api/models/spatial_surround_range.py index b6e6e8b..701bf7d 100644 --- a/python_client/mozart_api/models/spatial_surround_range.py +++ b/python_client/mozart_api/models/spatial_surround_range.py @@ -18,45 +18,59 @@ import re # noqa: F401 import json - -from typing import List -from pydantic import BaseModel, Field, conlist +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List from mozart_api.models.spatial_surround import SpatialSurround +from typing import Optional, Set +from typing_extensions import Self class SpatialSurroundRange(BaseModel): """ SpatialSurroundRange - """ + """ # noqa: E501 - default: SpatialSurround = Field(...) - range: conlist(SpatialSurround, unique_items=True) = Field( - ..., description="spatial-surround range" - ) - __properties = ["default", "range"] + default: SpatialSurround + range: List[SpatialSurround] = Field(description="spatial-surround range") + __properties: ClassVar[List[str]] = ["default", "range"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SpatialSurroundRange: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpatialSurroundRange from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -70,24 +84,26 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> SpatialSurroundRange: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpatialSurroundRange from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpatialSurroundRange.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpatialSurroundRange.parse_obj( + _obj = cls.model_validate( { - "default": SpatialSurround.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [ - SpatialSurround.from_dict(_item) for _item in obj.get("range") - ] - if obj.get("range") is not None - else None, + "default": ( + SpatialSurround.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [SpatialSurround.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/spatial_width.py b/python_client/mozart_api/models/spatial_width.py index b205d56..e02a68a 100644 --- a/python_client/mozart_api/models/spatial_width.py +++ b/python_client/mozart_api/models/spatial_width.py @@ -18,53 +18,69 @@ import re # noqa: F401 import json - -from typing import Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self class SpatialWidth(BaseModel): """ SpatialWidth - """ + """ # noqa: E501 value: Union[StrictFloat, StrictInt] = Field( - ..., description="Selected spatial-width value" + description="Selected spatial-width value" ) - __properties = ["value"] + __properties: ClassVar[List[str]] = ["value"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SpatialWidth: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpatialWidth from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> SpatialWidth: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpatialWidth from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpatialWidth.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpatialWidth.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/spatial_width_feature.py b/python_client/mozart_api/models/spatial_width_feature.py index 39e88fe..c6ae27e 100644 --- a/python_client/mozart_api/models/spatial_width_feature.py +++ b/python_client/mozart_api/models/spatial_width_feature.py @@ -18,48 +18,62 @@ import re # noqa: F401 import json - -from typing import List, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union from mozart_api.models.spatial_width import SpatialWidth +from typing import Optional, Set +from typing_extensions import Self class SpatialWidthFeature(BaseModel): """ SpatialWidthFeature - """ + """ # noqa: E501 value: Union[StrictFloat, StrictInt] = Field( - ..., description="Selected spatial-width value" + description="Selected spatial-width value" ) - default: SpatialWidth = Field(...) - range: conlist(SpatialWidth, unique_items=True) = Field( - ..., description="spatial-width range" + default: SpatialWidth + range: List[SpatialWidth] = Field(description="spatial-width range") + __properties: ClassVar[List[str]] = ["value", "default", "range"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), ) - __properties = ["value", "default", "range"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SpatialWidthFeature: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpatialWidthFeature from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -73,23 +87,27 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> SpatialWidthFeature: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpatialWidthFeature from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpatialWidthFeature.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpatialWidthFeature.parse_obj( + _obj = cls.model_validate( { "value": obj.get("value"), - "default": SpatialWidth.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [SpatialWidth.from_dict(_item) for _item in obj.get("range")] - if obj.get("range") is not None - else None, + "default": ( + SpatialWidth.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [SpatialWidth.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/spatial_width_range.py b/python_client/mozart_api/models/spatial_width_range.py index 558bee7..f35468a 100644 --- a/python_client/mozart_api/models/spatial_width_range.py +++ b/python_client/mozart_api/models/spatial_width_range.py @@ -18,45 +18,59 @@ import re # noqa: F401 import json - -from typing import List -from pydantic import BaseModel, Field, conlist +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List from mozart_api.models.spatial_width import SpatialWidth +from typing import Optional, Set +from typing_extensions import Self class SpatialWidthRange(BaseModel): """ SpatialWidthRange - """ + """ # noqa: E501 - default: SpatialWidth = Field(...) - range: conlist(SpatialWidth, unique_items=True) = Field( - ..., description="spatial-width range" - ) - __properties = ["default", "range"] + default: SpatialWidth + range: List[SpatialWidth] = Field(description="spatial-width range") + __properties: ClassVar[List[str]] = ["default", "range"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SpatialWidthRange: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpatialWidthRange from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -70,22 +84,26 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> SpatialWidthRange: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpatialWidthRange from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpatialWidthRange.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpatialWidthRange.parse_obj( + _obj = cls.model_validate( { - "default": SpatialWidth.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [SpatialWidth.from_dict(_item) for _item in obj.get("range")] - if obj.get("range") is not None - else None, + "default": ( + SpatialWidth.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [SpatialWidth.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/speaker_group.py b/python_client/mozart_api/models/speaker_group.py index 560e261..5bc56b7 100644 --- a/python_client/mozart_api/models/speaker_group.py +++ b/python_client/mozart_api/models/speaker_group.py @@ -18,48 +18,54 @@ import re # noqa: F401 import json - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr, conint, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated from mozart_api.models.latency_profile import LatencyProfile from mozart_api.models.speaker_group_member import SpeakerGroupMember +from typing import Optional, Set +from typing_extensions import Self class SpeakerGroup(BaseModel): """ SpeakerGroup - """ + """ # noqa: E501 - crossover_frequency: Optional[conint(strict=True, le=300, ge=20)] = Field( - None, - alias="crossoverFrequency", - description="Crossover frequency for bass management in Hz", + crossover_frequency: Optional[Annotated[int, Field(le=300, strict=True, ge=20)]] = ( + Field( + default=None, + description="Crossover frequency for bass management in Hz", + alias="crossoverFrequency", + ) ) enable_phase_compensation: Optional[StrictBool] = Field( - None, - alias="enablePhaseCompensation", + default=None, description="Enable phase compensation in bass management.", + alias="enablePhaseCompensation", ) friendly_name: Optional[StrictStr] = Field( - None, - alias="friendlyName", + default=None, description="Friendly name of the SpeakerGroup. Required when creating a new group ", + alias="friendlyName", ) id: Optional[StrictStr] = None - is_deleteable: Optional[StrictBool] = Field(None, alias="isDeleteable") - items: Optional[conlist(SpeakerGroupMember)] = None - latency_profile: Optional[LatencyProfile] = Field(None, alias="latencyProfile") + is_deleteable: Optional[StrictBool] = Field(default=None, alias="isDeleteable") + items: Optional[List[SpeakerGroupMember]] = None + latency_profile: Optional[LatencyProfile] = Field( + default=None, alias="latencyProfile" + ) room_compensation_id: Optional[StrictStr] = Field( - None, - alias="roomCompensationId", + default=None, description="ID of the calculated coefficents for this group, made during advanced room compensation. When updating an existing group, an empty string will clear roomCompensationId. ", + alias="roomCompensationId", ) - speaker_preset: Optional[conint(strict=True, le=99, ge=0)] = Field( - None, - alias="speakerPreset", + speaker_preset: Optional[Annotated[int, Field(le=99, strict=True, ge=0)]] = Field( + default=None, description="Speaker preset / listening mode eg. BL28 curtain position etc.", + alias="speakerPreset", ) - __properties = [ + __properties: ClassVar[List[str]] = [ "crossoverFrequency", "enablePhaseCompensation", "friendlyName", @@ -71,28 +77,43 @@ class SpeakerGroup(BaseModel): "speakerPreset", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SpeakerGroup: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpeakerGroup from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in items (list) _items = [] if self.items: @@ -104,77 +125,79 @@ def to_dict(self): if self.latency_profile: _dict["latencyProfile"] = self.latency_profile.to_dict() # set to None if crossover_frequency (nullable) is None - # and __fields_set__ contains the field + # and model_fields_set contains the field if ( self.crossover_frequency is None - and "crossover_frequency" in self.__fields_set__ + and "crossover_frequency" in self.model_fields_set ): _dict["crossoverFrequency"] = None # set to None if enable_phase_compensation (nullable) is None - # and __fields_set__ contains the field + # and model_fields_set contains the field if ( self.enable_phase_compensation is None - and "enable_phase_compensation" in self.__fields_set__ + and "enable_phase_compensation" in self.model_fields_set ): _dict["enablePhaseCompensation"] = None # set to None if friendly_name (nullable) is None - # and __fields_set__ contains the field - if self.friendly_name is None and "friendly_name" in self.__fields_set__: + # and model_fields_set contains the field + if self.friendly_name is None and "friendly_name" in self.model_fields_set: _dict["friendlyName"] = None # set to None if is_deleteable (nullable) is None - # and __fields_set__ contains the field - if self.is_deleteable is None and "is_deleteable" in self.__fields_set__: + # and model_fields_set contains the field + if self.is_deleteable is None and "is_deleteable" in self.model_fields_set: _dict["isDeleteable"] = None # set to None if items (nullable) is None - # and __fields_set__ contains the field - if self.items is None and "items" in self.__fields_set__: + # and model_fields_set contains the field + if self.items is None and "items" in self.model_fields_set: _dict["items"] = None # set to None if room_compensation_id (nullable) is None - # and __fields_set__ contains the field + # and model_fields_set contains the field if ( self.room_compensation_id is None - and "room_compensation_id" in self.__fields_set__ + and "room_compensation_id" in self.model_fields_set ): _dict["roomCompensationId"] = None # set to None if speaker_preset (nullable) is None - # and __fields_set__ contains the field - if self.speaker_preset is None and "speaker_preset" in self.__fields_set__: + # and model_fields_set contains the field + if self.speaker_preset is None and "speaker_preset" in self.model_fields_set: _dict["speakerPreset"] = None return _dict @classmethod - def from_dict(cls, obj: dict) -> SpeakerGroup: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpeakerGroup from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpeakerGroup.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpeakerGroup.parse_obj( + _obj = cls.model_validate( { - "crossover_frequency": obj.get("crossoverFrequency"), - "enable_phase_compensation": obj.get("enablePhaseCompensation"), - "friendly_name": obj.get("friendlyName"), + "crossoverFrequency": obj.get("crossoverFrequency"), + "enablePhaseCompensation": obj.get("enablePhaseCompensation"), + "friendlyName": obj.get("friendlyName"), "id": obj.get("id"), - "is_deleteable": obj.get("isDeleteable"), - "items": [ - SpeakerGroupMember.from_dict(_item) for _item in obj.get("items") - ] - if obj.get("items") is not None - else None, - "latency_profile": LatencyProfile.from_dict(obj.get("latencyProfile")) - if obj.get("latencyProfile") is not None - else None, - "room_compensation_id": obj.get("roomCompensationId"), - "speaker_preset": obj.get("speakerPreset"), + "isDeleteable": obj.get("isDeleteable"), + "items": ( + [SpeakerGroupMember.from_dict(_item) for _item in obj["items"]] + if obj.get("items") is not None + else None + ), + "latencyProfile": ( + LatencyProfile.from_dict(obj["latencyProfile"]) + if obj.get("latencyProfile") is not None + else None + ), + "roomCompensationId": obj.get("roomCompensationId"), + "speakerPreset": obj.get("speakerPreset"), } ) return _obj diff --git a/python_client/mozart_api/models/speaker_group_member.py b/python_client/mozart_api/models/speaker_group_member.py index c48b373..3b00d48 100644 --- a/python_client/mozart_api/models/speaker_group_member.py +++ b/python_client/mozart_api/models/speaker_group_member.py @@ -18,34 +18,41 @@ import re # noqa: F401 import json - -from typing import Optional, Union -from pydantic import BaseModel, Field, StrictStr, confloat, conint +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing_extensions import Annotated from mozart_api.models.speaker_group_member_location import SpeakerGroupMemberLocation +from typing import Optional, Set +from typing_extensions import Self class SpeakerGroupMember(BaseModel): """ SpeakerGroupMember - """ + """ # noqa: E501 - distance: Optional[conint(strict=True, le=1500, ge=0)] = Field( - None, description="Distance from listening position in cm" + distance: Optional[Annotated[int, Field(le=1500, strict=True, ge=0)]] = Field( + default=None, description="Distance from listening position in cm" ) - friendly_name: Optional[StrictStr] = Field(None, alias="friendlyName") + friendly_name: Optional[StrictStr] = Field(default=None, alias="friendlyName") gain: Optional[ - Union[confloat(le=6, ge=-24, strict=True), conint(le=6, ge=-24, strict=True)] - ] = Field(None, description="Level in dB") - id: StrictStr = Field(...) + Union[ + Annotated[float, Field(le=6, strict=True, ge=-24)], + Annotated[int, Field(le=6, strict=True, ge=-24)], + ] + ] = Field(default=None, description="Level in dB") + id: StrictStr location: Optional[SpeakerGroupMemberLocation] = None - redirection_level: Optional[conint(strict=True, le=6, ge=-100)] = Field( - None, - alias="redirectionLevel", - description="Redirection level for bass management in dB", + redirection_level: Optional[Annotated[int, Field(le=6, strict=True, ge=-100)]] = ( + Field( + default=None, + description="Redirection level for bass management in dB", + alias="redirectionLevel", + ) ) role: Optional[StrictStr] = None type: Optional[StrictStr] = None - __properties = [ + __properties: ClassVar[List[str]] = [ "distance", "friendlyName", "gain", @@ -56,90 +63,107 @@ class SpeakerGroupMember(BaseModel): "type", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SpeakerGroupMember: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpeakerGroupMember from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of location if self.location: _dict["location"] = self.location.to_dict() # set to None if distance (nullable) is None - # and __fields_set__ contains the field - if self.distance is None and "distance" in self.__fields_set__: + # and model_fields_set contains the field + if self.distance is None and "distance" in self.model_fields_set: _dict["distance"] = None # set to None if friendly_name (nullable) is None - # and __fields_set__ contains the field - if self.friendly_name is None and "friendly_name" in self.__fields_set__: + # and model_fields_set contains the field + if self.friendly_name is None and "friendly_name" in self.model_fields_set: _dict["friendlyName"] = None # set to None if gain (nullable) is None - # and __fields_set__ contains the field - if self.gain is None and "gain" in self.__fields_set__: + # and model_fields_set contains the field + if self.gain is None and "gain" in self.model_fields_set: _dict["gain"] = None # set to None if location (nullable) is None - # and __fields_set__ contains the field - if self.location is None and "location" in self.__fields_set__: + # and model_fields_set contains the field + if self.location is None and "location" in self.model_fields_set: _dict["location"] = None # set to None if redirection_level (nullable) is None - # and __fields_set__ contains the field + # and model_fields_set contains the field if ( self.redirection_level is None - and "redirection_level" in self.__fields_set__ + and "redirection_level" in self.model_fields_set ): _dict["redirectionLevel"] = None # set to None if role (nullable) is None - # and __fields_set__ contains the field - if self.role is None and "role" in self.__fields_set__: + # and model_fields_set contains the field + if self.role is None and "role" in self.model_fields_set: _dict["role"] = None # set to None if type (nullable) is None - # and __fields_set__ contains the field - if self.type is None and "type" in self.__fields_set__: + # and model_fields_set contains the field + if self.type is None and "type" in self.model_fields_set: _dict["type"] = None return _dict @classmethod - def from_dict(cls, obj: dict) -> SpeakerGroupMember: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpeakerGroupMember from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpeakerGroupMember.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpeakerGroupMember.parse_obj( + _obj = cls.model_validate( { "distance": obj.get("distance"), - "friendly_name": obj.get("friendlyName"), + "friendlyName": obj.get("friendlyName"), "gain": obj.get("gain"), "id": obj.get("id"), - "location": SpeakerGroupMemberLocation.from_dict(obj.get("location")) - if obj.get("location") is not None - else None, - "redirection_level": obj.get("redirectionLevel"), + "location": ( + SpeakerGroupMemberLocation.from_dict(obj["location"]) + if obj.get("location") is not None + else None + ), + "redirectionLevel": obj.get("redirectionLevel"), "role": obj.get("role"), "type": obj.get("type"), } diff --git a/python_client/mozart_api/models/speaker_group_member_location.py b/python_client/mozart_api/models/speaker_group_member_location.py index d27b630..b49120a 100644 --- a/python_client/mozart_api/models/speaker_group_member_location.py +++ b/python_client/mozart_api/models/speaker_group_member_location.py @@ -18,54 +18,71 @@ import re # noqa: F401 import json - -from pydantic import BaseModel, Field, StrictInt +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self class SpeakerGroupMemberLocation(BaseModel): """ - Coordinates of the speaker position in cm. Location is only relevant when the group is based on the automatic role assignment of advanced room compensation. The location is relative to the external microphone used during advanced room compensation measurements: x=0, y=0, z=0: The location of the external microphone used during measurement. x<0: To the left of the external microphone. x>0: To the right of the external microphone. y<0: Behind the external microphone. y>0: In front of the external microphone. z<0: Above the external microphone (may not be reliable). z>0: Below the external microphone (may not be reliable). # noqa: E501 - """ + Coordinates of the speaker position in cm. Location is only relevant when the group is based on the automatic role assignment of advanced room compensation. The location is relative to the external microphone used during advanced room compensation measurements: x=0, y=0, z=0: The location of the external microphone used during measurement. x<0: To the left of the external microphone. x>0: To the right of the external microphone. y<0: Behind the external microphone. y>0: In front of the external microphone. z<0: Above the external microphone (may not be reliable). z>0: Below the external microphone (may not be reliable). + """ # noqa: E501 - x: StrictInt = Field(...) - y: StrictInt = Field(...) - z: StrictInt = Field(...) - __properties = ["x", "y", "z"] + x: StrictInt + y: StrictInt + z: StrictInt + __properties: ClassVar[List[str]] = ["x", "y", "z"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SpeakerGroupMemberLocation: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpeakerGroupMemberLocation from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> SpeakerGroupMemberLocation: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpeakerGroupMemberLocation from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpeakerGroupMemberLocation.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpeakerGroupMemberLocation.parse_obj( + _obj = cls.model_validate( {"x": obj.get("x"), "y": obj.get("y"), "z": obj.get("z")} ) return _obj diff --git a/python_client/mozart_api/models/speaker_group_overview.py b/python_client/mozart_api/models/speaker_group_overview.py index 2e727da..a525137 100644 --- a/python_client/mozart_api/models/speaker_group_overview.py +++ b/python_client/mozart_api/models/speaker_group_overview.py @@ -18,58 +18,75 @@ import re # noqa: F401 import json - -from pydantic import BaseModel, Field, StrictBool, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self class SpeakerGroupOverview(BaseModel): """ SpeakerGroupOverview - """ + """ # noqa: E501 - friendly_name: StrictStr = Field(..., alias="friendlyName") - id: StrictStr = Field(...) - is_deleteable: StrictBool = Field(..., alias="isDeleteable") - __properties = ["friendlyName", "id", "isDeleteable"] + friendly_name: StrictStr = Field(alias="friendlyName") + id: StrictStr + is_deleteable: StrictBool = Field(alias="isDeleteable") + __properties: ClassVar[List[str]] = ["friendlyName", "id", "isDeleteable"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SpeakerGroupOverview: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpeakerGroupOverview from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> SpeakerGroupOverview: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpeakerGroupOverview from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpeakerGroupOverview.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpeakerGroupOverview.parse_obj( + _obj = cls.model_validate( { - "friendly_name": obj.get("friendlyName"), + "friendlyName": obj.get("friendlyName"), "id": obj.get("id"), - "is_deleteable": obj.get("isDeleteable"), + "isDeleteable": obj.get("isDeleteable"), } ) return _obj diff --git a/python_client/mozart_api/models/speaker_link_member_status.py b/python_client/mozart_api/models/speaker_link_member_status.py new file mode 100644 index 0000000..4b301c9 --- /dev/null +++ b/python_client/mozart_api/models/speaker_link_member_status.py @@ -0,0 +1,153 @@ +# coding: utf-8 + +""" + Mozart platform API + + API for interacting with the Mozart platform. + + The version of the OpenAPI document: 0.2.0 + Contact: support@bang-olufsen.dk + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + + +class SpeakerLinkMemberStatus(BaseModel): + """ + SpeakerLinkMemberStatus + """ # noqa: E501 + + base_url: Optional[StrictStr] = Field( + default=None, + description="API prefix to use when talking to the secondary", + alias="baseUrl", + ) + health: StrictStr + ip_address: Optional[StrictStr] = Field( + default=None, description="IP address", alias="ipAddress" + ) + network_type: StrictStr = Field(alias="networkType") + product_type: Optional[StrictStr] = Field(default=None, alias="productType") + serial_number: Annotated[str, Field(strict=True)] = Field( + description="Speaker serial number", alias="serialNumber" + ) + updated_at: datetime = Field( + description="Timestamp in RFC3393 format", alias="updatedAt" + ) + __properties: ClassVar[List[str]] = [ + "baseUrl", + "health", + "ipAddress", + "networkType", + "productType", + "serialNumber", + "updatedAt", + ] + + @field_validator("health") + def health_validate_enum(cls, value): + """Validates the enum""" + if value not in set(["unknown", "good", "warning", "bad"]): + raise ValueError( + "must be one of enum values ('unknown', 'good', 'warning', 'bad')" + ) + return value + + @field_validator("network_type") + def network_type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(["none", "wired", "wireless"]): + raise ValueError("must be one of enum values ('none', 'wired', 'wireless')") + return value + + @field_validator("serial_number") + def serial_number_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^\d{8}", value): + raise ValueError(r"must validate the regular expression /^\d{8}/") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SpeakerLinkMemberStatus from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if base_url (nullable) is None + # and model_fields_set contains the field + if self.base_url is None and "base_url" in self.model_fields_set: + _dict["baseUrl"] = None + + # set to None if ip_address (nullable) is None + # and model_fields_set contains the field + if self.ip_address is None and "ip_address" in self.model_fields_set: + _dict["ipAddress"] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SpeakerLinkMemberStatus from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "baseUrl": obj.get("baseUrl"), + "health": obj.get("health"), + "ipAddress": obj.get("ipAddress"), + "networkType": obj.get("networkType"), + "productType": obj.get("productType"), + "serialNumber": obj.get("serialNumber"), + "updatedAt": obj.get("updatedAt"), + } + ) + return _obj diff --git a/python_client/mozart_api/models/speaker_link_status.py b/python_client/mozart_api/models/speaker_link_status.py new file mode 100644 index 0000000..c03d919 --- /dev/null +++ b/python_client/mozart_api/models/speaker_link_status.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Mozart platform API + + API for interacting with the Mozart platform. + + The version of the OpenAPI document: 0.2.0 + Contact: support@bang-olufsen.dk + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from mozart_api.models.speaker_link_member_status import SpeakerLinkMemberStatus +from typing import Optional, Set +from typing_extensions import Self + + +class SpeakerLinkStatus(BaseModel): + """ + SpeakerLinkStatus + """ # noqa: E501 + + speakers: List[SpeakerLinkMemberStatus] + type: StrictStr + __properties: ClassVar[List[str]] = ["speakers", "type"] + + @field_validator("type") + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(["standalone", "stereo", "surround"]): + raise ValueError( + "must be one of enum values ('standalone', 'stereo', 'surround')" + ) + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SpeakerLinkStatus from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in speakers (list) + _items = [] + if self.speakers: + for _item in self.speakers: + if _item: + _items.append(_item.to_dict()) + _dict["speakers"] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SpeakerLinkStatus from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "speakers": ( + [ + SpeakerLinkMemberStatus.from_dict(_item) + for _item in obj["speakers"] + ] + if obj.get("speakers") is not None + else None + ), + "type": obj.get("type"), + } + ) + return _obj diff --git a/python_client/mozart_api/models/speaker_role_enum.py b/python_client/mozart_api/models/speaker_role_enum.py index 5b8113c..f37da75 100644 --- a/python_client/mozart_api/models/speaker_role_enum.py +++ b/python_client/mozart_api/models/speaker_role_enum.py @@ -18,63 +18,79 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr, validator +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class SpeakerRoleEnum(BaseModel): """ SpeakerRoleEnum - """ + """ # noqa: E501 value: Optional[StrictStr] = None - __properties = ["value"] + __properties: ClassVar[List[str]] = ["value"] - @validator("value") + @field_validator("value") def value_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("standalone", "multichannel"): + if value not in set(["standalone", "multichannel"]): raise ValueError( "must be one of enum values ('standalone', 'multichannel')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SpeakerRoleEnum: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpeakerRoleEnum from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> SpeakerRoleEnum: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpeakerRoleEnum from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpeakerRoleEnum.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpeakerRoleEnum.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/speech_enhance.py b/python_client/mozart_api/models/speech_enhance.py index e8c995e..78695b6 100644 --- a/python_client/mozart_api/models/speech_enhance.py +++ b/python_client/mozart_api/models/speech_enhance.py @@ -18,53 +18,69 @@ import re # noqa: F401 import json - -from typing import Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self class SpeechEnhance(BaseModel): """ SpeechEnhance - """ + """ # noqa: E501 value: Union[StrictFloat, StrictInt] = Field( - ..., description="Selected speech-enhance value" + description="Selected speech-enhance value" ) - __properties = ["value"] + __properties: ClassVar[List[str]] = ["value"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SpeechEnhance: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpeechEnhance from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> SpeechEnhance: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpeechEnhance from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpeechEnhance.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpeechEnhance.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/speech_enhance_feature.py b/python_client/mozart_api/models/speech_enhance_feature.py index 68615bb..3eb299a 100644 --- a/python_client/mozart_api/models/speech_enhance_feature.py +++ b/python_client/mozart_api/models/speech_enhance_feature.py @@ -18,48 +18,62 @@ import re # noqa: F401 import json - -from typing import List, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union from mozart_api.models.speech_enhance import SpeechEnhance +from typing import Optional, Set +from typing_extensions import Self class SpeechEnhanceFeature(BaseModel): """ SpeechEnhanceFeature - """ + """ # noqa: E501 value: Union[StrictFloat, StrictInt] = Field( - ..., description="Selected speech-enhance value" + description="Selected speech-enhance value" ) - default: SpeechEnhance = Field(...) - range: conlist(SpeechEnhance, unique_items=True) = Field( - ..., description="speech-enhance range" + default: SpeechEnhance + range: List[SpeechEnhance] = Field(description="speech-enhance range") + __properties: ClassVar[List[str]] = ["value", "default", "range"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), ) - __properties = ["value", "default", "range"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SpeechEnhanceFeature: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpeechEnhanceFeature from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -73,23 +87,27 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> SpeechEnhanceFeature: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpeechEnhanceFeature from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpeechEnhanceFeature.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpeechEnhanceFeature.parse_obj( + _obj = cls.model_validate( { "value": obj.get("value"), - "default": SpeechEnhance.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [SpeechEnhance.from_dict(_item) for _item in obj.get("range")] - if obj.get("range") is not None - else None, + "default": ( + SpeechEnhance.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [SpeechEnhance.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/speech_enhance_range.py b/python_client/mozart_api/models/speech_enhance_range.py index 730b440..33e54be 100644 --- a/python_client/mozart_api/models/speech_enhance_range.py +++ b/python_client/mozart_api/models/speech_enhance_range.py @@ -18,45 +18,59 @@ import re # noqa: F401 import json - -from typing import List -from pydantic import BaseModel, Field, conlist +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List from mozart_api.models.speech_enhance import SpeechEnhance +from typing import Optional, Set +from typing_extensions import Self class SpeechEnhanceRange(BaseModel): """ SpeechEnhanceRange - """ + """ # noqa: E501 - default: SpeechEnhance = Field(...) - range: conlist(SpeechEnhance, unique_items=True) = Field( - ..., description="speech-enhance range" - ) - __properties = ["default", "range"] + default: SpeechEnhance + range: List[SpeechEnhance] = Field(description="speech-enhance range") + __properties: ClassVar[List[str]] = ["default", "range"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SpeechEnhanceRange: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpeechEnhanceRange from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -70,22 +84,26 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> SpeechEnhanceRange: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of SpeechEnhanceRange from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SpeechEnhanceRange.parse_obj(obj) + return cls.model_validate(obj) - _obj = SpeechEnhanceRange.parse_obj( + _obj = cls.model_validate( { - "default": SpeechEnhance.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [SpeechEnhance.from_dict(_item) for _item in obj.get("range")] - if obj.get("range") is not None - else None, + "default": ( + SpeechEnhance.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [SpeechEnhance.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/stand_connected.py b/python_client/mozart_api/models/stand_connected.py index 3b1fbf7..52a7796 100644 --- a/python_client/mozart_api/models/stand_connected.py +++ b/python_client/mozart_api/models/stand_connected.py @@ -18,51 +18,67 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictBool +from pydantic import BaseModel, ConfigDict, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class StandConnected(BaseModel): """ StandConnected - """ + """ # noqa: E501 connected: Optional[StrictBool] = None - __properties = ["connected"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["connected"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> StandConnected: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of StandConnected from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> StandConnected: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of StandConnected from a dict""" if obj is None: return None if not isinstance(obj, dict): - return StandConnected.parse_obj(obj) + return cls.model_validate(obj) - _obj = StandConnected.parse_obj({"connected": obj.get("connected")}) + _obj = cls.model_validate({"connected": obj.get("connected")}) return _obj diff --git a/python_client/mozart_api/models/stand_movement.py b/python_client/mozart_api/models/stand_movement.py new file mode 100644 index 0000000..da2b3d7 --- /dev/null +++ b/python_client/mozart_api/models/stand_movement.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" + Mozart platform API + + API for interacting with the Mozart platform. + + The version of the OpenAPI document: 0.2.0 + Contact: support@bang-olufsen.dk + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import ( + BaseModel, + ConfigDict, + Field, + StrictBool, + StrictFloat, + StrictInt, + StrictStr, + field_validator, +) +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self + + +class StandMovement(BaseModel): + """ + StandMovement + """ # noqa: E501 + + angle: Optional[Union[StrictFloat, StrictInt]] = None + ignore_endstop: Optional[StrictBool] = Field(default=None, alias="ignoreEndstop") + stand_motion: Optional[StrictStr] = Field(default=None, alias="standMotion") + __properties: ClassVar[List[str]] = ["angle", "ignoreEndstop", "standMotion"] + + @field_validator("stand_motion") + def stand_motion_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set( + ["continuousCCW", "stepCCW", "stop", "stepCW", "continuousCW"] + ): + raise ValueError( + "must be one of enum values ('continuousCCW', 'stepCCW', 'stop', 'stepCW', 'continuousCW')" + ) + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of StandMovement from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if angle (nullable) is None + # and model_fields_set contains the field + if self.angle is None and "angle" in self.model_fields_set: + _dict["angle"] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of StandMovement from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "angle": obj.get("angle"), + "ignoreEndstop": obj.get("ignoreEndstop"), + "standMotion": obj.get("standMotion"), + } + ) + return _obj diff --git a/python_client/mozart_api/models/stand_position.py b/python_client/mozart_api/models/stand_position.py index 036ec1e..2af3c08 100644 --- a/python_client/mozart_api/models/stand_position.py +++ b/python_client/mozart_api/models/stand_position.py @@ -18,51 +18,67 @@ import re # noqa: F401 import json - -from typing import Optional, Union -from pydantic import BaseModel, StrictFloat, StrictInt +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self class StandPosition(BaseModel): """ StandPosition - """ + """ # noqa: E501 angle: Optional[Union[StrictFloat, StrictInt]] = None - __properties = ["angle"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["angle"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> StandPosition: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of StandPosition from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> StandPosition: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of StandPosition from a dict""" if obj is None: return None if not isinstance(obj, dict): - return StandPosition.parse_obj(obj) + return cls.model_validate(obj) - _obj = StandPosition.parse_obj({"angle": obj.get("angle")}) + _obj = cls.model_validate({"angle": obj.get("angle")}) return _obj diff --git a/python_client/mozart_api/models/tone_touch.py b/python_client/mozart_api/models/tone_touch.py index 0f0852e..ffdb0af 100644 --- a/python_client/mozart_api/models/tone_touch.py +++ b/python_client/mozart_api/models/tone_touch.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.tone_touch_type import ToneTouchType +from typing import Optional, Set +from typing_extensions import Self class ToneTouch(BaseModel): """ ToneTouch - """ + """ # noqa: E501 x: Optional[ToneTouchType] = None y: Optional[ToneTouchType] = None - __properties = ["x", "y"] + __properties: ClassVar[List[str]] = ["x", "y"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ToneTouch: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ToneTouch from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of x if self.x: _dict["x"] = self.x.to_dict() @@ -64,22 +80,26 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ToneTouch: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ToneTouch from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ToneTouch.parse_obj(obj) + return cls.model_validate(obj) - _obj = ToneTouch.parse_obj( + _obj = cls.model_validate( { - "x": ToneTouchType.from_dict(obj.get("x")) - if obj.get("x") is not None - else None, - "y": ToneTouchType.from_dict(obj.get("y")) - if obj.get("y") is not None - else None, + "x": ( + ToneTouchType.from_dict(obj["x"]) + if obj.get("x") is not None + else None + ), + "y": ( + ToneTouchType.from_dict(obj["y"]) + if obj.get("y") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/tone_touch_type.py b/python_client/mozart_api/models/tone_touch_type.py index 364c36b..40bd34b 100644 --- a/python_client/mozart_api/models/tone_touch_type.py +++ b/python_client/mozart_api/models/tone_touch_type.py @@ -18,51 +18,67 @@ import re # noqa: F401 import json - -from typing import Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self class ToneTouchType(BaseModel): """ ToneTouchType - """ - - value: Union[StrictFloat, StrictInt] = Field(...) - __properties = ["value"] + """ # noqa: E501 - class Config: - """Pydantic configuration""" + value: Union[StrictFloat, StrictInt] + __properties: ClassVar[List[str]] = ["value"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ToneTouchType: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ToneTouchType from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> ToneTouchType: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ToneTouchType from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ToneTouchType.parse_obj(obj) + return cls.model_validate(obj) - _obj = ToneTouchType.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/tone_touch_type_range.py b/python_client/mozart_api/models/tone_touch_type_range.py index 7355ac7..a8442f8 100644 --- a/python_client/mozart_api/models/tone_touch_type_range.py +++ b/python_client/mozart_api/models/tone_touch_type_range.py @@ -18,45 +18,61 @@ import re # noqa: F401 import json - -from typing import List -from pydantic import BaseModel, Field, conlist +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List from mozart_api.models.tone_touch_type import ToneTouchType +from typing import Optional, Set +from typing_extensions import Self class ToneTouchTypeRange(BaseModel): """ ToneTouchTypeRange - """ + """ # noqa: E501 - default: ToneTouchType = Field(...) - range: conlist(ToneTouchType, unique_items=True) = Field( - ..., description="Product and role specific tone touch X or Y range" + default: ToneTouchType + range: List[ToneTouchType] = Field( + description="Product and role specific tone touch X or Y range" ) - __properties = ["default", "range"] + __properties: ClassVar[List[str]] = ["default", "range"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ToneTouchTypeRange: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ToneTouchTypeRange from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -70,22 +86,26 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ToneTouchTypeRange: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ToneTouchTypeRange from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ToneTouchTypeRange.parse_obj(obj) + return cls.model_validate(obj) - _obj = ToneTouchTypeRange.parse_obj( + _obj = cls.model_validate( { - "default": ToneTouchType.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [ToneTouchType.from_dict(_item) for _item in obj.get("range")] - if obj.get("range") is not None - else None, + "default": ( + ToneTouchType.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [ToneTouchType.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/tone_touch_x_feature.py b/python_client/mozart_api/models/tone_touch_x_feature.py index 10d3554..d4603b4 100644 --- a/python_client/mozart_api/models/tone_touch_x_feature.py +++ b/python_client/mozart_api/models/tone_touch_x_feature.py @@ -18,46 +18,62 @@ import re # noqa: F401 import json - -from typing import List, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union from mozart_api.models.tone_touch_type import ToneTouchType +from typing import Optional, Set +from typing_extensions import Self class ToneTouchXFeature(BaseModel): """ ToneTouchXFeature - """ + """ # noqa: E501 - value: Union[StrictFloat, StrictInt] = Field(...) - default: ToneTouchType = Field(...) - range: conlist(ToneTouchType, unique_items=True) = Field( - ..., description="Product and role specific tone touch X or Y range" + value: Union[StrictFloat, StrictInt] + default: ToneTouchType + range: List[ToneTouchType] = Field( + description="Product and role specific tone touch X or Y range" ) - __properties = ["value", "default", "range"] + __properties: ClassVar[List[str]] = ["value", "default", "range"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ToneTouchXFeature: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ToneTouchXFeature from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -71,23 +87,27 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ToneTouchXFeature: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ToneTouchXFeature from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ToneTouchXFeature.parse_obj(obj) + return cls.model_validate(obj) - _obj = ToneTouchXFeature.parse_obj( + _obj = cls.model_validate( { "value": obj.get("value"), - "default": ToneTouchType.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [ToneTouchType.from_dict(_item) for _item in obj.get("range")] - if obj.get("range") is not None - else None, + "default": ( + ToneTouchType.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [ToneTouchType.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/tone_touch_y_feature.py b/python_client/mozart_api/models/tone_touch_y_feature.py index f196541..0bb8d39 100644 --- a/python_client/mozart_api/models/tone_touch_y_feature.py +++ b/python_client/mozart_api/models/tone_touch_y_feature.py @@ -18,46 +18,62 @@ import re # noqa: F401 import json - -from typing import List, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union from mozart_api.models.tone_touch_type import ToneTouchType +from typing import Optional, Set +from typing_extensions import Self class ToneTouchYFeature(BaseModel): """ ToneTouchYFeature - """ + """ # noqa: E501 - value: Union[StrictFloat, StrictInt] = Field(...) - default: ToneTouchType = Field(...) - range: conlist(ToneTouchType, unique_items=True) = Field( - ..., description="Product and role specific tone touch X or Y range" + value: Union[StrictFloat, StrictInt] + default: ToneTouchType + range: List[ToneTouchType] = Field( + description="Product and role specific tone touch X or Y range" ) - __properties = ["value", "default", "range"] + __properties: ClassVar[List[str]] = ["value", "default", "range"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ToneTouchYFeature: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ToneTouchYFeature from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -71,23 +87,27 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ToneTouchYFeature: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ToneTouchYFeature from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ToneTouchYFeature.parse_obj(obj) + return cls.model_validate(obj) - _obj = ToneTouchYFeature.parse_obj( + _obj = cls.model_validate( { "value": obj.get("value"), - "default": ToneTouchType.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [ToneTouchType.from_dict(_item) for _item in obj.get("range")] - if obj.get("range") is not None - else None, + "default": ( + ToneTouchType.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [ToneTouchType.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/treble.py b/python_client/mozart_api/models/treble.py index 8594083..2f88370 100644 --- a/python_client/mozart_api/models/treble.py +++ b/python_client/mozart_api/models/treble.py @@ -18,50 +18,67 @@ import re # noqa: F401 import json - -from pydantic import BaseModel, Field, StrictInt +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self class Treble(BaseModel): """ Treble - """ - - value: StrictInt = Field(..., description="Selected treble value") - __properties = ["value"] + """ # noqa: E501 - class Config: - """Pydantic configuration""" + value: StrictInt = Field(description="Selected treble value") + __properties: ClassVar[List[str]] = ["value"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Treble: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Treble from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> Treble: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Treble from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Treble.parse_obj(obj) + return cls.model_validate(obj) - _obj = Treble.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/treble_feature.py b/python_client/mozart_api/models/treble_feature.py index 885f7b4..aa1b0e8 100644 --- a/python_client/mozart_api/models/treble_feature.py +++ b/python_client/mozart_api/models/treble_feature.py @@ -18,46 +18,60 @@ import re # noqa: F401 import json - -from typing import List -from pydantic import BaseModel, Field, StrictInt, conlist +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List from mozart_api.models.treble import Treble +from typing import Optional, Set +from typing_extensions import Self class TrebleFeature(BaseModel): """ TrebleFeature - """ + """ # noqa: E501 - value: StrictInt = Field(..., description="Selected treble value") - default: Treble = Field(...) - range: conlist(Treble, unique_items=True) = Field( - ..., description="Product and role specific treble range" - ) - __properties = ["value", "default", "range"] + value: StrictInt = Field(description="Selected treble value") + default: Treble + range: List[Treble] = Field(description="Product and role specific treble range") + __properties: ClassVar[List[str]] = ["value", "default", "range"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> TrebleFeature: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of TrebleFeature from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -71,23 +85,27 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> TrebleFeature: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of TrebleFeature from a dict""" if obj is None: return None if not isinstance(obj, dict): - return TrebleFeature.parse_obj(obj) + return cls.model_validate(obj) - _obj = TrebleFeature.parse_obj( + _obj = cls.model_validate( { "value": obj.get("value"), - "default": Treble.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [Treble.from_dict(_item) for _item in obj.get("range")] - if obj.get("range") is not None - else None, + "default": ( + Treble.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [Treble.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/treble_range.py b/python_client/mozart_api/models/treble_range.py index 15b7976..466e4a4 100644 --- a/python_client/mozart_api/models/treble_range.py +++ b/python_client/mozart_api/models/treble_range.py @@ -18,45 +18,59 @@ import re # noqa: F401 import json - -from typing import List -from pydantic import BaseModel, Field, conlist +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List from mozart_api.models.treble import Treble +from typing import Optional, Set +from typing_extensions import Self class TrebleRange(BaseModel): """ TrebleRange - """ + """ # noqa: E501 - default: Treble = Field(...) - range: conlist(Treble, unique_items=True) = Field( - ..., description="Product and role specific treble range" - ) - __properties = ["default", "range"] + default: Treble + range: List[Treble] = Field(description="Product and role specific treble range") + __properties: ClassVar[List[str]] = ["default", "range"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> TrebleRange: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of TrebleRange from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -70,22 +84,26 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> TrebleRange: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of TrebleRange from a dict""" if obj is None: return None if not isinstance(obj, dict): - return TrebleRange.parse_obj(obj) + return cls.model_validate(obj) - _obj = TrebleRange.parse_obj( + _obj = cls.model_validate( { - "default": Treble.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "range": [Treble.from_dict(_item) for _item in obj.get("range")] - if obj.get("range") is not None - else None, + "default": ( + Treble.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "range": ( + [Treble.from_dict(_item) for _item in obj["range"]] + if obj.get("range") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/tv_info_event_data.py b/python_client/mozart_api/models/tv_info_event_data.py index 4276eca..ae091a4 100644 --- a/python_client/mozart_api/models/tv_info_event_data.py +++ b/python_client/mozart_api/models/tv_info_event_data.py @@ -18,61 +18,79 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.tv_integration_types import TvIntegrationTypes +from typing import Optional, Set +from typing_extensions import Self class TvInfoEventData(BaseModel): """ TvInfoEventData - """ + """ # noqa: E501 integration: Optional[TvIntegrationTypes] = None - __properties = ["integration"] + __properties: ClassVar[List[str]] = ["integration"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> TvInfoEventData: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of TvInfoEventData from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of integration if self.integration: _dict["integration"] = self.integration.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> TvInfoEventData: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of TvInfoEventData from a dict""" if obj is None: return None if not isinstance(obj, dict): - return TvInfoEventData.parse_obj(obj) + return cls.model_validate(obj) - _obj = TvInfoEventData.parse_obj( + _obj = cls.model_validate( { - "integration": TvIntegrationTypes.from_dict(obj.get("integration")) - if obj.get("integration") is not None - else None + "integration": ( + TvIntegrationTypes.from_dict(obj["integration"]) + if obj.get("integration") is not None + else None + ) } ) return _obj diff --git a/python_client/mozart_api/models/tv_integration_types.py b/python_client/mozart_api/models/tv_integration_types.py index 719e6f5..80f2147 100644 --- a/python_client/mozart_api/models/tv_integration_types.py +++ b/python_client/mozart_api/models/tv_integration_types.py @@ -18,61 +18,77 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr, validator +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class TvIntegrationTypes(BaseModel): """ TvIntegrationTypes - """ + """ # noqa: E501 value: Optional[StrictStr] = None - __properties = ["value"] + __properties: ClassVar[List[str]] = ["value"] - @validator("value") + @field_validator("value") def value_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("ThirdParty", "Lge"): + if value not in set(["ThirdParty", "Lge"]): raise ValueError("must be one of enum values ('ThirdParty', 'Lge')") return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> TvIntegrationTypes: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of TvIntegrationTypes from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> TvIntegrationTypes: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of TvIntegrationTypes from a dict""" if obj is None: return None if not isinstance(obj, dict): - return TvIntegrationTypes.parse_obj(obj) + return cls.model_validate(obj) - _obj = TvIntegrationTypes.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/tv_properties.py b/python_client/mozart_api/models/tv_properties.py index f49b5e6..a3c8a58 100644 --- a/python_client/mozart_api/models/tv_properties.py +++ b/python_client/mozart_api/models/tv_properties.py @@ -18,77 +18,93 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.tv_integration_types import TvIntegrationTypes +from typing import Optional, Set +from typing_extensions import Self class TvProperties(BaseModel): """ TvProperties - """ + """ # noqa: E501 integration_supported: Optional[TvIntegrationTypes] = Field( - None, alias="integrationSupported" + default=None, alias="integrationSupported" ) name: Optional[StrictStr] = None year: Optional[StrictInt] = None - __properties = ["integrationSupported", "name", "year"] + __properties: ClassVar[List[str]] = ["integrationSupported", "name", "year"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> TvProperties: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of TvProperties from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of integration_supported if self.integration_supported: _dict["integrationSupported"] = self.integration_supported.to_dict() # set to None if name (nullable) is None - # and __fields_set__ contains the field - if self.name is None and "name" in self.__fields_set__: + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: _dict["name"] = None # set to None if year (nullable) is None - # and __fields_set__ contains the field - if self.year is None and "year" in self.__fields_set__: + # and model_fields_set contains the field + if self.year is None and "year" in self.model_fields_set: _dict["year"] = None return _dict @classmethod - def from_dict(cls, obj: dict) -> TvProperties: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of TvProperties from a dict""" if obj is None: return None if not isinstance(obj, dict): - return TvProperties.parse_obj(obj) + return cls.model_validate(obj) - _obj = TvProperties.parse_obj( + _obj = cls.model_validate( { - "integration_supported": TvIntegrationTypes.from_dict( - obj.get("integrationSupported") - ) - if obj.get("integrationSupported") is not None - else None, + "integrationSupported": ( + TvIntegrationTypes.from_dict(obj["integrationSupported"]) + if obj.get("integrationSupported") is not None + else None + ), "name": obj.get("name"), "year": obj.get("year"), } diff --git a/python_client/mozart_api/models/tv_sound_settings.py b/python_client/mozart_api/models/tv_sound_settings.py index 7066c61..d34adbe 100644 --- a/python_client/mozart_api/models/tv_sound_settings.py +++ b/python_client/mozart_api/models/tv_sound_settings.py @@ -18,61 +18,79 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.lge_tv_sound_settings import LgeTvSoundSettings +from typing import Optional, Set +from typing_extensions import Self class TvSoundSettings(BaseModel): """ TvSoundSettings - """ + """ # noqa: E501 lge: Optional[LgeTvSoundSettings] = None - __properties = ["lge"] + __properties: ClassVar[List[str]] = ["lge"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> TvSoundSettings: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of TvSoundSettings from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of lge if self.lge: _dict["lge"] = self.lge.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> TvSoundSettings: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of TvSoundSettings from a dict""" if obj is None: return None if not isinstance(obj, dict): - return TvSoundSettings.parse_obj(obj) + return cls.model_validate(obj) - _obj = TvSoundSettings.parse_obj( + _obj = cls.model_validate( { - "lge": LgeTvSoundSettings.from_dict(obj.get("lge")) - if obj.get("lge") is not None - else None + "lge": ( + LgeTvSoundSettings.from_dict(obj["lge"]) + if obj.get("lge") is not None + else None + ) } ) return _obj diff --git a/python_client/mozart_api/models/tv_state.py b/python_client/mozart_api/models/tv_state.py index ab640f5..8638da3 100644 --- a/python_client/mozart_api/models/tv_state.py +++ b/python_client/mozart_api/models/tv_state.py @@ -18,46 +18,64 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.tv_integration_types import TvIntegrationTypes from mozart_api.models.tv_properties import TvProperties from mozart_api.models.tv_sound_settings import TvSoundSettings +from typing import Optional, Set +from typing_extensions import Self class TvState(BaseModel): """ TvState - """ + """ # noqa: E501 integration: Optional[TvIntegrationTypes] = None - sound_settings: Optional[TvSoundSettings] = Field(None, alias="soundSettings") - tv_info: Optional[TvProperties] = Field(None, alias="tvInfo") - __properties = ["integration", "soundSettings", "tvInfo"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + sound_settings: Optional[TvSoundSettings] = Field( + default=None, alias="soundSettings" + ) + tv_info: Optional[TvProperties] = Field(default=None, alias="tvInfo") + __properties: ClassVar[List[str]] = ["integration", "soundSettings", "tvInfo"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> TvState: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of TvState from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of integration if self.integration: _dict["integration"] = self.integration.to_dict() @@ -70,25 +88,31 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> TvState: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of TvState from a dict""" if obj is None: return None if not isinstance(obj, dict): - return TvState.parse_obj(obj) + return cls.model_validate(obj) - _obj = TvState.parse_obj( + _obj = cls.model_validate( { - "integration": TvIntegrationTypes.from_dict(obj.get("integration")) - if obj.get("integration") is not None - else None, - "sound_settings": TvSoundSettings.from_dict(obj.get("soundSettings")) - if obj.get("soundSettings") is not None - else None, - "tv_info": TvProperties.from_dict(obj.get("tvInfo")) - if obj.get("tvInfo") is not None - else None, + "integration": ( + TvIntegrationTypes.from_dict(obj["integration"]) + if obj.get("integration") is not None + else None + ), + "soundSettings": ( + TvSoundSettings.from_dict(obj["soundSettings"]) + if obj.get("soundSettings") is not None + else None + ), + "tvInfo": ( + TvProperties.from_dict(obj["tvInfo"]) + if obj.get("tvInfo") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/uri.py b/python_client/mozart_api/models/uri.py index 8d090fb..f42bc2a 100644 --- a/python_client/mozart_api/models/uri.py +++ b/python_client/mozart_api/models/uri.py @@ -18,51 +18,67 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class Uri(BaseModel): """ Uri - """ + """ # noqa: E501 location: Optional[StrictStr] = None - __properties = ["location"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["location"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Uri: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Uri from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> Uri: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of Uri from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Uri.parse_obj(obj) + return cls.model_validate(obj) - _obj = Uri.parse_obj({"location": obj.get("location")}) + _obj = cls.model_validate({"location": obj.get("location")}) return _obj diff --git a/python_client/mozart_api/models/user_flow.py b/python_client/mozart_api/models/user_flow.py index 9bf9c69..90993c3 100644 --- a/python_client/mozart_api/models/user_flow.py +++ b/python_client/mozart_api/models/user_flow.py @@ -18,51 +18,67 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class UserFlow(BaseModel): """ UserFlow - """ - - user_id: Optional[StrictStr] = Field(None, alias="userId") - __properties = ["userId"] + """ # noqa: E501 - class Config: - """Pydantic configuration""" + user_id: Optional[StrictStr] = Field(default=None, alias="userId") + __properties: ClassVar[List[str]] = ["userId"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> UserFlow: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of UserFlow from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> UserFlow: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of UserFlow from a dict""" if obj is None: return None if not isinstance(obj, dict): - return UserFlow.parse_obj(obj) + return cls.model_validate(obj) - _obj = UserFlow.parse_obj({"user_id": obj.get("userId")}) + _obj = cls.model_validate({"userId": obj.get("userId")}) return _obj diff --git a/python_client/mozart_api/models/video_pixel_format.py b/python_client/mozart_api/models/video_pixel_format.py index 1751dd4..e306266 100644 --- a/python_client/mozart_api/models/video_pixel_format.py +++ b/python_client/mozart_api/models/video_pixel_format.py @@ -18,109 +18,139 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr, validator +from pydantic import ( + BaseModel, + ConfigDict, + Field, + StrictBool, + StrictStr, + field_validator, +) +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class VideoPixelFormat(BaseModel): """ VideoPixelFormat - """ + """ # noqa: E501 bitdepth: Optional[StrictStr] = None - chroma_subsample: Optional[StrictStr] = Field(None, alias="chromaSubsample") + chroma_subsample: Optional[StrictStr] = Field(default=None, alias="chromaSubsample") colorimetry: Optional[StrictStr] = None - full_range: Optional[StrictBool] = Field(None, alias="fullRange") - __properties = ["bitdepth", "chromaSubsample", "colorimetry", "fullRange"] - - @validator("bitdepth") + full_range: Optional[StrictBool] = Field(default=None, alias="fullRange") + __properties: ClassVar[List[str]] = [ + "bitdepth", + "chromaSubsample", + "colorimetry", + "fullRange", + ] + + @field_validator("bitdepth") def bitdepth_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("bit8", "bit10", "bit12"): + if value not in set(["bit8", "bit10", "bit12"]): raise ValueError("must be one of enum values ('bit8', 'bit10', 'bit12')") return value - @validator("chroma_subsample") + @field_validator("chroma_subsample") def chroma_subsample_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("yCbCr444RGB", "yCbCr422", "yCbCr420"): + if value not in set(["yCbCr444RGB", "yCbCr422", "yCbCr420"]): raise ValueError( "must be one of enum values ('yCbCr444RGB', 'yCbCr422', 'yCbCr420')" ) return value - @validator("colorimetry") + @field_validator("colorimetry") def colorimetry_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ( - "rGB", - "opRGB", - "rGBP3D65", - "rGBP3DCI", - "rGB2020", - "yCC601", - "yCC709", - "xvYCC601", - "xvYCC709", - "sYCC601", - "opYCC601", - "yCC2020NCL", - "yCC2020NL", + if value not in set( + [ + "rGB", + "opRGB", + "rGBP3D65", + "rGBP3DCI", + "rGB2020", + "yCC601", + "yCC709", + "xvYCC601", + "xvYCC709", + "sYCC601", + "opYCC601", + "yCC2020NCL", + "yCC2020NL", + ] ): raise ValueError( "must be one of enum values ('rGB', 'opRGB', 'rGBP3D65', 'rGBP3DCI', 'rGB2020', 'yCC601', 'yCC709', 'xvYCC601', 'xvYCC709', 'sYCC601', 'opYCC601', 'yCC2020NCL', 'yCC2020NL')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> VideoPixelFormat: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VideoPixelFormat from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> VideoPixelFormat: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VideoPixelFormat from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VideoPixelFormat.parse_obj(obj) + return cls.model_validate(obj) - _obj = VideoPixelFormat.parse_obj( + _obj = cls.model_validate( { "bitdepth": obj.get("bitdepth"), - "chroma_subsample": obj.get("chromaSubsample"), + "chromaSubsample": obj.get("chromaSubsample"), "colorimetry": obj.get("colorimetry"), - "full_range": obj.get("fullRange"), + "fullRange": obj.get("fullRange"), } ) return _obj diff --git a/python_client/mozart_api/models/video_timings.py b/python_client/mozart_api/models/video_timings.py index f282469..827eb96 100644 --- a/python_client/mozart_api/models/video_timings.py +++ b/python_client/mozart_api/models/video_timings.py @@ -18,70 +18,88 @@ import re # noqa: F401 import json - -from typing import Optional, Union -from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self class VideoTimings(BaseModel): """ VideoTimings - """ + """ # noqa: E501 horizontal_resolution: Optional[StrictInt] = Field( - None, alias="horizontalResolution" + default=None, alias="horizontalResolution" ) interlaced: Optional[StrictBool] = None refresh_rate: Optional[Union[StrictFloat, StrictInt]] = Field( - None, alias="refreshRate" + default=None, alias="refreshRate" + ) + vertical_resolution: Optional[StrictInt] = Field( + default=None, alias="verticalResolution" ) - vertical_resolution: Optional[StrictInt] = Field(None, alias="verticalResolution") - __properties = [ + __properties: ClassVar[List[str]] = [ "horizontalResolution", "interlaced", "refreshRate", "verticalResolution", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> VideoTimings: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VideoTimings from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> VideoTimings: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VideoTimings from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VideoTimings.parse_obj(obj) + return cls.model_validate(obj) - _obj = VideoTimings.parse_obj( + _obj = cls.model_validate( { - "horizontal_resolution": obj.get("horizontalResolution"), + "horizontalResolution": obj.get("horizontalResolution"), "interlaced": obj.get("interlaced"), - "refresh_rate": obj.get("refreshRate"), - "vertical_resolution": obj.get("verticalResolution"), + "refreshRate": obj.get("refreshRate"), + "verticalResolution": obj.get("verticalResolution"), } ) return _obj diff --git a/python_client/mozart_api/models/volume_level.py b/python_client/mozart_api/models/volume_level.py index 5b6cd86..6b5b2fc 100644 --- a/python_client/mozart_api/models/volume_level.py +++ b/python_client/mozart_api/models/volume_level.py @@ -18,51 +18,67 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictInt +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class VolumeLevel(BaseModel): """ VolumeLevel - """ + """ # noqa: E501 level: Optional[StrictInt] = None - __properties = ["level"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["level"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> VolumeLevel: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VolumeLevel from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> VolumeLevel: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VolumeLevel from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VolumeLevel.parse_obj(obj) + return cls.model_validate(obj) - _obj = VolumeLevel.parse_obj({"level": obj.get("level")}) + _obj = cls.model_validate({"level": obj.get("level")}) return _obj diff --git a/python_client/mozart_api/models/volume_mute.py b/python_client/mozart_api/models/volume_mute.py index 77d7e33..1c6ceb0 100644 --- a/python_client/mozart_api/models/volume_mute.py +++ b/python_client/mozart_api/models/volume_mute.py @@ -18,51 +18,67 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictBool +from pydantic import BaseModel, ConfigDict, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class VolumeMute(BaseModel): """ VolumeMute - """ + """ # noqa: E501 muted: Optional[StrictBool] = None - __properties = ["muted"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["muted"] - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> VolumeMute: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VolumeMute from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> VolumeMute: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VolumeMute from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VolumeMute.parse_obj(obj) + return cls.model_validate(obj) - _obj = VolumeMute.parse_obj({"muted": obj.get("muted")}) + _obj = cls.model_validate({"muted": obj.get("muted")}) return _obj diff --git a/python_client/mozart_api/models/volume_settings.py b/python_client/mozart_api/models/volume_settings.py index c57e04a..9aa94b5 100644 --- a/python_client/mozart_api/models/volume_settings.py +++ b/python_client/mozart_api/models/volume_settings.py @@ -18,43 +18,59 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.volume_level import VolumeLevel +from typing import Optional, Set +from typing_extensions import Self class VolumeSettings(BaseModel): """ VolumeSettings - """ + """ # noqa: E501 default: Optional[VolumeLevel] = None maximum: Optional[VolumeLevel] = None - __properties = ["default", "maximum"] + __properties: ClassVar[List[str]] = ["default", "maximum"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> VolumeSettings: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VolumeSettings from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -64,22 +80,26 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> VolumeSettings: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VolumeSettings from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VolumeSettings.parse_obj(obj) + return cls.model_validate(obj) - _obj = VolumeSettings.parse_obj( + _obj = cls.model_validate( { - "default": VolumeLevel.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "maximum": VolumeLevel.from_dict(obj.get("maximum")) - if obj.get("maximum") is not None - else None, + "default": ( + VolumeLevel.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "maximum": ( + VolumeLevel.from_dict(obj["maximum"]) + if obj.get("maximum") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/volume_state.py b/python_client/mozart_api/models/volume_state.py index 414a666..b0f7895 100644 --- a/python_client/mozart_api/models/volume_state.py +++ b/python_client/mozart_api/models/volume_state.py @@ -18,46 +18,62 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.volume_level import VolumeLevel from mozart_api.models.volume_mute import VolumeMute +from typing import Optional, Set +from typing_extensions import Self class VolumeState(BaseModel): """ VolumeState - """ + """ # noqa: E501 default: Optional[VolumeLevel] = None level: Optional[VolumeLevel] = None maximum: Optional[VolumeLevel] = None muted: Optional[VolumeMute] = None - __properties = ["default", "level", "maximum", "muted"] + __properties: ClassVar[List[str]] = ["default", "level", "maximum", "muted"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> VolumeState: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of VolumeState from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default if self.default: _dict["default"] = self.default.to_dict() @@ -73,28 +89,36 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> VolumeState: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of VolumeState from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VolumeState.parse_obj(obj) + return cls.model_validate(obj) - _obj = VolumeState.parse_obj( + _obj = cls.model_validate( { - "default": VolumeLevel.from_dict(obj.get("default")) - if obj.get("default") is not None - else None, - "level": VolumeLevel.from_dict(obj.get("level")) - if obj.get("level") is not None - else None, - "maximum": VolumeLevel.from_dict(obj.get("maximum")) - if obj.get("maximum") is not None - else None, - "muted": VolumeMute.from_dict(obj.get("muted")) - if obj.get("muted") is not None - else None, + "default": ( + VolumeLevel.from_dict(obj["default"]) + if obj.get("default") is not None + else None + ), + "level": ( + VolumeLevel.from_dict(obj["level"]) + if obj.get("level") is not None + else None + ), + "maximum": ( + VolumeLevel.from_dict(obj["maximum"]) + if obj.get("maximum") is not None + else None + ), + "muted": ( + VolumeMute.from_dict(obj["muted"]) + if obj.get("muted") is not None + else None + ), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_active_hdmi_input_signal.py b/python_client/mozart_api/models/web_socket_event_active_hdmi_input_signal.py index 2e303db..ffbf033 100644 --- a/python_client/mozart_api/models/web_socket_event_active_hdmi_input_signal.py +++ b/python_client/mozart_api/models/web_socket_event_active_hdmi_input_signal.py @@ -18,63 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.hdmi_input import HdmiInput +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventActiveHdmiInputSignal(BaseModel): """ WebSocketEventActiveHdmiInputSignal - """ + """ # noqa: E501 - event_data: Optional[HdmiInput] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[HdmiInput] = Field(default=None, alias="eventData") + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventActiveHdmiInputSignal: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventActiveHdmiInputSignal from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventActiveHdmiInputSignal: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventActiveHdmiInputSignal from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventActiveHdmiInputSignal.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventActiveHdmiInputSignal.parse_obj( + _obj = cls.model_validate( { - "event_data": HdmiInput.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + HdmiInput.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_active_listening_mode.py b/python_client/mozart_api/models/web_socket_event_active_listening_mode.py index 8f7e797..d70e42e 100644 --- a/python_client/mozart_api/models/web_socket_event_active_listening_mode.py +++ b/python_client/mozart_api/models/web_socket_event_active_listening_mode.py @@ -18,63 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.listening_mode_props import ListeningModeProps +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventActiveListeningMode(BaseModel): """ WebSocketEventActiveListeningMode - """ + """ # noqa: E501 - event_data: Optional[ListeningModeProps] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[ListeningModeProps] = Field(default=None, alias="eventData") + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventActiveListeningMode: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventActiveListeningMode from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventActiveListeningMode: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventActiveListeningMode from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventActiveListeningMode.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventActiveListeningMode.parse_obj( + _obj = cls.model_validate( { - "event_data": ListeningModeProps.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + ListeningModeProps.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_active_speaker_group.py b/python_client/mozart_api/models/web_socket_event_active_speaker_group.py index 5257319..bacb4f0 100644 --- a/python_client/mozart_api/models/web_socket_event_active_speaker_group.py +++ b/python_client/mozart_api/models/web_socket_event_active_speaker_group.py @@ -18,63 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.speaker_group_overview import SpeakerGroupOverview +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventActiveSpeakerGroup(BaseModel): """ WebSocketEventActiveSpeakerGroup - """ + """ # noqa: E501 - event_data: Optional[SpeakerGroupOverview] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[SpeakerGroupOverview] = Field(default=None, alias="eventData") + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventActiveSpeakerGroup: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventActiveSpeakerGroup from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventActiveSpeakerGroup: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventActiveSpeakerGroup from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventActiveSpeakerGroup.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventActiveSpeakerGroup.parse_obj( + _obj = cls.model_validate( { - "event_data": SpeakerGroupOverview.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + SpeakerGroupOverview.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_alarm_timer.py b/python_client/mozart_api/models/web_socket_event_alarm_timer.py index 90c9d3e..18a02d8 100644 --- a/python_client/mozart_api/models/web_socket_event_alarm_timer.py +++ b/python_client/mozart_api/models/web_socket_event_alarm_timer.py @@ -18,63 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.alarm_timer_event_data import AlarmTimerEventData +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventAlarmTimer(BaseModel): """ WebSocketEventAlarmTimer - """ + """ # noqa: E501 - event_data: Optional[AlarmTimerEventData] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[AlarmTimerEventData] = Field(default=None, alias="eventData") + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventAlarmTimer: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventAlarmTimer from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventAlarmTimer: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventAlarmTimer from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventAlarmTimer.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventAlarmTimer.parse_obj( + _obj = cls.model_validate( { - "event_data": AlarmTimerEventData.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + AlarmTimerEventData.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_alarm_triggered.py b/python_client/mozart_api/models/web_socket_event_alarm_triggered.py index d38eccd..9f78ae6 100644 --- a/python_client/mozart_api/models/web_socket_event_alarm_triggered.py +++ b/python_client/mozart_api/models/web_socket_event_alarm_triggered.py @@ -18,63 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.alarm_triggered_info import AlarmTriggeredInfo +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventAlarmTriggered(BaseModel): """ WebSocketEventAlarmTriggered - """ + """ # noqa: E501 - event_data: Optional[AlarmTriggeredInfo] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[AlarmTriggeredInfo] = Field(default=None, alias="eventData") + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventAlarmTriggered: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventAlarmTriggered from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventAlarmTriggered: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventAlarmTriggered from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventAlarmTriggered.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventAlarmTriggered.parse_obj( + _obj = cls.model_validate( { - "event_data": AlarmTriggeredInfo.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + AlarmTriggeredInfo.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_battery.py b/python_client/mozart_api/models/web_socket_event_battery.py index 7bd5597..bc32a78 100644 --- a/python_client/mozart_api/models/web_socket_event_battery.py +++ b/python_client/mozart_api/models/web_socket_event_battery.py @@ -18,63 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.battery_state import BatteryState +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventBattery(BaseModel): """ WebSocketEventBattery - """ + """ # noqa: E501 - event_data: Optional[BatteryState] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[BatteryState] = Field(default=None, alias="eventData") + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventBattery: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventBattery from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventBattery: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventBattery from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventBattery.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventBattery.parse_obj( + _obj = cls.model_validate( { - "event_data": BatteryState.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + BatteryState.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_beo_remote_button.py b/python_client/mozart_api/models/web_socket_event_beo_remote_button.py index 87734fe..1688fa7 100644 --- a/python_client/mozart_api/models/web_socket_event_beo_remote_button.py +++ b/python_client/mozart_api/models/web_socket_event_beo_remote_button.py @@ -18,63 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.beo_remote_button import BeoRemoteButton +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventBeoRemoteButton(BaseModel): """ WebSocketEventBeoRemoteButton - """ + """ # noqa: E501 - event_data: Optional[BeoRemoteButton] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[BeoRemoteButton] = Field(default=None, alias="eventData") + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventBeoRemoteButton: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventBeoRemoteButton from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventBeoRemoteButton: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventBeoRemoteButton from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventBeoRemoteButton.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventBeoRemoteButton.parse_obj( + _obj = cls.model_validate( { - "event_data": BeoRemoteButton.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + BeoRemoteButton.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_beolink_experiences_result.py b/python_client/mozart_api/models/web_socket_event_beolink_experiences_result.py index b13ba37..040fe44 100644 --- a/python_client/mozart_api/models/web_socket_event_beolink_experiences_result.py +++ b/python_client/mozart_api/models/web_socket_event_beolink_experiences_result.py @@ -18,62 +18,81 @@ import re # noqa: F401 import json - -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List from mozart_api.models.beolink_experiences_result import BeolinkExperiencesResult +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventBeolinkExperiencesResult(BaseModel): """ WebSocketEventBeolinkExperiencesResult - """ + """ # noqa: E501 - event_data: BeolinkExperiencesResult = Field(..., alias="eventData") - event_type: StrictStr = Field(..., alias="eventType") - __properties = ["eventData", "eventType"] + event_data: BeolinkExperiencesResult = Field(alias="eventData") + event_type: StrictStr = Field(alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventBeolinkExperiencesResult: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventBeolinkExperiencesResult from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventBeolinkExperiencesResult: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventBeolinkExperiencesResult from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventBeolinkExperiencesResult.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventBeolinkExperiencesResult.parse_obj( + _obj = cls.model_validate( { - "event_data": BeolinkExperiencesResult.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + BeolinkExperiencesResult.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_beolink_join_result.py b/python_client/mozart_api/models/web_socket_event_beolink_join_result.py index bc2fbd3..646ffd7 100644 --- a/python_client/mozart_api/models/web_socket_event_beolink_join_result.py +++ b/python_client/mozart_api/models/web_socket_event_beolink_join_result.py @@ -18,62 +18,81 @@ import re # noqa: F401 import json - -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List from mozart_api.models.beolink_join_result import BeolinkJoinResult +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventBeolinkJoinResult(BaseModel): """ WebSocketEventBeolinkJoinResult - """ + """ # noqa: E501 - event_data: BeolinkJoinResult = Field(..., alias="eventData") - event_type: StrictStr = Field(..., alias="eventType") - __properties = ["eventData", "eventType"] + event_data: BeolinkJoinResult = Field(alias="eventData") + event_type: StrictStr = Field(alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventBeolinkJoinResult: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventBeolinkJoinResult from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventBeolinkJoinResult: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventBeolinkJoinResult from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventBeolinkJoinResult.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventBeolinkJoinResult.parse_obj( + _obj = cls.model_validate( { - "event_data": BeolinkJoinResult.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + BeolinkJoinResult.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_button.py b/python_client/mozart_api/models/web_socket_event_button.py index baf858e..04e7cf6 100644 --- a/python_client/mozart_api/models/web_socket_event_button.py +++ b/python_client/mozart_api/models/web_socket_event_button.py @@ -18,63 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.button_event import ButtonEvent +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventButton(BaseModel): """ WebSocketEventButton - """ + """ # noqa: E501 - event_data: Optional[ButtonEvent] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[ButtonEvent] = Field(default=None, alias="eventData") + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventButton: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventButton from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventButton: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventButton from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventButton.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventButton.parse_obj( + _obj = cls.model_validate( { - "event_data": ButtonEvent.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + ButtonEvent.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_curtains.py b/python_client/mozart_api/models/web_socket_event_curtains.py index 6996bd0..a26e2b9 100644 --- a/python_client/mozart_api/models/web_socket_event_curtains.py +++ b/python_client/mozart_api/models/web_socket_event_curtains.py @@ -18,63 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.product_curtain_status import ProductCurtainStatus +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventCurtains(BaseModel): """ WebSocketEventCurtains - """ + """ # noqa: E501 - event_data: Optional[ProductCurtainStatus] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[ProductCurtainStatus] = Field(default=None, alias="eventData") + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventCurtains: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventCurtains from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventCurtains: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventCurtains from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventCurtains.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventCurtains.parse_obj( + _obj = cls.model_validate( { - "event_data": ProductCurtainStatus.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + ProductCurtainStatus.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_hdmi_video_format_signal.py b/python_client/mozart_api/models/web_socket_event_hdmi_video_format_signal.py index 70e6b78..16da48a 100644 --- a/python_client/mozart_api/models/web_socket_event_hdmi_video_format_signal.py +++ b/python_client/mozart_api/models/web_socket_event_hdmi_video_format_signal.py @@ -18,63 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.hdmi_video_format import HdmiVideoFormat +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventHdmiVideoFormatSignal(BaseModel): """ WebSocketEventHdmiVideoFormatSignal - """ + """ # noqa: E501 - event_data: Optional[HdmiVideoFormat] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[HdmiVideoFormat] = Field(default=None, alias="eventData") + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventHdmiVideoFormatSignal: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventHdmiVideoFormatSignal from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventHdmiVideoFormatSignal: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventHdmiVideoFormatSignal from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventHdmiVideoFormatSignal.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventHdmiVideoFormatSignal.parse_obj( + _obj = cls.model_validate( { - "event_data": HdmiVideoFormat.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + HdmiVideoFormat.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_notification.py b/python_client/mozart_api/models/web_socket_event_notification.py index 388a5e8..ca7d555 100644 --- a/python_client/mozart_api/models/web_socket_event_notification.py +++ b/python_client/mozart_api/models/web_socket_event_notification.py @@ -18,63 +18,83 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.websocket_notification_tag import WebsocketNotificationTag +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventNotification(BaseModel): """ - This telegram is used to send a tagged notification. # noqa: E501 - """ + This telegram is used to send a tagged notification. + """ # noqa: E501 - event_data: Optional[WebsocketNotificationTag] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[WebsocketNotificationTag] = Field( + default=None, alias="eventData" + ) + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventNotification: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventNotification from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventNotification: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventNotification from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventNotification.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventNotification.parse_obj( + _obj = cls.model_validate( { - "event_data": WebsocketNotificationTag.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + WebsocketNotificationTag.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_playback_error.py b/python_client/mozart_api/models/web_socket_event_playback_error.py index 3655f6f..fd3fca0 100644 --- a/python_client/mozart_api/models/web_socket_event_playback_error.py +++ b/python_client/mozart_api/models/web_socket_event_playback_error.py @@ -18,63 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.playback_error import PlaybackError +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventPlaybackError(BaseModel): """ WebSocketEventPlaybackError - """ + """ # noqa: E501 - event_data: Optional[PlaybackError] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[PlaybackError] = Field(default=None, alias="eventData") + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventPlaybackError: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventPlaybackError from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventPlaybackError: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventPlaybackError from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventPlaybackError.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventPlaybackError.parse_obj( + _obj = cls.model_validate( { - "event_data": PlaybackError.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + PlaybackError.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_playback_metadata.py b/python_client/mozart_api/models/web_socket_event_playback_metadata.py index 6b419a1..bc5cf71 100644 --- a/python_client/mozart_api/models/web_socket_event_playback_metadata.py +++ b/python_client/mozart_api/models/web_socket_event_playback_metadata.py @@ -18,63 +18,83 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.playback_content_metadata import PlaybackContentMetadata +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventPlaybackMetadata(BaseModel): """ WebSocketEventPlaybackMetadata - """ + """ # noqa: E501 - event_data: Optional[PlaybackContentMetadata] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[PlaybackContentMetadata] = Field( + default=None, alias="eventData" + ) + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventPlaybackMetadata: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventPlaybackMetadata from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventPlaybackMetadata: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventPlaybackMetadata from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventPlaybackMetadata.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventPlaybackMetadata.parse_obj( + _obj = cls.model_validate( { - "event_data": PlaybackContentMetadata.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + PlaybackContentMetadata.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_playback_progress.py b/python_client/mozart_api/models/web_socket_event_playback_progress.py index 5852b14..b075d9e 100644 --- a/python_client/mozart_api/models/web_socket_event_playback_progress.py +++ b/python_client/mozart_api/models/web_socket_event_playback_progress.py @@ -18,63 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.playback_progress import PlaybackProgress +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventPlaybackProgress(BaseModel): """ WebSocketEventPlaybackProgress - """ + """ # noqa: E501 - event_data: Optional[PlaybackProgress] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[PlaybackProgress] = Field(default=None, alias="eventData") + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventPlaybackProgress: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventPlaybackProgress from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventPlaybackProgress: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventPlaybackProgress from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventPlaybackProgress.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventPlaybackProgress.parse_obj( + _obj = cls.model_validate( { - "event_data": PlaybackProgress.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + PlaybackProgress.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_playback_source.py b/python_client/mozart_api/models/web_socket_event_playback_source.py index 590adf0..51b9001 100644 --- a/python_client/mozart_api/models/web_socket_event_playback_source.py +++ b/python_client/mozart_api/models/web_socket_event_playback_source.py @@ -18,63 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.source import Source +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventPlaybackSource(BaseModel): """ WebSocketEventPlaybackSource - """ + """ # noqa: E501 - event_data: Optional[Source] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[Source] = Field(default=None, alias="eventData") + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventPlaybackSource: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventPlaybackSource from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventPlaybackSource: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventPlaybackSource from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventPlaybackSource.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventPlaybackSource.parse_obj( + _obj = cls.model_validate( { - "event_data": Source.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + Source.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_playback_state.py b/python_client/mozart_api/models/web_socket_event_playback_state.py index f816a52..137df79 100644 --- a/python_client/mozart_api/models/web_socket_event_playback_state.py +++ b/python_client/mozart_api/models/web_socket_event_playback_state.py @@ -18,63 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.rendering_state import RenderingState +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventPlaybackState(BaseModel): """ WebSocketEventPlaybackState - """ + """ # noqa: E501 - event_data: Optional[RenderingState] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[RenderingState] = Field(default=None, alias="eventData") + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventPlaybackState: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventPlaybackState from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventPlaybackState: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventPlaybackState from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventPlaybackState.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventPlaybackState.parse_obj( + _obj = cls.model_validate( { - "event_data": RenderingState.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + RenderingState.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_power_state.py b/python_client/mozart_api/models/web_socket_event_power_state.py index 1443e6e..86966b6 100644 --- a/python_client/mozart_api/models/web_socket_event_power_state.py +++ b/python_client/mozart_api/models/web_socket_event_power_state.py @@ -18,63 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.power_state_enum import PowerStateEnum +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventPowerState(BaseModel): """ WebSocketEventPowerState - """ + """ # noqa: E501 - event_data: Optional[PowerStateEnum] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[PowerStateEnum] = Field(default=None, alias="eventData") + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventPowerState: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventPowerState from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventPowerState: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventPowerState from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventPowerState.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventPowerState.parse_obj( + _obj = cls.model_validate( { - "event_data": PowerStateEnum.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + PowerStateEnum.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_puc_install_remote_id_status.py b/python_client/mozart_api/models/web_socket_event_puc_install_remote_id_status.py index 2cdd00e..7c8ddf5 100644 --- a/python_client/mozart_api/models/web_socket_event_puc_install_remote_id_status.py +++ b/python_client/mozart_api/models/web_socket_event_puc_install_remote_id_status.py @@ -18,63 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.install_record_id_state import InstallRecordIdState +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventPucInstallRemoteIdStatus(BaseModel): """ WebSocketEventPucInstallRemoteIdStatus - """ + """ # noqa: E501 - event_data: Optional[InstallRecordIdState] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[InstallRecordIdState] = Field(default=None, alias="eventData") + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventPucInstallRemoteIdStatus: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventPucInstallRemoteIdStatus from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventPucInstallRemoteIdStatus: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventPucInstallRemoteIdStatus from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventPucInstallRemoteIdStatus.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventPucInstallRemoteIdStatus.parse_obj( + _obj = cls.model_validate( { - "event_data": InstallRecordIdState.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + InstallRecordIdState.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_role.py b/python_client/mozart_api/models/web_socket_event_role.py index c27aff0..dabaff1 100644 --- a/python_client/mozart_api/models/web_socket_event_role.py +++ b/python_client/mozart_api/models/web_socket_event_role.py @@ -18,63 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.speaker_role_enum import SpeakerRoleEnum +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventRole(BaseModel): """ WebSocketEventRole - """ + """ # noqa: E501 - event_data: Optional[SpeakerRoleEnum] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[SpeakerRoleEnum] = Field(default=None, alias="eventData") + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventRole: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventRole from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventRole: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventRole from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventRole.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventRole.parse_obj( + _obj = cls.model_validate( { - "event_data": SpeakerRoleEnum.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + SpeakerRoleEnum.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_room_compensation_current_measurement_event.py b/python_client/mozart_api/models/web_socket_event_room_compensation_current_measurement_event.py index 42817c5..96912c4 100644 --- a/python_client/mozart_api/models/web_socket_event_room_compensation_current_measurement_event.py +++ b/python_client/mozart_api/models/web_socket_event_room_compensation_current_measurement_event.py @@ -18,73 +18,85 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.room_compensation_current_measurement import ( RoomCompensationCurrentMeasurement, ) +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventRoomCompensationCurrentMeasurementEvent(BaseModel): """ - Sent when a room compensation measurement is started/done. Is only sent when room compensation type is advanced. # noqa: E501 - """ + Sent when a room compensation measurement is started/done. Is only sent when room compensation type is advanced. + """ # noqa: E501 event_data: Optional[RoomCompensationCurrentMeasurement] = Field( - None, alias="eventData" + default=None, alias="eventData" ) - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json( - cls, json_str: str - ) -> WebSocketEventRoomCompensationCurrentMeasurementEvent: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventRoomCompensationCurrentMeasurementEvent from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict( - cls, obj: dict - ) -> WebSocketEventRoomCompensationCurrentMeasurementEvent: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventRoomCompensationCurrentMeasurementEvent from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventRoomCompensationCurrentMeasurementEvent.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventRoomCompensationCurrentMeasurementEvent.parse_obj( + _obj = cls.model_validate( { - "event_data": RoomCompensationCurrentMeasurement.from_dict( - obj.get("eventData") - ) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + RoomCompensationCurrentMeasurement.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_room_compensation_state.py b/python_client/mozart_api/models/web_socket_event_room_compensation_state.py index 3723b8d..ad17880 100644 --- a/python_client/mozart_api/models/web_socket_event_room_compensation_state.py +++ b/python_client/mozart_api/models/web_socket_event_room_compensation_state.py @@ -18,63 +18,83 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.room_compensation_state_value import RoomCompensationStateValue +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventRoomCompensationState(BaseModel): """ WebSocketEventRoomCompensationState - """ + """ # noqa: E501 - event_data: Optional[RoomCompensationStateValue] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[RoomCompensationStateValue] = Field( + default=None, alias="eventData" + ) + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventRoomCompensationState: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventRoomCompensationState from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventRoomCompensationState: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventRoomCompensationState from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventRoomCompensationState.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventRoomCompensationState.parse_obj( + _obj = cls.model_validate( { - "event_data": RoomCompensationStateValue.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + RoomCompensationStateValue.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_software_update_state.py b/python_client/mozart_api/models/web_socket_event_software_update_state.py index bd45f5f..9374ff8 100644 --- a/python_client/mozart_api/models/web_socket_event_software_update_state.py +++ b/python_client/mozart_api/models/web_socket_event_software_update_state.py @@ -18,63 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.software_update_state import SoftwareUpdateState +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventSoftwareUpdateState(BaseModel): """ WebSocketEventSoftwareUpdateState - """ + """ # noqa: E501 - event_data: Optional[SoftwareUpdateState] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[SoftwareUpdateState] = Field(default=None, alias="eventData") + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventSoftwareUpdateState: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventSoftwareUpdateState from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventSoftwareUpdateState: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventSoftwareUpdateState from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventSoftwareUpdateState.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventSoftwareUpdateState.parse_obj( + _obj = cls.model_validate( { - "event_data": SoftwareUpdateState.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + SoftwareUpdateState.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_sound_settings.py b/python_client/mozart_api/models/web_socket_event_sound_settings.py index 4a34a95..fc72413 100644 --- a/python_client/mozart_api/models/web_socket_event_sound_settings.py +++ b/python_client/mozart_api/models/web_socket_event_sound_settings.py @@ -18,63 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.sound_settings import SoundSettings +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventSoundSettings(BaseModel): """ WebSocketEventSoundSettings - """ + """ # noqa: E501 - event_data: Optional[SoundSettings] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[SoundSettings] = Field(default=None, alias="eventData") + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventSoundSettings: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventSoundSettings from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventSoundSettings: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventSoundSettings from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventSoundSettings.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventSoundSettings.parse_obj( + _obj = cls.model_validate( { - "event_data": SoundSettings.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + SoundSettings.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_source_change.py b/python_client/mozart_api/models/web_socket_event_source_change.py index 15cf6e4..2e7e203 100644 --- a/python_client/mozart_api/models/web_socket_event_source_change.py +++ b/python_client/mozart_api/models/web_socket_event_source_change.py @@ -18,63 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.source import Source +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventSourceChange(BaseModel): """ WebSocketEventSourceChange - """ + """ # noqa: E501 - event_data: Optional[Source] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[Source] = Field(default=None, alias="eventData") + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventSourceChange: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventSourceChange from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventSourceChange: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventSourceChange from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventSourceChange.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventSourceChange.parse_obj( + _obj = cls.model_validate( { - "event_data": Source.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + Source.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_speaker_group_changed.py b/python_client/mozart_api/models/web_socket_event_speaker_group_changed.py index bd97996..a78857d 100644 --- a/python_client/mozart_api/models/web_socket_event_speaker_group_changed.py +++ b/python_client/mozart_api/models/web_socket_event_speaker_group_changed.py @@ -18,54 +18,70 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventSpeakerGroupChanged(BaseModel): """ WebSocketEventSpeakerGroupChanged - """ + """ # noqa: E501 - event_data: Optional[StrictStr] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[StrictStr] = Field(default=None, alias="eventData") + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventSpeakerGroupChanged: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventSpeakerGroupChanged from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventSpeakerGroupChanged: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventSpeakerGroupChanged from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventSpeakerGroupChanged.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventSpeakerGroupChanged.parse_obj( - {"event_data": obj.get("eventData"), "event_type": obj.get("eventType")} + _obj = cls.model_validate( + {"eventData": obj.get("eventData"), "eventType": obj.get("eventType")} ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_speaker_link_status_changed.py b/python_client/mozart_api/models/web_socket_event_speaker_link_status_changed.py new file mode 100644 index 0000000..e48f438 --- /dev/null +++ b/python_client/mozart_api/models/web_socket_event_speaker_link_status_changed.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + Mozart platform API + + API for interacting with the Mozart platform. + + The version of the OpenAPI document: 0.2.0 + Contact: support@bang-olufsen.dk + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from mozart_api.models.speaker_link_status import SpeakerLinkStatus +from typing import Optional, Set +from typing_extensions import Self + + +class WebSocketEventSpeakerLinkStatusChanged(BaseModel): + """ + WebSocketEventSpeakerLinkStatusChanged + """ # noqa: E501 + + event_data: Optional[SpeakerLinkStatus] = Field(default=None, alias="eventData") + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WebSocketEventSpeakerLinkStatusChanged from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of event_data + if self.event_data: + _dict["eventData"] = self.event_data.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WebSocketEventSpeakerLinkStatusChanged from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "eventData": ( + SpeakerLinkStatus.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), + } + ) + return _obj diff --git a/python_client/mozart_api/models/web_socket_event_stand_connected.py b/python_client/mozart_api/models/web_socket_event_stand_connected.py index 93b895d..8e093c5 100644 --- a/python_client/mozart_api/models/web_socket_event_stand_connected.py +++ b/python_client/mozart_api/models/web_socket_event_stand_connected.py @@ -18,63 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.stand_connected import StandConnected +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventStandConnected(BaseModel): """ WebSocketEventStandConnected - """ + """ # noqa: E501 - event_data: Optional[StandConnected] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[StandConnected] = Field(default=None, alias="eventData") + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventStandConnected: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventStandConnected from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventStandConnected: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventStandConnected from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventStandConnected.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventStandConnected.parse_obj( + _obj = cls.model_validate( { - "event_data": StandConnected.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + StandConnected.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_stand_position.py b/python_client/mozart_api/models/web_socket_event_stand_position.py index e07d81e..8aa8a5c 100644 --- a/python_client/mozart_api/models/web_socket_event_stand_position.py +++ b/python_client/mozart_api/models/web_socket_event_stand_position.py @@ -18,63 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.stand_position import StandPosition +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventStandPosition(BaseModel): """ WebSocketEventStandPosition - """ + """ # noqa: E501 - event_data: Optional[StandPosition] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[StandPosition] = Field(default=None, alias="eventData") + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventStandPosition: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventStandPosition from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventStandPosition: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventStandPosition from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventStandPosition.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventStandPosition.parse_obj( + _obj = cls.model_validate( { - "event_data": StandPosition.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + StandPosition.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_tv_info.py b/python_client/mozart_api/models/web_socket_event_tv_info.py index 9679205..872ac15 100644 --- a/python_client/mozart_api/models/web_socket_event_tv_info.py +++ b/python_client/mozart_api/models/web_socket_event_tv_info.py @@ -18,63 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.tv_info_event_data import TvInfoEventData +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventTvInfo(BaseModel): """ WebSocketEventTvInfo - """ + """ # noqa: E501 - event_data: Optional[TvInfoEventData] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[TvInfoEventData] = Field(default=None, alias="eventData") + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventTvInfo: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventTvInfo from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventTvInfo: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventTvInfo from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventTvInfo.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventTvInfo.parse_obj( + _obj = cls.model_validate( { - "event_data": TvInfoEventData.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + TvInfoEventData.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_volume.py b/python_client/mozart_api/models/web_socket_event_volume.py index 4e758c9..69f1e37 100644 --- a/python_client/mozart_api/models/web_socket_event_volume.py +++ b/python_client/mozart_api/models/web_socket_event_volume.py @@ -18,63 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from mozart_api.models.volume_state import VolumeState +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventVolume(BaseModel): """ WebSocketEventVolume - """ + """ # noqa: E501 - event_data: Optional[VolumeState] = Field(None, alias="eventData") - event_type: Optional[StrictStr] = Field(None, alias="eventType") - __properties = ["eventData", "eventType"] + event_data: Optional[VolumeState] = Field(default=None, alias="eventData") + event_type: Optional[StrictStr] = Field(default=None, alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventVolume: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventVolume from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventVolume: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventVolume from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventVolume.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventVolume.parse_obj( + _obj = cls.model_validate( { - "event_data": VolumeState.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + VolumeState.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/web_socket_event_wisa_out_state.py b/python_client/mozart_api/models/web_socket_event_wisa_out_state.py index 07f2644..9b10710 100644 --- a/python_client/mozart_api/models/web_socket_event_wisa_out_state.py +++ b/python_client/mozart_api/models/web_socket_event_wisa_out_state.py @@ -18,62 +18,81 @@ import re # noqa: F401 import json - -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List from mozart_api.models.wisa_out_state import WisaOutState +from typing import Optional, Set +from typing_extensions import Self class WebSocketEventWisaOutState(BaseModel): """ - Speaker Discovery State changed # noqa: E501 - """ + Speaker Discovery State changed + """ # noqa: E501 - event_data: WisaOutState = Field(..., alias="eventData") - event_type: StrictStr = Field(..., alias="eventType") - __properties = ["eventData", "eventType"] + event_data: WisaOutState = Field(alias="eventData") + event_type: StrictStr = Field(alias="eventType") + __properties: ClassVar[List[str]] = ["eventData", "eventType"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebSocketEventWisaOutState: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebSocketEventWisaOutState from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of event_data if self.event_data: _dict["eventData"] = self.event_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebSocketEventWisaOutState: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebSocketEventWisaOutState from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebSocketEventWisaOutState.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebSocketEventWisaOutState.parse_obj( + _obj = cls.model_validate( { - "event_data": WisaOutState.from_dict(obj.get("eventData")) - if obj.get("eventData") is not None - else None, - "event_type": obj.get("eventType"), + "eventData": ( + WisaOutState.from_dict(obj["eventData"]) + if obj.get("eventData") is not None + else None + ), + "eventType": obj.get("eventType"), } ) return _obj diff --git a/python_client/mozart_api/models/websocket_notification_tag.py b/python_client/mozart_api/models/websocket_notification_tag.py index f6c11c9..e50180a 100644 --- a/python_client/mozart_api/models/websocket_notification_tag.py +++ b/python_client/mozart_api/models/websocket_notification_tag.py @@ -18,82 +18,100 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr, validator +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class WebsocketNotificationTag(BaseModel): """ WebsocketNotificationTag - """ + """ # noqa: E501 value: Optional[StrictStr] = None - __properties = ["value"] + __properties: ClassVar[List[str]] = ["value"] - @validator("value") + @field_validator("value") def value_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ( - "configuration", - "uri", - "generatorSettings", - "lineInSettings", - "bluetoothDevices", - "remoteControlDevices", - "secondariesList", - "queueHasBeenChanged", - "endOfQueueHasBeenReached", - "beolinkPeers", - "beolinkListeners", - "beolinkAvailableListeners", - "bluetoothPairingStateChanged", - "outputsChanged", - "speakerGroupOverviewChanged", - "remoteMenuChanged", - "proximityPresenceDetected", - "proximityPresenceNotDetected", + if value not in set( + [ + "configuration", + "uri", + "generatorSettings", + "lineInSettings", + "bluetoothDevices", + "remoteControlDevices", + "secondariesList", + "queueHasBeenChanged", + "endOfQueueHasBeenReached", + "beolinkPeers", + "beolinkListeners", + "beolinkAvailableListeners", + "bluetoothPairingStateChanged", + "outputsChanged", + "speakerGroupOverviewChanged", + "remoteMenuChanged", + "proximityPresenceDetected", + "proximityPresenceNotDetected", + ] ): raise ValueError( "must be one of enum values ('configuration', 'uri', 'generatorSettings', 'lineInSettings', 'bluetoothDevices', 'remoteControlDevices', 'secondariesList', 'queueHasBeenChanged', 'endOfQueueHasBeenReached', 'beolinkPeers', 'beolinkListeners', 'beolinkAvailableListeners', 'bluetoothPairingStateChanged', 'outputsChanged', 'speakerGroupOverviewChanged', 'remoteMenuChanged', 'proximityPresenceDetected', 'proximityPresenceNotDetected')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebsocketNotificationTag: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WebsocketNotificationTag from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> WebsocketNotificationTag: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WebsocketNotificationTag from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebsocketNotificationTag.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebsocketNotificationTag.parse_obj({"value": obj.get("value")}) + _obj = cls.model_validate({"value": obj.get("value")}) return _obj diff --git a/python_client/mozart_api/models/wisa_out_state.py b/python_client/mozart_api/models/wisa_out_state.py index b45f70b..f0a657d 100644 --- a/python_client/mozart_api/models/wisa_out_state.py +++ b/python_client/mozart_api/models/wisa_out_state.py @@ -18,63 +18,81 @@ import re # noqa: F401 import json - -from typing import Optional -from pydantic import BaseModel, StrictStr, validator +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self class WisaOutState(BaseModel): """ WisaOutState - """ + """ # noqa: E501 state: Optional[StrictStr] = None - __properties = ["state"] + __properties: ClassVar[List[str]] = ["state"] - @validator("state") + @field_validator("state") def state_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in ("idle", "discovering", "deleting", "updatingSpeakerFirmware"): + if value not in set( + ["idle", "discovering", "deleting", "updatingSpeakerFirmware"] + ): raise ValueError( "must be one of enum values ('idle', 'discovering', 'deleting', 'updatingSpeakerFirmware')" ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WisaOutState: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WisaOutState from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> WisaOutState: + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of WisaOutState from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WisaOutState.parse_obj(obj) + return cls.model_validate(obj) - _obj = WisaOutState.parse_obj({"state": obj.get("state")}) + _obj = cls.model_validate({"state": obj.get("state")}) return _obj diff --git a/python_client/mozart_api/mozart_cli.py b/python_client/mozart_api/mozart_cli.py index 2868938..6a3ba31 100644 --- a/python_client/mozart_api/mozart_cli.py +++ b/python_client/mozart_api/mozart_cli.py @@ -1,4 +1,5 @@ """Main Mozart CLI document.""" + # pylint: disable= too-few-public-methods too-many-instance-attributes import argparse @@ -14,7 +15,7 @@ from mozart_api import __version__ as MOZART_API_VERSION from mozart_api.models import VolumeLevel, VolumeMute from mozart_api.mozart_client import MozartClient -from zeroconf import ServiceBrowser, ServiceInfo, ServiceListener, Zeroconf +from zeroconf import ServiceBrowser, ServiceListener, Zeroconf MOZART_MDNS_TYPE: Final[str] = "_bangolufsen._tcp.local." MDNS_TIMEOUT: Final[int] = 10 @@ -69,7 +70,13 @@ def remove_service(self, zc: Zeroconf, type_: str, name: str) -> None: def add_service(self, zc: Zeroconf, type_: str, name: str) -> None: """Add discovered Mozart device.""" - info = cast(ServiceInfo, zc.get_service_info(type_, name)) + + info = zc.get_service_info(type_, name) + + # Sometimes service info is None. + if not info: + print(f"Error getting {name}") + return # Create MozartDevice object from MDNS discovered information. ip_address = info.parsed_addresses()[0] @@ -181,12 +188,12 @@ class MozartApiCli: def __init__(self) -> None: """Init the Mozart CLI.""" - self.timeout: int = MDNS_TIMEOUT - self.verbose: bool = False - self.websocket: bool = False - self.mode: str = "" - self.command: str = "" - self.host: str = "" + self.timeout = MDNS_TIMEOUT + self.verbose = False + self.websocket = False + self.mode = "" + self.command = "" + self.host = "" self.command_args: list[str] = [] self.mozart_devices: list[MozartDevice] = [] diff --git a/python_client/mozart_api/mozart_client.py b/python_client/mozart_api/mozart_client.py index 34808fe..ff8faba 100644 --- a/python_client/mozart_api/mozart_client.py +++ b/python_client/mozart_api/mozart_client.py @@ -1,32 +1,30 @@ """Helper classes for using auto-generated API.""" -# pylint: disable=line-too-long too-many-instance-attributes too-many-public-methods + +# pylint: disable=line-too-long too-many-instance-attributes too-many-public-methods protected-access import asyncio +import contextlib import json import logging import re from collections import defaultdict -from dataclasses import dataclass from datetime import time from typing import Callable -from aiohttp import ClientSession -from aiohttp.client_exceptions import ( - ClientConnectorError, - ClientOSError, - ServerTimeoutError, -) +import websockets +from aiohttp.client_exceptions import ClientConnectorError from inflection import underscore - from mozart_api.api.mozart_api import MozartApi from mozart_api.api_client import ApiClient from mozart_api.configuration import Configuration +from mozart_api.exceptions import ApiException from mozart_api.models import Art, PlaybackContentMetadata +from websockets.exceptions import ConnectionClosed, InvalidHandshake, InvalidURI -RECONNECT_INTERVAL = 15.0 -WEBSOCKET_HEARTBEAT = 10 WEBSOCKET_TIMEOUT = 5.0 +# Generated section start + NOTIFICATION_TYPES = { "active_hdmi_input_signal", "active_listening_mode", @@ -55,6 +53,7 @@ "sound_settings", "source_change", "speaker_group_changed", + "speaker_link_status_changed", "stand_connected", "stand_position", "tv_info", @@ -62,6 +61,8 @@ "wisa_out_state", } +# Generated section end + logger = logging.getLogger(__name__) @@ -116,23 +117,18 @@ def get_highest_resolution_artwork(metadata: PlaybackContentMetadata) -> Art: class MozartClient(MozartApi): - """User friendly setup for a Mozart device.""" + """User friendly Mozart REST API and WebSocket client.""" - def __init__( - self, - host: str, - websocket_reconnect: bool = False, - websocket_reconnect_interval: float = RECONNECT_INTERVAL, - urllib3_logging_level: int = logging.WARNING, - ) -> None: - """Initialize Mozart device.""" - self.host: str = host - self.websocket_connected: bool = False - self.websocket_reconnect: bool = websocket_reconnect - self._websocket_reconnect_interval: float = websocket_reconnect_interval + def __init__(self, host: str) -> None: + """Initialize Mozart client.""" + self.host = host + self.websocket_connected = False + self.websocket_reconnect = False + self._websocket_listener_active = False + self._websocket_listener_remote_listener_active = False + self._websocket_listeners_active = False self._websocket_tasks: set[asyncio.Task] = set() - self._websocket_active: bool = False self._on_connection_lost = None self._on_connection = None @@ -145,7 +141,6 @@ def __init__( # Configure MozartApi object. self.configuration = Configuration(host="http://" + self.host) - self.configuration.logger["urllib3_logger"].setLevel(urllib3_logging_level) self.configuration.verify_ssl = False super().__init__(ApiClient(self.configuration)) @@ -162,108 +157,169 @@ async def __aenter__(self): async def __aexit__(self, exc_type, exc_value, traceback): """Context exit.""" - await self.api_client.close() + await self.close_api_client() + + async def _check_websocket_connection( + self, + ) -> ( + bool + | InvalidHandshake + | OSError + | asyncio.TimeoutError + | InvalidURI + | ConnectionClosed + | ConnectionError + ): + """Check if a connection can be made to the device's WebSocket notification channel.""" + try: + async with websockets.connect( + uri=f"ws://{self.host}:9339/", open_timeout=WEBSOCKET_TIMEOUT + ): + pass + except ( + InvalidHandshake, + OSError, + asyncio.TimeoutError, + InvalidURI, + ConnectionClosed, + ConnectionError, + ) as error: + return error + + return True + + async def _check_api_connection( + self, + ) -> bool | ApiException | ClientConnectorError | TimeoutError: + """Check if a connection can be made to the device's REST API.""" + try: + await self.get_battery_state(_request_timeout=3) + except (ApiException, ClientConnectorError, TimeoutError) as error: + return error + + return True - @dataclass - class _ResponseWrapper: - """Wrapper class for deserializing WebSocket response.""" + async def check_device_connection(self, raise_error=False) -> bool: + """Check API and WebSocket connection.""" + # Don't use a taskgroup as both tasks should always be checked + tasks: tuple[asyncio.Task] = ( + asyncio.create_task(self._check_websocket_connection(), name="websocket"), + asyncio.create_task(self._check_api_connection(), name="REST API"), + ) - data: str + # Wait for tasks to complete + for task in tasks: + while not task.done(): + await asyncio.sleep(0) - async def connect_notifications(self, remote_control=False) -> bool: - """Start the WebSocket listener task(s). Returns if a connection can be made.""" + connection_available = True + errors = [] + + # Check status + for task in tasks: + if task.result() is not True: + connection_available = False + errors.append(task.result()) + + # Raise any exceptions + if raise_error and not connection_available: + raise ExceptionGroup(f"Can't connect to {self.host}", tuple(errors)) + + return connection_available + + async def connect_notifications( + self, remote_control=False, reconnect=False + ) -> None: + """Start the WebSocket listener task(s).""" + self.websocket_reconnect = reconnect + self.websocket_reconnect = reconnect # Always add main WebSocket listener - if len(self._websocket_tasks) == 0: - websocket_listener = asyncio.create_task( - coro=self._websocket_listener(f"ws://{self.host}:9339/"), - name=f"{self.host} - listener task", + if not self._websocket_listener_active: + self._websocket_tasks.add( + asyncio.create_task( + coro=self._websocket_listener(f"ws://{self.host}:9339/"), + name=f"{self.host} - listener task", + ) ) - self._websocket_tasks.add(websocket_listener) + + self._websocket_listener_active = True # Add WebSocket listener for remote control events if defined. - if len(self._websocket_tasks) == 1 and remote_control: - websocket_remote_listener = asyncio.create_task( - coro=self._websocket_listener(f"ws://{self.host}:9339/remoteControl"), - name=f"{self.host} - remote listener task", + if not self._websocket_listener_remote_listener_active and remote_control: + self._websocket_tasks.add( + asyncio.create_task( + coro=self._websocket_listener( + f"ws://{self.host}:9339/remoteControl" + ), + name=f"{self.host} - remote listener task", + ) ) - self._websocket_tasks.add(websocket_remote_listener) - - self._websocket_active = True + self._websocket_listener_remote_listener_active = True - return await self.check_websocket_connection() - - async def check_websocket_connection(self) -> bool: - """Check if a connection can be made to the device's WebSocket notification channel.""" - try: - async with ClientSession(conn_timeout=WEBSOCKET_TIMEOUT) as session: - async with session.ws_connect(f"ws://{self.host}:9339/") as websocket: - return bool(await websocket.receive()) - - except (ClientConnectorError, ClientOSError, ServerTimeoutError): - return False + self._websocket_listeners_active = True def disconnect_notifications(self) -> None: """Stop the WebSocket listener tasks.""" - self._websocket_active = False + self._websocket_listener_active = False + self._websocket_listener_remote_listener_active = False + self._websocket_listeners_active = False for task in self._websocket_tasks: task.cancel() - self._websocket_tasks = set() + self._websocket_tasks.clear() async def _websocket_listener(self, host: str) -> None: """WebSocket listener.""" - while True: + # Ensure automatic reconnect if needed + async for websocket in websockets.connect( + uri=host, + logger=logger, + ping_interval=WEBSOCKET_TIMEOUT, + ping_timeout=WEBSOCKET_TIMEOUT, + ): try: - async with ClientSession(conn_timeout=WEBSOCKET_TIMEOUT) as session: - async with session.ws_connect( - url=host, heartbeat=WEBSOCKET_HEARTBEAT - ) as websocket: - self.websocket_connected = True - - if self._on_connection: - await self._trigger_callback(self._on_connection) - - while self._websocket_active: - try: - # Receive JSON in order to get the Websocket notification name for deserialization - notification = await asyncio.wait_for( - websocket.receive_json(), - timeout=WEBSOCKET_TIMEOUT, - ) - - # Ensure that any notifications received after the disconnect command has been executed are not processed - if not self._websocket_active: - break - - await self._on_message(notification) - - except asyncio.TimeoutError: - pass - - return + self.websocket_connected = True + + if self._on_connection: + await self._trigger_callback(self._on_connection) + + # While listener is active + while self._websocket_listeners_active: + with contextlib.suppress(asyncio.TimeoutError): + notification = await asyncio.wait_for( + websocket.recv(), + timeout=WEBSOCKET_TIMEOUT, + ) + await self._on_message(json.loads(notification)) + + # Disconnect + self.websocket_connected = False + await websocket.close() + return except ( - ClientConnectorError, - ClientOSError, - TypeError, - ServerTimeoutError, + InvalidHandshake, + OSError, + asyncio.TimeoutError, + InvalidURI, + ConnectionClosed, + ConnectionError, ) as error: if self.websocket_connected: self.websocket_connected = False + logger.debug("%s : %s - %s", host, type(error), error) if self._on_connection_lost: await self._trigger_callback(self._on_connection_lost) - if not self.websocket_reconnect: - logger.error("%s : %s", host, error) - return - - await asyncio.sleep(self._websocket_reconnect_interval) + if not self.websocket_reconnect: + logger.error("%s : %s - %s", host, type(error), error) + self.disconnect_notifications() + return - except asyncio.CancelledError: - return + await asyncio.sleep(WEBSOCKET_TIMEOUT) async def _on_message(self, notification) -> None: """Handle WebSocket notifications.""" @@ -273,12 +329,13 @@ async def _on_message(self, notification) -> None: notification_type = notification["eventType"] deserialized_data = self.api_client.deserialize( - self._ResponseWrapper(json.dumps(notification)), notification_type + json.dumps(notification), notification_type ).event_data except (ValueError, AttributeError) as error: logger.error( - "Unable to deserialize WebSocket notification: (%s : %s) with error: (%s : %s)", + "%s unable to deserialize WebSocket notification: (%s : %s) with error: (%s : %s)", + self.host, notification_type, notification, type(error), @@ -330,43 +387,45 @@ def get_all_notifications_raw(self, on_all_notifications_raw) -> None: """Callback for all notifications as dict.""" self._on_all_notifications_raw = on_all_notifications_raw + # Generated section start + def get_active_hdmi_input_signal_notifications( self, on_active_hdmi_input_signal_notification ) -> None: """Callback for WebSocketEventActiveHdmiInputSignal notifications.""" - self._notification_callbacks[ - "WebSocketEventActiveHdmiInputSignal" - ] = on_active_hdmi_input_signal_notification + self._notification_callbacks["WebSocketEventActiveHdmiInputSignal"] = ( + on_active_hdmi_input_signal_notification + ) def get_active_listening_mode_notifications( self, on_active_listening_mode_notification ) -> None: """Callback for WebSocketEventActiveListeningMode notifications.""" - self._notification_callbacks[ - "WebSocketEventActiveListeningMode" - ] = on_active_listening_mode_notification + self._notification_callbacks["WebSocketEventActiveListeningMode"] = ( + on_active_listening_mode_notification + ) def get_active_speaker_group_notifications( self, on_active_speaker_group_notification ) -> None: """Callback for WebSocketEventActiveSpeakerGroup notifications.""" - self._notification_callbacks[ - "WebSocketEventActiveSpeakerGroup" - ] = on_active_speaker_group_notification + self._notification_callbacks["WebSocketEventActiveSpeakerGroup"] = ( + on_active_speaker_group_notification + ) def get_alarm_timer_notifications(self, on_alarm_timer_notification) -> None: """Callback for WebSocketEventAlarmTimer notifications.""" - self._notification_callbacks[ - "WebSocketEventAlarmTimer" - ] = on_alarm_timer_notification + self._notification_callbacks["WebSocketEventAlarmTimer"] = ( + on_alarm_timer_notification + ) def get_alarm_triggered_notifications( self, on_alarm_triggered_notification ) -> None: """Callback for WebSocketEventAlarmTriggered notifications.""" - self._notification_callbacks[ - "WebSocketEventAlarmTriggered" - ] = on_alarm_triggered_notification + self._notification_callbacks["WebSocketEventAlarmTriggered"] = ( + on_alarm_triggered_notification + ) def get_battery_notifications(self, on_battery_notification) -> None: """Callback for WebSocketEventBattery notifications.""" @@ -376,25 +435,25 @@ def get_beo_remote_button_notifications( self, on_beo_remote_button_notification ) -> None: """Callback for WebSocketEventBeoRemoteButton notifications.""" - self._notification_callbacks[ - "WebSocketEventBeoRemoteButton" - ] = on_beo_remote_button_notification + self._notification_callbacks["WebSocketEventBeoRemoteButton"] = ( + on_beo_remote_button_notification + ) def get_beolink_experiences_result_notifications( self, on_beolink_experiences_result_notification ) -> None: """Callback for WebSocketEventBeolinkExperiencesResult notifications.""" - self._notification_callbacks[ - "WebSocketEventBeolinkExperiencesResult" - ] = on_beolink_experiences_result_notification + self._notification_callbacks["WebSocketEventBeolinkExperiencesResult"] = ( + on_beolink_experiences_result_notification + ) def get_beolink_join_result_notifications( self, on_beolink_join_result_notification ) -> None: """Callback for WebSocketEventBeolinkJoinResult notifications.""" - self._notification_callbacks[ - "WebSocketEventBeolinkJoinResult" - ] = on_beolink_join_result_notification + self._notification_callbacks["WebSocketEventBeolinkJoinResult"] = ( + on_beolink_join_result_notification + ) def get_button_notifications(self, on_button_notification) -> None: """Callback for WebSocketEventButton notifications.""" @@ -402,73 +461,73 @@ def get_button_notifications(self, on_button_notification) -> None: def get_curtains_notifications(self, on_curtains_notification) -> None: """Callback for WebSocketEventCurtains notifications.""" - self._notification_callbacks[ - "WebSocketEventCurtains" - ] = on_curtains_notification + self._notification_callbacks["WebSocketEventCurtains"] = ( + on_curtains_notification + ) def get_hdmi_video_format_signal_notifications( self, on_hdmi_video_format_signal_notification ) -> None: """Callback for WebSocketEventHdmiVideoFormatSignal notifications.""" - self._notification_callbacks[ - "WebSocketEventHdmiVideoFormatSignal" - ] = on_hdmi_video_format_signal_notification + self._notification_callbacks["WebSocketEventHdmiVideoFormatSignal"] = ( + on_hdmi_video_format_signal_notification + ) def get_notification_notifications(self, on_notification_notification) -> None: """Callback for WebSocketEventNotification notifications.""" - self._notification_callbacks[ - "WebSocketEventNotification" - ] = on_notification_notification + self._notification_callbacks["WebSocketEventNotification"] = ( + on_notification_notification + ) def get_playback_error_notifications(self, on_playback_error_notification) -> None: """Callback for WebSocketEventPlaybackError notifications.""" - self._notification_callbacks[ - "WebSocketEventPlaybackError" - ] = on_playback_error_notification + self._notification_callbacks["WebSocketEventPlaybackError"] = ( + on_playback_error_notification + ) def get_playback_metadata_notifications( self, on_playback_metadata_notification ) -> None: """Callback for WebSocketEventPlaybackMetadata notifications.""" - self._notification_callbacks[ - "WebSocketEventPlaybackMetadata" - ] = on_playback_metadata_notification + self._notification_callbacks["WebSocketEventPlaybackMetadata"] = ( + on_playback_metadata_notification + ) def get_playback_progress_notifications( self, on_playback_progress_notification ) -> None: """Callback for WebSocketEventPlaybackProgress notifications.""" - self._notification_callbacks[ - "WebSocketEventPlaybackProgress" - ] = on_playback_progress_notification + self._notification_callbacks["WebSocketEventPlaybackProgress"] = ( + on_playback_progress_notification + ) def get_playback_source_notifications( self, on_playback_source_notification ) -> None: """Callback for WebSocketEventPlaybackSource notifications.""" - self._notification_callbacks[ - "WebSocketEventPlaybackSource" - ] = on_playback_source_notification + self._notification_callbacks["WebSocketEventPlaybackSource"] = ( + on_playback_source_notification + ) def get_playback_state_notifications(self, on_playback_state_notification) -> None: """Callback for WebSocketEventPlaybackState notifications.""" - self._notification_callbacks[ - "WebSocketEventPlaybackState" - ] = on_playback_state_notification + self._notification_callbacks["WebSocketEventPlaybackState"] = ( + on_playback_state_notification + ) def get_power_state_notifications(self, on_power_state_notification) -> None: """Callback for WebSocketEventPowerState notifications.""" - self._notification_callbacks[ - "WebSocketEventPowerState" - ] = on_power_state_notification + self._notification_callbacks["WebSocketEventPowerState"] = ( + on_power_state_notification + ) def get_puc_install_remote_id_status_notifications( self, on_puc_install_remote_id_status_notification ) -> None: """Callback for WebSocketEventPucInstallRemoteIdStatus notifications.""" - self._notification_callbacks[ - "WebSocketEventPucInstallRemoteIdStatus" - ] = on_puc_install_remote_id_status_notification + self._notification_callbacks["WebSocketEventPucInstallRemoteIdStatus"] = ( + on_puc_install_remote_id_status_notification + ) def get_role_notifications(self, on_role_notification) -> None: """Callback for WebSocketEventRole notifications.""" @@ -486,51 +545,59 @@ def get_room_compensation_state_notifications( self, on_room_compensation_state_notification ) -> None: """Callback for WebSocketEventRoomCompensationState notifications.""" - self._notification_callbacks[ - "WebSocketEventRoomCompensationState" - ] = on_room_compensation_state_notification + self._notification_callbacks["WebSocketEventRoomCompensationState"] = ( + on_room_compensation_state_notification + ) def get_software_update_state_notifications( self, on_software_update_state_notification ) -> None: """Callback for WebSocketEventSoftwareUpdateState notifications.""" - self._notification_callbacks[ - "WebSocketEventSoftwareUpdateState" - ] = on_software_update_state_notification + self._notification_callbacks["WebSocketEventSoftwareUpdateState"] = ( + on_software_update_state_notification + ) def get_sound_settings_notifications(self, on_sound_settings_notification) -> None: """Callback for WebSocketEventSoundSettings notifications.""" - self._notification_callbacks[ - "WebSocketEventSoundSettings" - ] = on_sound_settings_notification + self._notification_callbacks["WebSocketEventSoundSettings"] = ( + on_sound_settings_notification + ) def get_source_change_notifications(self, on_source_change_notification) -> None: """Callback for WebSocketEventSourceChange notifications.""" - self._notification_callbacks[ - "WebSocketEventSourceChange" - ] = on_source_change_notification + self._notification_callbacks["WebSocketEventSourceChange"] = ( + on_source_change_notification + ) def get_speaker_group_changed_notifications( self, on_speaker_group_changed_notification ) -> None: """Callback for WebSocketEventSpeakerGroupChanged notifications.""" - self._notification_callbacks[ - "WebSocketEventSpeakerGroupChanged" - ] = on_speaker_group_changed_notification + self._notification_callbacks["WebSocketEventSpeakerGroupChanged"] = ( + on_speaker_group_changed_notification + ) + + def get_speaker_link_status_changed_notifications( + self, on_speaker_link_status_changed_notification + ) -> None: + """Callback for WebSocketEventSpeakerLinkStatusChanged notifications.""" + self._notification_callbacks["WebSocketEventSpeakerLinkStatusChanged"] = ( + on_speaker_link_status_changed_notification + ) def get_stand_connected_notifications( self, on_stand_connected_notification ) -> None: """Callback for WebSocketEventStandConnected notifications.""" - self._notification_callbacks[ - "WebSocketEventStandConnected" - ] = on_stand_connected_notification + self._notification_callbacks["WebSocketEventStandConnected"] = ( + on_stand_connected_notification + ) def get_stand_position_notifications(self, on_stand_position_notification) -> None: """Callback for WebSocketEventStandPosition notifications.""" - self._notification_callbacks[ - "WebSocketEventStandPosition" - ] = on_stand_position_notification + self._notification_callbacks["WebSocketEventStandPosition"] = ( + on_stand_position_notification + ) def get_tv_info_notifications(self, on_tv_info_notification) -> None: """Callback for WebSocketEventTvInfo notifications.""" @@ -542,6 +609,8 @@ def get_volume_notifications(self, on_volume_notification) -> None: def get_wisa_out_state_notifications(self, on_wisa_out_state_notification) -> None: """Callback for WebSocketEventWisaOutState notifications.""" - self._notification_callbacks[ - "WebSocketEventWisaOutState" - ] = on_wisa_out_state_notification + self._notification_callbacks["WebSocketEventWisaOutState"] = ( + on_wisa_out_state_notification + ) + + # Generated section end diff --git a/python_client/mozart_api/rest.py b/python_client/mozart_api/rest.py index a79d5d8..77ef9b3 100644 --- a/python_client/mozart_api/rest.py +++ b/python_client/mozart_api/rest.py @@ -15,39 +15,48 @@ import io import json -import logging import re import ssl +from typing import Optional, Union import aiohttp -from urllib.parse import urlencode, quote_plus +import aiohttp_retry from mozart_api.exceptions import ApiException, ApiValueError -logger = logging.getLogger(__name__) +RESTResponseType = aiohttp.ClientResponse + +ALLOW_RETRY_METHODS = frozenset({"DELETE", "GET", "HEAD", "OPTIONS", "PUT", "TRACE"}) class RESTResponse(io.IOBase): - def __init__(self, resp, data) -> None: - self.aiohttp_response = resp + + def __init__(self, resp) -> None: + self.response = resp self.status = resp.status self.reason = resp.reason - self.data = data + self.data = None + + async def read(self): + if self.data is None: + self.data = await self.response.read() + return self.data def getheaders(self): """Returns a CIMultiDictProxy of the response headers.""" - return self.aiohttp_response.headers + return self.response.headers def getheader(self, name, default=None): """Returns a given response header.""" - return self.aiohttp_response.headers.get(name, default) + return self.response.headers.get(name, default) class RESTClientObject: - def __init__(self, configuration, pools_size=4, maxsize=None) -> None: + + def __init__(self, configuration) -> None: + # maxsize is number of requests to host that are allowed in parallel - if maxsize is None: - maxsize = configuration.connection_pool_maxsize + maxsize = configuration.connection_pool_maxsize ssl_context = ssl.create_default_context(cafile=configuration.ssl_ca_cert) if configuration.cert_file: @@ -67,32 +76,41 @@ def __init__(self, configuration, pools_size=4, maxsize=None) -> None: # https pool manager self.pool_manager = aiohttp.ClientSession(connector=connector, trust_env=True) + retries = configuration.retries + self.retry_client: Optional[aiohttp_retry.RetryClient] + if retries is not None: + self.retry_client = aiohttp_retry.RetryClient( + client_session=self.pool_manager, + retry_options=aiohttp_retry.ExponentialRetry( + attempts=retries, factor=0.0, start_timeout=0.0, max_timeout=120.0 + ), + ) + else: + self.retry_client = None + async def close(self): await self.pool_manager.close() + if self.retry_client is not None: + await self.retry_client.close() async def request( self, method, url, - query_params=None, headers=None, body=None, post_params=None, - _preload_content=True, _request_timeout=None, ): """Execute request :param method: http request method :param url: http request url - :param query_params: query parameters in the url :param headers: http request headers :param body: request json body, for `application/json` :param post_params: request post parameters, `application/x-www-form-urlencoded` and `multipart/form-data` - :param _preload_content: this is a non-applicable field for - the AiohttpClient. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -109,8 +127,6 @@ async def request( post_params = post_params or {} headers = headers or {} # url already contains the URL query string - # so reset query_params to empty dict - query_params = {} timeout = _request_timeout or 5 * 60 if "Content-Type" not in headers: @@ -123,18 +139,13 @@ async def request( if self.proxy_headers: args["proxy_headers"] = self.proxy_headers - if query_params: - args["url"] += "?" + urlencode(query_params) - # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]: if re.search("json", headers["Content-Type"], re.IGNORECASE): if body is not None: body = json.dumps(body) args["data"] = body - elif ( - headers["Content-Type"] == "application/x-www-form-urlencoded" - ): # noqa: E501 + elif headers["Content-Type"] == "application/x-www-form-urlencoded": args["data"] = aiohttp.FormData(post_params) elif headers["Content-Type"] == "multipart/form-data": # must del headers['Content-Type'], or the correct @@ -161,152 +172,12 @@ async def request( declared content type.""" raise ApiException(status=0, reason=msg) - r = await self.pool_manager.request(**args) - if _preload_content: - data = await r.read() - r = RESTResponse(r, data) - - # log response body - logger.debug("response body: %s", r.data) + pool_manager: Union[aiohttp.ClientSession, aiohttp_retry.RetryClient] + if self.retry_client is not None and method in ALLOW_RETRY_METHODS: + pool_manager = self.retry_client + else: + pool_manager = self.pool_manager - if not 200 <= r.status <= 299: - raise ApiException(http_resp=r) + r = await pool_manager.request(**args) - return r - - async def get_request( - self, - url, - headers=None, - query_params=None, - _preload_content=True, - _request_timeout=None, - ): - return await self.request( - "GET", - url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params, - ) - - async def head_request( - self, - url, - headers=None, - query_params=None, - _preload_content=True, - _request_timeout=None, - ): - return await self.request( - "HEAD", - url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params, - ) - - async def options_request( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return await self.request( - "OPTIONS", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - async def delete_request( - self, - url, - headers=None, - query_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return await self.request( - "DELETE", - url, - headers=headers, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - async def post_request( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return await self.request( - "POST", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - async def put_request( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return await self.request( - "PUT", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - async def patch_request( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return await self.request( - "PATCH", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) + return RESTResponse(r) diff --git a/python_client/pyproject.toml b/python_client/pyproject.toml index a522d23..e173cfd 100644 --- a/python_client/pyproject.toml +++ b/python_client/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "mozart_api" -version = "3.2.1.150.6" +version = "3.4.1.8.2" description = "Mozart platform API" authors = [ "BangOlufsen ", @@ -22,7 +22,6 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", "Topic :: Multimedia", "Intended Audience :: Developers", ] @@ -34,18 +33,21 @@ exclude = [ urllib3 = ">= 1.25.3" python-dateutil = ">=2.8.2" aiohttp = ">=3.8.3" -pydantic = "^1.10.5, <2" -aenum = ">=3.1.11" +aiohttp-retry = ">= 2.8.3" +pydantic = ">=2" +typing-extensions = ">=4.7.1" aioconsole = ">=0.4.1" inflection = ">=0.5.1" -typing-extensions = ">=4.7.1" zeroconf = ">=0.25.1" -python = ">=3.8" +websockets = ">=12.0" +python = ">=3.11" [tool.poetry.dev-dependencies] pytest = ">=7.2.1" tox = ">=3.9.0" flake8 = ">=4.0.0" +types-python-dateutil = ">=2.8.19.14" +mypy = "1.4.1" [tool.poetry.urls] "Bug Tracker" = "https://github.com/bang-olufsen/mozart-open-api/issues" @@ -56,6 +58,21 @@ mozart_api = "mozart_api.mozart_cli:MozartApiCli" [tool.pylint."MESSAGES CONTROL"] extension-pkg-whitelist = "pydantic" +[tool.mypy] +files = [ + "mozart_api", + "tests", +] +warn_unused_configs = true +warn_redundant_casts = true +warn_unused_ignores = true +strict_equality = true +strict_concatenate = true +check_untyped_defs = true +disallow_subclassing_any = true +disallow_untyped_decorators = true +disallow_any_generics = true + [build-system] requires = [ "poetry-core",