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,95 @@
|
|
|
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
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from beetkeeper_api_client.models.validation_error import ValidationError
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
from pydantic_core import to_jsonable_python
|
|
26
|
+
|
|
27
|
+
class HTTPValidationError(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
HTTPValidationError
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
detail: Optional[List[ValidationError]] = None
|
|
32
|
+
__properties: ClassVar[List[str]] = ["detail"]
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
validate_by_name=True,
|
|
36
|
+
validate_by_alias=True,
|
|
37
|
+
validate_assignment=True,
|
|
38
|
+
protected_namespaces=(),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def to_str(self) -> str:
|
|
43
|
+
"""Returns the string representation of the model using alias"""
|
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
45
|
+
|
|
46
|
+
def to_json(self) -> str:
|
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
|
48
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
52
|
+
"""Create an instance of HTTPValidationError from a JSON string"""
|
|
53
|
+
return cls.from_dict(json.loads(json_str))
|
|
54
|
+
|
|
55
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
56
|
+
"""Return the dictionary representation of the model using alias.
|
|
57
|
+
|
|
58
|
+
This has the following differences from calling pydantic's
|
|
59
|
+
`self.model_dump(by_alias=True)`:
|
|
60
|
+
|
|
61
|
+
* `None` is only added to the output dict for nullable fields that
|
|
62
|
+
were set at model initialization. Other fields with value `None`
|
|
63
|
+
are ignored.
|
|
64
|
+
"""
|
|
65
|
+
excluded_fields: Set[str] = set([
|
|
66
|
+
])
|
|
67
|
+
|
|
68
|
+
_dict = self.model_dump(
|
|
69
|
+
by_alias=True,
|
|
70
|
+
exclude=excluded_fields,
|
|
71
|
+
exclude_none=True,
|
|
72
|
+
)
|
|
73
|
+
# override the default output from pydantic by calling `to_dict()` of each item in detail (list)
|
|
74
|
+
_items = []
|
|
75
|
+
if self.detail:
|
|
76
|
+
for _item_detail in self.detail:
|
|
77
|
+
_items.append(_item_detail.to_dict() if _item_detail is not None else None)
|
|
78
|
+
_dict['detail'] = _items
|
|
79
|
+
return _dict
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
83
|
+
"""Create an instance of HTTPValidationError from a dict"""
|
|
84
|
+
if obj is None:
|
|
85
|
+
return None
|
|
86
|
+
|
|
87
|
+
if not isinstance(obj, dict):
|
|
88
|
+
return cls.model_validate(obj)
|
|
89
|
+
|
|
90
|
+
_obj = cls.model_validate({
|
|
91
|
+
"detail": [ValidationError.from_dict(_item) for _item in obj["detail"]] if obj.get("detail") is not None else None
|
|
92
|
+
})
|
|
93
|
+
return _obj
|
|
94
|
+
|
|
95
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
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 json
|
|
17
|
+
from enum import Enum
|
|
18
|
+
from typing_extensions import Self
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class ImportAction(str, Enum):
|
|
22
|
+
"""
|
|
23
|
+
beetkeeper-side mirror of beets' import `action` choices (decoupled from beets internals). `APPLY` imports with the chosen candidate's metadata, `ASIS` imports without changing tags, `SKIP` skips the task.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
"""
|
|
27
|
+
allowed enum values
|
|
28
|
+
"""
|
|
29
|
+
APPLY = 'apply'
|
|
30
|
+
ASIS = 'asis'
|
|
31
|
+
SKIP = 'skip'
|
|
32
|
+
|
|
33
|
+
@classmethod
|
|
34
|
+
def from_json(cls, json_str: str) -> Self:
|
|
35
|
+
"""Create an instance of ImportAction from a JSON string"""
|
|
36
|
+
return cls(json.loads(json_str))
|
|
37
|
+
|
|
38
|
+
|
|
@@ -0,0 +1,171 @@
|
|
|
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, Field, StrictFloat, StrictInt, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
from pydantic_core import to_jsonable_python
|
|
25
|
+
|
|
26
|
+
class ImportCandidate(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
A serializable view of one beets match candidate, surfaced to the UI for selection. Beyond the headline `label`/`similarity`, the optional release attributes below let the UI tell otherwise-identical candidates apart (e.g. different pressings/editions of the same album); `details` joins the populated ones into a single human-readable line for display.
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
index: StrictInt
|
|
31
|
+
label: StrictStr
|
|
32
|
+
similarity: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="1.0 - beets match distance, if available.")
|
|
33
|
+
data_source: Optional[StrictStr] = None
|
|
34
|
+
year: Optional[StrictInt] = None
|
|
35
|
+
country: Optional[StrictStr] = None
|
|
36
|
+
media: Optional[StrictStr] = None
|
|
37
|
+
record_label: Optional[StrictStr] = None
|
|
38
|
+
catalognum: Optional[StrictStr] = None
|
|
39
|
+
disambiguation: Optional[StrictStr] = None
|
|
40
|
+
track_count: Optional[StrictInt] = None
|
|
41
|
+
album_id: Optional[StrictStr] = Field(default=None, description="Source-specific release id (e.g. a MusicBrainz MBID).")
|
|
42
|
+
release_url: Optional[StrictStr] = Field(default=None, description="Web URL for the release, from the source plugin (beets' `AlbumInfo.data_url`).")
|
|
43
|
+
details: StrictStr = Field(description="One-line summary of the differentiating attributes (empty string when none are known).")
|
|
44
|
+
__properties: ClassVar[List[str]] = ["index", "label", "similarity", "data_source", "year", "country", "media", "record_label", "catalognum", "disambiguation", "track_count", "album_id", "release_url", "details"]
|
|
45
|
+
|
|
46
|
+
model_config = ConfigDict(
|
|
47
|
+
validate_by_name=True,
|
|
48
|
+
validate_by_alias=True,
|
|
49
|
+
validate_assignment=True,
|
|
50
|
+
protected_namespaces=(),
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def to_str(self) -> str:
|
|
55
|
+
"""Returns the string representation of the model using alias"""
|
|
56
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
57
|
+
|
|
58
|
+
def to_json(self) -> str:
|
|
59
|
+
"""Returns the JSON representation of the model using alias"""
|
|
60
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
61
|
+
|
|
62
|
+
@classmethod
|
|
63
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
64
|
+
"""Create an instance of ImportCandidate from a JSON string"""
|
|
65
|
+
return cls.from_dict(json.loads(json_str))
|
|
66
|
+
|
|
67
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
68
|
+
"""Return the dictionary representation of the model using alias.
|
|
69
|
+
|
|
70
|
+
This has the following differences from calling pydantic's
|
|
71
|
+
`self.model_dump(by_alias=True)`:
|
|
72
|
+
|
|
73
|
+
* `None` is only added to the output dict for nullable fields that
|
|
74
|
+
were set at model initialization. Other fields with value `None`
|
|
75
|
+
are ignored.
|
|
76
|
+
* OpenAPI `readOnly` fields are excluded.
|
|
77
|
+
"""
|
|
78
|
+
excluded_fields: Set[str] = set([
|
|
79
|
+
"details",
|
|
80
|
+
])
|
|
81
|
+
|
|
82
|
+
_dict = self.model_dump(
|
|
83
|
+
by_alias=True,
|
|
84
|
+
exclude=excluded_fields,
|
|
85
|
+
exclude_none=True,
|
|
86
|
+
)
|
|
87
|
+
# set to None if similarity (nullable) is None
|
|
88
|
+
# and model_fields_set contains the field
|
|
89
|
+
if self.similarity is None and "similarity" in self.model_fields_set:
|
|
90
|
+
_dict['similarity'] = None
|
|
91
|
+
|
|
92
|
+
# set to None if data_source (nullable) is None
|
|
93
|
+
# and model_fields_set contains the field
|
|
94
|
+
if self.data_source is None and "data_source" in self.model_fields_set:
|
|
95
|
+
_dict['data_source'] = None
|
|
96
|
+
|
|
97
|
+
# set to None if year (nullable) is None
|
|
98
|
+
# and model_fields_set contains the field
|
|
99
|
+
if self.year is None and "year" in self.model_fields_set:
|
|
100
|
+
_dict['year'] = None
|
|
101
|
+
|
|
102
|
+
# set to None if country (nullable) is None
|
|
103
|
+
# and model_fields_set contains the field
|
|
104
|
+
if self.country is None and "country" in self.model_fields_set:
|
|
105
|
+
_dict['country'] = None
|
|
106
|
+
|
|
107
|
+
# set to None if media (nullable) is None
|
|
108
|
+
# and model_fields_set contains the field
|
|
109
|
+
if self.media is None and "media" in self.model_fields_set:
|
|
110
|
+
_dict['media'] = None
|
|
111
|
+
|
|
112
|
+
# set to None if record_label (nullable) is None
|
|
113
|
+
# and model_fields_set contains the field
|
|
114
|
+
if self.record_label is None and "record_label" in self.model_fields_set:
|
|
115
|
+
_dict['record_label'] = None
|
|
116
|
+
|
|
117
|
+
# set to None if catalognum (nullable) is None
|
|
118
|
+
# and model_fields_set contains the field
|
|
119
|
+
if self.catalognum is None and "catalognum" in self.model_fields_set:
|
|
120
|
+
_dict['catalognum'] = None
|
|
121
|
+
|
|
122
|
+
# set to None if disambiguation (nullable) is None
|
|
123
|
+
# and model_fields_set contains the field
|
|
124
|
+
if self.disambiguation is None and "disambiguation" in self.model_fields_set:
|
|
125
|
+
_dict['disambiguation'] = None
|
|
126
|
+
|
|
127
|
+
# set to None if track_count (nullable) is None
|
|
128
|
+
# and model_fields_set contains the field
|
|
129
|
+
if self.track_count is None and "track_count" in self.model_fields_set:
|
|
130
|
+
_dict['track_count'] = None
|
|
131
|
+
|
|
132
|
+
# set to None if album_id (nullable) is None
|
|
133
|
+
# and model_fields_set contains the field
|
|
134
|
+
if self.album_id is None and "album_id" in self.model_fields_set:
|
|
135
|
+
_dict['album_id'] = None
|
|
136
|
+
|
|
137
|
+
# set to None if release_url (nullable) is None
|
|
138
|
+
# and model_fields_set contains the field
|
|
139
|
+
if self.release_url is None and "release_url" in self.model_fields_set:
|
|
140
|
+
_dict['release_url'] = None
|
|
141
|
+
|
|
142
|
+
return _dict
|
|
143
|
+
|
|
144
|
+
@classmethod
|
|
145
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
146
|
+
"""Create an instance of ImportCandidate from a dict"""
|
|
147
|
+
if obj is None:
|
|
148
|
+
return None
|
|
149
|
+
|
|
150
|
+
if not isinstance(obj, dict):
|
|
151
|
+
return cls.model_validate(obj)
|
|
152
|
+
|
|
153
|
+
_obj = cls.model_validate({
|
|
154
|
+
"index": obj.get("index"),
|
|
155
|
+
"label": obj.get("label"),
|
|
156
|
+
"similarity": obj.get("similarity"),
|
|
157
|
+
"data_source": obj.get("data_source"),
|
|
158
|
+
"year": obj.get("year"),
|
|
159
|
+
"country": obj.get("country"),
|
|
160
|
+
"media": obj.get("media"),
|
|
161
|
+
"record_label": obj.get("record_label"),
|
|
162
|
+
"catalognum": obj.get("catalognum"),
|
|
163
|
+
"disambiguation": obj.get("disambiguation"),
|
|
164
|
+
"track_count": obj.get("track_count"),
|
|
165
|
+
"album_id": obj.get("album_id"),
|
|
166
|
+
"release_url": obj.get("release_url"),
|
|
167
|
+
"details": obj.get("details")
|
|
168
|
+
})
|
|
169
|
+
return _obj
|
|
170
|
+
|
|
171
|
+
|
|
@@ -0,0 +1,96 @@
|
|
|
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, Field, StrictInt
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from beetkeeper_api_client.models.import_action import ImportAction
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
from pydantic_core import to_jsonable_python
|
|
26
|
+
|
|
27
|
+
class ImportDecision(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
The user's answer to a `DecisionRequest` (posted back from the UI).
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
action: ImportAction
|
|
32
|
+
candidate_index: Optional[StrictInt] = Field(default=None, description="Required when `action` is APPLY.")
|
|
33
|
+
__properties: ClassVar[List[str]] = ["action", "candidate_index"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
validate_by_name=True,
|
|
37
|
+
validate_by_alias=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def to_str(self) -> str:
|
|
44
|
+
"""Returns the string representation of the model using alias"""
|
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
46
|
+
|
|
47
|
+
def to_json(self) -> str:
|
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
|
49
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of ImportDecision from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
# set to None if candidate_index (nullable) is None
|
|
75
|
+
# and model_fields_set contains the field
|
|
76
|
+
if self.candidate_index is None and "candidate_index" in self.model_fields_set:
|
|
77
|
+
_dict['candidate_index'] = None
|
|
78
|
+
|
|
79
|
+
return _dict
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
83
|
+
"""Create an instance of ImportDecision from a dict"""
|
|
84
|
+
if obj is None:
|
|
85
|
+
return None
|
|
86
|
+
|
|
87
|
+
if not isinstance(obj, dict):
|
|
88
|
+
return cls.model_validate(obj)
|
|
89
|
+
|
|
90
|
+
_obj = cls.model_validate({
|
|
91
|
+
"action": obj.get("action"),
|
|
92
|
+
"candidate_index": obj.get("candidate_index")
|
|
93
|
+
})
|
|
94
|
+
return _obj
|
|
95
|
+
|
|
96
|
+
|
|
@@ -0,0 +1,162 @@
|
|
|
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 datetime import datetime
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from beetkeeper_api_client.models.decision_request import DecisionRequest
|
|
24
|
+
from beetkeeper_api_client.models.import_job_status import ImportJobStatus
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
from pydantic_core import to_jsonable_python
|
|
28
|
+
|
|
29
|
+
class ImportJob(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
API-facing view of a single import job (the persisted record is `db.models.ImportJobRecord`).
|
|
32
|
+
""" # noqa: E501
|
|
33
|
+
id: StrictStr = Field(description="Unique job id (32 hex characters), the `job_id` of the per-job import routes.")
|
|
34
|
+
status: ImportJobStatus = Field(description="The job's lifecycle state.")
|
|
35
|
+
paths: List[StrictStr] = Field(description="The filesystem paths beets imports (for a clean slate, the removed entry's raw source folder).")
|
|
36
|
+
created_at: datetime = Field(description="When the job was submitted (naive UTC).")
|
|
37
|
+
error: Optional[StrictStr] = Field(default=None, description="Why the job FAILED, once it has; None otherwise.")
|
|
38
|
+
pending_decision: Optional[DecisionRequest] = Field(default=None, description="The decision the worker is parked on while AWAITING_DECISION; None otherwise.")
|
|
39
|
+
decision_submitted: Optional[StrictBool] = Field(default=False, description="True once the UI has answered the pending decision but the worker has not consumed it yet: the job is momentarily still AWAITING_DECISION, so keep polling instead of re-showing the prompt.")
|
|
40
|
+
output: Optional[StrictStr] = Field(default=None, description="Human-readable, append-only log of the import's progress.")
|
|
41
|
+
quiet: Optional[StrictBool] = Field(default=False, description="Non-interactive (`beet import -q`) mode: the worker auto-decides matches instead of prompting.")
|
|
42
|
+
logpath: Optional[StrictStr] = Field(default=None, description="The `beet import -l` log file path, if any.")
|
|
43
|
+
group_albums: Optional[StrictBool] = Field(default=False, description="The `beet import --group-albums` flag.")
|
|
44
|
+
flat: Optional[StrictBool] = Field(default=False, description="The `beet import --flat` flag.")
|
|
45
|
+
set_fields: Optional[Dict[str, StrictStr]] = Field(default=None, description="The `beet import --set` field values.")
|
|
46
|
+
clean_slate_album_id: Optional[StrictInt] = Field(default=None, description="The library album removed before `paths` (its source folder) is imported afresh.")
|
|
47
|
+
clean_slate_item_id: Optional[StrictInt] = Field(default=None, description="The standalone track removed before `paths` is imported afresh. At most one clean-slate id is set; both None means a plain path import.")
|
|
48
|
+
clean_slate_allow_fewer_files: Optional[StrictBool] = Field(default=False, description="The submitter's opt-in to a source holding fewer audio files than the entry has on disk (see `CleanSlatePreview.needs_confirmation`); the worker re-runs the preview with it before removing anything.")
|
|
49
|
+
is_clean_slate: StrictBool = Field(description="Whether this job removes an existing library entry before importing its source afresh.")
|
|
50
|
+
source_label: StrictStr = Field(description="Display name for the import source: the path basename(s), prefixed for a clean-slate import.")
|
|
51
|
+
__properties: ClassVar[List[str]] = ["id", "status", "paths", "created_at", "error", "pending_decision", "decision_submitted", "output", "quiet", "logpath", "group_albums", "flat", "set_fields", "clean_slate_album_id", "clean_slate_item_id", "clean_slate_allow_fewer_files", "is_clean_slate", "source_label"]
|
|
52
|
+
|
|
53
|
+
model_config = ConfigDict(
|
|
54
|
+
validate_by_name=True,
|
|
55
|
+
validate_by_alias=True,
|
|
56
|
+
validate_assignment=True,
|
|
57
|
+
protected_namespaces=(),
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def to_str(self) -> str:
|
|
62
|
+
"""Returns the string representation of the model using alias"""
|
|
63
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
64
|
+
|
|
65
|
+
def to_json(self) -> str:
|
|
66
|
+
"""Returns the JSON representation of the model using alias"""
|
|
67
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
68
|
+
|
|
69
|
+
@classmethod
|
|
70
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
71
|
+
"""Create an instance of ImportJob from a JSON string"""
|
|
72
|
+
return cls.from_dict(json.loads(json_str))
|
|
73
|
+
|
|
74
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
75
|
+
"""Return the dictionary representation of the model using alias.
|
|
76
|
+
|
|
77
|
+
This has the following differences from calling pydantic's
|
|
78
|
+
`self.model_dump(by_alias=True)`:
|
|
79
|
+
|
|
80
|
+
* `None` is only added to the output dict for nullable fields that
|
|
81
|
+
were set at model initialization. Other fields with value `None`
|
|
82
|
+
are ignored.
|
|
83
|
+
* OpenAPI `readOnly` fields are excluded.
|
|
84
|
+
* OpenAPI `readOnly` fields are excluded.
|
|
85
|
+
"""
|
|
86
|
+
excluded_fields: Set[str] = set([
|
|
87
|
+
"is_clean_slate",
|
|
88
|
+
"source_label",
|
|
89
|
+
])
|
|
90
|
+
|
|
91
|
+
_dict = self.model_dump(
|
|
92
|
+
by_alias=True,
|
|
93
|
+
exclude=excluded_fields,
|
|
94
|
+
exclude_none=True,
|
|
95
|
+
)
|
|
96
|
+
# override the default output from pydantic by calling `to_dict()` of pending_decision
|
|
97
|
+
if self.pending_decision:
|
|
98
|
+
_dict['pending_decision'] = self.pending_decision.to_dict()
|
|
99
|
+
# set to None if error (nullable) is None
|
|
100
|
+
# and model_fields_set contains the field
|
|
101
|
+
if self.error is None and "error" in self.model_fields_set:
|
|
102
|
+
_dict['error'] = None
|
|
103
|
+
|
|
104
|
+
# set to None if pending_decision (nullable) is None
|
|
105
|
+
# and model_fields_set contains the field
|
|
106
|
+
if self.pending_decision is None and "pending_decision" in self.model_fields_set:
|
|
107
|
+
_dict['pending_decision'] = None
|
|
108
|
+
|
|
109
|
+
# set to None if output (nullable) is None
|
|
110
|
+
# and model_fields_set contains the field
|
|
111
|
+
if self.output is None and "output" in self.model_fields_set:
|
|
112
|
+
_dict['output'] = None
|
|
113
|
+
|
|
114
|
+
# set to None if logpath (nullable) is None
|
|
115
|
+
# and model_fields_set contains the field
|
|
116
|
+
if self.logpath is None and "logpath" in self.model_fields_set:
|
|
117
|
+
_dict['logpath'] = None
|
|
118
|
+
|
|
119
|
+
# set to None if clean_slate_album_id (nullable) is None
|
|
120
|
+
# and model_fields_set contains the field
|
|
121
|
+
if self.clean_slate_album_id is None and "clean_slate_album_id" in self.model_fields_set:
|
|
122
|
+
_dict['clean_slate_album_id'] = None
|
|
123
|
+
|
|
124
|
+
# set to None if clean_slate_item_id (nullable) is None
|
|
125
|
+
# and model_fields_set contains the field
|
|
126
|
+
if self.clean_slate_item_id is None and "clean_slate_item_id" in self.model_fields_set:
|
|
127
|
+
_dict['clean_slate_item_id'] = None
|
|
128
|
+
|
|
129
|
+
return _dict
|
|
130
|
+
|
|
131
|
+
@classmethod
|
|
132
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
133
|
+
"""Create an instance of ImportJob from a dict"""
|
|
134
|
+
if obj is None:
|
|
135
|
+
return None
|
|
136
|
+
|
|
137
|
+
if not isinstance(obj, dict):
|
|
138
|
+
return cls.model_validate(obj)
|
|
139
|
+
|
|
140
|
+
_obj = cls.model_validate({
|
|
141
|
+
"id": obj.get("id"),
|
|
142
|
+
"status": obj.get("status"),
|
|
143
|
+
"paths": obj.get("paths"),
|
|
144
|
+
"created_at": obj.get("created_at"),
|
|
145
|
+
"error": obj.get("error"),
|
|
146
|
+
"pending_decision": DecisionRequest.from_dict(obj["pending_decision"]) if obj.get("pending_decision") is not None else None,
|
|
147
|
+
"decision_submitted": obj.get("decision_submitted") if obj.get("decision_submitted") is not None else False,
|
|
148
|
+
"output": obj.get("output"),
|
|
149
|
+
"quiet": obj.get("quiet") if obj.get("quiet") is not None else False,
|
|
150
|
+
"logpath": obj.get("logpath"),
|
|
151
|
+
"group_albums": obj.get("group_albums") if obj.get("group_albums") is not None else False,
|
|
152
|
+
"flat": obj.get("flat") if obj.get("flat") is not None else False,
|
|
153
|
+
"set_fields": obj.get("set_fields"),
|
|
154
|
+
"clean_slate_album_id": obj.get("clean_slate_album_id"),
|
|
155
|
+
"clean_slate_item_id": obj.get("clean_slate_item_id"),
|
|
156
|
+
"clean_slate_allow_fewer_files": obj.get("clean_slate_allow_fewer_files") if obj.get("clean_slate_allow_fewer_files") is not None else False,
|
|
157
|
+
"is_clean_slate": obj.get("is_clean_slate"),
|
|
158
|
+
"source_label": obj.get("source_label")
|
|
159
|
+
})
|
|
160
|
+
return _obj
|
|
161
|
+
|
|
162
|
+
|
|
@@ -0,0 +1,41 @@
|
|
|
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 json
|
|
17
|
+
from enum import Enum
|
|
18
|
+
from typing_extensions import Self
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class ImportJobStatus(str, Enum):
|
|
22
|
+
"""
|
|
23
|
+
Lifecycle states of an import job.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
"""
|
|
27
|
+
allowed enum values
|
|
28
|
+
"""
|
|
29
|
+
PENDING = 'pending'
|
|
30
|
+
RUNNING = 'running'
|
|
31
|
+
AWAITING_DECISION = 'awaiting_decision'
|
|
32
|
+
COMPLETED = 'completed'
|
|
33
|
+
FAILED = 'failed'
|
|
34
|
+
ABORTED = 'aborted'
|
|
35
|
+
|
|
36
|
+
@classmethod
|
|
37
|
+
def from_json(cls, json_str: str) -> Self:
|
|
38
|
+
"""Create an instance of ImportJobStatus from a JSON string"""
|
|
39
|
+
return cls(json.loads(json_str))
|
|
40
|
+
|
|
41
|
+
|