diff --git a/docs/mozart-api.yaml b/docs/mozart-api.yaml index d95c401..f53033a 100644 --- a/docs/mozart-api.yaml +++ b/docs/mozart-api.yaml @@ -4745,7 +4745,7 @@ info: - [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.2.1.150 of the\ - \ Mozart platform and API generation version 3.2.1.150.4.\n\n## Python API\n\ + \ Mozart platform and API generation version 3.2.1.150.5.\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,\ \ has been made that makes the API more pythonic. We recommend using this.\n\ @@ -4756,12 +4756,13 @@ info: \ using pip:\n\n```terminal\npip3 install mozart-api\n```\n\n### API usage\n\ \nTo use the Python API:\n\n- Create a MozartClient object\n- Choose which\ \ (if any) WebSocket events to listen to\n- Connect to the WebSocket notification\ - \ channel (if needed)\n- Use any of the endpoints\n\n#### Example\n\n\n\n```python\nimport\ - \ asyncio\n\nfrom mozart_api.models import VolumeLevel\nfrom mozart_api.mozart_client\ - \ import MozartClient\n\n\ndef all_notifications(notification: object, notification_type:\ - \ str):\n \"\"\"Notification handler.\"\"\"\n print(f\"{notification_type}\ - \ : {notification}\")\n\n\ndef volume_notifications(notification: object):\n\ + \ channel (if needed)\n- Use any of the endpoints\n\n#### Example\n\n\n\n\n\n```python\nimport asyncio\n\nfrom mozart_api.models\ + \ import VolumeLevel\nfrom mozart_api.mozart_client import MozartClient\n\n\ + \ndef all_notifications(notification: object, notification_type: str):\n \ + \ \"\"\"Notification handler.\"\"\"\n print(f\"{notification_type} :\ + \ {notification}\")\n\n\ndef volume_notifications(notification: object):\n\ \ \"\"\"Volume notification handler.\"\"\"\n print(notification)\n\n\ \nasync def test_api():\n \"\"\"Test Mozart API.\"\"\"\n mozart_client\ \ = MozartClient(host=\"192.168.0.1\")\n\n mozart_client.get_all_notifications(all_notifications)\n\ @@ -4770,17 +4771,33 @@ info: \ await mozart_client.activate_preset(id=2)\n await mozart_client.post_beolink_expand(\n\ \ jid=\"1234.1234567.12345678@products.bang-olufsen.com\"\n )\n\n\ \ listeners = await mozart_client.get_beolink_listeners()\n print(listeners)\n\ - \n\nasyncio.run(test_api())\n```\n\nWhere `192.168.0.1` is a Mozart device's\ - \ IP-address.\n\n#### Beware\n\nSome of the classes defined in the Mozart\ - \ API are aliases to other data types, for example: `ActionList` is an array\ - \ of `Action` objects. These classes are not generated and can therefore not\ - \ be used in the Python API. instead, use the built in Python data types,\ - \ for example when defining an ActionList, simply use a `list` instead.\n\n\ - #### WebSocket events\n\nThe most convenient way of getting state information\ - \ from a Mozart device is through the WebSocket notification channel. All\ - \ notification types are available as a set of strings in the NOTIFICATION_TYPES\ - \ constant.\n\nTo receive `WebSocketEventBeoRemoteButton` events requires\ - \ that `remote_control=True` is defined when running the `connect_notifications()`\ + \n # Close aiohttp ClientSession\n await mozart_client.close()\n\n\n\ + asyncio.run(test_api())\n```\n\n\n\n\n\n```python\nimport asyncio\n\nfrom mozart_api.models\ + \ import VolumeLevel\nfrom mozart_api.mozart_client import MozartClient\n\n\ + \ndef all_notifications(notification: object, notification_type: str):\n \ + \ \"\"\"Notification handler.\"\"\"\n print(f\"{notification_type} :\ + \ {notification}\")\n\n\ndef volume_notifications(notification: object):\n\ + \ \"\"\"Volume notification handler.\"\"\"\n print(notification)\n\n\ + \nasync def test_api():\n \"\"\"Test Mozart API.\"\"\"\n mozart_client\ + \ = MozartClient(host=\"192.168.0.1\")\n\n mozart_client.get_all_notifications(all_notifications)\n\ + \ mozart_client.get_volume_notifications(volume_notifications)\n\n mozart_client.connect_notifications(remote_control=True)\n\ + \n async with mozart_client:\n await mozart_client.set_current_volume_level(volume_level=VolumeLevel(level=50))\n\ + \ await mozart_client.activate_preset(id=2)\n await mozart_client.post_beolink_expand(\n\ + \ jid=\"1234.1234567.12345678@products.bang-olufsen.com\"\n \ + \ )\n\n listeners = await mozart_client.get_beolink_listeners()\n\ + \ print(listeners)\n\nasyncio.run(test_api())\n```\n\n\n\nWhere `192.168.0.1` is a Mozart device's IP-address.\n\n#### Beware\n\ + \nSome of the classes defined in the Mozart API are aliases to other data\ + \ types, for example: `ActionList` is an array of `Action` objects. These\ + \ classes are not generated and can therefore not be used in the Python API.\ + \ instead, use the built in Python data types, for example when defining an\ + \ ActionList, simply use a `list` instead.\n\n#### WebSocket events\n\nThe\ + \ most convenient way of getting state information from a Mozart device is\ + \ through the WebSocket notification channel. All notification types are available\ + \ as a set of strings in the NOTIFICATION_TYPES constant.\n\nTo receive `WebSocketEventBeoRemoteButton`\ + \ events requires that `remote_control=True` is defined when running the `connect_notifications()`\ \ method.\n\nA callback is available for each of the WebSocket events as well\ \ as:\n\n\n\nThe `get_on_connection_lost`\ \ method will set a callback when the WebSocket listener loses connection.\n\