Skip to content

Commit

Permalink
Improve API client typing
Browse files Browse the repository at this point in the history
Remove unused websockets dependency
Pin aiohttp to avoid next major version breaking API client
Use ruff for formatting instead of black
Add mozart_client classes to mozart_api.__init__py imports
Update OpenAPI generator to 7.10
Improve API documentation
  • Loading branch information
mj23000 committed Nov 22, 2024
1 parent 32d3887 commit 042b663
Show file tree
Hide file tree
Showing 233 changed files with 5,981 additions and 5,080 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

[![Balance stereo](https://raw.githubusercontent.com/bang-olufsen/mozart-open-api/main/docs/media/balance_stereo.png)](https://www.bang-olufsen.com/en/dk/speakers/beosound-balance-stereo-set?variant=beosound-balance-gva-naturaloak-bundle)

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).
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 repository](https://github.com/bang-olufsen/mozart-open-api/blob/main/mozart-api-4.1.1.116.yaml).

Supported by:
- [Beoconnect Core](https://www.bang-olufsen.com/en/dk/accessories/beoconnect-core)
Expand Down
3,328 changes: 2,405 additions & 923 deletions docs/mozart-api.yaml

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions python_client/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: mozart_api
Version: 4.1.1.116.0
Version: 4.1.1.116.1
Summary: Mozart platform API
Home-page: https://pypi.org/project/mozart-api/
License: MIT
Expand All @@ -14,17 +14,17 @@ Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
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 (>=3.8.3,<4)
Requires-Dist: inflection (>=0.5.1)
Requires-Dist: pydantic (>=1.10)
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/
Expand All @@ -40,7 +40,7 @@ Description-Content-Type: text/markdown

[![Balance stereo](https://raw.githubusercontent.com/bang-olufsen/mozart-open-api/main/docs/media/balance_stereo.png)](https://www.bang-olufsen.com/en/dk/speakers/beosound-balance-stereo-set?variant=beosound-balance-gva-naturaloak-bundle)

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).
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 repository](https://github.com/bang-olufsen/mozart-open-api/blob/main/mozart-api-4.1.1.116.yaml).

Supported by:
- [Beoconnect Core](https://www.bang-olufsen.com/en/dk/accessories/beoconnect-core)
Expand Down
2 changes: 1 addition & 1 deletion python_client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

[![Balance stereo](https://raw.githubusercontent.com/bang-olufsen/mozart-open-api/main/docs/media/balance_stereo.png)](https://www.bang-olufsen.com/en/dk/speakers/beosound-balance-stereo-set?variant=beosound-balance-gva-naturaloak-bundle)

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).
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 repository](https://github.com/bang-olufsen/mozart-open-api/blob/main/mozart-api-4.1.1.116.yaml).

Supported by:
- [Beoconnect Core](https://www.bang-olufsen.com/en/dk/accessories/beoconnect-core)
Expand Down
20 changes: 13 additions & 7 deletions python_client/mozart_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,25 @@
# flake8: noqa

"""
Mozart platform API
Mozart platform API
API for interacting with the Mozart platform.
API for interacting with the Mozart platform.
The version of the OpenAPI document: 0.2.0
Contact: [email protected]
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 0.2.0
Contact: [email protected]
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501

__version__ = "4.1.1.116.1"

__version__ = "4.1.1.116.0"
# import manually created api client
from mozart_api.mozart_client import (
BaseWebSocketResponse,
MozartClient,
WebSocketEventType,
)

# import apis into sdk package
from mozart_api.api.beolink_api import BeolinkApi
Expand Down
97 changes: 34 additions & 63 deletions python_client/mozart_api/api/beolink_api.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
# coding: utf-8

"""
Mozart platform API
Mozart platform API
API for interacting with the Mozart platform.
API for interacting with the Mozart platform.
The version of the OpenAPI document: 0.2.0
Contact: [email protected]
Generated by OpenAPI Generator (https://openapi-generator.tech)
The version of the OpenAPI document: 0.2.0
Contact: [email protected]
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
Do not edit the class manually.
""" # noqa: E501


import re # noqa: F401
import io
import re # noqa: F401
import warnings


try:
from pydantic.v1 import validate_arguments, ValidationError
from pydantic.v1 import ValidationError, validate_arguments
except ImportError:
from pydantic import validate_arguments, ValidationError
from pydantic import ValidationError, validate_arguments

from typing import overload, Optional, Union, Awaitable
from typing import Awaitable, Optional, Union, overload

from typing_extensions import Annotated

Expand All @@ -35,17 +33,16 @@

from typing import List, Optional

from mozart_api.api_client import ApiClient
from mozart_api.api_response import ApiResponse
from mozart_api.exceptions import ApiTypeError, ApiValueError # noqa: F401
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.models.beolink_self import BeolinkSelf

from mozart_api.api_client import ApiClient
from mozart_api.api_response import ApiResponse
from mozart_api.exceptions import ApiTypeError, ApiValueError # noqa: F401


class BeolinkApi:
"""NOTE: This class is auto generated by OpenAPI Generator
Expand Down Expand Up @@ -80,9 +77,7 @@ async def get_beolink_available_listeners(
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
return await self.get_beolink_available_listeners_with_http_info(**kwargs) # noqa: E501

@validate_arguments
async def get_beolink_available_listeners_with_http_info(
Expand Down Expand Up @@ -188,7 +183,7 @@ async def get_beolink_available_listeners_with_http_info(
async def get_beolink_join_result(
self,
id: Annotated[StrictStr, Field(..., description="Join request ID")],
**kwargs
**kwargs,
) -> BeolinkJoinResult: # noqa: E501
"""Get Beolink join result, test-endpoint # noqa: E501
Expand All @@ -209,15 +204,13 @@ async def get_beolink_join_result(
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
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(
self,
id: Annotated[StrictStr, Field(..., description="Join request ID")],
**kwargs
**kwargs,
) -> ApiResponse: # noqa: E501
"""Get Beolink join result, test-endpoint # noqa: E501
Expand Down Expand Up @@ -320,9 +313,7 @@ async def get_beolink_join_result_with_http_info(
)

@validate_arguments
async def get_beolink_listeners(
self, **kwargs
) -> List[BeolinkListener]: # noqa: E501
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
Expand All @@ -343,9 +334,7 @@ async def get_beolink_listeners(
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
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
Expand Down Expand Up @@ -464,9 +453,7 @@ async def get_beolink_peers(self, **kwargs) -> List[BeolinkPeer]: # noqa: E501
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
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
Expand Down Expand Up @@ -585,9 +572,7 @@ async def get_beolink_self(self, **kwargs) -> BeolinkSelf: # noqa: E501
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
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
Expand Down Expand Up @@ -691,7 +676,7 @@ async def join_beolink_peer(
Optional[StrictStr],
Field(description="Ask to join a specific source on peer"),
] = None,
**kwargs
**kwargs,
) -> BeolinkJoinRequest: # noqa: E501
"""Join multi-room experience # noqa: E501
Expand All @@ -714,9 +699,7 @@ async def join_beolink_peer(
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
return await self.join_beolink_peer_with_http_info(jid, source, **kwargs) # noqa: E501

@validate_arguments
async def join_beolink_peer_with_http_info(
Expand All @@ -726,7 +709,7 @@ async def join_beolink_peer_with_http_info(
Optional[StrictStr],
Field(description="Ask to join a specific source on peer"),
] = None,
**kwargs
**kwargs,
) -> ApiResponse: # noqa: E501
"""Join multi-room experience # noqa: E501
Expand Down Expand Up @@ -835,9 +818,7 @@ async def join_beolink_peer_with_http_info(
)

@validate_arguments
async def join_latest_beolink_experience(
self, **kwargs
) -> BeolinkJoinRequest: # noqa: E501
async def join_latest_beolink_experience(self, **kwargs) -> BeolinkJoinRequest: # noqa: E501
"""Trigger touch to join # noqa: E501
Expand All @@ -854,9 +835,7 @@ async def join_latest_beolink_experience(
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
return await self.join_latest_beolink_experience_with_http_info(**kwargs) # noqa: E501

@validate_arguments
async def join_latest_beolink_experience_with_http_info(
Expand Down Expand Up @@ -979,9 +958,7 @@ async def post_beolink_allstandby(self, **kwargs) -> None: # noqa: E501
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
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
Expand Down Expand Up @@ -1083,7 +1060,7 @@ async def post_beolink_expand(
..., description="Jabber id of peer to expand the active experience to"
),
],
**kwargs
**kwargs,
) -> None: # noqa: E501
"""Expand the current active experience # noqa: E501
Expand All @@ -1104,9 +1081,7 @@ async def post_beolink_expand(
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
return await self.post_beolink_expand_with_http_info(jid, **kwargs) # noqa: E501

@validate_arguments
async def post_beolink_expand_with_http_info(
Expand All @@ -1117,7 +1092,7 @@ async def post_beolink_expand_with_http_info(
..., description="Jabber id of peer to expand the active experience to"
),
],
**kwargs
**kwargs,
) -> ApiResponse: # noqa: E501
"""Expand the current active experience # noqa: E501
Expand Down Expand Up @@ -1237,9 +1212,7 @@ async def post_beolink_leave(self, **kwargs) -> None: # noqa: E501
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
async def post_beolink_leave_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501
"""Leave the ongoing experience (disconnect this device from remote) # noqa: E501
Expand Down Expand Up @@ -1338,7 +1311,7 @@ async def post_beolink_unexpand(
jid: Annotated[
StrictStr, Field(..., description="Jabber id of peer to unexpand")
],
**kwargs
**kwargs,
) -> None: # noqa: E501
"""Unexpand (disconnect) a device from the multiroom session # noqa: E501
Expand All @@ -1359,17 +1332,15 @@ async def post_beolink_unexpand(
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
return await self.post_beolink_unexpand_with_http_info(jid, **kwargs) # noqa: E501

@validate_arguments
async def post_beolink_unexpand_with_http_info(
self,
jid: Annotated[
StrictStr, Field(..., description="Jabber id of peer to unexpand")
],
**kwargs
**kwargs,
) -> ApiResponse: # noqa: E501
"""Unexpand (disconnect) a device from the multiroom session # noqa: E501
Expand Down
Loading

0 comments on commit 042b663

Please sign in to comment.