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.
Files changed (48) hide show
  1. beetkeeper_api_client/__init__.py +112 -0
  2. beetkeeper_api_client/_scm_version.py +1 -0
  3. beetkeeper_api_client/api/__init__.py +9 -0
  4. beetkeeper_api_client/api/authentication_api.py +758 -0
  5. beetkeeper_api_client/api/events_api.py +1663 -0
  6. beetkeeper_api_client/api/imports_api.py +3134 -0
  7. beetkeeper_api_client/api/monitoring_api.py +377 -0
  8. beetkeeper_api_client/api/query_api.py +1250 -0
  9. beetkeeper_api_client/api_client.py +845 -0
  10. beetkeeper_api_client/api_response.py +21 -0
  11. beetkeeper_api_client/configuration.py +604 -0
  12. beetkeeper_api_client/exceptions.py +218 -0
  13. beetkeeper_api_client/models/__init__.py +44 -0
  14. beetkeeper_api_client/models/api_album.py +285 -0
  15. beetkeeper_api_client/models/api_track.py +528 -0
  16. beetkeeper_api_client/models/beets_event_type.py +40 -0
  17. beetkeeper_api_client/models/clean_slate_preview.py +147 -0
  18. beetkeeper_api_client/models/clean_slate_submit_request.py +116 -0
  19. beetkeeper_api_client/models/current_beets_subject_state.py +140 -0
  20. beetkeeper_api_client/models/decision_request.py +104 -0
  21. beetkeeper_api_client/models/event_search_response.py +97 -0
  22. beetkeeper_api_client/models/event_search_result.py +107 -0
  23. beetkeeper_api_client/models/event_subject_summary.py +100 -0
  24. beetkeeper_api_client/models/events_list_response.py +95 -0
  25. beetkeeper_api_client/models/find_missing_source_path_request.py +100 -0
  26. beetkeeper_api_client/models/find_missing_source_path_response.py +108 -0
  27. beetkeeper_api_client/models/health_info.py +101 -0
  28. beetkeeper_api_client/models/http_validation_error.py +95 -0
  29. beetkeeper_api_client/models/import_action.py +38 -0
  30. beetkeeper_api_client/models/import_candidate.py +171 -0
  31. beetkeeper_api_client/models/import_decision.py +96 -0
  32. beetkeeper_api_client/models/import_job.py +162 -0
  33. beetkeeper_api_client/models/import_job_status.py +41 -0
  34. beetkeeper_api_client/models/import_submit_request.py +104 -0
  35. beetkeeper_api_client/models/listener_event_details.py +121 -0
  36. beetkeeper_api_client/models/location_inner.py +138 -0
  37. beetkeeper_api_client/models/login_request_body.py +90 -0
  38. beetkeeper_api_client/models/login_response_body.py +100 -0
  39. beetkeeper_api_client/models/logout_response_body.py +88 -0
  40. beetkeeper_api_client/models/search_missing_source_path_result.py +106 -0
  41. beetkeeper_api_client/models/validation_error.py +108 -0
  42. beetkeeper_api_client/py.typed +0 -0
  43. beetkeeper_api_client/rest.py +201 -0
  44. beetkeeper_api_client/sync_helper.py +57 -0
  45. beetkeeper_api_client-0.12.0.dist-info/METADATA +34 -0
  46. beetkeeper_api_client-0.12.0.dist-info/RECORD +48 -0
  47. beetkeeper_api_client-0.12.0.dist-info/WHEEL +5 -0
  48. beetkeeper_api_client-0.12.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,147 @@
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, StrictBool, StrictInt, StrictStr, field_validator
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+ from pydantic_core import to_jsonable_python
25
+
26
+ class CleanSlatePreview(BaseModel):
27
+ """
28
+ The dry run of a clean-slate import: what removing the library entry and importing its source would do. Produced read-only by `core.clean_slate.preview` for the API/UI preview, and again by the worker as the guard before it removes anything. `errors` lists the conditions that block the job outright; `warnings` are worth a look but do not block. `needs_confirmation` is set when the source folder holds fewer audio files than the entry currently has on disk — proceeding would delete files the source cannot replace, so the caller must opt in explicitly (`allow_fewer_files`).
29
+ """ # noqa: E501
30
+ subject: StrictStr
31
+ beets_id: StrictInt
32
+ label: StrictStr = Field(description="`albumartist - album` for an album, `artist - title` for a standalone track.")
33
+ item_count: StrictInt = Field(description="Library rows the entry holds (1 for a standalone track).")
34
+ files_present: StrictInt = Field(description="How many of those rows still have their file on disk.")
35
+ missing_paths: Optional[List[StrictStr]] = Field(default=None, description="Library paths whose file is gone.")
36
+ expected_tracks: Optional[StrictInt] = Field(default=None, description="Track total the album's tags claim (beets' `albumtotal`), when known.")
37
+ files_to_delete: Optional[List[StrictStr]] = Field(default=None, description="Library files the removal deletes (inside the beets directory).")
38
+ files_kept_outside_library: Optional[List[StrictStr]] = Field(default=None, description="Entry files left on disk because they live outside the beets directory.")
39
+ art_to_delete: Optional[StrictStr] = Field(default=None, description="The album art file the removal deletes, if any.")
40
+ flexible_attributes_lost: Optional[List[StrictStr]] = Field(default=None, description="Flexible attribute names on the entry that a clean slate does not keep (`fields_preserved` aside).")
41
+ fields_preserved: Optional[Dict[str, StrictStr]] = Field(default=None, description="The entry's flexible attributes named as keys of the `downloader_hook.beet_field_to_dl_search_field` config, with their values: re-applied to the fresh import via beets' `--set`.")
42
+ source_path: StrictStr
43
+ source_audio_files: Optional[StrictInt] = Field(default=0, description="Readable audio files found under the source path.")
44
+ source_album_groups: Optional[StrictInt] = Field(default=0, description="Album folders beets would import from the source.")
45
+ warnings: Optional[List[StrictStr]] = None
46
+ errors: Optional[List[StrictStr]] = None
47
+ needs_confirmation: Optional[StrictBool] = Field(default=False, description="The source has fewer audio files than the entry has on disk and `allow_fewer_files` was not set.")
48
+ ok: StrictBool = Field(description="Whether the clean slate may run as previewed (no blocking error and no outstanding confirmation).")
49
+ files_missing: StrictInt = Field(description="How many of the entry's rows point at a file that no longer exists.")
50
+ __properties: ClassVar[List[str]] = ["subject", "beets_id", "label", "item_count", "files_present", "missing_paths", "expected_tracks", "files_to_delete", "files_kept_outside_library", "art_to_delete", "flexible_attributes_lost", "fields_preserved", "source_path", "source_audio_files", "source_album_groups", "warnings", "errors", "needs_confirmation", "ok", "files_missing"]
51
+
52
+ @field_validator('subject')
53
+ def subject_validate_enum(cls, value):
54
+ """Validates the enum"""
55
+ if value not in set(['album', 'track']):
56
+ raise ValueError("must be one of enum values ('album', 'track')")
57
+ return value
58
+
59
+ model_config = ConfigDict(
60
+ validate_by_name=True,
61
+ validate_by_alias=True,
62
+ validate_assignment=True,
63
+ protected_namespaces=(),
64
+ )
65
+
66
+
67
+ def to_str(self) -> str:
68
+ """Returns the string representation of the model using alias"""
69
+ return pprint.pformat(self.model_dump(by_alias=True))
70
+
71
+ def to_json(self) -> str:
72
+ """Returns the JSON representation of the model using alias"""
73
+ return json.dumps(to_jsonable_python(self.to_dict()))
74
+
75
+ @classmethod
76
+ def from_json(cls, json_str: str) -> Optional[Self]:
77
+ """Create an instance of CleanSlatePreview from a JSON string"""
78
+ return cls.from_dict(json.loads(json_str))
79
+
80
+ def to_dict(self) -> Dict[str, Any]:
81
+ """Return the dictionary representation of the model using alias.
82
+
83
+ This has the following differences from calling pydantic's
84
+ `self.model_dump(by_alias=True)`:
85
+
86
+ * `None` is only added to the output dict for nullable fields that
87
+ were set at model initialization. Other fields with value `None`
88
+ are ignored.
89
+ * OpenAPI `readOnly` fields are excluded.
90
+ * OpenAPI `readOnly` fields are excluded.
91
+ """
92
+ excluded_fields: Set[str] = set([
93
+ "ok",
94
+ "files_missing",
95
+ ])
96
+
97
+ _dict = self.model_dump(
98
+ by_alias=True,
99
+ exclude=excluded_fields,
100
+ exclude_none=True,
101
+ )
102
+ # set to None if expected_tracks (nullable) is None
103
+ # and model_fields_set contains the field
104
+ if self.expected_tracks is None and "expected_tracks" in self.model_fields_set:
105
+ _dict['expected_tracks'] = None
106
+
107
+ # set to None if art_to_delete (nullable) is None
108
+ # and model_fields_set contains the field
109
+ if self.art_to_delete is None and "art_to_delete" in self.model_fields_set:
110
+ _dict['art_to_delete'] = None
111
+
112
+ return _dict
113
+
114
+ @classmethod
115
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
116
+ """Create an instance of CleanSlatePreview from a dict"""
117
+ if obj is None:
118
+ return None
119
+
120
+ if not isinstance(obj, dict):
121
+ return cls.model_validate(obj)
122
+
123
+ _obj = cls.model_validate({
124
+ "subject": obj.get("subject"),
125
+ "beets_id": obj.get("beets_id"),
126
+ "label": obj.get("label"),
127
+ "item_count": obj.get("item_count"),
128
+ "files_present": obj.get("files_present"),
129
+ "missing_paths": obj.get("missing_paths"),
130
+ "expected_tracks": obj.get("expected_tracks"),
131
+ "files_to_delete": obj.get("files_to_delete"),
132
+ "files_kept_outside_library": obj.get("files_kept_outside_library"),
133
+ "art_to_delete": obj.get("art_to_delete"),
134
+ "flexible_attributes_lost": obj.get("flexible_attributes_lost"),
135
+ "fields_preserved": obj.get("fields_preserved"),
136
+ "source_path": obj.get("source_path"),
137
+ "source_audio_files": obj.get("source_audio_files") if obj.get("source_audio_files") is not None else 0,
138
+ "source_album_groups": obj.get("source_album_groups") if obj.get("source_album_groups") is not None else 0,
139
+ "warnings": obj.get("warnings"),
140
+ "errors": obj.get("errors"),
141
+ "needs_confirmation": obj.get("needs_confirmation") if obj.get("needs_confirmation") is not None else False,
142
+ "ok": obj.get("ok"),
143
+ "files_missing": obj.get("files_missing")
144
+ })
145
+ return _obj
146
+
147
+
@@ -0,0 +1,116 @@
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, StrictBool, StrictInt, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing_extensions import Annotated
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+ from pydantic_core import to_jsonable_python
26
+
27
+ class CleanSlateSubmitRequest(BaseModel):
28
+ """
29
+ Body for starting a clean-slate import: remove the named library entry — its rows, the files inside the beets directory and the album art, like `beet remove -d` — then import `source_path` afresh as an ordinary path import (decisions, abort, quiet mode all apply). Nothing is carried over from the old entry — not its flexible attributes, not its added-date — except the flexible attributes named as keys of the `downloader_hook.beet_field_to_dl_search_field` config, whose values are re-applied to the fresh import via `set_fields` (winning over a `set_fields` entry of the same name). Option defaults come from the `beets.config` values. The removal happens before the import starts; skipping or aborting the import afterwards leaves the entry removed and the source files where they are. Preview first with `GET /api/import/clean_slate/preview`.
30
+ """ # noqa: E501
31
+ beets_album_id: Optional[StrictInt] = Field(default=None, description="The beets library id of an album. Mutually exclusive with `beets_item_id`.")
32
+ beets_item_id: Optional[StrictInt] = Field(default=None, description="The beets library id of an item (track). Mutually exclusive with `beets_album_id`.")
33
+ source_path: Annotated[str, Field(min_length=1, strict=True)] = Field(description="The entry's raw (pre-import) source folder, under beetkeeper's `downloads_path`; for a standalone track, the audio file itself or a folder holding just that file.")
34
+ allow_fewer_files: Optional[StrictBool] = Field(default=False, description="Proceed even when the source holds fewer audio files than the entry currently has on disk (the clean slate would then delete files the source cannot replace). Off by default.")
35
+ quiet: Optional[StrictBool] = Field(default=None, description="Run non-interactively (like `beet import -q`). See `ImportSubmitRequest.quiet`.")
36
+ logpath: Optional[StrictStr] = Field(default=None, description="Corresponds to the `-l` option, or the config's `import.log` option.")
37
+ set_fields: Optional[Dict[str, StrictStr]] = Field(default=None, description="Corresponds to the `--set field=value` option for beets' `import` CLI command.")
38
+ __properties: ClassVar[List[str]] = ["beets_album_id", "beets_item_id", "source_path", "allow_fewer_files", "quiet", "logpath", "set_fields"]
39
+
40
+ model_config = ConfigDict(
41
+ validate_by_name=True,
42
+ validate_by_alias=True,
43
+ validate_assignment=True,
44
+ protected_namespaces=(),
45
+ )
46
+
47
+
48
+ def to_str(self) -> str:
49
+ """Returns the string representation of the model using alias"""
50
+ return pprint.pformat(self.model_dump(by_alias=True))
51
+
52
+ def to_json(self) -> str:
53
+ """Returns the JSON representation of the model using alias"""
54
+ return json.dumps(to_jsonable_python(self.to_dict()))
55
+
56
+ @classmethod
57
+ def from_json(cls, json_str: str) -> Optional[Self]:
58
+ """Create an instance of CleanSlateSubmitRequest from a JSON string"""
59
+ return cls.from_dict(json.loads(json_str))
60
+
61
+ def to_dict(self) -> Dict[str, Any]:
62
+ """Return the dictionary representation of the model using alias.
63
+
64
+ This has the following differences from calling pydantic's
65
+ `self.model_dump(by_alias=True)`:
66
+
67
+ * `None` is only added to the output dict for nullable fields that
68
+ were set at model initialization. Other fields with value `None`
69
+ are ignored.
70
+ """
71
+ excluded_fields: Set[str] = set([
72
+ ])
73
+
74
+ _dict = self.model_dump(
75
+ by_alias=True,
76
+ exclude=excluded_fields,
77
+ exclude_none=True,
78
+ )
79
+ # set to None if beets_album_id (nullable) is None
80
+ # and model_fields_set contains the field
81
+ if self.beets_album_id is None and "beets_album_id" in self.model_fields_set:
82
+ _dict['beets_album_id'] = None
83
+
84
+ # set to None if beets_item_id (nullable) is None
85
+ # and model_fields_set contains the field
86
+ if self.beets_item_id is None and "beets_item_id" in self.model_fields_set:
87
+ _dict['beets_item_id'] = None
88
+
89
+ # set to None if logpath (nullable) is None
90
+ # and model_fields_set contains the field
91
+ if self.logpath is None and "logpath" in self.model_fields_set:
92
+ _dict['logpath'] = None
93
+
94
+ return _dict
95
+
96
+ @classmethod
97
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
98
+ """Create an instance of CleanSlateSubmitRequest from a dict"""
99
+ if obj is None:
100
+ return None
101
+
102
+ if not isinstance(obj, dict):
103
+ return cls.model_validate(obj)
104
+
105
+ _obj = cls.model_validate({
106
+ "beets_album_id": obj.get("beets_album_id"),
107
+ "beets_item_id": obj.get("beets_item_id"),
108
+ "source_path": obj.get("source_path"),
109
+ "allow_fewer_files": obj.get("allow_fewer_files") if obj.get("allow_fewer_files") is not None else False,
110
+ "quiet": obj.get("quiet"),
111
+ "logpath": obj.get("logpath"),
112
+ "set_fields": obj.get("set_fields")
113
+ })
114
+ return _obj
115
+
116
+
@@ -0,0 +1,140 @@
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
+ from inspect import getfullargspec
17
+ import json
18
+ import pprint
19
+ import re # noqa: F401
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
21
+ from typing import Optional
22
+ from beetkeeper_api_client.models.api_album import APIAlbum
23
+ from beetkeeper_api_client.models.api_track import APITrack
24
+ from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
25
+ from typing_extensions import Literal, Self
26
+ from pydantic import Field
27
+
28
+ CURRENTBEETSSUBJECTSTATE_ANY_OF_SCHEMAS = ["APIAlbum", "APITrack"]
29
+
30
+ class CurrentBeetsSubjectState(BaseModel):
31
+ """
32
+ Current state of the event's subject (Album or Item). Null if subject no longer exists.
33
+ """
34
+
35
+ # data type: APIAlbum
36
+ anyof_schema_1_validator: Optional[APIAlbum] = None
37
+ # data type: APITrack
38
+ anyof_schema_2_validator: Optional[APITrack] = None
39
+ if TYPE_CHECKING:
40
+ actual_instance: Optional[Union[APIAlbum, APITrack]] = None
41
+ else:
42
+ actual_instance: Any = None
43
+ any_of_schemas: Set[str] = { "APIAlbum", "APITrack" }
44
+
45
+ model_config = {
46
+ "validate_assignment": True,
47
+ "protected_namespaces": (),
48
+ }
49
+
50
+ def __init__(self, *args, **kwargs) -> None:
51
+ if args:
52
+ if len(args) > 1:
53
+ raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
54
+ if kwargs:
55
+ raise ValueError("If a position argument is used, keyword arguments cannot be used.")
56
+ super().__init__(actual_instance=args[0])
57
+ else:
58
+ super().__init__(**kwargs)
59
+
60
+ @field_validator('actual_instance')
61
+ def actual_instance_must_validate_anyof(cls, v):
62
+ if v is None:
63
+ return v
64
+
65
+ instance = CurrentBeetsSubjectState.model_construct()
66
+ error_messages = []
67
+ # validate data type: APIAlbum
68
+ if not isinstance(v, APIAlbum):
69
+ error_messages.append(f"Error! Input type `{type(v)}` is not `APIAlbum`")
70
+ else:
71
+ return v
72
+
73
+ # validate data type: APITrack
74
+ if not isinstance(v, APITrack):
75
+ error_messages.append(f"Error! Input type `{type(v)}` is not `APITrack`")
76
+ else:
77
+ return v
78
+
79
+ if error_messages:
80
+ # no match
81
+ raise ValueError("No match found when setting the actual_instance in CurrentBeetsSubjectState with anyOf schemas: APIAlbum, APITrack. Details: " + ", ".join(error_messages))
82
+ else:
83
+ return v
84
+
85
+ @classmethod
86
+ def from_dict(cls, obj: Dict[str, Any]) -> Self:
87
+ return cls.from_json(json.dumps(obj))
88
+
89
+ @classmethod
90
+ def from_json(cls, json_str: str) -> Self:
91
+ """Returns the object represented by the json string"""
92
+ instance = cls.model_construct()
93
+ if json_str is None:
94
+ return instance
95
+
96
+ error_messages = []
97
+ # anyof_schema_1_validator: Optional[APIAlbum] = None
98
+ try:
99
+ instance.actual_instance = APIAlbum.from_json(json_str)
100
+ return instance
101
+ except (ValidationError, ValueError) as e:
102
+ error_messages.append(str(e))
103
+ # anyof_schema_2_validator: Optional[APITrack] = None
104
+ try:
105
+ instance.actual_instance = APITrack.from_json(json_str)
106
+ return instance
107
+ except (ValidationError, ValueError) as e:
108
+ error_messages.append(str(e))
109
+
110
+ if error_messages:
111
+ # no match
112
+ raise ValueError("No match found when deserializing the JSON string into CurrentBeetsSubjectState with anyOf schemas: APIAlbum, APITrack. Details: " + ", ".join(error_messages))
113
+ else:
114
+ return instance
115
+
116
+ def to_json(self) -> str:
117
+ """Returns the JSON representation of the actual instance"""
118
+ if self.actual_instance is None:
119
+ return "null"
120
+
121
+ if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
122
+ return self.actual_instance.to_json()
123
+ else:
124
+ return json.dumps(self.actual_instance)
125
+
126
+ def to_dict(self) -> Optional[Union[Dict[str, Any], APIAlbum, APITrack]]:
127
+ """Returns the dict representation of the actual instance"""
128
+ if self.actual_instance is None:
129
+ return None
130
+
131
+ if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
132
+ return self.actual_instance.to_dict()
133
+ else:
134
+ return self.actual_instance
135
+
136
+ def to_str(self) -> str:
137
+ """Returns the string representation of the actual instance"""
138
+ return pprint.pformat(self.model_dump())
139
+
140
+
@@ -0,0 +1,104 @@
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, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from beetkeeper_api_client.models.import_action import ImportAction
23
+ from beetkeeper_api_client.models.import_candidate import ImportCandidate
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class DecisionRequest(BaseModel):
29
+ """
30
+ Published when the importer needs a user choice for a task; the matching `ImportDecision` unblocks it.
31
+ """ # noqa: E501
32
+ job_id: StrictStr
33
+ task_id: StrictStr
34
+ prompt: StrictStr
35
+ candidates: Optional[List[ImportCandidate]] = None
36
+ allowed_actions: Optional[List[ImportAction]] = None
37
+ __properties: ClassVar[List[str]] = ["job_id", "task_id", "prompt", "candidates", "allowed_actions"]
38
+
39
+ model_config = ConfigDict(
40
+ validate_by_name=True,
41
+ validate_by_alias=True,
42
+ validate_assignment=True,
43
+ protected_namespaces=(),
44
+ )
45
+
46
+
47
+ def to_str(self) -> str:
48
+ """Returns the string representation of the model using alias"""
49
+ return pprint.pformat(self.model_dump(by_alias=True))
50
+
51
+ def to_json(self) -> str:
52
+ """Returns the JSON representation of the model using alias"""
53
+ return json.dumps(to_jsonable_python(self.to_dict()))
54
+
55
+ @classmethod
56
+ def from_json(cls, json_str: str) -> Optional[Self]:
57
+ """Create an instance of DecisionRequest from a JSON string"""
58
+ return cls.from_dict(json.loads(json_str))
59
+
60
+ def to_dict(self) -> Dict[str, Any]:
61
+ """Return the dictionary representation of the model using alias.
62
+
63
+ This has the following differences from calling pydantic's
64
+ `self.model_dump(by_alias=True)`:
65
+
66
+ * `None` is only added to the output dict for nullable fields that
67
+ were set at model initialization. Other fields with value `None`
68
+ are ignored.
69
+ """
70
+ excluded_fields: Set[str] = set([
71
+ ])
72
+
73
+ _dict = self.model_dump(
74
+ by_alias=True,
75
+ exclude=excluded_fields,
76
+ exclude_none=True,
77
+ )
78
+ # override the default output from pydantic by calling `to_dict()` of each item in candidates (list)
79
+ _items = []
80
+ if self.candidates:
81
+ for _item_candidates in self.candidates:
82
+ _items.append(_item_candidates.to_dict() if _item_candidates is not None else None)
83
+ _dict['candidates'] = _items
84
+ return _dict
85
+
86
+ @classmethod
87
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
88
+ """Create an instance of DecisionRequest from a dict"""
89
+ if obj is None:
90
+ return None
91
+
92
+ if not isinstance(obj, dict):
93
+ return cls.model_validate(obj)
94
+
95
+ _obj = cls.model_validate({
96
+ "job_id": obj.get("job_id"),
97
+ "task_id": obj.get("task_id"),
98
+ "prompt": obj.get("prompt"),
99
+ "candidates": [ImportCandidate.from_dict(_item) for _item in obj["candidates"]] if obj.get("candidates") is not None else None,
100
+ "allowed_actions": obj.get("allowed_actions")
101
+ })
102
+ return _obj
103
+
104
+
@@ -0,0 +1,97 @@
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, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from beetkeeper_api_client.models.event_search_result import EventSearchResult
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+ from pydantic_core import to_jsonable_python
26
+
27
+ class EventSearchResponse(BaseModel):
28
+ """
29
+ Response model for the `GET /api/events/(album|track)/{id}` and `GET /api/events/{event_id}` search routes.
30
+ """ # noqa: E501
31
+ results: Optional[List[EventSearchResult]] = None
32
+ errors: Optional[List[StrictStr]] = Field(default=None, description="Any error messages from the event search.")
33
+ __properties: ClassVar[List[str]] = ["results", "errors"]
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 EventSearchResponse 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
+ # override the default output from pydantic by calling `to_dict()` of each item in results (list)
75
+ _items = []
76
+ if self.results:
77
+ for _item_results in self.results:
78
+ _items.append(_item_results.to_dict() if _item_results is not None else None)
79
+ _dict['results'] = _items
80
+ return _dict
81
+
82
+ @classmethod
83
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84
+ """Create an instance of EventSearchResponse from a dict"""
85
+ if obj is None:
86
+ return None
87
+
88
+ if not isinstance(obj, dict):
89
+ return cls.model_validate(obj)
90
+
91
+ _obj = cls.model_validate({
92
+ "results": [EventSearchResult.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None,
93
+ "errors": obj.get("errors")
94
+ })
95
+ return _obj
96
+
97
+