beetkeeper-api-client 0.12.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- beetkeeper_api_client/__init__.py +112 -0
- beetkeeper_api_client/_scm_version.py +1 -0
- beetkeeper_api_client/api/__init__.py +9 -0
- beetkeeper_api_client/api/authentication_api.py +758 -0
- beetkeeper_api_client/api/events_api.py +1663 -0
- beetkeeper_api_client/api/imports_api.py +3134 -0
- beetkeeper_api_client/api/monitoring_api.py +377 -0
- beetkeeper_api_client/api/query_api.py +1250 -0
- beetkeeper_api_client/api_client.py +845 -0
- beetkeeper_api_client/api_response.py +21 -0
- beetkeeper_api_client/configuration.py +604 -0
- beetkeeper_api_client/exceptions.py +218 -0
- beetkeeper_api_client/models/__init__.py +44 -0
- beetkeeper_api_client/models/api_album.py +285 -0
- beetkeeper_api_client/models/api_track.py +528 -0
- beetkeeper_api_client/models/beets_event_type.py +40 -0
- beetkeeper_api_client/models/clean_slate_preview.py +147 -0
- beetkeeper_api_client/models/clean_slate_submit_request.py +116 -0
- beetkeeper_api_client/models/current_beets_subject_state.py +140 -0
- beetkeeper_api_client/models/decision_request.py +104 -0
- beetkeeper_api_client/models/event_search_response.py +97 -0
- beetkeeper_api_client/models/event_search_result.py +107 -0
- beetkeeper_api_client/models/event_subject_summary.py +100 -0
- beetkeeper_api_client/models/events_list_response.py +95 -0
- beetkeeper_api_client/models/find_missing_source_path_request.py +100 -0
- beetkeeper_api_client/models/find_missing_source_path_response.py +108 -0
- beetkeeper_api_client/models/health_info.py +101 -0
- beetkeeper_api_client/models/http_validation_error.py +95 -0
- beetkeeper_api_client/models/import_action.py +38 -0
- beetkeeper_api_client/models/import_candidate.py +171 -0
- beetkeeper_api_client/models/import_decision.py +96 -0
- beetkeeper_api_client/models/import_job.py +162 -0
- beetkeeper_api_client/models/import_job_status.py +41 -0
- beetkeeper_api_client/models/import_submit_request.py +104 -0
- beetkeeper_api_client/models/listener_event_details.py +121 -0
- beetkeeper_api_client/models/location_inner.py +138 -0
- beetkeeper_api_client/models/login_request_body.py +90 -0
- beetkeeper_api_client/models/login_response_body.py +100 -0
- beetkeeper_api_client/models/logout_response_body.py +88 -0
- beetkeeper_api_client/models/search_missing_source_path_result.py +106 -0
- beetkeeper_api_client/models/validation_error.py +108 -0
- beetkeeper_api_client/py.typed +0 -0
- beetkeeper_api_client/rest.py +201 -0
- beetkeeper_api_client/sync_helper.py +57 -0
- beetkeeper_api_client-0.12.0.dist-info/METADATA +34 -0
- beetkeeper_api_client-0.12.0.dist-info/RECORD +48 -0
- beetkeeper_api_client-0.12.0.dist-info/WHEEL +5 -0
- beetkeeper_api_client-0.12.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"""
|
|
2
|
+
beetkeeper
|
|
3
|
+
|
|
4
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document:
|
|
7
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
8
|
+
|
|
9
|
+
Do not edit the class manually.
|
|
10
|
+
""" # noqa: E501
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
from typing import Any, Optional
|
|
14
|
+
from typing_extensions import Self
|
|
15
|
+
|
|
16
|
+
class OpenApiException(Exception):
|
|
17
|
+
"""The base exception class for all OpenAPIExceptions"""
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class ApiTypeError(OpenApiException, TypeError):
|
|
21
|
+
def __init__(self, msg, path_to_item=None, valid_classes=None,
|
|
22
|
+
key_type=None) -> None:
|
|
23
|
+
""" Raises an exception for TypeErrors
|
|
24
|
+
|
|
25
|
+
Args:
|
|
26
|
+
msg (str): the exception message
|
|
27
|
+
|
|
28
|
+
Keyword Args:
|
|
29
|
+
path_to_item (list): a list of keys an indices to get to the
|
|
30
|
+
current_item
|
|
31
|
+
None if unset
|
|
32
|
+
valid_classes (tuple): the primitive classes that current item
|
|
33
|
+
should be an instance of
|
|
34
|
+
None if unset
|
|
35
|
+
key_type (bool): False if our value is a value in a dict
|
|
36
|
+
True if it is a key in a dict
|
|
37
|
+
False if our item is an item in a list
|
|
38
|
+
None if unset
|
|
39
|
+
"""
|
|
40
|
+
self.path_to_item = path_to_item
|
|
41
|
+
self.valid_classes = valid_classes
|
|
42
|
+
self.key_type = key_type
|
|
43
|
+
full_msg = msg
|
|
44
|
+
if path_to_item:
|
|
45
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
46
|
+
super(ApiTypeError, self).__init__(full_msg)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class ApiValueError(OpenApiException, ValueError):
|
|
50
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
|
51
|
+
"""
|
|
52
|
+
Args:
|
|
53
|
+
msg (str): the exception message
|
|
54
|
+
|
|
55
|
+
Keyword Args:
|
|
56
|
+
path_to_item (list) the path to the exception in the
|
|
57
|
+
received_data dict. None if unset
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
self.path_to_item = path_to_item
|
|
61
|
+
full_msg = msg
|
|
62
|
+
if path_to_item:
|
|
63
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
64
|
+
super(ApiValueError, self).__init__(full_msg)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class ApiAttributeError(OpenApiException, AttributeError):
|
|
68
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
|
69
|
+
"""
|
|
70
|
+
Raised when an attribute reference or assignment fails.
|
|
71
|
+
|
|
72
|
+
Args:
|
|
73
|
+
msg (str): the exception message
|
|
74
|
+
|
|
75
|
+
Keyword Args:
|
|
76
|
+
path_to_item (None/list) the path to the exception in the
|
|
77
|
+
received_data dict
|
|
78
|
+
"""
|
|
79
|
+
self.path_to_item = path_to_item
|
|
80
|
+
full_msg = msg
|
|
81
|
+
if path_to_item:
|
|
82
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
83
|
+
super(ApiAttributeError, self).__init__(full_msg)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class ApiKeyError(OpenApiException, KeyError):
|
|
87
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
|
88
|
+
"""
|
|
89
|
+
Args:
|
|
90
|
+
msg (str): the exception message
|
|
91
|
+
|
|
92
|
+
Keyword Args:
|
|
93
|
+
path_to_item (None/list) the path to the exception in the
|
|
94
|
+
received_data dict
|
|
95
|
+
"""
|
|
96
|
+
self.path_to_item = path_to_item
|
|
97
|
+
full_msg = msg
|
|
98
|
+
if path_to_item:
|
|
99
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
100
|
+
super(ApiKeyError, self).__init__(full_msg)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class ApiException(OpenApiException):
|
|
104
|
+
|
|
105
|
+
def __init__(
|
|
106
|
+
self,
|
|
107
|
+
status=None,
|
|
108
|
+
reason=None,
|
|
109
|
+
http_resp=None,
|
|
110
|
+
*,
|
|
111
|
+
body: Optional[str] = None,
|
|
112
|
+
data: Optional[Any] = None,
|
|
113
|
+
) -> None:
|
|
114
|
+
self.status = status
|
|
115
|
+
self.reason = reason
|
|
116
|
+
self.body = body
|
|
117
|
+
self.data = data
|
|
118
|
+
self.headers = None
|
|
119
|
+
|
|
120
|
+
if http_resp:
|
|
121
|
+
if self.status is None:
|
|
122
|
+
self.status = http_resp.status
|
|
123
|
+
if self.reason is None:
|
|
124
|
+
self.reason = http_resp.reason
|
|
125
|
+
if self.body is None:
|
|
126
|
+
try:
|
|
127
|
+
self.body = http_resp.data.decode('utf-8')
|
|
128
|
+
except Exception:
|
|
129
|
+
pass
|
|
130
|
+
self.headers = http_resp.headers
|
|
131
|
+
|
|
132
|
+
@classmethod
|
|
133
|
+
def from_response(
|
|
134
|
+
cls,
|
|
135
|
+
*,
|
|
136
|
+
http_resp,
|
|
137
|
+
body: Optional[str],
|
|
138
|
+
data: Optional[Any],
|
|
139
|
+
) -> Self:
|
|
140
|
+
if http_resp.status == 400:
|
|
141
|
+
raise BadRequestException(http_resp=http_resp, body=body, data=data)
|
|
142
|
+
|
|
143
|
+
if http_resp.status == 401:
|
|
144
|
+
raise UnauthorizedException(http_resp=http_resp, body=body, data=data)
|
|
145
|
+
|
|
146
|
+
if http_resp.status == 403:
|
|
147
|
+
raise ForbiddenException(http_resp=http_resp, body=body, data=data)
|
|
148
|
+
|
|
149
|
+
if http_resp.status == 404:
|
|
150
|
+
raise NotFoundException(http_resp=http_resp, body=body, data=data)
|
|
151
|
+
|
|
152
|
+
# Added new conditions for 409 and 422
|
|
153
|
+
if http_resp.status == 409:
|
|
154
|
+
raise ConflictException(http_resp=http_resp, body=body, data=data)
|
|
155
|
+
|
|
156
|
+
if http_resp.status == 422:
|
|
157
|
+
raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data)
|
|
158
|
+
|
|
159
|
+
if 500 <= http_resp.status <= 599:
|
|
160
|
+
raise ServiceException(http_resp=http_resp, body=body, data=data)
|
|
161
|
+
raise ApiException(http_resp=http_resp, body=body, data=data)
|
|
162
|
+
|
|
163
|
+
def __str__(self):
|
|
164
|
+
"""Custom error messages for exception"""
|
|
165
|
+
error_message = "({0})\n"\
|
|
166
|
+
"Reason: {1}\n".format(self.status, self.reason)
|
|
167
|
+
if self.headers:
|
|
168
|
+
error_message += "HTTP response headers: {0}\n".format(
|
|
169
|
+
self.headers)
|
|
170
|
+
|
|
171
|
+
if self.body:
|
|
172
|
+
error_message += "HTTP response body: {0}\n".format(self.body)
|
|
173
|
+
|
|
174
|
+
if self.data:
|
|
175
|
+
error_message += "HTTP response data: {0}\n".format(self.data)
|
|
176
|
+
|
|
177
|
+
return error_message
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
class BadRequestException(ApiException):
|
|
181
|
+
pass
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
class NotFoundException(ApiException):
|
|
185
|
+
pass
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
class UnauthorizedException(ApiException):
|
|
189
|
+
pass
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
class ForbiddenException(ApiException):
|
|
193
|
+
pass
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
class ServiceException(ApiException):
|
|
197
|
+
pass
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
class ConflictException(ApiException):
|
|
201
|
+
"""Exception for HTTP 409 Conflict."""
|
|
202
|
+
pass
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
class UnprocessableEntityException(ApiException):
|
|
206
|
+
"""Exception for HTTP 422 Unprocessable Entity."""
|
|
207
|
+
pass
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def render_path(path_to_item):
|
|
211
|
+
"""Returns a string representation of a path"""
|
|
212
|
+
result = ""
|
|
213
|
+
for pth in path_to_item:
|
|
214
|
+
if isinstance(pth, int):
|
|
215
|
+
result += "[{0}]".format(pth)
|
|
216
|
+
else:
|
|
217
|
+
result += "['{0}']".format(pth)
|
|
218
|
+
return result
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
# flake8: noqa
|
|
4
|
+
"""
|
|
5
|
+
beetkeeper
|
|
6
|
+
|
|
7
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
8
|
+
|
|
9
|
+
The version of the OpenAPI document:
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
# import models into model package
|
|
16
|
+
from beetkeeper_api_client.models.api_album import APIAlbum
|
|
17
|
+
from beetkeeper_api_client.models.api_track import APITrack
|
|
18
|
+
from beetkeeper_api_client.models.beets_event_type import BeetsEventType
|
|
19
|
+
from beetkeeper_api_client.models.clean_slate_preview import CleanSlatePreview
|
|
20
|
+
from beetkeeper_api_client.models.clean_slate_submit_request import CleanSlateSubmitRequest
|
|
21
|
+
from beetkeeper_api_client.models.current_beets_subject_state import CurrentBeetsSubjectState
|
|
22
|
+
from beetkeeper_api_client.models.decision_request import DecisionRequest
|
|
23
|
+
from beetkeeper_api_client.models.event_search_response import EventSearchResponse
|
|
24
|
+
from beetkeeper_api_client.models.event_search_result import EventSearchResult
|
|
25
|
+
from beetkeeper_api_client.models.event_subject_summary import EventSubjectSummary
|
|
26
|
+
from beetkeeper_api_client.models.events_list_response import EventsListResponse
|
|
27
|
+
from beetkeeper_api_client.models.find_missing_source_path_request import FindMissingSourcePathRequest
|
|
28
|
+
from beetkeeper_api_client.models.find_missing_source_path_response import FindMissingSourcePathResponse
|
|
29
|
+
from beetkeeper_api_client.models.http_validation_error import HTTPValidationError
|
|
30
|
+
from beetkeeper_api_client.models.health_info import HealthInfo
|
|
31
|
+
from beetkeeper_api_client.models.import_action import ImportAction
|
|
32
|
+
from beetkeeper_api_client.models.import_candidate import ImportCandidate
|
|
33
|
+
from beetkeeper_api_client.models.import_decision import ImportDecision
|
|
34
|
+
from beetkeeper_api_client.models.import_job import ImportJob
|
|
35
|
+
from beetkeeper_api_client.models.import_job_status import ImportJobStatus
|
|
36
|
+
from beetkeeper_api_client.models.import_submit_request import ImportSubmitRequest
|
|
37
|
+
from beetkeeper_api_client.models.listener_event_details import ListenerEventDetails
|
|
38
|
+
from beetkeeper_api_client.models.location_inner import LocationInner
|
|
39
|
+
from beetkeeper_api_client.models.login_request_body import LoginRequestBody
|
|
40
|
+
from beetkeeper_api_client.models.login_response_body import LoginResponseBody
|
|
41
|
+
from beetkeeper_api_client.models.logout_response_body import LogoutResponseBody
|
|
42
|
+
from beetkeeper_api_client.models.search_missing_source_path_result import SearchMissingSourcePathResult
|
|
43
|
+
from beetkeeper_api_client.models.validation_error import ValidationError
|
|
44
|
+
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
beetkeeper
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document:
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictBool, StrictBytes, StrictFloat, StrictInt, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional, Tuple, Union
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
from pydantic_core import to_jsonable_python
|
|
25
|
+
|
|
26
|
+
class APIAlbum(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
Model for the relevant parts of a `beets.library.Album` instance. used during beets plugin client push events for an event tied to a given album. For simplicity, we only mark `id` as required, with all other fields as optional (which might not be the case for beets internals). NOTE: This was generated from `build_scripts/code_gen/pydantic_field_info_from_beets_model.py`.
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
id: StrictInt
|
|
31
|
+
added: Optional[Union[StrictFloat, StrictInt]] = None
|
|
32
|
+
album: Optional[StrictStr] = ''
|
|
33
|
+
albumartist: Optional[StrictStr] = ''
|
|
34
|
+
albumartist_credit: Optional[StrictStr] = ''
|
|
35
|
+
albumartist_sort: Optional[StrictStr] = ''
|
|
36
|
+
albumartists: Optional[List[Any]] = None
|
|
37
|
+
albumartists_credit: Optional[List[Any]] = None
|
|
38
|
+
albumartists_sort: Optional[List[Any]] = None
|
|
39
|
+
albumdisambig: Optional[StrictStr] = ''
|
|
40
|
+
albumstatus: Optional[StrictStr] = ''
|
|
41
|
+
albumtype: Optional[StrictStr] = ''
|
|
42
|
+
albumtypes: Optional[List[Any]] = None
|
|
43
|
+
artpath: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = ''
|
|
44
|
+
asin: Optional[StrictStr] = ''
|
|
45
|
+
barcode: Optional[StrictStr] = ''
|
|
46
|
+
catalognum: Optional[StrictStr] = ''
|
|
47
|
+
comp: Optional[StrictBool] = False
|
|
48
|
+
country: Optional[StrictStr] = ''
|
|
49
|
+
day: Optional[StrictInt] = None
|
|
50
|
+
discogs_albumid: Optional[StrictInt] = None
|
|
51
|
+
discogs_artistid: Optional[StrictInt] = None
|
|
52
|
+
discogs_labelid: Optional[StrictInt] = None
|
|
53
|
+
disctotal: Optional[StrictInt] = None
|
|
54
|
+
genres: Optional[List[Any]] = None
|
|
55
|
+
label: Optional[StrictStr] = ''
|
|
56
|
+
language: Optional[StrictStr] = ''
|
|
57
|
+
mb_albumartistid: Optional[StrictStr] = ''
|
|
58
|
+
mb_albumartistids: Optional[List[Any]] = None
|
|
59
|
+
mb_albumid: Optional[StrictStr] = ''
|
|
60
|
+
mb_releasegroupid: Optional[StrictStr] = ''
|
|
61
|
+
month: Optional[StrictInt] = None
|
|
62
|
+
original_day: Optional[StrictInt] = None
|
|
63
|
+
original_month: Optional[StrictInt] = None
|
|
64
|
+
original_year: Optional[StrictInt] = None
|
|
65
|
+
r128_album_gain: Optional[Union[StrictFloat, StrictInt]] = None
|
|
66
|
+
release_group_title: Optional[StrictStr] = ''
|
|
67
|
+
releasegroupdisambig: Optional[StrictStr] = ''
|
|
68
|
+
rg_album_gain: Optional[Union[StrictFloat, StrictInt]] = None
|
|
69
|
+
rg_album_peak: Optional[Union[StrictFloat, StrictInt]] = None
|
|
70
|
+
script: Optional[StrictStr] = ''
|
|
71
|
+
style: Optional[StrictStr] = ''
|
|
72
|
+
year: Optional[StrictInt] = None
|
|
73
|
+
additional_properties: Dict[str, Any] = {}
|
|
74
|
+
__properties: ClassVar[List[str]] = ["id", "added", "album", "albumartist", "albumartist_credit", "albumartist_sort", "albumartists", "albumartists_credit", "albumartists_sort", "albumdisambig", "albumstatus", "albumtype", "albumtypes", "artpath", "asin", "barcode", "catalognum", "comp", "country", "day", "discogs_albumid", "discogs_artistid", "discogs_labelid", "disctotal", "genres", "label", "language", "mb_albumartistid", "mb_albumartistids", "mb_albumid", "mb_releasegroupid", "month", "original_day", "original_month", "original_year", "r128_album_gain", "release_group_title", "releasegroupdisambig", "rg_album_gain", "rg_album_peak", "script", "style", "year"]
|
|
75
|
+
|
|
76
|
+
model_config = ConfigDict(
|
|
77
|
+
validate_by_name=True,
|
|
78
|
+
validate_by_alias=True,
|
|
79
|
+
validate_assignment=True,
|
|
80
|
+
protected_namespaces=(),
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def to_str(self) -> str:
|
|
85
|
+
"""Returns the string representation of the model using alias"""
|
|
86
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
87
|
+
|
|
88
|
+
def to_json(self) -> str:
|
|
89
|
+
"""Returns the JSON representation of the model using alias"""
|
|
90
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
91
|
+
|
|
92
|
+
@classmethod
|
|
93
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
94
|
+
"""Create an instance of APIAlbum from a JSON string"""
|
|
95
|
+
return cls.from_dict(json.loads(json_str))
|
|
96
|
+
|
|
97
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
98
|
+
"""Return the dictionary representation of the model using alias.
|
|
99
|
+
|
|
100
|
+
This has the following differences from calling pydantic's
|
|
101
|
+
`self.model_dump(by_alias=True)`:
|
|
102
|
+
|
|
103
|
+
* `None` is only added to the output dict for nullable fields that
|
|
104
|
+
were set at model initialization. Other fields with value `None`
|
|
105
|
+
are ignored.
|
|
106
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
|
107
|
+
"""
|
|
108
|
+
excluded_fields: Set[str] = set([
|
|
109
|
+
"additional_properties",
|
|
110
|
+
])
|
|
111
|
+
|
|
112
|
+
_dict = self.model_dump(
|
|
113
|
+
by_alias=True,
|
|
114
|
+
exclude=excluded_fields,
|
|
115
|
+
exclude_none=True,
|
|
116
|
+
)
|
|
117
|
+
# puts key-value pairs in additional_properties in the top level
|
|
118
|
+
if self.additional_properties is not None:
|
|
119
|
+
for _key, _value in self.additional_properties.items():
|
|
120
|
+
_dict[_key] = _value
|
|
121
|
+
|
|
122
|
+
# set to None if added (nullable) is None
|
|
123
|
+
# and model_fields_set contains the field
|
|
124
|
+
if self.added is None and "added" in self.model_fields_set:
|
|
125
|
+
_dict['added'] = None
|
|
126
|
+
|
|
127
|
+
# set to None if albumartists (nullable) is None
|
|
128
|
+
# and model_fields_set contains the field
|
|
129
|
+
if self.albumartists is None and "albumartists" in self.model_fields_set:
|
|
130
|
+
_dict['albumartists'] = None
|
|
131
|
+
|
|
132
|
+
# set to None if albumartists_credit (nullable) is None
|
|
133
|
+
# and model_fields_set contains the field
|
|
134
|
+
if self.albumartists_credit is None and "albumartists_credit" in self.model_fields_set:
|
|
135
|
+
_dict['albumartists_credit'] = None
|
|
136
|
+
|
|
137
|
+
# set to None if albumartists_sort (nullable) is None
|
|
138
|
+
# and model_fields_set contains the field
|
|
139
|
+
if self.albumartists_sort is None and "albumartists_sort" in self.model_fields_set:
|
|
140
|
+
_dict['albumartists_sort'] = None
|
|
141
|
+
|
|
142
|
+
# set to None if albumtypes (nullable) is None
|
|
143
|
+
# and model_fields_set contains the field
|
|
144
|
+
if self.albumtypes is None and "albumtypes" in self.model_fields_set:
|
|
145
|
+
_dict['albumtypes'] = None
|
|
146
|
+
|
|
147
|
+
# set to None if day (nullable) is None
|
|
148
|
+
# and model_fields_set contains the field
|
|
149
|
+
if self.day is None and "day" in self.model_fields_set:
|
|
150
|
+
_dict['day'] = None
|
|
151
|
+
|
|
152
|
+
# set to None if discogs_albumid (nullable) is None
|
|
153
|
+
# and model_fields_set contains the field
|
|
154
|
+
if self.discogs_albumid is None and "discogs_albumid" in self.model_fields_set:
|
|
155
|
+
_dict['discogs_albumid'] = None
|
|
156
|
+
|
|
157
|
+
# set to None if discogs_artistid (nullable) is None
|
|
158
|
+
# and model_fields_set contains the field
|
|
159
|
+
if self.discogs_artistid is None and "discogs_artistid" in self.model_fields_set:
|
|
160
|
+
_dict['discogs_artistid'] = None
|
|
161
|
+
|
|
162
|
+
# set to None if discogs_labelid (nullable) is None
|
|
163
|
+
# and model_fields_set contains the field
|
|
164
|
+
if self.discogs_labelid is None and "discogs_labelid" in self.model_fields_set:
|
|
165
|
+
_dict['discogs_labelid'] = None
|
|
166
|
+
|
|
167
|
+
# set to None if disctotal (nullable) is None
|
|
168
|
+
# and model_fields_set contains the field
|
|
169
|
+
if self.disctotal is None and "disctotal" in self.model_fields_set:
|
|
170
|
+
_dict['disctotal'] = None
|
|
171
|
+
|
|
172
|
+
# set to None if genres (nullable) is None
|
|
173
|
+
# and model_fields_set contains the field
|
|
174
|
+
if self.genres is None and "genres" in self.model_fields_set:
|
|
175
|
+
_dict['genres'] = None
|
|
176
|
+
|
|
177
|
+
# set to None if mb_albumartistids (nullable) is None
|
|
178
|
+
# and model_fields_set contains the field
|
|
179
|
+
if self.mb_albumartistids is None and "mb_albumartistids" in self.model_fields_set:
|
|
180
|
+
_dict['mb_albumartistids'] = None
|
|
181
|
+
|
|
182
|
+
# set to None if month (nullable) is None
|
|
183
|
+
# and model_fields_set contains the field
|
|
184
|
+
if self.month is None and "month" in self.model_fields_set:
|
|
185
|
+
_dict['month'] = None
|
|
186
|
+
|
|
187
|
+
# set to None if original_day (nullable) is None
|
|
188
|
+
# and model_fields_set contains the field
|
|
189
|
+
if self.original_day is None and "original_day" in self.model_fields_set:
|
|
190
|
+
_dict['original_day'] = None
|
|
191
|
+
|
|
192
|
+
# set to None if original_month (nullable) is None
|
|
193
|
+
# and model_fields_set contains the field
|
|
194
|
+
if self.original_month is None and "original_month" in self.model_fields_set:
|
|
195
|
+
_dict['original_month'] = None
|
|
196
|
+
|
|
197
|
+
# set to None if original_year (nullable) is None
|
|
198
|
+
# and model_fields_set contains the field
|
|
199
|
+
if self.original_year is None and "original_year" in self.model_fields_set:
|
|
200
|
+
_dict['original_year'] = None
|
|
201
|
+
|
|
202
|
+
# set to None if r128_album_gain (nullable) is None
|
|
203
|
+
# and model_fields_set contains the field
|
|
204
|
+
if self.r128_album_gain is None and "r128_album_gain" in self.model_fields_set:
|
|
205
|
+
_dict['r128_album_gain'] = None
|
|
206
|
+
|
|
207
|
+
# set to None if rg_album_gain (nullable) is None
|
|
208
|
+
# and model_fields_set contains the field
|
|
209
|
+
if self.rg_album_gain is None and "rg_album_gain" in self.model_fields_set:
|
|
210
|
+
_dict['rg_album_gain'] = None
|
|
211
|
+
|
|
212
|
+
# set to None if rg_album_peak (nullable) is None
|
|
213
|
+
# and model_fields_set contains the field
|
|
214
|
+
if self.rg_album_peak is None and "rg_album_peak" in self.model_fields_set:
|
|
215
|
+
_dict['rg_album_peak'] = None
|
|
216
|
+
|
|
217
|
+
# set to None if year (nullable) is None
|
|
218
|
+
# and model_fields_set contains the field
|
|
219
|
+
if self.year is None and "year" in self.model_fields_set:
|
|
220
|
+
_dict['year'] = None
|
|
221
|
+
|
|
222
|
+
return _dict
|
|
223
|
+
|
|
224
|
+
@classmethod
|
|
225
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
226
|
+
"""Create an instance of APIAlbum from a dict"""
|
|
227
|
+
if obj is None:
|
|
228
|
+
return None
|
|
229
|
+
|
|
230
|
+
if not isinstance(obj, dict):
|
|
231
|
+
return cls.model_validate(obj)
|
|
232
|
+
|
|
233
|
+
_obj = cls.model_validate({
|
|
234
|
+
"id": obj.get("id"),
|
|
235
|
+
"added": obj.get("added"),
|
|
236
|
+
"album": obj.get("album") if obj.get("album") is not None else '',
|
|
237
|
+
"albumartist": obj.get("albumartist") if obj.get("albumartist") is not None else '',
|
|
238
|
+
"albumartist_credit": obj.get("albumartist_credit") if obj.get("albumartist_credit") is not None else '',
|
|
239
|
+
"albumartist_sort": obj.get("albumartist_sort") if obj.get("albumartist_sort") is not None else '',
|
|
240
|
+
"albumartists": obj.get("albumartists"),
|
|
241
|
+
"albumartists_credit": obj.get("albumartists_credit"),
|
|
242
|
+
"albumartists_sort": obj.get("albumartists_sort"),
|
|
243
|
+
"albumdisambig": obj.get("albumdisambig") if obj.get("albumdisambig") is not None else '',
|
|
244
|
+
"albumstatus": obj.get("albumstatus") if obj.get("albumstatus") is not None else '',
|
|
245
|
+
"albumtype": obj.get("albumtype") if obj.get("albumtype") is not None else '',
|
|
246
|
+
"albumtypes": obj.get("albumtypes"),
|
|
247
|
+
"artpath": obj.get("artpath") if obj.get("artpath") is not None else '',
|
|
248
|
+
"asin": obj.get("asin") if obj.get("asin") is not None else '',
|
|
249
|
+
"barcode": obj.get("barcode") if obj.get("barcode") is not None else '',
|
|
250
|
+
"catalognum": obj.get("catalognum") if obj.get("catalognum") is not None else '',
|
|
251
|
+
"comp": obj.get("comp") if obj.get("comp") is not None else False,
|
|
252
|
+
"country": obj.get("country") if obj.get("country") is not None else '',
|
|
253
|
+
"day": obj.get("day"),
|
|
254
|
+
"discogs_albumid": obj.get("discogs_albumid"),
|
|
255
|
+
"discogs_artistid": obj.get("discogs_artistid"),
|
|
256
|
+
"discogs_labelid": obj.get("discogs_labelid"),
|
|
257
|
+
"disctotal": obj.get("disctotal"),
|
|
258
|
+
"genres": obj.get("genres"),
|
|
259
|
+
"label": obj.get("label") if obj.get("label") is not None else '',
|
|
260
|
+
"language": obj.get("language") if obj.get("language") is not None else '',
|
|
261
|
+
"mb_albumartistid": obj.get("mb_albumartistid") if obj.get("mb_albumartistid") is not None else '',
|
|
262
|
+
"mb_albumartistids": obj.get("mb_albumartistids"),
|
|
263
|
+
"mb_albumid": obj.get("mb_albumid") if obj.get("mb_albumid") is not None else '',
|
|
264
|
+
"mb_releasegroupid": obj.get("mb_releasegroupid") if obj.get("mb_releasegroupid") is not None else '',
|
|
265
|
+
"month": obj.get("month"),
|
|
266
|
+
"original_day": obj.get("original_day"),
|
|
267
|
+
"original_month": obj.get("original_month"),
|
|
268
|
+
"original_year": obj.get("original_year"),
|
|
269
|
+
"r128_album_gain": obj.get("r128_album_gain"),
|
|
270
|
+
"release_group_title": obj.get("release_group_title") if obj.get("release_group_title") is not None else '',
|
|
271
|
+
"releasegroupdisambig": obj.get("releasegroupdisambig") if obj.get("releasegroupdisambig") is not None else '',
|
|
272
|
+
"rg_album_gain": obj.get("rg_album_gain"),
|
|
273
|
+
"rg_album_peak": obj.get("rg_album_peak"),
|
|
274
|
+
"script": obj.get("script") if obj.get("script") is not None else '',
|
|
275
|
+
"style": obj.get("style") if obj.get("style") is not None else '',
|
|
276
|
+
"year": obj.get("year")
|
|
277
|
+
})
|
|
278
|
+
# store additional fields in additional_properties
|
|
279
|
+
for _key in obj.keys():
|
|
280
|
+
if _key not in cls.__properties:
|
|
281
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
|
282
|
+
|
|
283
|
+
return _obj
|
|
284
|
+
|
|
285
|
+
|