Skip to content

Commit

Permalink
Merge pull request #50 from devopsarr/feature/code-generation
Browse files Browse the repository at this point in the history
fix: map Field to ContractField to avoid pydantic issue
  • Loading branch information
devopsarr[bot] committed Feb 21, 2024
2 parents af4661f + 60d03b2 commit f070802
Show file tree
Hide file tree
Showing 15 changed files with 72 additions and 27 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ Class | Method | HTTP request | Description
- [CommandResource](docs/CommandResource.md)
- [CommandStatus](docs/CommandStatus.md)
- [CommandTrigger](docs/CommandTrigger.md)
- [ContractField](docs/ContractField.md)
- [CustomFilterResource](docs/CustomFilterResource.md)
- [DatabaseType](docs/DatabaseType.md)
- [DevelopmentConfigResource](docs/DevelopmentConfigResource.md)
Expand All @@ -253,7 +254,6 @@ Class | Method | HTTP request | Description
- [DownloadClientConfigResource](docs/DownloadClientConfigResource.md)
- [DownloadClientResource](docs/DownloadClientResource.md)
- [DownloadProtocol](docs/DownloadProtocol.md)
- [Field](docs/Field.md)
- [HealthCheckResult](docs/HealthCheckResult.md)
- [HealthResource](docs/HealthResource.md)
- [HistoryEventType](docs/HistoryEventType.md)
Expand Down
2 changes: 1 addition & 1 deletion docs/ApplicationResource.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional]
**name** | **str** | | [optional]
**fields** | [**List[Field]**](Field.md) | | [optional]
**fields** | [**List[ContractField]**](ContractField.md) | | [optional]
**implementation_name** | **str** | | [optional]
**implementation** | **str** | | [optional]
**config_contract** | **str** | | [optional]
Expand Down
45 changes: 45 additions & 0 deletions docs/ContractField.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# ContractField


## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**order** | **int** | | [optional]
**name** | **str** | | [optional]
**label** | **str** | | [optional]
**unit** | **str** | | [optional]
**help_text** | **str** | | [optional]
**help_text_warning** | **str** | | [optional]
**help_link** | **str** | | [optional]
**value** | **object** | | [optional]
**type** | **str** | | [optional]
**advanced** | **bool** | | [optional]
**select_options** | [**List[SelectOption]**](SelectOption.md) | | [optional]
**select_options_provider_action** | **str** | | [optional]
**section** | **str** | | [optional]
**hidden** | **str** | | [optional]
**privacy** | [**PrivacyLevel**](PrivacyLevel.md) | | [optional]
**placeholder** | **str** | | [optional]
**is_float** | **bool** | | [optional]

## Example

```python
from prowlarr.models.contract_field import ContractField

# TODO update the JSON string below
json = "{}"
# create an instance of ContractField from a JSON string
contract_field_instance = ContractField.from_json(json)
# print the JSON string representation of the object
print ContractField.to_json()

# convert the object into a dict
contract_field_dict = contract_field_instance.to_dict()
# create an instance of ContractField from a dict
contract_field_form_dict = contract_field.from_dict(contract_field_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


2 changes: 1 addition & 1 deletion docs/DownloadClientResource.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional]
**name** | **str** | | [optional]
**fields** | [**List[Field]**](Field.md) | | [optional]
**fields** | [**List[ContractField]**](ContractField.md) | | [optional]
**implementation_name** | **str** | | [optional]
**implementation** | **str** | | [optional]
**config_contract** | **str** | | [optional]
Expand Down
2 changes: 1 addition & 1 deletion docs/IndexerProxyResource.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional]
**name** | **str** | | [optional]
**fields** | [**List[Field]**](Field.md) | | [optional]
**fields** | [**List[ContractField]**](ContractField.md) | | [optional]
**implementation_name** | **str** | | [optional]
**implementation** | **str** | | [optional]
**config_contract** | **str** | | [optional]
Expand Down
2 changes: 1 addition & 1 deletion docs/IndexerResource.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional]
**name** | **str** | | [optional]
**fields** | [**List[Field]**](Field.md) | | [optional]
**fields** | [**List[ContractField]**](ContractField.md) | | [optional]
**implementation_name** | **str** | | [optional]
**implementation** | **str** | | [optional]
**config_contract** | **str** | | [optional]
Expand Down
2 changes: 1 addition & 1 deletion docs/NotificationResource.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional]
**name** | **str** | | [optional]
**fields** | [**List[Field]**](Field.md) | | [optional]
**fields** | [**List[ContractField]**](ContractField.md) | | [optional]
**implementation_name** | **str** | | [optional]
**implementation** | **str** | | [optional]
**config_contract** | **str** | | [optional]
Expand Down
2 changes: 1 addition & 1 deletion prowlarr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
from prowlarr.models.command_resource import CommandResource
from prowlarr.models.command_status import CommandStatus
from prowlarr.models.command_trigger import CommandTrigger
from prowlarr.models.contract_field import ContractField
from prowlarr.models.custom_filter_resource import CustomFilterResource
from prowlarr.models.database_type import DatabaseType
from prowlarr.models.development_config_resource import DevelopmentConfigResource
Expand All @@ -89,7 +90,6 @@
from prowlarr.models.download_client_config_resource import DownloadClientConfigResource
from prowlarr.models.download_client_resource import DownloadClientResource
from prowlarr.models.download_protocol import DownloadProtocol
from prowlarr.models.field import Field
from prowlarr.models.health_check_result import HealthCheckResult
from prowlarr.models.health_resource import HealthResource
from prowlarr.models.history_event_type import HistoryEventType
Expand Down
2 changes: 1 addition & 1 deletion prowlarr/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from prowlarr.models.command_resource import CommandResource
from prowlarr.models.command_status import CommandStatus
from prowlarr.models.command_trigger import CommandTrigger
from prowlarr.models.contract_field import ContractField
from prowlarr.models.custom_filter_resource import CustomFilterResource
from prowlarr.models.database_type import DatabaseType
from prowlarr.models.development_config_resource import DevelopmentConfigResource
Expand All @@ -39,7 +40,6 @@
from prowlarr.models.download_client_config_resource import DownloadClientConfigResource
from prowlarr.models.download_client_resource import DownloadClientResource
from prowlarr.models.download_protocol import DownloadProtocol
from prowlarr.models.field import Field
from prowlarr.models.health_check_result import HealthCheckResult
from prowlarr.models.health_resource import HealthResource
from prowlarr.models.history_event_type import HistoryEventType
Expand Down
6 changes: 3 additions & 3 deletions prowlarr/models/application_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from pydantic import BaseModel, Field, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from prowlarr.models.application_sync_level import ApplicationSyncLevel
from prowlarr.models.field import Field
from prowlarr.models.contract_field import ContractField
from prowlarr.models.provider_message import ProviderMessage
from typing import Optional, Set
from typing_extensions import Self
Expand All @@ -31,7 +31,7 @@ class ApplicationResource(BaseModel):
""" # noqa: E501
id: Optional[StrictInt] = None
name: Optional[StrictStr] = None
fields: Optional[List[Field]] = None
fields: Optional[List[ContractField]] = None
implementation_name: Optional[StrictStr] = Field(default=None, alias="implementationName")
implementation: Optional[StrictStr] = None
config_contract: Optional[StrictStr] = Field(default=None, alias="configContract")
Expand Down Expand Up @@ -158,7 +158,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
_obj = cls.model_validate({
"id": obj.get("id"),
"name": obj.get("name"),
"fields": [Field.from_dict(_item) for _item in obj["fields"]] if obj.get("fields") is not None else None,
"fields": [ContractField.from_dict(_item) for _item in obj["fields"]] if obj.get("fields") is not None else None,
"implementationName": obj.get("implementationName"),
"implementation": obj.get("implementation"),
"configContract": obj.get("configContract"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
from typing import Optional, Set
from typing_extensions import Self

class Field(BaseModel):
class ContractField(BaseModel):
"""
Field
ContractField
""" # noqa: E501
order: Optional[StrictInt] = None
name: Optional[StrictStr] = None
Expand Down Expand Up @@ -65,7 +65,7 @@ def to_json(self) -> str:

@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of Field from a JSON string"""
"""Create an instance of ContractField from a JSON string"""
return cls.from_dict(json.loads(json_str))

def to_dict(self) -> Dict[str, Any]:
Expand Down Expand Up @@ -162,7 +162,7 @@ def to_dict(self) -> Dict[str, Any]:

@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of Field from a dict"""
"""Create an instance of ContractField from a dict"""
if obj is None:
return None

Expand Down
6 changes: 3 additions & 3 deletions prowlarr/models/download_client_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from prowlarr.models.contract_field import ContractField
from prowlarr.models.download_client_category import DownloadClientCategory
from prowlarr.models.download_protocol import DownloadProtocol
from prowlarr.models.field import Field
from prowlarr.models.provider_message import ProviderMessage
from typing import Optional, Set
from typing_extensions import Self
Expand All @@ -32,7 +32,7 @@ class DownloadClientResource(BaseModel):
""" # noqa: E501
id: Optional[StrictInt] = None
name: Optional[StrictStr] = None
fields: Optional[List[Field]] = None
fields: Optional[List[ContractField]] = None
implementation_name: Optional[StrictStr] = Field(default=None, alias="implementationName")
implementation: Optional[StrictStr] = None
config_contract: Optional[StrictStr] = Field(default=None, alias="configContract")
Expand Down Expand Up @@ -169,7 +169,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
_obj = cls.model_validate({
"id": obj.get("id"),
"name": obj.get("name"),
"fields": [Field.from_dict(_item) for _item in obj["fields"]] if obj.get("fields") is not None else None,
"fields": [ContractField.from_dict(_item) for _item in obj["fields"]] if obj.get("fields") is not None else None,
"implementationName": obj.get("implementationName"),
"implementation": obj.get("implementation"),
"configContract": obj.get("configContract"),
Expand Down
6 changes: 3 additions & 3 deletions prowlarr/models/indexer_proxy_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from prowlarr.models.field import Field
from prowlarr.models.contract_field import ContractField
from prowlarr.models.provider_message import ProviderMessage
from typing import Optional, Set
from typing_extensions import Self
Expand All @@ -30,7 +30,7 @@ class IndexerProxyResource(BaseModel):
""" # noqa: E501
id: Optional[StrictInt] = None
name: Optional[StrictStr] = None
fields: Optional[List[Field]] = None
fields: Optional[List[ContractField]] = None
implementation_name: Optional[StrictStr] = Field(default=None, alias="implementationName")
implementation: Optional[StrictStr] = None
config_contract: Optional[StrictStr] = Field(default=None, alias="configContract")
Expand Down Expand Up @@ -165,7 +165,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
_obj = cls.model_validate({
"id": obj.get("id"),
"name": obj.get("name"),
"fields": [Field.from_dict(_item) for _item in obj["fields"]] if obj.get("fields") is not None else None,
"fields": [ContractField.from_dict(_item) for _item in obj["fields"]] if obj.get("fields") is not None else None,
"implementationName": obj.get("implementationName"),
"implementation": obj.get("implementation"),
"configContract": obj.get("configContract"),
Expand Down
6 changes: 3 additions & 3 deletions prowlarr/models/indexer_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
from datetime import datetime
from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from prowlarr.models.contract_field import ContractField
from prowlarr.models.download_protocol import DownloadProtocol
from prowlarr.models.field import Field
from prowlarr.models.indexer_capability_resource import IndexerCapabilityResource
from prowlarr.models.indexer_privacy import IndexerPrivacy
from prowlarr.models.indexer_status_resource import IndexerStatusResource
Expand All @@ -35,7 +35,7 @@ class IndexerResource(BaseModel):
""" # noqa: E501
id: Optional[StrictInt] = None
name: Optional[StrictStr] = None
fields: Optional[List[Field]] = None
fields: Optional[List[ContractField]] = None
implementation_name: Optional[StrictStr] = Field(default=None, alias="implementationName")
implementation: Optional[StrictStr] = None
config_contract: Optional[StrictStr] = Field(default=None, alias="configContract")
Expand Down Expand Up @@ -217,7 +217,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
_obj = cls.model_validate({
"id": obj.get("id"),
"name": obj.get("name"),
"fields": [Field.from_dict(_item) for _item in obj["fields"]] if obj.get("fields") is not None else None,
"fields": [ContractField.from_dict(_item) for _item in obj["fields"]] if obj.get("fields") is not None else None,
"implementationName": obj.get("implementationName"),
"implementation": obj.get("implementation"),
"configContract": obj.get("configContract"),
Expand Down
6 changes: 3 additions & 3 deletions prowlarr/models/notification_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from prowlarr.models.field import Field
from prowlarr.models.contract_field import ContractField
from prowlarr.models.provider_message import ProviderMessage
from typing import Optional, Set
from typing_extensions import Self
Expand All @@ -30,7 +30,7 @@ class NotificationResource(BaseModel):
""" # noqa: E501
id: Optional[StrictInt] = None
name: Optional[StrictStr] = None
fields: Optional[List[Field]] = None
fields: Optional[List[ContractField]] = None
implementation_name: Optional[StrictStr] = Field(default=None, alias="implementationName")
implementation: Optional[StrictStr] = None
config_contract: Optional[StrictStr] = Field(default=None, alias="configContract")
Expand Down Expand Up @@ -172,7 +172,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
_obj = cls.model_validate({
"id": obj.get("id"),
"name": obj.get("name"),
"fields": [Field.from_dict(_item) for _item in obj["fields"]] if obj.get("fields") is not None else None,
"fields": [ContractField.from_dict(_item) for _item in obj["fields"]] if obj.get("fields") is not None else None,
"implementationName": obj.get("implementationName"),
"implementation": obj.get("implementation"),
"configContract": obj.get("configContract"),
Expand Down

0 comments on commit f070802

Please sign in to comment.