funapi-sciencedb 1.0.1__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 (54) hide show
  1. funapi_sciencedb-1.0.1.dist-info/LICENSE +21 -0
  2. funapi_sciencedb-1.0.1.dist-info/METADATA +10 -0
  3. funapi_sciencedb-1.0.1.dist-info/RECORD +54 -0
  4. funapi_sciencedb-1.0.1.dist-info/WHEEL +5 -0
  5. funapi_sciencedb-1.0.1.dist-info/top_level.txt +1 -0
  6. sciencedb/__init__.py +8 -0
  7. sciencedb/api/__init__.py +1 -0
  8. sciencedb/api/open_api_controller/__init__.py +0 -0
  9. sciencedb/api/open_api_controller/harvest_using_get.py +211 -0
  10. sciencedb/api/open_api_controller/json_using_get.py +164 -0
  11. sciencedb/api/open_api_controller/metrics_using_get.py +166 -0
  12. sciencedb/api/open_api_controller/search_using_get.py +196 -0
  13. sciencedb/api/sushi_controller/__init__.py +0 -0
  14. sciencedb/api/sushi_controller/get_api_status.py +171 -0
  15. sciencedb/api/sushi_controller/get_report_by_id_using_get.py +173 -0
  16. sciencedb/api/sushi_controller/get_reports.py +181 -0
  17. sciencedb/client.py +286 -0
  18. sciencedb/errors.py +16 -0
  19. sciencedb/models/__init__.py +75 -0
  20. sciencedb/models/api_result_metrics_result.py +99 -0
  21. sciencedb/models/api_result_search_result.py +99 -0
  22. sciencedb/models/counter_dataset_attributes.py +69 -0
  23. sciencedb/models/counter_dataset_attributes_type.py +10 -0
  24. sciencedb/models/counter_dataset_contributors.py +68 -0
  25. sciencedb/models/counter_dataset_contributors_type.py +10 -0
  26. sciencedb/models/counter_dataset_dates.py +68 -0
  27. sciencedb/models/counter_dataset_dates_type.py +10 -0
  28. sciencedb/models/counter_dataset_identifiers.py +68 -0
  29. sciencedb/models/counter_dataset_identifiers_type.py +10 -0
  30. sciencedb/models/counter_dataset_instance.py +98 -0
  31. sciencedb/models/counter_dataset_instance_access_method.py +9 -0
  32. sciencedb/models/counter_dataset_instance_metric_type.py +11 -0
  33. sciencedb/models/counter_dataset_performance.py +82 -0
  34. sciencedb/models/counter_dataset_period.py +83 -0
  35. sciencedb/models/counter_dataset_report.py +106 -0
  36. sciencedb/models/counter_dataset_usage.py +230 -0
  37. sciencedb/models/counter_dataset_usage_data_type.py +8 -0
  38. sciencedb/models/counter_publisher_identifiers.py +68 -0
  39. sciencedb/models/counter_publisher_identifiers_type.py +10 -0
  40. sciencedb/models/metrics_result.py +95 -0
  41. sciencedb/models/search_record.py +150 -0
  42. sciencedb/models/search_result.py +111 -0
  43. sciencedb/models/sushi_error_model.py +97 -0
  44. sciencedb/models/sushi_error_model_severity.py +11 -0
  45. sciencedb/models/sushi_page_meta.py +77 -0
  46. sciencedb/models/sushi_report.py +72 -0
  47. sciencedb/models/sushi_report_header.py +189 -0
  48. sciencedb/models/sushi_report_header_report_attributes_item.py +43 -0
  49. sciencedb/models/sushi_report_header_report_filters_item.py +43 -0
  50. sciencedb/models/sushi_report_list.py +82 -0
  51. sciencedb/models/sushi_report_page.py +93 -0
  52. sciencedb/models/sushi_service_status.py +118 -0
  53. sciencedb/models/sushi_service_status_alerts_item.py +43 -0
  54. sciencedb/types.py +53 -0
