diff --git a/README.md b/README.md index 5ae240a..a12e392 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Sonarr API docs This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: 3.0.0 -- Package version: 0.0.1 +- Package version: 0.5.1 - Build package: org.openapitools.codegen.languages.PythonNextgenClientCodegen ## Requirements. @@ -295,7 +295,7 @@ Class | Method | HTTP request | Description *SeriesEditorApi* | [**delete_series_editor**](docs/SeriesEditorApi.md#delete_series_editor) | **DELETE** /api/v3/series/editor | *SeriesEditorApi* | [**put_series_editor**](docs/SeriesEditorApi.md#put_series_editor) | **PUT** /api/v3/series/editor | *SeriesImportApi* | [**create_series_import**](docs/SeriesImportApi.md#create_series_import) | **POST** /api/v3/series/import | -*SeriesLookupApi* | [**get_series_lookup**](docs/SeriesLookupApi.md#get_series_lookup) | **GET** /api/v3/series/lookup | +*SeriesLookupApi* | [**list_series_lookup**](docs/SeriesLookupApi.md#list_series_lookup) | **GET** /api/v3/series/lookup | *StaticResourceApi* | [**get**](docs/StaticResourceApi.md#get) | **GET** / | *StaticResourceApi* | [**get_by_path**](docs/StaticResourceApi.md#get_by_path) | **GET** /{path} | *StaticResourceApi* | [**get_content_by_path**](docs/StaticResourceApi.md#get_content_by_path) | **GET** /content/{path} | @@ -364,7 +364,6 @@ Class | Method | HTTP request | Description - [HistoryResource](docs/HistoryResource.md) - [HistoryResourcePagingResource](docs/HistoryResourcePagingResource.md) - [HostConfigResource](docs/HostConfigResource.md) - - [HttpUri](docs/HttpUri.md) - [ImportListExclusionResource](docs/ImportListExclusionResource.md) - [ImportListResource](docs/ImportListResource.md) - [ImportListType](docs/ImportListType.md) @@ -437,7 +436,6 @@ Class | Method | HTTP request | Description - [TagDetailsResource](docs/TagDetailsResource.md) - [TagResource](docs/TagResource.md) - [TaskResource](docs/TaskResource.md) - - [TimeSpan](docs/TimeSpan.md) - [TrackedDownloadState](docs/TrackedDownloadState.md) - [TrackedDownloadStatus](docs/TrackedDownloadStatus.md) - [TrackedDownloadStatusMessage](docs/TrackedDownloadStatusMessage.md) diff --git a/docs/CommandResource.md b/docs/CommandResource.md index c272fb1..d379204 100644 --- a/docs/CommandResource.md +++ b/docs/CommandResource.md @@ -14,7 +14,7 @@ Name | Type | Description | Notes **queued** | **datetime** | | [optional] **started** | **datetime** | | [optional] **ended** | **datetime** | | [optional] -**duration** | [**TimeSpan**](TimeSpan.md) | | [optional] +**duration** | **str** | | [optional] **exception** | **str** | | [optional] **trigger** | [**CommandTrigger**](CommandTrigger.md) | | [optional] **client_user_agent** | **str** | | [optional] diff --git a/docs/ImportListResource.md b/docs/ImportListResource.md index 1ba27fb..37e7ed4 100644 --- a/docs/ImportListResource.md +++ b/docs/ImportListResource.md @@ -22,7 +22,7 @@ Name | Type | Description | Notes **season_folder** | **bool** | | [optional] **list_type** | [**ImportListType**](ImportListType.md) | | [optional] **list_order** | **int** | | [optional] -**min_refresh_interval** | [**TimeSpan**](TimeSpan.md) | | [optional] +**min_refresh_interval** | **str** | | [optional] ## Example diff --git a/docs/QueueResource.md b/docs/QueueResource.md index c867f5c..35a2886 100644 --- a/docs/QueueResource.md +++ b/docs/QueueResource.md @@ -15,7 +15,7 @@ Name | Type | Description | Notes **size** | **float** | | [optional] **title** | **str** | | [optional] **sizeleft** | **float** | | [optional] -**timeleft** | [**TimeSpan**](TimeSpan.md) | | [optional] +**timeleft** | **str** | | [optional] **estimated_completion_time** | **datetime** | | [optional] **status** | **str** | | [optional] **tracked_download_status** | [**TrackedDownloadStatus**](TrackedDownloadStatus.md) | | [optional] diff --git a/docs/TaskResource.md b/docs/TaskResource.md index cd9bfd2..ff086eb 100644 --- a/docs/TaskResource.md +++ b/docs/TaskResource.md @@ -11,7 +11,7 @@ Name | Type | Description | Notes **last_execution** | **datetime** | | [optional] **last_start_time** | **datetime** | | [optional] **next_execution** | **datetime** | | [optional] -**last_duration** | [**TimeSpan**](TimeSpan.md) | | [optional] +**last_duration** | **str** | | [optional] ## Example diff --git a/sonarr/__init__.py b/sonarr/__init__.py index b9457e6..939fe51 100644 --- a/sonarr/__init__.py +++ b/sonarr/__init__.py @@ -14,7 +14,7 @@ from __future__ import absolute_import -__version__ = "0.0.1" +__version__ = "0.5.1" # import apis into sdk package from sonarr.api.api_info_api import ApiInfoApi @@ -208,7 +208,6 @@ from sonarr.models.tag_details_resource import TagDetailsResource from sonarr.models.tag_resource import TagResource from sonarr.models.task_resource import TaskResource -from sonarr.models.time_span import TimeSpan from sonarr.models.tracked_download_state import TrackedDownloadState from sonarr.models.tracked_download_status import TrackedDownloadStatus from sonarr.models.tracked_download_status_message import TrackedDownloadStatusMessage diff --git a/sonarr/models/__init__.py b/sonarr/models/__init__.py index 1112dd6..557c108 100644 --- a/sonarr/models/__init__.py +++ b/sonarr/models/__init__.py @@ -128,7 +128,6 @@ from sonarr.models.tag_details_resource import TagDetailsResource from sonarr.models.tag_resource import TagResource from sonarr.models.task_resource import TaskResource -from sonarr.models.time_span import TimeSpan from sonarr.models.tracked_download_state import TrackedDownloadState from sonarr.models.tracked_download_status import TrackedDownloadStatus from sonarr.models.tracked_download_status_message import TrackedDownloadStatusMessage diff --git a/sonarr/models/command_resource.py b/sonarr/models/command_resource.py index 163e0cf..902a580 100644 --- a/sonarr/models/command_resource.py +++ b/sonarr/models/command_resource.py @@ -23,7 +23,6 @@ from sonarr.models.command_priority import CommandPriority from sonarr.models.command_status import CommandStatus from sonarr.models.command_trigger import CommandTrigger -from sonarr.models.time_span import TimeSpan class CommandResource(BaseModel): """NOTE: This class is auto generated by OpenAPI Generator. @@ -41,7 +40,7 @@ class CommandResource(BaseModel): queued: Optional[datetime] started: Optional[datetime] ended: Optional[datetime] - duration: Optional[TimeSpan] + duration: Optional[str] exception: Optional[str] trigger: Optional[CommandTrigger] client_user_agent: Optional[str] @@ -51,6 +50,12 @@ class CommandResource(BaseModel): last_execution_time: Optional[datetime] __properties = ["id", "name", "commandName", "message", "body", "priority", "status", "queued", "started", "ended", "duration", "exception", "trigger", "clientUserAgent", "stateChangeTime", "sendUpdatesToClient", "updateScheduledTask", "lastExecutionTime"] + @validator('duration') + def duration_validate_regular_expression(cls, v): + if not re.match(r"\d{2}:\d{2}:\d{2}", v): + raise ValueError(r"must validate the regular expression /\d{2}:\d{2}:\d{2}/") + return v + class Config: allow_population_by_field_name = True validate_assignment = True @@ -81,9 +86,6 @@ def to_dict(self): # override the default output from pydantic by calling `to_dict()` of body if self.body: _dict['body'] = self.body.to_dict() - # override the default output from pydantic by calling `to_dict()` of duration - if self.duration: - _dict['duration'] = self.duration.to_dict() # set to None if name (nullable) is None if self.name is None: _dict['name'] = None @@ -142,7 +144,7 @@ def from_dict(cls, obj: dict) -> CommandResource: "queued": obj.get("queued"), "started": obj.get("started"), "ended": obj.get("ended"), - "duration": TimeSpan.from_dict(obj.get("duration")) if obj.get("duration") is not None else None, + "duration": obj.get("duration"), "exception": obj.get("exception"), "trigger": obj.get("trigger"), "client_user_agent": obj.get("clientUserAgent"), diff --git a/sonarr/models/import_list_resource.py b/sonarr/models/import_list_resource.py index ebdb3af..2c496ed 100644 --- a/sonarr/models/import_list_resource.py +++ b/sonarr/models/import_list_resource.py @@ -24,7 +24,6 @@ from sonarr.models.monitor_types import MonitorTypes from sonarr.models.provider_message import ProviderMessage from sonarr.models.series_types import SeriesTypes -from sonarr.models.time_span import TimeSpan class ImportListResource(BaseModel): """NOTE: This class is auto generated by OpenAPI Generator. @@ -50,9 +49,15 @@ class ImportListResource(BaseModel): season_folder: Optional[bool] list_type: Optional[ImportListType] list_order: Optional[int] - min_refresh_interval: Optional[TimeSpan] + min_refresh_interval: Optional[str] __properties = ["id", "name", "fields", "implementationName", "implementation", "configContract", "infoLink", "message", "tags", "presets", "enableAutomaticAdd", "shouldMonitor", "rootFolderPath", "qualityProfileId", "seriesType", "seasonFolder", "listType", "listOrder", "minRefreshInterval"] + @validator('min_refresh_interval') + def min_refresh_interval_validate_regular_expression(cls, v): + if not re.match(r"\d{2}:\d{2}:\d{2}", v): + raise ValueError(r"must validate the regular expression /\d{2}:\d{2}:\d{2}/") + return v + class Config: allow_population_by_field_name = True validate_assignment = True @@ -97,9 +102,6 @@ def to_dict(self): if _item: _items.append(_item.to_dict()) _dict['presets'] = _items - # override the default output from pydantic by calling `to_dict()` of min_refresh_interval - if self.min_refresh_interval: - _dict['minRefreshInterval'] = self.min_refresh_interval.to_dict() # set to None if name (nullable) is None if self.name is None: _dict['name'] = None @@ -166,7 +168,7 @@ def from_dict(cls, obj: dict) -> ImportListResource: "season_folder": obj.get("seasonFolder"), "list_type": obj.get("listType"), "list_order": obj.get("listOrder"), - "min_refresh_interval": TimeSpan.from_dict(obj.get("minRefreshInterval")) if obj.get("minRefreshInterval") is not None else None + "min_refresh_interval": obj.get("minRefreshInterval") }) return _obj diff --git a/sonarr/models/queue_resource.py b/sonarr/models/queue_resource.py index 5a8ea7b..facfc7f 100644 --- a/sonarr/models/queue_resource.py +++ b/sonarr/models/queue_resource.py @@ -25,7 +25,6 @@ from sonarr.models.language import Language from sonarr.models.quality_model import QualityModel from sonarr.models.series_resource import SeriesResource -from sonarr.models.time_span import TimeSpan from sonarr.models.tracked_download_state import TrackedDownloadState from sonarr.models.tracked_download_status import TrackedDownloadStatus from sonarr.models.tracked_download_status_message import TrackedDownloadStatusMessage @@ -47,7 +46,7 @@ class QueueResource(BaseModel): size: Optional[float] title: Optional[str] sizeleft: Optional[float] - timeleft: Optional[TimeSpan] + timeleft: Optional[str] estimated_completion_time: Optional[datetime] status: Optional[str] tracked_download_status: Optional[TrackedDownloadStatus] @@ -61,6 +60,12 @@ class QueueResource(BaseModel): output_path: Optional[str] __properties = ["id", "seriesId", "episodeId", "series", "episode", "languages", "quality", "customFormats", "size", "title", "sizeleft", "timeleft", "estimatedCompletionTime", "status", "trackedDownloadStatus", "trackedDownloadState", "statusMessages", "errorMessage", "downloadId", "protocol", "downloadClient", "indexer", "outputPath"] + @validator('timeleft') + def timeleft_validate_regular_expression(cls, v): + if not re.match(r"\d{2}:\d{2}:\d{2}", v): + raise ValueError(r"must validate the regular expression /\d{2}:\d{2}:\d{2}/") + return v + class Config: allow_population_by_field_name = True validate_assignment = True @@ -111,9 +116,6 @@ def to_dict(self): if _item: _items.append(_item.to_dict()) _dict['customFormats'] = _items - # override the default output from pydantic by calling `to_dict()` of timeleft - if self.timeleft: - _dict['timeleft'] = self.timeleft.to_dict() # override the default output from pydantic by calling `to_dict()` of each item in status_messages (list) _items = [] if self.status_messages: @@ -196,7 +198,7 @@ def from_dict(cls, obj: dict) -> QueueResource: "size": obj.get("size"), "title": obj.get("title"), "sizeleft": obj.get("sizeleft"), - "timeleft": TimeSpan.from_dict(obj.get("timeleft")) if obj.get("timeleft") is not None else None, + "timeleft": obj.get("timeleft"), "estimated_completion_time": obj.get("estimatedCompletionTime"), "status": obj.get("status"), "tracked_download_status": obj.get("trackedDownloadStatus"), diff --git a/sonarr/models/task_resource.py b/sonarr/models/task_resource.py index 552137e..e4905ba 100644 --- a/sonarr/models/task_resource.py +++ b/sonarr/models/task_resource.py @@ -19,7 +19,6 @@ from datetime import datetime from typing import Optional from pydantic import BaseModel -from sonarr.models.time_span import TimeSpan class TaskResource(BaseModel): """NOTE: This class is auto generated by OpenAPI Generator. @@ -34,9 +33,15 @@ class TaskResource(BaseModel): last_execution: Optional[datetime] last_start_time: Optional[datetime] next_execution: Optional[datetime] - last_duration: Optional[TimeSpan] + last_duration: Optional[str] __properties = ["id", "name", "taskName", "interval", "lastExecution", "lastStartTime", "nextExecution", "lastDuration"] + @validator('last_duration') + def last_duration_validate_regular_expression(cls, v): + if not re.match(r"\d{2}:\d{2}:\d{2}", v): + raise ValueError(r"must validate the regular expression /\d{2}:\d{2}:\d{2}/") + return v + class Config: allow_population_by_field_name = True validate_assignment = True @@ -64,9 +69,6 @@ def to_dict(self): exclude={ }, exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of last_duration - if self.last_duration: - _dict['lastDuration'] = self.last_duration.to_dict() # set to None if name (nullable) is None if self.name is None: _dict['name'] = None @@ -94,7 +96,7 @@ def from_dict(cls, obj: dict) -> TaskResource: "last_execution": obj.get("lastExecution"), "last_start_time": obj.get("lastStartTime"), "next_execution": obj.get("nextExecution"), - "last_duration": TimeSpan.from_dict(obj.get("lastDuration")) if obj.get("lastDuration") is not None else None + "last_duration": obj.get("lastDuration") }) return _obj diff --git a/sonarr/models/time_span.py b/sonarr/models/time_span.py deleted file mode 100644 index 955e942..0000000 --- a/sonarr/models/time_span.py +++ /dev/null @@ -1,104 +0,0 @@ -# coding: utf-8 - -""" - Sonarr - - Sonarr API docs # noqa: E501 - - The version of the OpenAPI document: 3.0.0 - Generated by: https://openapi-generator.tech -""" - - -from __future__ import annotations -from inspect import getfullargspec -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel - -class TimeSpan(BaseModel): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - ticks: Optional[int] - days: Optional[int] - hours: Optional[int] - milliseconds: Optional[int] - minutes: Optional[int] - seconds: Optional[int] - total_days: Optional[float] - total_hours: Optional[float] - total_milliseconds: Optional[float] - total_minutes: Optional[float] - total_seconds: Optional[float] - __properties = ["ticks", "days", "hours", "milliseconds", "minutes", "seconds", "totalDays", "totalHours", "totalMilliseconds", "totalMinutes", "totalSeconds"] - - class Config: - allow_population_by_field_name = True - validate_assignment = True - alias_generator = lambda x: x.split("_")[0] + "".join(word.capitalize() for word in x.split("_")[1:]) - - def __getitem__(self, item): - return getattr(self, item) - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> TimeSpan: - """Create an instance of TimeSpan from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - "days", - "hours", - "milliseconds", - "minutes", - "seconds", - "total_days", - "total_hours", - "total_milliseconds", - "total_minutes", - "total_seconds", - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> TimeSpan: - """Create an instance of TimeSpan from a dict""" - if obj is None: - return None - - if type(obj) is not dict: - return TimeSpan.parse_obj(obj) - - _obj = TimeSpan.parse_obj({ - "ticks": obj.get("ticks"), - "days": obj.get("days"), - "hours": obj.get("hours"), - "milliseconds": obj.get("milliseconds"), - "minutes": obj.get("minutes"), - "seconds": obj.get("seconds"), - "total_days": obj.get("totalDays"), - "total_hours": obj.get("totalHours"), - "total_milliseconds": obj.get("totalMilliseconds"), - "total_minutes": obj.get("totalMinutes"), - "total_seconds": obj.get("totalSeconds") - }) - return _obj -