-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.py
69 lines (57 loc) · 1.34 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
from dataclasses import dataclass
from typing import List, Optional
@dataclass
class TagSchema:
creator: int
id: int
images: List[dict]
last_updated: str
last_updater: int
last_updater_username: str
name: str
repository: int
full_size: int
v2: bool
tag_status: str
tag_last_pulled: str
tag_last_pushed: str
media_type: str = ""
content_type: str = ""
content_type: str = ""
digest: Optional[str] = ""
@dataclass
class RepositorySchema:
name: str
namespace: str
repository_type: str
status: int
status_description: str
description: str
is_private: bool
star_count: int
pull_count: int
last_updated: str
date_registered: str
affiliation: str
media_types: List[str]
content_types: List[str]
@dataclass
class ApiResponse:
count: int
next: Optional[str]
previous: Optional[str]
results: List[RepositorySchema]
def __post_init__(self):
self.results = [RepositorySchema(**x) for x in self.results]
@dataclass
class TagApiResponse:
count: int
next: Optional[str]
previous: Optional[str]
results: List[TagSchema]
def __post_init__(self):
self.results = [TagSchema(**x) for x in self.results]
@dataclass
class ApiParameters:
page_size: Optional[str] = 100
page: Optional[str] = None