Skip to content
Snippets Groups Projects
Verified Commit 33081110 authored by Georg Krause's avatar Georg Krause
Browse files

Fix upload functions

parent ebbec5f2
No related branches found
No related tags found
1 merge request!1Add basic model tests
...@@ -16,6 +16,7 @@ T = TypeVar("T", bound="PatchedUploadForOwnerRequest") ...@@ -16,6 +16,7 @@ T = TypeVar("T", bound="PatchedUploadForOwnerRequest")
class PatchedUploadForOwnerRequest: class PatchedUploadForOwnerRequest:
""" """
Attributes: Attributes:
filename (Union[Unset, str]):
track (Union[Unset, None, TrackRequest]): track (Union[Unset, None, TrackRequest]):
library (Union[Unset, str]): library (Union[Unset, str]):
channel (Union[Unset, str]): channel (Union[Unset, str]):
...@@ -26,6 +27,7 @@ class PatchedUploadForOwnerRequest: ...@@ -26,6 +27,7 @@ class PatchedUploadForOwnerRequest:
audio_file (Union[Unset, File]): audio_file (Union[Unset, File]):
""" """
filename: Union[Unset, str] = UNSET
track: Union[Unset, None, TrackRequest] = UNSET track: Union[Unset, None, TrackRequest] = UNSET
library: Union[Unset, str] = UNSET library: Union[Unset, str] = UNSET
channel: Union[Unset, str] = UNSET channel: Union[Unset, str] = UNSET
...@@ -37,6 +39,7 @@ class PatchedUploadForOwnerRequest: ...@@ -37,6 +39,7 @@ class PatchedUploadForOwnerRequest:
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
filename = self.filename
track: Union[Unset, None, Dict[str, Any]] = UNSET track: Union[Unset, None, Dict[str, Any]] = UNSET
if not isinstance(self.track, Unset): if not isinstance(self.track, Unset):
track = self.track.to_dict() if self.track else None track = self.track.to_dict() if self.track else None
...@@ -60,6 +63,8 @@ class PatchedUploadForOwnerRequest: ...@@ -60,6 +63,8 @@ class PatchedUploadForOwnerRequest:
field_dict: Dict[str, Any] = {} field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties) field_dict.update(self.additional_properties)
field_dict.update({}) field_dict.update({})
if filename is not UNSET:
field_dict["filename"] = filename
if track is not UNSET: if track is not UNSET:
field_dict["track"] = track field_dict["track"] = track
if library is not UNSET: if library is not UNSET:
...@@ -80,6 +85,9 @@ class PatchedUploadForOwnerRequest: ...@@ -80,6 +85,9 @@ class PatchedUploadForOwnerRequest:
return field_dict return field_dict
def to_multipart(self) -> Dict[str, Any]: def to_multipart(self) -> Dict[str, Any]:
filename = (
self.filename if isinstance(self.filename, Unset) else (None, str(self.filename).encode(), "text/plain")
)
track: Union[Unset, Tuple[None, bytes, str]] = UNSET track: Union[Unset, Tuple[None, bytes, str]] = UNSET
if not isinstance(self.track, Unset): if not isinstance(self.track, Unset):
track = (None, json.dumps(self.track.to_dict()).encode(), "application/json") if self.track else None track = (None, json.dumps(self.track.to_dict()).encode(), "application/json") if self.track else None
...@@ -109,6 +117,8 @@ class PatchedUploadForOwnerRequest: ...@@ -109,6 +117,8 @@ class PatchedUploadForOwnerRequest:
{key: (None, str(value).encode(), "text/plain") for key, value in self.additional_properties.items()} {key: (None, str(value).encode(), "text/plain") for key, value in self.additional_properties.items()}
) )
field_dict.update({}) field_dict.update({})
if filename is not UNSET:
field_dict["filename"] = filename
if track is not UNSET: if track is not UNSET:
field_dict["track"] = track field_dict["track"] = track
if library is not UNSET: if library is not UNSET:
...@@ -131,6 +141,8 @@ class PatchedUploadForOwnerRequest: ...@@ -131,6 +141,8 @@ class PatchedUploadForOwnerRequest:
@classmethod @classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy() d = src_dict.copy()
filename = d.pop("filename", UNSET)
_track = d.pop("track", UNSET) _track = d.pop("track", UNSET)
track: Union[Unset, None, TrackRequest] track: Union[Unset, None, TrackRequest]
if _track is None: if _track is None:
...@@ -170,6 +182,7 @@ class PatchedUploadForOwnerRequest: ...@@ -170,6 +182,7 @@ class PatchedUploadForOwnerRequest:
audio_file = File(payload=BytesIO(_audio_file)) audio_file = File(payload=BytesIO(_audio_file))
patched_upload_for_owner_request = cls( patched_upload_for_owner_request = cls(
filename=filename,
track=track, track=track,
library=library, library=library,
channel=channel, channel=channel,
......
...@@ -19,10 +19,10 @@ class UploadForOwner: ...@@ -19,10 +19,10 @@ class UploadForOwner:
""" """
Attributes: Attributes:
uuid (str): uuid (str):
filename (str):
creation_date (datetime.datetime): creation_date (datetime.datetime):
import_details (UploadForOwnerImportDetails): import_details (UploadForOwnerImportDetails):
metadata (UploadForOwnerMetadata): metadata (UploadForOwnerMetadata):
filename (Union[Unset, str]):
mimetype (Optional[str]): mimetype (Optional[str]):
track (Union[Unset, None, Track]): track (Union[Unset, None, Track]):
library (Union[Unset, str]): library (Union[Unset, str]):
...@@ -38,7 +38,6 @@ class UploadForOwner: ...@@ -38,7 +38,6 @@ class UploadForOwner:
""" """
uuid: str uuid: str
filename: str
creation_date: datetime.datetime creation_date: datetime.datetime
import_details: UploadForOwnerImportDetails import_details: UploadForOwnerImportDetails
metadata: UploadForOwnerMetadata metadata: UploadForOwnerMetadata
...@@ -47,6 +46,7 @@ class UploadForOwner: ...@@ -47,6 +46,7 @@ class UploadForOwner:
bitrate: Optional[int] bitrate: Optional[int]
size: Optional[int] size: Optional[int]
import_date: Optional[datetime.datetime] import_date: Optional[datetime.datetime]
filename: Union[Unset, str] = UNSET
track: Union[Unset, None, Track] = UNSET track: Union[Unset, None, Track] = UNSET
library: Union[Unset, str] = UNSET library: Union[Unset, str] = UNSET
channel: Union[Unset, str] = UNSET channel: Union[Unset, str] = UNSET
...@@ -58,13 +58,13 @@ class UploadForOwner: ...@@ -58,13 +58,13 @@ class UploadForOwner:
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
uuid = self.uuid uuid = self.uuid
filename = self.filename
creation_date = self.creation_date.isoformat() creation_date = self.creation_date.isoformat()
import_details = self.import_details.to_dict() import_details = self.import_details.to_dict()
metadata = self.metadata.to_dict() metadata = self.metadata.to_dict()
filename = self.filename
mimetype = self.mimetype mimetype = self.mimetype
track: Union[Unset, None, Dict[str, Any]] = UNSET track: Union[Unset, None, Dict[str, Any]] = UNSET
if not isinstance(self.track, Unset): if not isinstance(self.track, Unset):
...@@ -93,7 +93,6 @@ class UploadForOwner: ...@@ -93,7 +93,6 @@ class UploadForOwner:
field_dict.update( field_dict.update(
{ {
"uuid": uuid, "uuid": uuid,
"filename": filename,
"creation_date": creation_date, "creation_date": creation_date,
"import_details": import_details, "import_details": import_details,
"metadata": metadata, "metadata": metadata,
...@@ -104,6 +103,8 @@ class UploadForOwner: ...@@ -104,6 +103,8 @@ class UploadForOwner:
"import_date": import_date, "import_date": import_date,
} }
) )
if filename is not UNSET:
field_dict["filename"] = filename
if track is not UNSET: if track is not UNSET:
field_dict["track"] = track field_dict["track"] = track
if library is not UNSET: if library is not UNSET:
...@@ -126,14 +127,14 @@ class UploadForOwner: ...@@ -126,14 +127,14 @@ class UploadForOwner:
d = src_dict.copy() d = src_dict.copy()
uuid = d.pop("uuid") uuid = d.pop("uuid")
filename = d.pop("filename")
creation_date = isoparse(d.pop("creation_date")) creation_date = isoparse(d.pop("creation_date"))
import_details = UploadForOwnerImportDetails.from_dict(d.pop("import_details")) import_details = UploadForOwnerImportDetails.from_dict(d.pop("import_details"))
metadata = UploadForOwnerMetadata.from_dict(d.pop("metadata")) metadata = UploadForOwnerMetadata.from_dict(d.pop("metadata"))
filename = d.pop("filename", UNSET)
mimetype = d.pop("mimetype") mimetype = d.pop("mimetype")
_track = d.pop("track", UNSET) _track = d.pop("track", UNSET)
...@@ -182,10 +183,10 @@ class UploadForOwner: ...@@ -182,10 +183,10 @@ class UploadForOwner:
upload_for_owner = cls( upload_for_owner = cls(
uuid=uuid, uuid=uuid,
filename=filename,
creation_date=creation_date, creation_date=creation_date,
import_details=import_details, import_details=import_details,
metadata=metadata, metadata=metadata,
filename=filename,
mimetype=mimetype, mimetype=mimetype,
track=track, track=track,
library=library, library=library,
......
...@@ -17,6 +17,7 @@ class UploadForOwnerRequest: ...@@ -17,6 +17,7 @@ class UploadForOwnerRequest:
""" """
Attributes: Attributes:
audio_file (File): audio_file (File):
filename (Union[Unset, str]):
track (Union[Unset, None, TrackRequest]): track (Union[Unset, None, TrackRequest]):
library (Union[Unset, str]): library (Union[Unset, str]):
channel (Union[Unset, str]): channel (Union[Unset, str]):
...@@ -27,6 +28,7 @@ class UploadForOwnerRequest: ...@@ -27,6 +28,7 @@ class UploadForOwnerRequest:
""" """
audio_file: File audio_file: File
filename: Union[Unset, str] = UNSET
track: Union[Unset, None, TrackRequest] = UNSET track: Union[Unset, None, TrackRequest] = UNSET
library: Union[Unset, str] = UNSET library: Union[Unset, str] = UNSET
channel: Union[Unset, str] = UNSET channel: Union[Unset, str] = UNSET
...@@ -39,6 +41,7 @@ class UploadForOwnerRequest: ...@@ -39,6 +41,7 @@ class UploadForOwnerRequest:
def to_dict(self) -> Dict[str, Any]: def to_dict(self) -> Dict[str, Any]:
audio_file = self.audio_file.to_tuple() audio_file = self.audio_file.to_tuple()
filename = self.filename
track: Union[Unset, None, Dict[str, Any]] = UNSET track: Union[Unset, None, Dict[str, Any]] = UNSET
if not isinstance(self.track, Unset): if not isinstance(self.track, Unset):
track = self.track.to_dict() if self.track else None track = self.track.to_dict() if self.track else None
...@@ -63,6 +66,8 @@ class UploadForOwnerRequest: ...@@ -63,6 +66,8 @@ class UploadForOwnerRequest:
"audio_file": audio_file, "audio_file": audio_file,
} }
) )
if filename is not UNSET:
field_dict["filename"] = filename
if track is not UNSET: if track is not UNSET:
field_dict["track"] = track field_dict["track"] = track
if library is not UNSET: if library is not UNSET:
...@@ -83,6 +88,9 @@ class UploadForOwnerRequest: ...@@ -83,6 +88,9 @@ class UploadForOwnerRequest:
def to_multipart(self) -> Dict[str, Any]: def to_multipart(self) -> Dict[str, Any]:
audio_file = self.audio_file.to_tuple() audio_file = self.audio_file.to_tuple()
filename = (
self.filename if isinstance(self.filename, Unset) else (None, str(self.filename).encode(), "text/plain")
)
track: Union[Unset, Tuple[None, bytes, str]] = UNSET track: Union[Unset, Tuple[None, bytes, str]] = UNSET
if not isinstance(self.track, Unset): if not isinstance(self.track, Unset):
track = (None, json.dumps(self.track.to_dict()).encode(), "application/json") if self.track else None track = (None, json.dumps(self.track.to_dict()).encode(), "application/json") if self.track else None
...@@ -113,6 +121,8 @@ class UploadForOwnerRequest: ...@@ -113,6 +121,8 @@ class UploadForOwnerRequest:
"audio_file": audio_file, "audio_file": audio_file,
} }
) )
if filename is not UNSET:
field_dict["filename"] = filename
if track is not UNSET: if track is not UNSET:
field_dict["track"] = track field_dict["track"] = track
if library is not UNSET: if library is not UNSET:
...@@ -135,6 +145,8 @@ class UploadForOwnerRequest: ...@@ -135,6 +145,8 @@ class UploadForOwnerRequest:
d = src_dict.copy() d = src_dict.copy()
audio_file = File(payload=BytesIO(d.pop("audio_file"))) audio_file = File(payload=BytesIO(d.pop("audio_file")))
filename = d.pop("filename", UNSET)
_track = d.pop("track", UNSET) _track = d.pop("track", UNSET)
track: Union[Unset, None, TrackRequest] track: Union[Unset, None, TrackRequest]
if _track is None: if _track is None:
...@@ -168,6 +180,7 @@ class UploadForOwnerRequest: ...@@ -168,6 +180,7 @@ class UploadForOwnerRequest:
upload_for_owner_request = cls( upload_for_owner_request = cls(
audio_file=audio_file, audio_file=audio_file,
filename=filename,
track=track, track=track,
library=library, library=library,
channel=channel, channel=channel,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment