1
0

More types
All checks were successful
Test Python / Test (push) Successful in 25s

This commit is contained in:
Jon Michael Aanes 2024-10-01 16:40:44 +02:00
parent 5aea78dd33
commit 618bb9e083
2 changed files with 44 additions and 7 deletions

View File

@ -32,7 +32,7 @@ URL_UPDATE_CARD = URL_API_ROOT + '/cards/{card_id}'
URL_GET_USER = URL_API_ROOT + '/users/{user_id}'
URL_GET_TAG = URL_API_ROOT + '/tags/{tag_id}'
URL_GET_CUSTOM_FIELD = URL_API_ROOT + '/customfields/{custom_field_id}'
URL_GET_TASKS = URL_API_ROOT + '/tasks'
class CardCache:
def __init__(self):

View File

@ -20,7 +20,7 @@ class CardId:
@dataclasses.dataclass(frozen=True)
class CommonId:
class CardCommonId:
raw_id: str
@ -48,6 +48,14 @@ class WidgetCommonId:
class CustomFieldItemId:
raw_id: str
@dataclasses.dataclass(frozen=True)
class TaskId:
raw_id: str
@dataclasses.dataclass(frozen=True)
class TaskListId:
raw_id: str
@dataclasses.dataclass(frozen=True)
class CardAssignment:
@ -137,7 +145,15 @@ class CustomFieldInfo:
@staticmethod
def from_json(json: dict[str, Any]) -> 'CustomFieldInfo':
pass # TODO
return CustomFieldInfo(
organization_id= OrganizationId(json['organizationId']),
custom_field_id= CustomFieldId(json['customFieldId']),
widget_common_id= WidgetCommonId(json['widgetCommonId']),
type= json['type'],
name= json['name'],
enabled= json['enabled'],
custom_field_items= json['customFieldItems'],
)
@dataclasses.dataclass(frozen=True)
@ -156,7 +172,7 @@ class CustomField:
@dataclasses.dataclass(frozen=True)
class CardDependency:
card_id: CardId
card_common_id: CommonId
card_common_id: CardCommonId
is_before: bool
reverse_card_id: CardId
@ -164,17 +180,38 @@ class CardDependency:
def from_json(json: dict[str, Any]) -> 'CardDependency':
return CardDependency(
CardId(json['cardId']),
CommonId(json['cardCommonId']),
CardCommonId(json['cardCommonId']),
json['isBefore'],
CardId(json['reverseCardId']),
)
@dataclasses.dataclass(frozen=True)
class Task:
task_id: TaskId
task_list_id: TaskListId
organization_id: OrganizationId
card_common_id: CardCommonId
name: str
completed: bool
position: int
@staticmethod
def from_json(json: dict[str, Any]) -> 'Task':
return Task(
task_id = json['taskId'],
task_list_id = json['taskListId'],
organization_id = json['organizationId'],
card_common_id = json['cardCommonId'],
name = json['name'],
completed = json['completed'],
position = json['position'],
)
@dataclasses.dataclass(frozen=True)
class Card:
card_id: CardId
seq_id: SeqId
common_id: CommonId
common_id: CardCommonId
organization_id: OrganizationId
is_archived: bool
name: str
@ -197,7 +234,7 @@ class Card:
return Card(
card_id=CardId(json['cardId']),
seq_id=SeqId(json['sequentialId']),
common_id=CommonId(json['cardCommonId']),
common_id=CardCommonId(json['cardCommonId']),
detailed_description=json.get('detailedDescription'),
is_archived=json['archived'],
organization_id=OrganizationId(json['organizationId']),