@@ -0,0 +1,230 @@
1
+ from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union
2
+
3
+ from attrs import define as _attrs_define
4
+ from attrs import field as _attrs_field
5
+
6
+ from ..models.counter_dataset_usage_data_type import COUNTERDatasetUsageDataType
7
+ from ..types import UNSET, Unset
8
+
9
+ if TYPE_CHECKING:
10
+ from ..models.counter_dataset_attributes import COUNTERDatasetAttributes
11
+ from ..models.counter_dataset_contributors import COUNTERDatasetContributors
12
+ from ..models.counter_dataset_dates import COUNTERDatasetDates
13
+ from ..models.counter_dataset_identifiers import COUNTERDatasetIdentifiers
14
+ from ..models.counter_dataset_performance import COUNTERDatasetPerformance
15
+ from ..models.counter_publisher_identifiers import COUNTERPublisherIdentifiers
16
+
17
+
18
+ T = TypeVar("T", bound="COUNTERDatasetUsage")
19
+
20
+
21
+ @_attrs_define
22
+ class COUNTERDatasetUsage:
23
+ """Defines the output for the Report_Datasets being returned in a Dataset Report.
24
+
25
+ Attributes:
26
+ data_type (COUNTERDatasetUsageDataType): Nature of the dataset being reported. Example: Dataset.
27
+ dataset_title (str): Name of the dataset being reported. Example: Lake Erie Fish Community Data.
28
+ performance (List['COUNTERDatasetPerformance']): The usage data related to the report dataset
29
+ platform (str): Name of the platform Example: Science Data Bank.
30
+ publisher (str): Name of publisher of the dataset Example: Science Data Bank.
31
+ publisher_id (List['COUNTERPublisherIdentifiers']): The identifier for the publisher.
32
+ dataset_attributes (Union[Unset, List['COUNTERDatasetAttributes']]): Other attributes related related to the
33
+ dataset.
34
+ dataset_contributors (Union[Unset, List['COUNTERDatasetContributors']]): The identifier for contributor (i.e.
35
+ creator) of the dataset.
36
+ dataset_dates (Union[Unset, List['COUNTERDatasetDates']]): Publication or other date(s)related to the dataset.
37
+ dataset_id (Union[Unset, List['COUNTERDatasetIdentifiers']]): The identifier for the report dataset
38
+ yop (Union[Unset, str]): Year of publication in the format of 'yyyy'. Use '0001' for unknown and '9999' for
39
+ articles in press. Example: 2010.
40
+ """
41
+
42
+ data_type: COUNTERDatasetUsageDataType
43
+ dataset_title: str
44
+ performance: List["COUNTERDatasetPerformance"]
45
+ platform: str
46
+ publisher: str
47
+ publisher_id: List["COUNTERPublisherIdentifiers"]
48
+ dataset_attributes: Union[Unset, List["COUNTERDatasetAttributes"]] = UNSET
49
+ dataset_contributors: Union[Unset, List["COUNTERDatasetContributors"]] = UNSET
50
+ dataset_dates: Union[Unset, List["COUNTERDatasetDates"]] = UNSET
51
+ dataset_id: Union[Unset, List["COUNTERDatasetIdentifiers"]] = UNSET
52
+ yop: Union[Unset, str] = UNSET
53
+ additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ data_type = self.data_type.value
57
+
58
+ dataset_title = self.dataset_title
59
+
60
+ performance = []
61
+ for performance_item_data in self.performance:
62
+ performance_item = performance_item_data.to_dict()
63
+ performance.append(performance_item)
64
+
65
+ platform = self.platform
66
+
67
+ publisher = self.publisher
68
+
69
+ publisher_id = []
70
+ for publisher_id_item_data in self.publisher_id:
71
+ publisher_id_item = publisher_id_item_data.to_dict()
72
+ publisher_id.append(publisher_id_item)
73
+
74
+ dataset_attributes: Union[Unset, List[Dict[str, Any]]] = UNSET
75
+ if not isinstance(self.dataset_attributes, Unset):
76
+ dataset_attributes = []
77
+ for dataset_attributes_item_data in self.dataset_attributes:
78
+ dataset_attributes_item = dataset_attributes_item_data.to_dict()
79
+ dataset_attributes.append(dataset_attributes_item)
80
+
81
+ dataset_contributors: Union[Unset, List[Dict[str, Any]]] = UNSET
82
+ if not isinstance(self.dataset_contributors, Unset):
83
+ dataset_contributors = []
84
+ for dataset_contributors_item_data in self.dataset_contributors:
85
+ dataset_contributors_item = dataset_contributors_item_data.to_dict()
86
+ dataset_contributors.append(dataset_contributors_item)
87
+
88
+ dataset_dates: Union[Unset, List[Dict[str, Any]]] = UNSET
89
+ if not isinstance(self.dataset_dates, Unset):
90
+ dataset_dates = []
91
+ for dataset_dates_item_data in self.dataset_dates:
92
+ dataset_dates_item = dataset_dates_item_data.to_dict()
93
+ dataset_dates.append(dataset_dates_item)
94
+
95
+ dataset_id: Union[Unset, List[Dict[str, Any]]] = UNSET
96
+ if not isinstance(self.dataset_id, Unset):
97
+ dataset_id = []
98
+ for dataset_id_item_data in self.dataset_id:
99
+ dataset_id_item = dataset_id_item_data.to_dict()
100
+ dataset_id.append(dataset_id_item)
101
+
102
+ yop = self.yop
103
+
104
+ field_dict: Dict[str, Any] = {}
105
+ field_dict.update(self.additional_properties)
106
+ field_dict.update(
107
+ {
108
+ "data-type": data_type,
109
+ "dataset-title": dataset_title,
110
+ "performance": performance,
111
+ "platform": platform,
112
+ "publisher": publisher,
113
+ "publisher-id": publisher_id,
114
+ }
115
+ )
116
+ if dataset_attributes is not UNSET:
117
+ field_dict["dataset-attributes"] = dataset_attributes
118
+ if dataset_contributors is not UNSET:
119
+ field_dict["dataset-contributors"] = dataset_contributors
120
+ if dataset_dates is not UNSET:
121
+ field_dict["dataset-dates"] = dataset_dates
122
+ if dataset_id is not UNSET:
123
+ field_dict["dataset-id"] = dataset_id
124
+ if yop is not UNSET:
125
+ field_dict["yop"] = yop
126
+
127
+ return field_dict
128
+
129
+ @classmethod
130
+ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
131
+ from ..models.counter_dataset_attributes import COUNTERDatasetAttributes
132
+ from ..models.counter_dataset_contributors import COUNTERDatasetContributors
133
+ from ..models.counter_dataset_dates import COUNTERDatasetDates
134
+ from ..models.counter_dataset_identifiers import COUNTERDatasetIdentifiers
135
+ from ..models.counter_dataset_performance import COUNTERDatasetPerformance
136
+ from ..models.counter_publisher_identifiers import COUNTERPublisherIdentifiers
137
+
138
+ d = src_dict.copy()
139
+ data_type = COUNTERDatasetUsageDataType(d.pop("data-type"))
140
+
141
+ dataset_title = d.pop("dataset-title")
142
+
143
+ performance = []
144
+ _performance = d.pop("performance")
145
+ for performance_item_data in _performance:
146
+ performance_item = COUNTERDatasetPerformance.from_dict(
147
+ performance_item_data
148
+ )
149
+
150
+ performance.append(performance_item)
151
+
152
+ platform = d.pop("platform")
153
+
154
+ publisher = d.pop("publisher")
155
+
156
+ publisher_id = []
157
+ _publisher_id = d.pop("publisher-id")
158
+ for publisher_id_item_data in _publisher_id:
159
+ publisher_id_item = COUNTERPublisherIdentifiers.from_dict(
160
+ publisher_id_item_data
161
+ )
162
+
163
+ publisher_id.append(publisher_id_item)
164
+
165
+ dataset_attributes = []
166
+ _dataset_attributes = d.pop("dataset-attributes", UNSET)
167
+ for dataset_attributes_item_data in _dataset_attributes or []:
168
+ dataset_attributes_item = COUNTERDatasetAttributes.from_dict(
169
+ dataset_attributes_item_data
170
+ )
171
+
172
+ dataset_attributes.append(dataset_attributes_item)
173
+
174
+ dataset_contributors = []
175
+ _dataset_contributors = d.pop("dataset-contributors", UNSET)
176
+ for dataset_contributors_item_data in _dataset_contributors or []:
177
+ dataset_contributors_item = COUNTERDatasetContributors.from_dict(
178
+ dataset_contributors_item_data
179
+ )
180
+
181
+ dataset_contributors.append(dataset_contributors_item)
182
+
183
+ dataset_dates = []
184
+ _dataset_dates = d.pop("dataset-dates", UNSET)
185
+ for dataset_dates_item_data in _dataset_dates or []:
186
+ dataset_dates_item = COUNTERDatasetDates.from_dict(dataset_dates_item_data)
187
+
188
+ dataset_dates.append(dataset_dates_item)
189
+
190
+ dataset_id = []
191
+ _dataset_id = d.pop("dataset-id", UNSET)
192
+ for dataset_id_item_data in _dataset_id or []:
193
+ dataset_id_item = COUNTERDatasetIdentifiers.from_dict(dataset_id_item_data)
194
+
195
+ dataset_id.append(dataset_id_item)
196
+
197
+ yop = d.pop("yop", UNSET)
198
+
199
+ counter_dataset_usage = cls(
200
+ data_type=data_type,
201
+ dataset_title=dataset_title,
202
+ performance=performance,
203
+ platform=platform,
204
+ publisher=publisher,
205
+ publisher_id=publisher_id,
206
+ dataset_attributes=dataset_attributes,
207
+ dataset_contributors=dataset_contributors,
208
+ dataset_dates=dataset_dates,
209
+ dataset_id=dataset_id,
210
+ yop=yop,
211
+ )
212
+
213
+ counter_dataset_usage.additional_properties = d
214
+ return counter_dataset_usage
215
+
216
+ @property
217
+ def additional_keys(self) -> List[str]:
218
+ return list(self.additional_properties.keys())
219
+
220
+ def __getitem__(self, key: str) -> Any:
221
+ return self.additional_properties[key]
222
+
223
+ def __setitem__(self, key: str, value: Any) -> None:
224
+ self.additional_properties[key] = value
225
+
226
+ def __delitem__(self, key: str) -> None:
227
+ del self.additional_properties[key]
228
+
229
+ def __contains__(self, key: str) -> bool:
230
+ return key in self.additional_properties
@@ -0,0 +1,8 @@
1
+ from enum import Enum
2
+
3
+
4
+ class COUNTERDatasetUsageDataType(str, Enum):
5
+ DATASET = "Dataset"
6
+
7
+ def __str__(self) -> str:
8
+ return str(self.value)
@@ -0,0 +1,68 @@
1
+ from typing import Any, Dict, List, Type, TypeVar
2
+
3
+ from attrs import define as _attrs_define
4
+ from attrs import field as _attrs_field
5
+
6
+ from ..models.counter_publisher_identifiers_type import COUNTERPublisherIdentifiersType
7
+
8
+ T = TypeVar("T", bound="COUNTERPublisherIdentifiers")
9
+
10
+
11
+ @_attrs_define
12
+ class COUNTERPublisherIdentifiers:
13
+ """
14
+ Attributes:
15
+ type (COUNTERPublisherIdentifiersType): Example: ORCID.
16
+ value (str): Value of the publisher identifier Example: 1234-1234-1234-1234.
17
+ """
18
+
19
+ type: COUNTERPublisherIdentifiersType
20
+ value: str
21
+ additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
22
+
23
+ def to_dict(self) -> Dict[str, Any]:
24
+ type = self.type.value
25
+
26
+ value = self.value
27
+
28
+ field_dict: Dict[str, Any] = {}
29
+ field_dict.update(self.additional_properties)
30
+ field_dict.update(
31
+ {
32
+ "Type": type,
33
+ "Value": value,
34
+ }
35
+ )
36
+
37
+ return field_dict
38
+
39
+ @classmethod
40
+ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
41
+ d = src_dict.copy()
42
+ type = COUNTERPublisherIdentifiersType(d.pop("Type"))
43
+
44
+ value = d.pop("Value")
45
+
46
+ counter_publisher_identifiers = cls(
47
+ type=type,
48
+ value=value,
49
+ )
50
+
51
+ counter_publisher_identifiers.additional_properties = d
52
+ return counter_publisher_identifiers
53
+
54
+ @property
55
+ def additional_keys(self) -> List[str]:
56
+ return list(self.additional_properties.keys())
57
+
58
+ def __getitem__(self, key: str) -> Any:
59
+ return self.additional_properties[key]
60
+
61
+ def __setitem__(self, key: str, value: Any) -> None:
62
+ self.additional_properties[key] = value
63
+
64
+ def __delitem__(self, key: str) -> None:
65
+ del self.additional_properties[key]
66
+
67
+ def __contains__(self, key: str) -> bool:
68
+ return key in self.additional_properties
@@ -0,0 +1,10 @@
1
+ from enum import Enum
2
+
3
+
4
+ class COUNTERPublisherIdentifiersType(str, Enum):
5
+ GRID = "GRID"
6
+ ISNI = "ISNI"
7
+ ORCID = "ORCID"
8
+
9
+ def __str__(self) -> str:
10
+ return str(self.value)
@@ -0,0 +1,95 @@
1
+ from typing import Any, Dict, List, Type, TypeVar, Union
2
+
3
+ from attrs import define as _attrs_define
4
+ from attrs import field as _attrs_field
5
+
6
+ from ..types import UNSET, Unset
7
+
8
+ T = TypeVar("T", bound="MetricsResult")
9
+
10
+
11
+ @_attrs_define
12
+ class MetricsResult:
13
+ """wrapper of records of '/harvest' and '/search' and '/metrics' API
14
+
15
+ Attributes:
16
+ title_zh (Union[Unset, str]): Chinese title of dataset
17
+ title_en (Union[Unset, str]): English title of dataset
18
+ visit (Union[Unset, int]): Number of data set accesses
19
+ download (Union[Unset, int]): Number of data set downloads
20
+ ref_papers (Union[Unset, int]): The number of papers cited in the dataset
21
+ """
22
+
23
+ title_zh: Union[Unset, str] = UNSET
24
+ title_en: Union[Unset, str] = UNSET
25
+ visit: Union[Unset, int] = UNSET
26
+ download: Union[Unset, int] = UNSET
27
+ ref_papers: Union[Unset, int] = UNSET
28
+ additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
29
+
30
+ def to_dict(self) -> Dict[str, Any]:
31
+ title_zh = self.title_zh
32
+
33
+ title_en = self.title_en
34
+
35
+ visit = self.visit
36
+
37
+ download = self.download
38
+
39
+ ref_papers = self.ref_papers
40
+
41
+ field_dict: Dict[str, Any] = {}
42
+ field_dict.update(self.additional_properties)
43
+ field_dict.update({})
44
+ if title_zh is not UNSET:
45
+ field_dict["titleZh"] = title_zh
46
+ if title_en is not UNSET:
47
+ field_dict["titleEn"] = title_en
48
+ if visit is not UNSET:
49
+ field_dict["visit"] = visit
50
+ if download is not UNSET:
51
+ field_dict["download"] = download
52
+ if ref_papers is not UNSET:
53
+ field_dict["refPapers"] = ref_papers
54
+
55
+ return field_dict
56
+
57
+ @classmethod
58
+ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
59
+ d = src_dict.copy()
60
+ title_zh = d.pop("titleZh", UNSET)
61
+
62
+ title_en = d.pop("titleEn", UNSET)
63
+
64
+ visit = d.pop("visit", UNSET)
65
+
66
+ download = d.pop("download", UNSET)
67
+
68
+ ref_papers = d.pop("refPapers", UNSET)
69
+
70
+ metrics_result = cls(
71
+ title_zh=title_zh,
72
+ title_en=title_en,
73
+ visit=visit,
74
+ download=download,
75
+ ref_papers=ref_papers,
76
+ )
77
+
78
+ metrics_result.additional_properties = d
79
+ return metrics_result
80
+
81
+ @property
82
+ def additional_keys(self) -> List[str]:
83
+ return list(self.additional_properties.keys())
84
+
85
+ def __getitem__(self, key: str) -> Any:
86
+ return self.additional_properties[key]
87
+
88
+ def __setitem__(self, key: str, value: Any) -> None:
89
+ self.additional_properties[key] = value
90
+
91
+ def __delitem__(self, key: str) -> None:
92
+ del self.additional_properties[key]
93
+
94
+ def __contains__(self, key: str) -> bool:
95
+ return key in self.additional_properties
@@ -0,0 +1,150 @@
1
+ from typing import Any, Dict, List, Type, TypeVar, Union
2
+
3
+ from attrs import define as _attrs_define
4
+ from attrs import field as _attrs_field
5
+
6
+ from ..types import UNSET, Unset
7
+
8
+ T = TypeVar("T", bound="SearchRecord")
9
+
10
+
11
+ @_attrs_define
12
+ class SearchRecord:
13
+ """dataset's brief record of '/harvest' and '/search' API
14
+
15
+ Attributes:
16
+ clicks (Union[Unset, int]):
17
+ language (Union[Unset, str]):
18
+ reference_number (Union[Unset, int]):
19
+ title (Union[Unset, str]): dataset's title
20
+ introduction (Union[Unset, str]): dataset's introduction
21
+ keyword (Union[Unset, str]): dataset's keywords, put together in quotation marks Example: kw_1;kw_2;kw_3.
22
+ author (Union[Unset, str]): dataset's authors, put together in quotation marks Example: 2021-08-11 18:20:51.
23
+ publish_date (Union[Unset, str]): publish date in ScienceDB Example: author_1;author_2;author_3.
24
+ taxonomy (Union[Unset, str]): taxonomy in ScienceDB,put together in quotation marks,format is 'code'-'taxonomy'
25
+ Example: 170-Earth science;00-Others.
26
+ year (Union[Unset, str]): publish year in ScienceDB Example: 2021.
27
+ doi (Union[Unset, str]): dataset's doi Example: 10.11922/sciencedb.00101.
28
+ """
29
+
30
+ clicks: Union[Unset, int] = UNSET
31
+ language: Union[Unset, str] = UNSET
32
+ reference_number: Union[Unset, int] = UNSET
33
+ title: Union[Unset, str] = UNSET
34
+ introduction: Union[Unset, str] = UNSET
35
+ keyword: Union[Unset, str] = UNSET
36
+ author: Union[Unset, str] = UNSET
37
+ publish_date: Union[Unset, str] = UNSET
38
+ taxonomy: Union[Unset, str] = UNSET
39
+ year: Union[Unset, str] = UNSET
40
+ doi: Union[Unset, str] = UNSET
41
+ additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
42
+
43
+ def to_dict(self) -> Dict[str, Any]:
44
+ clicks = self.clicks
45
+
46
+ language = self.language
47
+
48
+ reference_number = self.reference_number
49
+
50
+ title = self.title
51
+
52
+ introduction = self.introduction
53
+
54
+ keyword = self.keyword
55
+
56
+ author = self.author
57
+
58
+ publish_date = self.publish_date
59
+
60
+ taxonomy = self.taxonomy
61
+
62
+ year = self.year
63
+
64
+ doi = self.doi
65
+
66
+ field_dict: Dict[str, Any] = {}
67
+ field_dict.update(self.additional_properties)
68
+ field_dict.update({})
69
+ if clicks is not UNSET:
70
+ field_dict["clicks"] = clicks
71
+ if language is not UNSET:
72
+ field_dict["language"] = language
73
+ if reference_number is not UNSET:
74
+ field_dict["referenceNumber"] = reference_number
75
+ if title is not UNSET:
76
+ field_dict["title"] = title
77
+ if introduction is not UNSET:
78
+ field_dict["introduction"] = introduction
79
+ if keyword is not UNSET:
80
+ field_dict["keyword"] = keyword
81
+ if author is not UNSET:
82
+ field_dict["author"] = author
83
+ if publish_date is not UNSET:
84
+ field_dict["publishDate"] = publish_date
85
+ if taxonomy is not UNSET:
86
+ field_dict["taxonomy"] = taxonomy
87
+ if year is not UNSET:
88
+ field_dict["year"] = year
89
+ if doi is not UNSET:
90
+ field_dict["doi"] = doi
91
+
92
+ return field_dict
93
+
94
+ @classmethod
95
+ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
96
+ d = src_dict.copy()
97
+ clicks = d.pop("clicks", UNSET)
98
+
99
+ language = d.pop("language", UNSET)
100
+
101
+ reference_number = d.pop("referenceNumber", UNSET)
102
+
103
+ title = d.pop("title", UNSET)
104
+
105
+ introduction = d.pop("introduction", UNSET)
106
+
107
+ keyword = d.pop("keyword", UNSET)
108
+
109
+ author = d.pop("author", UNSET)
110
+
111
+ publish_date = d.pop("publishDate", UNSET)
112
+
113
+ taxonomy = d.pop("taxonomy", UNSET)
114
+
115
+ year = d.pop("year", UNSET)
116
+
117
+ doi = d.pop("doi", UNSET)
118
+
119
+ search_record = cls(
120
+ clicks=clicks,
121
+ language=language,
122
+ reference_number=reference_number,
123
+ title=title,
124
+ introduction=introduction,
125
+ keyword=keyword,
126
+ author=author,
127
+ publish_date=publish_date,
128
+ taxonomy=taxonomy,
129
+ year=year,
130
+ doi=doi,
131
+ )
132
+
133
+ search_record.additional_properties = d
134
+ return search_record
135
+
136
+ @property
137
+ def additional_keys(self) -> List[str]:
138
+ return list(self.additional_properties.keys())
139
+
140
+ def __getitem__(self, key: str) -> Any:
141
+ return self.additional_properties[key]
142
+
143
+ def __setitem__(self, key: str, value: Any) -> None:
144
+ self.additional_properties[key] = value
145
+
146
+ def __delitem__(self, key: str) -> None:
147
+ del self.additional_properties[key]
148
+
149
+ def __contains__(self, key: str) -> bool:
150
+ return key in self.additional_properties
@@ -0,0 +1,111 @@
1
+ from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union
2
+
3
+ from attrs import define as _attrs_define
4
+ from attrs import field as _attrs_field
5
+
6
+ from ..types import UNSET, Unset
7
+
8
+ if TYPE_CHECKING:
9
+ from ..models.search_record import SearchRecord
10
+
11
+
12
+ T = TypeVar("T", bound="SearchResult")
13
+
14
+
15
+ @_attrs_define
16
+ class SearchResult:
17
+ """wrapper of records of '/harvest' and '/search' API
18
+
19
+ Attributes:
20
+ page_no (Union[Unset, int]):
21
+ page_size (Union[Unset, int]):
22
+ total_pages (Union[Unset, int]): total pages of records
23
+ total_elements (Union[Unset, int]): total number of records
24
+ recommend_data (Union[Unset, List['SearchRecord']]): the list of current page records
25
+ """
26
+
27
+ page_no: Union[Unset, int] = UNSET
28
+ page_size: Union[Unset, int] = UNSET
29
+ total_pages: Union[Unset, int] = UNSET
30
+ total_elements: Union[Unset, int] = UNSET
31
+ recommend_data: Union[Unset, List["SearchRecord"]] = UNSET
32
+ additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
33
+
34
+ def to_dict(self) -> Dict[str, Any]:
35
+ page_no = self.page_no
36
+
37
+ page_size = self.page_size
38
+
39
+ total_pages = self.total_pages
40
+
41
+ total_elements = self.total_elements
42
+
43
+ recommend_data: Union[Unset, List[Dict[str, Any]]] = UNSET
44
+ if not isinstance(self.recommend_data, Unset):
45
+ recommend_data = []
46
+ for recommend_data_item_data in self.recommend_data:
47
+ recommend_data_item = recommend_data_item_data.to_dict()
48
+ recommend_data.append(recommend_data_item)
49
+
50
+ field_dict: Dict[str, Any] = {}
51
+ field_dict.update(self.additional_properties)
52
+ field_dict.update({})
53
+ if page_no is not UNSET:
54
+ field_dict["pageNo"] = page_no
55
+ if page_size is not UNSET:
56
+ field_dict["pageSize"] = page_size
57
+ if total_pages is not UNSET:
58
+ field_dict["totalPages"] = total_pages
59
+ if total_elements is not UNSET:
60
+ field_dict["totalElements"] = total_elements
61
+ if recommend_data is not UNSET:
62
+ field_dict["recommendData"] = recommend_data
63
+
64
+ return field_dict
65
+
66
+ @classmethod
67
+ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
68
+ from ..models.search_record import SearchRecord
69
+
70
+ d = src_dict.copy()
71
+ page_no = d.pop("pageNo", UNSET)
72
+
73
+ page_size = d.pop("pageSize", UNSET)
74
+
75
+ total_pages = d.pop("totalPages", UNSET)
76
+
77
+ total_elements = d.pop("totalElements", UNSET)
78
+
79
+ recommend_data = []
80
+ _recommend_data = d.pop("recommendData", UNSET)
81
+ for recommend_data_item_data in _recommend_data or []:
82
+ recommend_data_item = SearchRecord.from_dict(recommend_data_item_data)
83
+
84
+ recommend_data.append(recommend_data_item)
85
+
86
+ search_result = cls(
87
+ page_no=page_no,
88
+ page_size=page_size,
89
+ total_pages=total_pages,
90
+ total_elements=total_elements,
91
+ recommend_data=recommend_data,
92
+ )
93
+
94
+ search_result.additional_properties = d
95
+ return search_result
96
+
97
+ @property
98
+ def additional_keys(self) -> List[str]:
99
+ return list(self.additional_properties.keys())
100
+
101
+ def __getitem__(self, key: str) -> Any:
102
+ return self.additional_properties[key]
103
+
104
+ def __setitem__(self, key: str, value: Any) -> None:
105
+ self.additional_properties[key] = value
106
+
107
+ def __delitem__(self, key: str) -> None:
108
+ del self.additional_properties[key]
109
+
110
+ def __contains__(self, key: str) -> bool:
111
+ return key in self.additional_properties