From 19dab67d7cb0c911b51ff89e769d983ec3ca7173 Mon Sep 17 00:00:00 2001 From: Georg Krause <mail@georg-krause.net> Date: Thu, 29 Sep 2022 07:52:08 +0200 Subject: [PATCH] Update to current develop --- .../api/channels/create_channel.py | 72 +++---- .../api/channels/partial_update_channel.py | 72 +++---- .../api/channels/subscribe_channel.py | 63 +------ .../api/channels/subscribe_channel_rss.py | 102 +--------- .../api/channels/unsubscribe_channel_2.py | 25 --- .../api/channels/update_channel.py | 72 +++---- .../{get_listen.py => get_track_file.py} | 63 +------ .../{get_stream.py => get_track_stream.py} | 0 funkwhale_api_client/models/__init__.py | 14 +- funkwhale_api_client/models/channel_create.py | 113 +++++++++++ ...metadata.py => channel_create_metadata.py} | 10 +- .../models/channel_create_request.py | 161 ++++++++++++++++ ....py => channel_create_request_metadata.py} | 10 +- .../models/channel_request.py | 155 ---------------- funkwhale_api_client/models/channel_update.py | 106 +++++++++++ .../models/channel_update_metadata.py | 44 +++++ .../models/channel_update_request.py | 150 +++++++++++++++ .../models/channel_update_request_metadata.py | 44 +++++ .../models/patched_channel_request.py | 175 ------------------ .../models/patched_channel_update_request.py | 173 +++++++++++++++++ ...patched_channel_update_request_metadata.py | 44 +++++ 21 files changed, 984 insertions(+), 684 deletions(-) rename funkwhale_api_client/api/listen/{get_listen.py => get_track_file.py} (57%) rename funkwhale_api_client/api/stream/{get_stream.py => get_track_stream.py} (100%) create mode 100644 funkwhale_api_client/models/channel_create.py rename funkwhale_api_client/models/{channel_request_metadata.py => channel_create_metadata.py} (81%) create mode 100644 funkwhale_api_client/models/channel_create_request.py rename funkwhale_api_client/models/{patched_channel_request_metadata.py => channel_create_request_metadata.py} (79%) delete mode 100644 funkwhale_api_client/models/channel_request.py create mode 100644 funkwhale_api_client/models/channel_update.py create mode 100644 funkwhale_api_client/models/channel_update_metadata.py create mode 100644 funkwhale_api_client/models/channel_update_request.py create mode 100644 funkwhale_api_client/models/channel_update_request_metadata.py delete mode 100644 funkwhale_api_client/models/patched_channel_request.py create mode 100644 funkwhale_api_client/models/patched_channel_update_request.py create mode 100644 funkwhale_api_client/models/patched_channel_update_request_metadata.py diff --git a/funkwhale_api_client/api/channels/create_channel.py b/funkwhale_api_client/api/channels/create_channel.py index 2890922..22f2da9 100644 --- a/funkwhale_api_client/api/channels/create_channel.py +++ b/funkwhale_api_client/api/channels/create_channel.py @@ -3,17 +3,17 @@ from typing import Any, Dict, Optional import httpx from ...client import AuthenticatedClient -from ...models.channel import Channel -from ...models.channel_request import ChannelRequest +from ...models.channel_create import ChannelCreate +from ...models.channel_create_request import ChannelCreateRequest from ...types import Response def _get_kwargs( *, client: AuthenticatedClient, - form_data: ChannelRequest, - multipart_data: ChannelRequest, - json_body: ChannelRequest, + form_data: ChannelCreateRequest, + multipart_data: ChannelCreateRequest, + json_body: ChannelCreateRequest, ) -> Dict[str, Any]: url = "{}/api/v1/channels/".format(client.base_url) @@ -34,15 +34,15 @@ def _get_kwargs( } -def _parse_response(*, response: httpx.Response) -> Optional[Channel]: +def _parse_response(*, response: httpx.Response) -> Optional[ChannelCreate]: if response.status_code == 201: - response_201 = Channel.from_dict(response.json()) + response_201 = ChannelCreate.from_dict(response.json()) return response_201 return None -def _build_response(*, response: httpx.Response) -> Response[Channel]: +def _build_response(*, response: httpx.Response) -> Response[ChannelCreate]: return Response( status_code=response.status_code, content=response.content, @@ -54,17 +54,17 @@ def _build_response(*, response: httpx.Response) -> Response[Channel]: def sync_detailed( *, client: AuthenticatedClient, - form_data: ChannelRequest, - multipart_data: ChannelRequest, - json_body: ChannelRequest, -) -> Response[Channel]: + form_data: ChannelCreateRequest, + multipart_data: ChannelCreateRequest, + json_body: ChannelCreateRequest, +) -> Response[ChannelCreate]: """ Args: - multipart_data (ChannelRequest): - json_body (ChannelRequest): + multipart_data (ChannelCreateRequest): + json_body (ChannelCreateRequest): Returns: - Response[Channel] + Response[ChannelCreate] """ kwargs = _get_kwargs( @@ -85,17 +85,17 @@ def sync_detailed( def sync( *, client: AuthenticatedClient, - form_data: ChannelRequest, - multipart_data: ChannelRequest, - json_body: ChannelRequest, -) -> Optional[Channel]: + form_data: ChannelCreateRequest, + multipart_data: ChannelCreateRequest, + json_body: ChannelCreateRequest, +) -> Optional[ChannelCreate]: """ Args: - multipart_data (ChannelRequest): - json_body (ChannelRequest): + multipart_data (ChannelCreateRequest): + json_body (ChannelCreateRequest): Returns: - Response[Channel] + Response[ChannelCreate] """ return sync_detailed( @@ -109,17 +109,17 @@ def sync( async def asyncio_detailed( *, client: AuthenticatedClient, - form_data: ChannelRequest, - multipart_data: ChannelRequest, - json_body: ChannelRequest, -) -> Response[Channel]: + form_data: ChannelCreateRequest, + multipart_data: ChannelCreateRequest, + json_body: ChannelCreateRequest, +) -> Response[ChannelCreate]: """ Args: - multipart_data (ChannelRequest): - json_body (ChannelRequest): + multipart_data (ChannelCreateRequest): + json_body (ChannelCreateRequest): Returns: - Response[Channel] + Response[ChannelCreate] """ kwargs = _get_kwargs( @@ -138,17 +138,17 @@ async def asyncio_detailed( async def asyncio( *, client: AuthenticatedClient, - form_data: ChannelRequest, - multipart_data: ChannelRequest, - json_body: ChannelRequest, -) -> Optional[Channel]: + form_data: ChannelCreateRequest, + multipart_data: ChannelCreateRequest, + json_body: ChannelCreateRequest, +) -> Optional[ChannelCreate]: """ Args: - multipart_data (ChannelRequest): - json_body (ChannelRequest): + multipart_data (ChannelCreateRequest): + json_body (ChannelCreateRequest): Returns: - Response[Channel] + Response[ChannelCreate] """ return ( diff --git a/funkwhale_api_client/api/channels/partial_update_channel.py b/funkwhale_api_client/api/channels/partial_update_channel.py index f20f25b..65d976b 100644 --- a/funkwhale_api_client/api/channels/partial_update_channel.py +++ b/funkwhale_api_client/api/channels/partial_update_channel.py @@ -3,8 +3,8 @@ from typing import Any, Dict, Optional import httpx from ...client import AuthenticatedClient -from ...models.channel import Channel -from ...models.patched_channel_request import PatchedChannelRequest +from ...models.channel_update import ChannelUpdate +from ...models.patched_channel_update_request import PatchedChannelUpdateRequest from ...types import Response @@ -12,9 +12,9 @@ def _get_kwargs( composite: str, *, client: AuthenticatedClient, - form_data: PatchedChannelRequest, - multipart_data: PatchedChannelRequest, - json_body: PatchedChannelRequest, + form_data: PatchedChannelUpdateRequest, + multipart_data: PatchedChannelUpdateRequest, + json_body: PatchedChannelUpdateRequest, ) -> Dict[str, Any]: url = "{}/api/v1/channels/{composite}/".format(client.base_url, composite=composite) @@ -35,15 +35,15 @@ def _get_kwargs( } -def _parse_response(*, response: httpx.Response) -> Optional[Channel]: +def _parse_response(*, response: httpx.Response) -> Optional[ChannelUpdate]: if response.status_code == 200: - response_200 = Channel.from_dict(response.json()) + response_200 = ChannelUpdate.from_dict(response.json()) return response_200 return None -def _build_response(*, response: httpx.Response) -> Response[Channel]: +def _build_response(*, response: httpx.Response) -> Response[ChannelUpdate]: return Response( status_code=response.status_code, content=response.content, @@ -56,18 +56,18 @@ def sync_detailed( composite: str, *, client: AuthenticatedClient, - form_data: PatchedChannelRequest, - multipart_data: PatchedChannelRequest, - json_body: PatchedChannelRequest, -) -> Response[Channel]: + form_data: PatchedChannelUpdateRequest, + multipart_data: PatchedChannelUpdateRequest, + json_body: PatchedChannelUpdateRequest, +) -> Response[ChannelUpdate]: """ Args: composite (str): - multipart_data (PatchedChannelRequest): - json_body (PatchedChannelRequest): + multipart_data (PatchedChannelUpdateRequest): + json_body (PatchedChannelUpdateRequest): Returns: - Response[Channel] + Response[ChannelUpdate] """ kwargs = _get_kwargs( @@ -90,18 +90,18 @@ def sync( composite: str, *, client: AuthenticatedClient, - form_data: PatchedChannelRequest, - multipart_data: PatchedChannelRequest, - json_body: PatchedChannelRequest, -) -> Optional[Channel]: + form_data: PatchedChannelUpdateRequest, + multipart_data: PatchedChannelUpdateRequest, + json_body: PatchedChannelUpdateRequest, +) -> Optional[ChannelUpdate]: """ Args: composite (str): - multipart_data (PatchedChannelRequest): - json_body (PatchedChannelRequest): + multipart_data (PatchedChannelUpdateRequest): + json_body (PatchedChannelUpdateRequest): Returns: - Response[Channel] + Response[ChannelUpdate] """ return sync_detailed( @@ -117,18 +117,18 @@ async def asyncio_detailed( composite: str, *, client: AuthenticatedClient, - form_data: PatchedChannelRequest, - multipart_data: PatchedChannelRequest, - json_body: PatchedChannelRequest, -) -> Response[Channel]: + form_data: PatchedChannelUpdateRequest, + multipart_data: PatchedChannelUpdateRequest, + json_body: PatchedChannelUpdateRequest, +) -> Response[ChannelUpdate]: """ Args: composite (str): - multipart_data (PatchedChannelRequest): - json_body (PatchedChannelRequest): + multipart_data (PatchedChannelUpdateRequest): + json_body (PatchedChannelUpdateRequest): Returns: - Response[Channel] + Response[ChannelUpdate] """ kwargs = _get_kwargs( @@ -149,18 +149,18 @@ async def asyncio( composite: str, *, client: AuthenticatedClient, - form_data: PatchedChannelRequest, - multipart_data: PatchedChannelRequest, - json_body: PatchedChannelRequest, -) -> Optional[Channel]: + form_data: PatchedChannelUpdateRequest, + multipart_data: PatchedChannelUpdateRequest, + json_body: PatchedChannelUpdateRequest, +) -> Optional[ChannelUpdate]: """ Args: composite (str): - multipart_data (PatchedChannelRequest): - json_body (PatchedChannelRequest): + multipart_data (PatchedChannelUpdateRequest): + json_body (PatchedChannelUpdateRequest): Returns: - Response[Channel] + Response[ChannelUpdate] """ return ( diff --git a/funkwhale_api_client/api/channels/subscribe_channel.py b/funkwhale_api_client/api/channels/subscribe_channel.py index 26ccc06..84be4ca 100644 --- a/funkwhale_api_client/api/channels/subscribe_channel.py +++ b/funkwhale_api_client/api/channels/subscribe_channel.py @@ -1,9 +1,8 @@ -from typing import Any, Dict, Optional +from typing import Any, Dict import httpx from ...client import AuthenticatedClient -from ...models.subscription import Subscription from ...types import Response @@ -26,20 +25,12 @@ def _get_kwargs( } -def _parse_response(*, response: httpx.Response) -> Optional[Subscription]: - if response.status_code == 200: - response_200 = Subscription.from_dict(response.json()) - - return response_200 - return None - - -def _build_response(*, response: httpx.Response) -> Response[Subscription]: +def _build_response(*, response: httpx.Response) -> Response[Any]: return Response( status_code=response.status_code, content=response.content, headers=response.headers, - parsed=_parse_response(response=response), + parsed=None, ) @@ -47,13 +38,13 @@ def sync_detailed( composite: str, *, client: AuthenticatedClient, -) -> Response[Subscription]: +) -> Response[Any]: """ Args: composite (str): Returns: - Response[Subscription] + Response[Any] """ kwargs = _get_kwargs( @@ -69,36 +60,17 @@ def sync_detailed( return _build_response(response=response) -def sync( - composite: str, - *, - client: AuthenticatedClient, -) -> Optional[Subscription]: - """ - Args: - composite (str): - - Returns: - Response[Subscription] - """ - - return sync_detailed( - composite=composite, - client=client, - ).parsed - - async def asyncio_detailed( composite: str, *, client: AuthenticatedClient, -) -> Response[Subscription]: +) -> Response[Any]: """ Args: composite (str): Returns: - Response[Subscription] + Response[Any] """ kwargs = _get_kwargs( @@ -110,24 +82,3 @@ async def asyncio_detailed( response = await _client.request(**kwargs) return _build_response(response=response) - - -async def asyncio( - composite: str, - *, - client: AuthenticatedClient, -) -> Optional[Subscription]: - """ - Args: - composite (str): - - Returns: - Response[Subscription] - """ - - return ( - await asyncio_detailed( - composite=composite, - client=client, - ) - ).parsed diff --git a/funkwhale_api_client/api/channels/subscribe_channel_rss.py b/funkwhale_api_client/api/channels/subscribe_channel_rss.py index 3cb5eea..a995699 100644 --- a/funkwhale_api_client/api/channels/subscribe_channel_rss.py +++ b/funkwhale_api_client/api/channels/subscribe_channel_rss.py @@ -1,77 +1,49 @@ -from typing import Any, Dict, Optional +from typing import Any, Dict import httpx from ...client import AuthenticatedClient -from ...models.channel import Channel -from ...models.channel_request import ChannelRequest from ...types import Response def _get_kwargs( *, client: AuthenticatedClient, - form_data: ChannelRequest, - multipart_data: ChannelRequest, - json_body: ChannelRequest, ) -> Dict[str, Any]: url = "{}/api/v1/channels/rss-subscribe/".format(client.base_url) headers: Dict[str, str] = client.get_headers() cookies: Dict[str, Any] = client.get_cookies() - json_body.to_dict() - - multipart_data.to_multipart() - return { "method": "post", "url": url, "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), - "data": form_data.to_dict(), } -def _parse_response(*, response: httpx.Response) -> Optional[Channel]: - if response.status_code == 200: - response_200 = Channel.from_dict(response.json()) - - return response_200 - return None - - -def _build_response(*, response: httpx.Response) -> Response[Channel]: +def _build_response(*, response: httpx.Response) -> Response[Any]: return Response( status_code=response.status_code, content=response.content, headers=response.headers, - parsed=_parse_response(response=response), + parsed=None, ) def sync_detailed( *, client: AuthenticatedClient, - form_data: ChannelRequest, - multipart_data: ChannelRequest, - json_body: ChannelRequest, -) -> Response[Channel]: +) -> Response[Any]: """ - Args: - multipart_data (ChannelRequest): - json_body (ChannelRequest): - Returns: - Response[Channel] + Response[Any] """ kwargs = _get_kwargs( client=client, - form_data=form_data, - multipart_data=multipart_data, - json_body=json_body, ) response = httpx.request( @@ -82,80 +54,20 @@ def sync_detailed( return _build_response(response=response) -def sync( - *, - client: AuthenticatedClient, - form_data: ChannelRequest, - multipart_data: ChannelRequest, - json_body: ChannelRequest, -) -> Optional[Channel]: - """ - Args: - multipart_data (ChannelRequest): - json_body (ChannelRequest): - - Returns: - Response[Channel] - """ - - return sync_detailed( - client=client, - form_data=form_data, - multipart_data=multipart_data, - json_body=json_body, - ).parsed - - async def asyncio_detailed( *, client: AuthenticatedClient, - form_data: ChannelRequest, - multipart_data: ChannelRequest, - json_body: ChannelRequest, -) -> Response[Channel]: +) -> Response[Any]: """ - Args: - multipart_data (ChannelRequest): - json_body (ChannelRequest): - Returns: - Response[Channel] + Response[Any] """ kwargs = _get_kwargs( client=client, - form_data=form_data, - multipart_data=multipart_data, - json_body=json_body, ) async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) return _build_response(response=response) - - -async def asyncio( - *, - client: AuthenticatedClient, - form_data: ChannelRequest, - multipart_data: ChannelRequest, - json_body: ChannelRequest, -) -> Optional[Channel]: - """ - Args: - multipart_data (ChannelRequest): - json_body (ChannelRequest): - - Returns: - Response[Channel] - """ - - return ( - await asyncio_detailed( - client=client, - form_data=form_data, - multipart_data=multipart_data, - json_body=json_body, - ) - ).parsed diff --git a/funkwhale_api_client/api/channels/unsubscribe_channel_2.py b/funkwhale_api_client/api/channels/unsubscribe_channel_2.py index d918932..afc09ba 100644 --- a/funkwhale_api_client/api/channels/unsubscribe_channel_2.py +++ b/funkwhale_api_client/api/channels/unsubscribe_channel_2.py @@ -3,7 +3,6 @@ from typing import Any, Dict import httpx from ...client import AuthenticatedClient -from ...models.channel_request import ChannelRequest from ...types import Response @@ -11,26 +10,18 @@ def _get_kwargs( composite: str, *, client: AuthenticatedClient, - form_data: ChannelRequest, - multipart_data: ChannelRequest, - json_body: ChannelRequest, ) -> Dict[str, Any]: url = "{}/api/v1/channels/{composite}/unsubscribe/".format(client.base_url, composite=composite) headers: Dict[str, str] = client.get_headers() cookies: Dict[str, Any] = client.get_cookies() - json_body.to_dict() - - multipart_data.to_multipart() - return { "method": "post", "url": url, "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), - "data": form_data.to_dict(), } @@ -47,15 +38,10 @@ def sync_detailed( composite: str, *, client: AuthenticatedClient, - form_data: ChannelRequest, - multipart_data: ChannelRequest, - json_body: ChannelRequest, ) -> Response[Any]: """ Args: composite (str): - multipart_data (ChannelRequest): - json_body (ChannelRequest): Returns: Response[Any] @@ -64,9 +50,6 @@ def sync_detailed( kwargs = _get_kwargs( composite=composite, client=client, - form_data=form_data, - multipart_data=multipart_data, - json_body=json_body, ) response = httpx.request( @@ -81,15 +64,10 @@ async def asyncio_detailed( composite: str, *, client: AuthenticatedClient, - form_data: ChannelRequest, - multipart_data: ChannelRequest, - json_body: ChannelRequest, ) -> Response[Any]: """ Args: composite (str): - multipart_data (ChannelRequest): - json_body (ChannelRequest): Returns: Response[Any] @@ -98,9 +76,6 @@ async def asyncio_detailed( kwargs = _get_kwargs( composite=composite, client=client, - form_data=form_data, - multipart_data=multipart_data, - json_body=json_body, ) async with httpx.AsyncClient(verify=client.verify_ssl) as _client: diff --git a/funkwhale_api_client/api/channels/update_channel.py b/funkwhale_api_client/api/channels/update_channel.py index ebc4429..d644834 100644 --- a/funkwhale_api_client/api/channels/update_channel.py +++ b/funkwhale_api_client/api/channels/update_channel.py @@ -3,8 +3,8 @@ from typing import Any, Dict, Optional import httpx from ...client import AuthenticatedClient -from ...models.channel import Channel -from ...models.channel_request import ChannelRequest +from ...models.channel_update import ChannelUpdate +from ...models.channel_update_request import ChannelUpdateRequest from ...types import Response @@ -12,9 +12,9 @@ def _get_kwargs( composite: str, *, client: AuthenticatedClient, - form_data: ChannelRequest, - multipart_data: ChannelRequest, - json_body: ChannelRequest, + form_data: ChannelUpdateRequest, + multipart_data: ChannelUpdateRequest, + json_body: ChannelUpdateRequest, ) -> Dict[str, Any]: url = "{}/api/v1/channels/{composite}/".format(client.base_url, composite=composite) @@ -35,15 +35,15 @@ def _get_kwargs( } -def _parse_response(*, response: httpx.Response) -> Optional[Channel]: +def _parse_response(*, response: httpx.Response) -> Optional[ChannelUpdate]: if response.status_code == 200: - response_200 = Channel.from_dict(response.json()) + response_200 = ChannelUpdate.from_dict(response.json()) return response_200 return None -def _build_response(*, response: httpx.Response) -> Response[Channel]: +def _build_response(*, response: httpx.Response) -> Response[ChannelUpdate]: return Response( status_code=response.status_code, content=response.content, @@ -56,18 +56,18 @@ def sync_detailed( composite: str, *, client: AuthenticatedClient, - form_data: ChannelRequest, - multipart_data: ChannelRequest, - json_body: ChannelRequest, -) -> Response[Channel]: + form_data: ChannelUpdateRequest, + multipart_data: ChannelUpdateRequest, + json_body: ChannelUpdateRequest, +) -> Response[ChannelUpdate]: """ Args: composite (str): - multipart_data (ChannelRequest): - json_body (ChannelRequest): + multipart_data (ChannelUpdateRequest): + json_body (ChannelUpdateRequest): Returns: - Response[Channel] + Response[ChannelUpdate] """ kwargs = _get_kwargs( @@ -90,18 +90,18 @@ def sync( composite: str, *, client: AuthenticatedClient, - form_data: ChannelRequest, - multipart_data: ChannelRequest, - json_body: ChannelRequest, -) -> Optional[Channel]: + form_data: ChannelUpdateRequest, + multipart_data: ChannelUpdateRequest, + json_body: ChannelUpdateRequest, +) -> Optional[ChannelUpdate]: """ Args: composite (str): - multipart_data (ChannelRequest): - json_body (ChannelRequest): + multipart_data (ChannelUpdateRequest): + json_body (ChannelUpdateRequest): Returns: - Response[Channel] + Response[ChannelUpdate] """ return sync_detailed( @@ -117,18 +117,18 @@ async def asyncio_detailed( composite: str, *, client: AuthenticatedClient, - form_data: ChannelRequest, - multipart_data: ChannelRequest, - json_body: ChannelRequest, -) -> Response[Channel]: + form_data: ChannelUpdateRequest, + multipart_data: ChannelUpdateRequest, + json_body: ChannelUpdateRequest, +) -> Response[ChannelUpdate]: """ Args: composite (str): - multipart_data (ChannelRequest): - json_body (ChannelRequest): + multipart_data (ChannelUpdateRequest): + json_body (ChannelUpdateRequest): Returns: - Response[Channel] + Response[ChannelUpdate] """ kwargs = _get_kwargs( @@ -149,18 +149,18 @@ async def asyncio( composite: str, *, client: AuthenticatedClient, - form_data: ChannelRequest, - multipart_data: ChannelRequest, - json_body: ChannelRequest, -) -> Optional[Channel]: + form_data: ChannelUpdateRequest, + multipart_data: ChannelUpdateRequest, + json_body: ChannelUpdateRequest, +) -> Optional[ChannelUpdate]: """ Args: composite (str): - multipart_data (ChannelRequest): - json_body (ChannelRequest): + multipart_data (ChannelUpdateRequest): + json_body (ChannelUpdateRequest): Returns: - Response[Channel] + Response[ChannelUpdate] """ return ( diff --git a/funkwhale_api_client/api/listen/get_listen.py b/funkwhale_api_client/api/listen/get_track_file.py similarity index 57% rename from funkwhale_api_client/api/listen/get_listen.py rename to funkwhale_api_client/api/listen/get_track_file.py index f96f67b..5e327ab 100644 --- a/funkwhale_api_client/api/listen/get_listen.py +++ b/funkwhale_api_client/api/listen/get_track_file.py @@ -1,9 +1,8 @@ -from typing import Any, Dict, Optional +from typing import Any, Dict import httpx from ...client import AuthenticatedClient -from ...models.track import Track from ...types import Response @@ -26,20 +25,12 @@ def _get_kwargs( } -def _parse_response(*, response: httpx.Response) -> Optional[Track]: - if response.status_code == 200: - response_200 = Track.from_dict(response.json()) - - return response_200 - return None - - -def _build_response(*, response: httpx.Response) -> Response[Track]: +def _build_response(*, response: httpx.Response) -> Response[Any]: return Response( status_code=response.status_code, content=response.content, headers=response.headers, - parsed=_parse_response(response=response), + parsed=None, ) @@ -47,13 +38,13 @@ def sync_detailed( uuid: str, *, client: AuthenticatedClient, -) -> Response[Track]: +) -> Response[Any]: """ Args: uuid (str): Returns: - Response[Track] + Response[Any] """ kwargs = _get_kwargs( @@ -69,36 +60,17 @@ def sync_detailed( return _build_response(response=response) -def sync( - uuid: str, - *, - client: AuthenticatedClient, -) -> Optional[Track]: - """ - Args: - uuid (str): - - Returns: - Response[Track] - """ - - return sync_detailed( - uuid=uuid, - client=client, - ).parsed - - async def asyncio_detailed( uuid: str, *, client: AuthenticatedClient, -) -> Response[Track]: +) -> Response[Any]: """ Args: uuid (str): Returns: - Response[Track] + Response[Any] """ kwargs = _get_kwargs( @@ -110,24 +82,3 @@ async def asyncio_detailed( response = await _client.request(**kwargs) return _build_response(response=response) - - -async def asyncio( - uuid: str, - *, - client: AuthenticatedClient, -) -> Optional[Track]: - """ - Args: - uuid (str): - - Returns: - Response[Track] - """ - - return ( - await asyncio_detailed( - uuid=uuid, - client=client, - ) - ).parsed diff --git a/funkwhale_api_client/api/stream/get_stream.py b/funkwhale_api_client/api/stream/get_track_stream.py similarity index 100% rename from funkwhale_api_client/api/stream/get_stream.py rename to funkwhale_api_client/api/stream/get_track_stream.py diff --git a/funkwhale_api_client/models/__init__.py b/funkwhale_api_client/models/__init__.py index ff44bbd..c169630 100644 --- a/funkwhale_api_client/models/__init__.py +++ b/funkwhale_api_client/models/__init__.py @@ -39,9 +39,15 @@ from .attachment import Attachment from .attachment_request import AttachmentRequest from .attachment_urls import AttachmentUrls from .channel import Channel +from .channel_create import ChannelCreate +from .channel_create_metadata import ChannelCreateMetadata +from .channel_create_request import ChannelCreateRequest +from .channel_create_request_metadata import ChannelCreateRequestMetadata from .channel_metadata import ChannelMetadata -from .channel_request import ChannelRequest -from .channel_request_metadata import ChannelRequestMetadata +from .channel_update import ChannelUpdate +from .channel_update_metadata import ChannelUpdateMetadata +from .channel_update_request import ChannelUpdateRequest +from .channel_update_request_metadata import ChannelUpdateRequestMetadata from .content import Content from .content_category_enum import ContentCategoryEnum from .content_request import ContentRequest @@ -220,8 +226,8 @@ from .password_reset_confirm import PasswordResetConfirm from .password_reset_confirm_request import PasswordResetConfirmRequest from .password_reset_request import PasswordResetRequest from .patched_application_request import PatchedApplicationRequest -from .patched_channel_request import PatchedChannelRequest -from .patched_channel_request_metadata import PatchedChannelRequestMetadata +from .patched_channel_update_request import PatchedChannelUpdateRequest +from .patched_channel_update_request_metadata import PatchedChannelUpdateRequestMetadata from .patched_global_preference_request import PatchedGlobalPreferenceRequest from .patched_inbox_item_request import PatchedInboxItemRequest from .patched_library_for_owner_request import PatchedLibraryForOwnerRequest diff --git a/funkwhale_api_client/models/channel_create.py b/funkwhale_api_client/models/channel_create.py new file mode 100644 index 0000000..4863737 --- /dev/null +++ b/funkwhale_api_client/models/channel_create.py @@ -0,0 +1,113 @@ +from typing import Any, Dict, List, Optional, Type, TypeVar, Union, cast + +import attr + +from ..models.channel_create_metadata import ChannelCreateMetadata +from ..models.content import Content +from ..models.content_category_enum import ContentCategoryEnum +from ..types import UNSET, Unset + +T = TypeVar("T", bound="ChannelCreate") + + +@attr.s(auto_attribs=True) +class ChannelCreate: + """ + Attributes: + name (str): + username (str): + tags (List[str]): + content_category (ContentCategoryEnum): + description (Optional[Content]): + metadata (Union[Unset, ChannelCreateMetadata]): + """ + + name: str + username: str + tags: List[str] + content_category: ContentCategoryEnum + description: Optional[Content] + metadata: Union[Unset, ChannelCreateMetadata] = UNSET + additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + name = self.name + username = self.username + tags = self.tags + + content_category = self.content_category.value + + description = self.description.to_dict() if self.description else None + + metadata: Union[Unset, Dict[str, Any]] = UNSET + if not isinstance(self.metadata, Unset): + metadata = self.metadata.to_dict() + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + "username": username, + "tags": tags, + "content_category": content_category, + "description": description, + } + ) + if metadata is not UNSET: + field_dict["metadata"] = metadata + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + name = d.pop("name") + + username = d.pop("username") + + tags = cast(List[str], d.pop("tags")) + + content_category = ContentCategoryEnum(d.pop("content_category")) + + _description = d.pop("description") + description: Optional[Content] + if _description is None: + description = None + else: + description = Content.from_dict(_description) + + _metadata = d.pop("metadata", UNSET) + metadata: Union[Unset, ChannelCreateMetadata] + if isinstance(_metadata, Unset): + metadata = UNSET + else: + metadata = ChannelCreateMetadata.from_dict(_metadata) + + channel_create = cls( + name=name, + username=username, + tags=tags, + content_category=content_category, + description=description, + metadata=metadata, + ) + + channel_create.additional_properties = d + return channel_create + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/funkwhale_api_client/models/channel_request_metadata.py b/funkwhale_api_client/models/channel_create_metadata.py similarity index 81% rename from funkwhale_api_client/models/channel_request_metadata.py rename to funkwhale_api_client/models/channel_create_metadata.py index 409b929..da52c5e 100644 --- a/funkwhale_api_client/models/channel_request_metadata.py +++ b/funkwhale_api_client/models/channel_create_metadata.py @@ -2,11 +2,11 @@ from typing import Any, Dict, List, Type, TypeVar import attr -T = TypeVar("T", bound="ChannelRequestMetadata") +T = TypeVar("T", bound="ChannelCreateMetadata") @attr.s(auto_attribs=True) -class ChannelRequestMetadata: +class ChannelCreateMetadata: """ """ additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) @@ -22,10 +22,10 @@ class ChannelRequestMetadata: @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: d = src_dict.copy() - channel_request_metadata = cls() + channel_create_metadata = cls() - channel_request_metadata.additional_properties = d - return channel_request_metadata + channel_create_metadata.additional_properties = d + return channel_create_metadata @property def additional_keys(self) -> List[str]: diff --git a/funkwhale_api_client/models/channel_create_request.py b/funkwhale_api_client/models/channel_create_request.py new file mode 100644 index 0000000..d1d35d7 --- /dev/null +++ b/funkwhale_api_client/models/channel_create_request.py @@ -0,0 +1,161 @@ +import json +from typing import Any, Dict, List, Optional, Tuple, Type, TypeVar, Union, cast + +import attr + +from ..models.channel_create_request_metadata import ChannelCreateRequestMetadata +from ..models.content_category_enum import ContentCategoryEnum +from ..models.content_request import ContentRequest +from ..types import UNSET, Unset + +T = TypeVar("T", bound="ChannelCreateRequest") + + +@attr.s(auto_attribs=True) +class ChannelCreateRequest: + """ + Attributes: + name (str): + username (str): + tags (List[str]): + content_category (ContentCategoryEnum): + cover (Union[Unset, None, str]): + description (Optional[ContentRequest]): + metadata (Union[Unset, ChannelCreateRequestMetadata]): + """ + + name: str + username: str + tags: List[str] + content_category: ContentCategoryEnum + description: Optional[ContentRequest] + cover: Union[Unset, None, str] = UNSET + metadata: Union[Unset, ChannelCreateRequestMetadata] = UNSET + additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + name = self.name + username = self.username + tags = self.tags + + content_category = self.content_category.value + + cover = self.cover + description = self.description.to_dict() if self.description else None + + metadata: Union[Unset, Dict[str, Any]] = UNSET + if not isinstance(self.metadata, Unset): + metadata = self.metadata.to_dict() + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + "username": username, + "tags": tags, + "content_category": content_category, + "description": description, + } + ) + if cover is not UNSET: + field_dict["cover"] = cover + if metadata is not UNSET: + field_dict["metadata"] = metadata + + return field_dict + + def to_multipart(self) -> Dict[str, Any]: + name = self.name if isinstance(self.name, Unset) else (None, str(self.name).encode(), "text/plain") + username = ( + self.username if isinstance(self.username, Unset) else (None, str(self.username).encode(), "text/plain") + ) + _temp_tags = self.tags + tags = (None, json.dumps(_temp_tags).encode(), "application/json") + + content_category = (None, str(self.content_category.value).encode(), "text/plain") + + cover = self.cover if isinstance(self.cover, Unset) else (None, str(self.cover).encode(), "text/plain") + description = ( + (None, json.dumps(self.description.to_dict()).encode(), "application/json") if self.description else None + ) + + metadata: Union[Unset, Tuple[None, bytes, str]] = UNSET + if not isinstance(self.metadata, Unset): + metadata = (None, json.dumps(self.metadata.to_dict()).encode(), "application/json") + + field_dict: Dict[str, Any] = {} + field_dict.update( + {key: (None, str(value).encode(), "text/plain") for key, value in self.additional_properties.items()} + ) + field_dict.update( + { + "name": name, + "username": username, + "tags": tags, + "content_category": content_category, + "description": description, + } + ) + if cover is not UNSET: + field_dict["cover"] = cover + if metadata is not UNSET: + field_dict["metadata"] = metadata + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + name = d.pop("name") + + username = d.pop("username") + + tags = cast(List[str], d.pop("tags")) + + content_category = ContentCategoryEnum(d.pop("content_category")) + + cover = d.pop("cover", UNSET) + + _description = d.pop("description") + description: Optional[ContentRequest] + if _description is None: + description = None + else: + description = ContentRequest.from_dict(_description) + + _metadata = d.pop("metadata", UNSET) + metadata: Union[Unset, ChannelCreateRequestMetadata] + if isinstance(_metadata, Unset): + metadata = UNSET + else: + metadata = ChannelCreateRequestMetadata.from_dict(_metadata) + + channel_create_request = cls( + name=name, + username=username, + tags=tags, + content_category=content_category, + cover=cover, + description=description, + metadata=metadata, + ) + + channel_create_request.additional_properties = d + return channel_create_request + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/funkwhale_api_client/models/patched_channel_request_metadata.py b/funkwhale_api_client/models/channel_create_request_metadata.py similarity index 79% rename from funkwhale_api_client/models/patched_channel_request_metadata.py rename to funkwhale_api_client/models/channel_create_request_metadata.py index 46d2e43..60aeb84 100644 --- a/funkwhale_api_client/models/patched_channel_request_metadata.py +++ b/funkwhale_api_client/models/channel_create_request_metadata.py @@ -2,11 +2,11 @@ from typing import Any, Dict, List, Type, TypeVar import attr -T = TypeVar("T", bound="PatchedChannelRequestMetadata") +T = TypeVar("T", bound="ChannelCreateRequestMetadata") @attr.s(auto_attribs=True) -class PatchedChannelRequestMetadata: +class ChannelCreateRequestMetadata: """ """ additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) @@ -22,10 +22,10 @@ class PatchedChannelRequestMetadata: @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: d = src_dict.copy() - patched_channel_request_metadata = cls() + channel_create_request_metadata = cls() - patched_channel_request_metadata.additional_properties = d - return patched_channel_request_metadata + channel_create_request_metadata.additional_properties = d + return channel_create_request_metadata @property def additional_keys(self) -> List[str]: diff --git a/funkwhale_api_client/models/channel_request.py b/funkwhale_api_client/models/channel_request.py deleted file mode 100644 index 454f7f3..0000000 --- a/funkwhale_api_client/models/channel_request.py +++ /dev/null @@ -1,155 +0,0 @@ -import datetime -import json -from typing import Any, Dict, List, Tuple, Type, TypeVar, Union - -import attr -from dateutil.parser import isoparse - -from ..models.api_actor_request import APIActorRequest -from ..models.channel_request_metadata import ChannelRequestMetadata -from ..models.simple_artist_request import SimpleArtistRequest -from ..types import UNSET, Unset - -T = TypeVar("T", bound="ChannelRequest") - - -@attr.s(auto_attribs=True) -class ChannelRequest: - """ - Attributes: - artist (SimpleArtistRequest): - attributed_to (APIActorRequest): - rss_url (str): - uuid (Union[Unset, str]): - creation_date (Union[Unset, datetime.datetime]): - metadata (Union[Unset, ChannelRequestMetadata]): - """ - - artist: SimpleArtistRequest - attributed_to: APIActorRequest - rss_url: str - uuid: Union[Unset, str] = UNSET - creation_date: Union[Unset, datetime.datetime] = UNSET - metadata: Union[Unset, ChannelRequestMetadata] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) - - def to_dict(self) -> Dict[str, Any]: - artist = self.artist.to_dict() - - attributed_to = self.attributed_to.to_dict() - - rss_url = self.rss_url - uuid = self.uuid - creation_date: Union[Unset, str] = UNSET - if not isinstance(self.creation_date, Unset): - creation_date = self.creation_date.isoformat() - - metadata: Union[Unset, Dict[str, Any]] = UNSET - if not isinstance(self.metadata, Unset): - metadata = self.metadata.to_dict() - - field_dict: Dict[str, Any] = {} - field_dict.update(self.additional_properties) - field_dict.update( - { - "artist": artist, - "attributed_to": attributed_to, - "rss_url": rss_url, - } - ) - if uuid is not UNSET: - field_dict["uuid"] = uuid - if creation_date is not UNSET: - field_dict["creation_date"] = creation_date - if metadata is not UNSET: - field_dict["metadata"] = metadata - - return field_dict - - def to_multipart(self) -> Dict[str, Any]: - artist = (None, json.dumps(self.artist.to_dict()).encode(), "application/json") - - attributed_to = (None, json.dumps(self.attributed_to.to_dict()).encode(), "application/json") - - rss_url = self.rss_url if isinstance(self.rss_url, Unset) else (None, str(self.rss_url).encode(), "text/plain") - uuid = self.uuid if isinstance(self.uuid, Unset) else (None, str(self.uuid).encode(), "text/plain") - creation_date: Union[Unset, bytes] = UNSET - if not isinstance(self.creation_date, Unset): - creation_date = self.creation_date.isoformat().encode() - - metadata: Union[Unset, Tuple[None, bytes, str]] = UNSET - if not isinstance(self.metadata, Unset): - metadata = (None, json.dumps(self.metadata.to_dict()).encode(), "application/json") - - field_dict: Dict[str, Any] = {} - field_dict.update( - {key: (None, str(value).encode(), "text/plain") for key, value in self.additional_properties.items()} - ) - field_dict.update( - { - "artist": artist, - "attributed_to": attributed_to, - "rss_url": rss_url, - } - ) - if uuid is not UNSET: - field_dict["uuid"] = uuid - if creation_date is not UNSET: - field_dict["creation_date"] = creation_date - if metadata is not UNSET: - field_dict["metadata"] = metadata - - return field_dict - - @classmethod - def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: - d = src_dict.copy() - artist = SimpleArtistRequest.from_dict(d.pop("artist")) - - attributed_to = APIActorRequest.from_dict(d.pop("attributed_to")) - - rss_url = d.pop("rss_url") - - uuid = d.pop("uuid", UNSET) - - _creation_date = d.pop("creation_date", UNSET) - creation_date: Union[Unset, datetime.datetime] - if isinstance(_creation_date, Unset): - creation_date = UNSET - else: - creation_date = isoparse(_creation_date) - - _metadata = d.pop("metadata", UNSET) - metadata: Union[Unset, ChannelRequestMetadata] - if isinstance(_metadata, Unset): - metadata = UNSET - else: - metadata = ChannelRequestMetadata.from_dict(_metadata) - - channel_request = cls( - artist=artist, - attributed_to=attributed_to, - rss_url=rss_url, - uuid=uuid, - creation_date=creation_date, - metadata=metadata, - ) - - channel_request.additional_properties = d - return channel_request - - @property - def additional_keys(self) -> List[str]: - return list(self.additional_properties.keys()) - - def __getitem__(self, key: str) -> Any: - return self.additional_properties[key] - - def __setitem__(self, key: str, value: Any) -> None: - self.additional_properties[key] = value - - def __delitem__(self, key: str) -> None: - del self.additional_properties[key] - - def __contains__(self, key: str) -> bool: - return key in self.additional_properties diff --git a/funkwhale_api_client/models/channel_update.py b/funkwhale_api_client/models/channel_update.py new file mode 100644 index 0000000..372bbde --- /dev/null +++ b/funkwhale_api_client/models/channel_update.py @@ -0,0 +1,106 @@ +from typing import Any, Dict, List, Optional, Type, TypeVar, Union, cast + +import attr + +from ..models.channel_update_metadata import ChannelUpdateMetadata +from ..models.content import Content +from ..models.content_category_enum import ContentCategoryEnum +from ..types import UNSET, Unset + +T = TypeVar("T", bound="ChannelUpdate") + + +@attr.s(auto_attribs=True) +class ChannelUpdate: + """ + Attributes: + name (str): + tags (List[str]): + content_category (ContentCategoryEnum): + description (Optional[Content]): + metadata (Union[Unset, ChannelUpdateMetadata]): + """ + + name: str + tags: List[str] + content_category: ContentCategoryEnum + description: Optional[Content] + metadata: Union[Unset, ChannelUpdateMetadata] = UNSET + additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + name = self.name + tags = self.tags + + content_category = self.content_category.value + + description = self.description.to_dict() if self.description else None + + metadata: Union[Unset, Dict[str, Any]] = UNSET + if not isinstance(self.metadata, Unset): + metadata = self.metadata.to_dict() + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + "tags": tags, + "content_category": content_category, + "description": description, + } + ) + if metadata is not UNSET: + field_dict["metadata"] = metadata + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + name = d.pop("name") + + tags = cast(List[str], d.pop("tags")) + + content_category = ContentCategoryEnum(d.pop("content_category")) + + _description = d.pop("description") + description: Optional[Content] + if _description is None: + description = None + else: + description = Content.from_dict(_description) + + _metadata = d.pop("metadata", UNSET) + metadata: Union[Unset, ChannelUpdateMetadata] + if isinstance(_metadata, Unset): + metadata = UNSET + else: + metadata = ChannelUpdateMetadata.from_dict(_metadata) + + channel_update = cls( + name=name, + tags=tags, + content_category=content_category, + description=description, + metadata=metadata, + ) + + channel_update.additional_properties = d + return channel_update + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/funkwhale_api_client/models/channel_update_metadata.py b/funkwhale_api_client/models/channel_update_metadata.py new file mode 100644 index 0000000..9016a9e --- /dev/null +++ b/funkwhale_api_client/models/channel_update_metadata.py @@ -0,0 +1,44 @@ +from typing import Any, Dict, List, Type, TypeVar + +import attr + +T = TypeVar("T", bound="ChannelUpdateMetadata") + + +@attr.s(auto_attribs=True) +class ChannelUpdateMetadata: + """ """ + + additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + channel_update_metadata = cls() + + channel_update_metadata.additional_properties = d + return channel_update_metadata + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/funkwhale_api_client/models/channel_update_request.py b/funkwhale_api_client/models/channel_update_request.py new file mode 100644 index 0000000..095dac4 --- /dev/null +++ b/funkwhale_api_client/models/channel_update_request.py @@ -0,0 +1,150 @@ +import json +from typing import Any, Dict, List, Optional, Tuple, Type, TypeVar, Union, cast + +import attr + +from ..models.channel_update_request_metadata import ChannelUpdateRequestMetadata +from ..models.content_category_enum import ContentCategoryEnum +from ..models.content_request import ContentRequest +from ..types import UNSET, Unset + +T = TypeVar("T", bound="ChannelUpdateRequest") + + +@attr.s(auto_attribs=True) +class ChannelUpdateRequest: + """ + Attributes: + name (str): + tags (List[str]): + content_category (ContentCategoryEnum): + cover (Union[Unset, None, str]): + description (Optional[ContentRequest]): + metadata (Union[Unset, ChannelUpdateRequestMetadata]): + """ + + name: str + tags: List[str] + content_category: ContentCategoryEnum + description: Optional[ContentRequest] + cover: Union[Unset, None, str] = UNSET + metadata: Union[Unset, ChannelUpdateRequestMetadata] = UNSET + additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + name = self.name + tags = self.tags + + content_category = self.content_category.value + + cover = self.cover + description = self.description.to_dict() if self.description else None + + metadata: Union[Unset, Dict[str, Any]] = UNSET + if not isinstance(self.metadata, Unset): + metadata = self.metadata.to_dict() + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + "tags": tags, + "content_category": content_category, + "description": description, + } + ) + if cover is not UNSET: + field_dict["cover"] = cover + if metadata is not UNSET: + field_dict["metadata"] = metadata + + return field_dict + + def to_multipart(self) -> Dict[str, Any]: + name = self.name if isinstance(self.name, Unset) else (None, str(self.name).encode(), "text/plain") + _temp_tags = self.tags + tags = (None, json.dumps(_temp_tags).encode(), "application/json") + + content_category = (None, str(self.content_category.value).encode(), "text/plain") + + cover = self.cover if isinstance(self.cover, Unset) else (None, str(self.cover).encode(), "text/plain") + description = ( + (None, json.dumps(self.description.to_dict()).encode(), "application/json") if self.description else None + ) + + metadata: Union[Unset, Tuple[None, bytes, str]] = UNSET + if not isinstance(self.metadata, Unset): + metadata = (None, json.dumps(self.metadata.to_dict()).encode(), "application/json") + + field_dict: Dict[str, Any] = {} + field_dict.update( + {key: (None, str(value).encode(), "text/plain") for key, value in self.additional_properties.items()} + ) + field_dict.update( + { + "name": name, + "tags": tags, + "content_category": content_category, + "description": description, + } + ) + if cover is not UNSET: + field_dict["cover"] = cover + if metadata is not UNSET: + field_dict["metadata"] = metadata + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + name = d.pop("name") + + tags = cast(List[str], d.pop("tags")) + + content_category = ContentCategoryEnum(d.pop("content_category")) + + cover = d.pop("cover", UNSET) + + _description = d.pop("description") + description: Optional[ContentRequest] + if _description is None: + description = None + else: + description = ContentRequest.from_dict(_description) + + _metadata = d.pop("metadata", UNSET) + metadata: Union[Unset, ChannelUpdateRequestMetadata] + if isinstance(_metadata, Unset): + metadata = UNSET + else: + metadata = ChannelUpdateRequestMetadata.from_dict(_metadata) + + channel_update_request = cls( + name=name, + tags=tags, + content_category=content_category, + cover=cover, + description=description, + metadata=metadata, + ) + + channel_update_request.additional_properties = d + return channel_update_request + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/funkwhale_api_client/models/channel_update_request_metadata.py b/funkwhale_api_client/models/channel_update_request_metadata.py new file mode 100644 index 0000000..141626f --- /dev/null +++ b/funkwhale_api_client/models/channel_update_request_metadata.py @@ -0,0 +1,44 @@ +from typing import Any, Dict, List, Type, TypeVar + +import attr + +T = TypeVar("T", bound="ChannelUpdateRequestMetadata") + + +@attr.s(auto_attribs=True) +class ChannelUpdateRequestMetadata: + """ """ + + additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + channel_update_request_metadata = cls() + + channel_update_request_metadata.additional_properties = d + return channel_update_request_metadata + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/funkwhale_api_client/models/patched_channel_request.py b/funkwhale_api_client/models/patched_channel_request.py deleted file mode 100644 index afcf9f6..0000000 --- a/funkwhale_api_client/models/patched_channel_request.py +++ /dev/null @@ -1,175 +0,0 @@ -import datetime -import json -from typing import Any, Dict, List, Tuple, Type, TypeVar, Union - -import attr -from dateutil.parser import isoparse - -from ..models.api_actor_request import APIActorRequest -from ..models.patched_channel_request_metadata import PatchedChannelRequestMetadata -from ..models.simple_artist_request import SimpleArtistRequest -from ..types import UNSET, Unset - -T = TypeVar("T", bound="PatchedChannelRequest") - - -@attr.s(auto_attribs=True) -class PatchedChannelRequest: - """ - Attributes: - uuid (Union[Unset, str]): - artist (Union[Unset, SimpleArtistRequest]): - attributed_to (Union[Unset, APIActorRequest]): - creation_date (Union[Unset, datetime.datetime]): - metadata (Union[Unset, PatchedChannelRequestMetadata]): - rss_url (Union[Unset, str]): - """ - - uuid: Union[Unset, str] = UNSET - artist: Union[Unset, SimpleArtistRequest] = UNSET - attributed_to: Union[Unset, APIActorRequest] = UNSET - creation_date: Union[Unset, datetime.datetime] = UNSET - metadata: Union[Unset, PatchedChannelRequestMetadata] = UNSET - rss_url: Union[Unset, str] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) - - def to_dict(self) -> Dict[str, Any]: - uuid = self.uuid - artist: Union[Unset, Dict[str, Any]] = UNSET - if not isinstance(self.artist, Unset): - artist = self.artist.to_dict() - - attributed_to: Union[Unset, Dict[str, Any]] = UNSET - if not isinstance(self.attributed_to, Unset): - attributed_to = self.attributed_to.to_dict() - - creation_date: Union[Unset, str] = UNSET - if not isinstance(self.creation_date, Unset): - creation_date = self.creation_date.isoformat() - - metadata: Union[Unset, Dict[str, Any]] = UNSET - if not isinstance(self.metadata, Unset): - metadata = self.metadata.to_dict() - - rss_url = self.rss_url - - field_dict: Dict[str, Any] = {} - field_dict.update(self.additional_properties) - field_dict.update({}) - if uuid is not UNSET: - field_dict["uuid"] = uuid - if artist is not UNSET: - field_dict["artist"] = artist - if attributed_to is not UNSET: - field_dict["attributed_to"] = attributed_to - if creation_date is not UNSET: - field_dict["creation_date"] = creation_date - if metadata is not UNSET: - field_dict["metadata"] = metadata - if rss_url is not UNSET: - field_dict["rss_url"] = rss_url - - return field_dict - - def to_multipart(self) -> Dict[str, Any]: - uuid = self.uuid if isinstance(self.uuid, Unset) else (None, str(self.uuid).encode(), "text/plain") - artist: Union[Unset, Tuple[None, bytes, str]] = UNSET - if not isinstance(self.artist, Unset): - artist = (None, json.dumps(self.artist.to_dict()).encode(), "application/json") - - attributed_to: Union[Unset, Tuple[None, bytes, str]] = UNSET - if not isinstance(self.attributed_to, Unset): - attributed_to = (None, json.dumps(self.attributed_to.to_dict()).encode(), "application/json") - - creation_date: Union[Unset, bytes] = UNSET - if not isinstance(self.creation_date, Unset): - creation_date = self.creation_date.isoformat().encode() - - metadata: Union[Unset, Tuple[None, bytes, str]] = UNSET - if not isinstance(self.metadata, Unset): - metadata = (None, json.dumps(self.metadata.to_dict()).encode(), "application/json") - - rss_url = self.rss_url if isinstance(self.rss_url, Unset) else (None, str(self.rss_url).encode(), "text/plain") - - field_dict: Dict[str, Any] = {} - field_dict.update( - {key: (None, str(value).encode(), "text/plain") for key, value in self.additional_properties.items()} - ) - field_dict.update({}) - if uuid is not UNSET: - field_dict["uuid"] = uuid - if artist is not UNSET: - field_dict["artist"] = artist - if attributed_to is not UNSET: - field_dict["attributed_to"] = attributed_to - if creation_date is not UNSET: - field_dict["creation_date"] = creation_date - if metadata is not UNSET: - field_dict["metadata"] = metadata - if rss_url is not UNSET: - field_dict["rss_url"] = rss_url - - return field_dict - - @classmethod - def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: - d = src_dict.copy() - uuid = d.pop("uuid", UNSET) - - _artist = d.pop("artist", UNSET) - artist: Union[Unset, SimpleArtistRequest] - if isinstance(_artist, Unset): - artist = UNSET - else: - artist = SimpleArtistRequest.from_dict(_artist) - - _attributed_to = d.pop("attributed_to", UNSET) - attributed_to: Union[Unset, APIActorRequest] - if isinstance(_attributed_to, Unset): - attributed_to = UNSET - else: - attributed_to = APIActorRequest.from_dict(_attributed_to) - - _creation_date = d.pop("creation_date", UNSET) - creation_date: Union[Unset, datetime.datetime] - if isinstance(_creation_date, Unset): - creation_date = UNSET - else: - creation_date = isoparse(_creation_date) - - _metadata = d.pop("metadata", UNSET) - metadata: Union[Unset, PatchedChannelRequestMetadata] - if isinstance(_metadata, Unset): - metadata = UNSET - else: - metadata = PatchedChannelRequestMetadata.from_dict(_metadata) - - rss_url = d.pop("rss_url", UNSET) - - patched_channel_request = cls( - uuid=uuid, - artist=artist, - attributed_to=attributed_to, - creation_date=creation_date, - metadata=metadata, - rss_url=rss_url, - ) - - patched_channel_request.additional_properties = d - return patched_channel_request - - @property - def additional_keys(self) -> List[str]: - return list(self.additional_properties.keys()) - - def __getitem__(self, key: str) -> Any: - return self.additional_properties[key] - - def __setitem__(self, key: str, value: Any) -> None: - self.additional_properties[key] = value - - def __delitem__(self, key: str) -> None: - del self.additional_properties[key] - - def __contains__(self, key: str) -> bool: - return key in self.additional_properties diff --git a/funkwhale_api_client/models/patched_channel_update_request.py b/funkwhale_api_client/models/patched_channel_update_request.py new file mode 100644 index 0000000..c0f5de0 --- /dev/null +++ b/funkwhale_api_client/models/patched_channel_update_request.py @@ -0,0 +1,173 @@ +import json +from typing import Any, Dict, List, Tuple, Type, TypeVar, Union, cast + +import attr + +from ..models.content_category_enum import ContentCategoryEnum +from ..models.content_request import ContentRequest +from ..models.patched_channel_update_request_metadata import PatchedChannelUpdateRequestMetadata +from ..types import UNSET, Unset + +T = TypeVar("T", bound="PatchedChannelUpdateRequest") + + +@attr.s(auto_attribs=True) +class PatchedChannelUpdateRequest: + """ + Attributes: + cover (Union[Unset, None, str]): + name (Union[Unset, str]): + description (Union[Unset, None, ContentRequest]): + tags (Union[Unset, List[str]]): + content_category (Union[Unset, ContentCategoryEnum]): + metadata (Union[Unset, PatchedChannelUpdateRequestMetadata]): + """ + + cover: Union[Unset, None, str] = UNSET + name: Union[Unset, str] = UNSET + description: Union[Unset, None, ContentRequest] = UNSET + tags: Union[Unset, List[str]] = UNSET + content_category: Union[Unset, ContentCategoryEnum] = UNSET + metadata: Union[Unset, PatchedChannelUpdateRequestMetadata] = UNSET + additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + cover = self.cover + name = self.name + description: Union[Unset, None, Dict[str, Any]] = UNSET + if not isinstance(self.description, Unset): + description = self.description.to_dict() if self.description else None + + tags: Union[Unset, List[str]] = UNSET + if not isinstance(self.tags, Unset): + tags = self.tags + + content_category: Union[Unset, str] = UNSET + if not isinstance(self.content_category, Unset): + content_category = self.content_category.value + + metadata: Union[Unset, Dict[str, Any]] = UNSET + if not isinstance(self.metadata, Unset): + metadata = self.metadata.to_dict() + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if cover is not UNSET: + field_dict["cover"] = cover + if name is not UNSET: + field_dict["name"] = name + if description is not UNSET: + field_dict["description"] = description + if tags is not UNSET: + field_dict["tags"] = tags + if content_category is not UNSET: + field_dict["content_category"] = content_category + if metadata is not UNSET: + field_dict["metadata"] = metadata + + return field_dict + + def to_multipart(self) -> Dict[str, Any]: + cover = self.cover if isinstance(self.cover, Unset) else (None, str(self.cover).encode(), "text/plain") + name = self.name if isinstance(self.name, Unset) else (None, str(self.name).encode(), "text/plain") + description: Union[Unset, Tuple[None, bytes, str]] = UNSET + if not isinstance(self.description, Unset): + description = ( + (None, json.dumps(self.description.to_dict()).encode(), "application/json") + if self.description + else None + ) + + tags: Union[Unset, Tuple[None, bytes, str]] = UNSET + if not isinstance(self.tags, Unset): + _temp_tags = self.tags + tags = (None, json.dumps(_temp_tags).encode(), "application/json") + + content_category: Union[Unset, Tuple[None, bytes, str]] = UNSET + if not isinstance(self.content_category, Unset): + content_category = (None, str(self.content_category.value).encode(), "text/plain") + + metadata: Union[Unset, Tuple[None, bytes, str]] = UNSET + if not isinstance(self.metadata, Unset): + metadata = (None, json.dumps(self.metadata.to_dict()).encode(), "application/json") + + field_dict: Dict[str, Any] = {} + field_dict.update( + {key: (None, str(value).encode(), "text/plain") for key, value in self.additional_properties.items()} + ) + field_dict.update({}) + if cover is not UNSET: + field_dict["cover"] = cover + if name is not UNSET: + field_dict["name"] = name + if description is not UNSET: + field_dict["description"] = description + if tags is not UNSET: + field_dict["tags"] = tags + if content_category is not UNSET: + field_dict["content_category"] = content_category + if metadata is not UNSET: + field_dict["metadata"] = metadata + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + cover = d.pop("cover", UNSET) + + name = d.pop("name", UNSET) + + _description = d.pop("description", UNSET) + description: Union[Unset, None, ContentRequest] + if _description is None: + description = None + elif isinstance(_description, Unset): + description = UNSET + else: + description = ContentRequest.from_dict(_description) + + tags = cast(List[str], d.pop("tags", UNSET)) + + _content_category = d.pop("content_category", UNSET) + content_category: Union[Unset, ContentCategoryEnum] + if isinstance(_content_category, Unset): + content_category = UNSET + else: + content_category = ContentCategoryEnum(_content_category) + + _metadata = d.pop("metadata", UNSET) + metadata: Union[Unset, PatchedChannelUpdateRequestMetadata] + if isinstance(_metadata, Unset): + metadata = UNSET + else: + metadata = PatchedChannelUpdateRequestMetadata.from_dict(_metadata) + + patched_channel_update_request = cls( + cover=cover, + name=name, + description=description, + tags=tags, + content_category=content_category, + metadata=metadata, + ) + + patched_channel_update_request.additional_properties = d + return patched_channel_update_request + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/funkwhale_api_client/models/patched_channel_update_request_metadata.py b/funkwhale_api_client/models/patched_channel_update_request_metadata.py new file mode 100644 index 0000000..38b7c7d --- /dev/null +++ b/funkwhale_api_client/models/patched_channel_update_request_metadata.py @@ -0,0 +1,44 @@ +from typing import Any, Dict, List, Type, TypeVar + +import attr + +T = TypeVar("T", bound="PatchedChannelUpdateRequestMetadata") + + +@attr.s(auto_attribs=True) +class PatchedChannelUpdateRequestMetadata: + """ """ + + additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + patched_channel_update_request_metadata = cls() + + patched_channel_update_request_metadata.additional_properties = d + return patched_channel_update_request_metadata + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties -- GitLab