funapi-sciencedb 1.0.1__tar.gz

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 (59) hide show
  1. funapi_sciencedb-1.0.1/LICENSE +21 -0
  2. funapi_sciencedb-1.0.1/PKG-INFO +10 -0
  3. funapi_sciencedb-1.0.1/README.md +1 -0
  4. funapi_sciencedb-1.0.1/pyproject.toml +7 -0
  5. funapi_sciencedb-1.0.1/setup.cfg +4 -0
  6. funapi_sciencedb-1.0.1/src/funapi_sciencedb.egg-info/PKG-INFO +10 -0
  7. funapi_sciencedb-1.0.1/src/funapi_sciencedb.egg-info/SOURCES.txt +57 -0
  8. funapi_sciencedb-1.0.1/src/funapi_sciencedb.egg-info/dependency_links.txt +1 -0
  9. funapi_sciencedb-1.0.1/src/funapi_sciencedb.egg-info/requires.txt +1 -0
  10. funapi_sciencedb-1.0.1/src/funapi_sciencedb.egg-info/top_level.txt +1 -0
  11. funapi_sciencedb-1.0.1/src/sciencedb/__init__.py +8 -0
  12. funapi_sciencedb-1.0.1/src/sciencedb/api/__init__.py +1 -0
  13. funapi_sciencedb-1.0.1/src/sciencedb/api/open_api_controller/__init__.py +0 -0
  14. funapi_sciencedb-1.0.1/src/sciencedb/api/open_api_controller/harvest_using_get.py +211 -0
  15. funapi_sciencedb-1.0.1/src/sciencedb/api/open_api_controller/json_using_get.py +164 -0
  16. funapi_sciencedb-1.0.1/src/sciencedb/api/open_api_controller/metrics_using_get.py +166 -0
  17. funapi_sciencedb-1.0.1/src/sciencedb/api/open_api_controller/search_using_get.py +196 -0
  18. funapi_sciencedb-1.0.1/src/sciencedb/api/sushi_controller/__init__.py +0 -0
  19. funapi_sciencedb-1.0.1/src/sciencedb/api/sushi_controller/get_api_status.py +171 -0
  20. funapi_sciencedb-1.0.1/src/sciencedb/api/sushi_controller/get_report_by_id_using_get.py +173 -0
  21. funapi_sciencedb-1.0.1/src/sciencedb/api/sushi_controller/get_reports.py +181 -0
  22. funapi_sciencedb-1.0.1/src/sciencedb/client.py +286 -0
  23. funapi_sciencedb-1.0.1/src/sciencedb/errors.py +16 -0
  24. funapi_sciencedb-1.0.1/src/sciencedb/models/__init__.py +75 -0
  25. funapi_sciencedb-1.0.1/src/sciencedb/models/api_result_metrics_result.py +99 -0
  26. funapi_sciencedb-1.0.1/src/sciencedb/models/api_result_search_result.py +99 -0
  27. funapi_sciencedb-1.0.1/src/sciencedb/models/counter_dataset_attributes.py +69 -0
  28. funapi_sciencedb-1.0.1/src/sciencedb/models/counter_dataset_attributes_type.py +10 -0
  29. funapi_sciencedb-1.0.1/src/sciencedb/models/counter_dataset_contributors.py +68 -0
  30. funapi_sciencedb-1.0.1/src/sciencedb/models/counter_dataset_contributors_type.py +10 -0
  31. funapi_sciencedb-1.0.1/src/sciencedb/models/counter_dataset_dates.py +68 -0
  32. funapi_sciencedb-1.0.1/src/sciencedb/models/counter_dataset_dates_type.py +10 -0
  33. funapi_sciencedb-1.0.1/src/sciencedb/models/counter_dataset_identifiers.py +68 -0
  34. funapi_sciencedb-1.0.1/src/sciencedb/models/counter_dataset_identifiers_type.py +10 -0
  35. funapi_sciencedb-1.0.1/src/sciencedb/models/counter_dataset_instance.py +98 -0
  36. funapi_sciencedb-1.0.1/src/sciencedb/models/counter_dataset_instance_access_method.py +9 -0
  37. funapi_sciencedb-1.0.1/src/sciencedb/models/counter_dataset_instance_metric_type.py +11 -0
  38. funapi_sciencedb-1.0.1/src/sciencedb/models/counter_dataset_performance.py +82 -0
  39. funapi_sciencedb-1.0.1/src/sciencedb/models/counter_dataset_period.py +83 -0
  40. funapi_sciencedb-1.0.1/src/sciencedb/models/counter_dataset_report.py +106 -0
  41. funapi_sciencedb-1.0.1/src/sciencedb/models/counter_dataset_usage.py +230 -0
  42. funapi_sciencedb-1.0.1/src/sciencedb/models/counter_dataset_usage_data_type.py +8 -0
  43. funapi_sciencedb-1.0.1/src/sciencedb/models/counter_publisher_identifiers.py +68 -0
  44. funapi_sciencedb-1.0.1/src/sciencedb/models/counter_publisher_identifiers_type.py +10 -0
  45. funapi_sciencedb-1.0.1/src/sciencedb/models/metrics_result.py +95 -0
  46. funapi_sciencedb-1.0.1/src/sciencedb/models/search_record.py +150 -0
  47. funapi_sciencedb-1.0.1/src/sciencedb/models/search_result.py +111 -0
  48. funapi_sciencedb-1.0.1/src/sciencedb/models/sushi_error_model.py +97 -0
  49. funapi_sciencedb-1.0.1/src/sciencedb/models/sushi_error_model_severity.py +11 -0
  50. funapi_sciencedb-1.0.1/src/sciencedb/models/sushi_page_meta.py +77 -0
  51. funapi_sciencedb-1.0.1/src/sciencedb/models/sushi_report.py +72 -0
  52. funapi_sciencedb-1.0.1/src/sciencedb/models/sushi_report_header.py +189 -0
  53. funapi_sciencedb-1.0.1/src/sciencedb/models/sushi_report_header_report_attributes_item.py +43 -0
  54. funapi_sciencedb-1.0.1/src/sciencedb/models/sushi_report_header_report_filters_item.py +43 -0
  55. funapi_sciencedb-1.0.1/src/sciencedb/models/sushi_report_list.py +82 -0
  56. funapi_sciencedb-1.0.1/src/sciencedb/models/sushi_report_page.py +93 -0
  57. funapi_sciencedb-1.0.1/src/sciencedb/models/sushi_service_status.py +118 -0
  58. funapi_sciencedb-1.0.1/src/sciencedb/models/sushi_service_status_alerts_item.py +43 -0
  59. funapi_sciencedb-1.0.1/src/sciencedb/types.py +53 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 farfarfun
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,10 @@
1
+ Metadata-Version: 2.1
2
+ Name: funapi-sciencedb
3
+ Version: 1.0.1
4
+ Summary: Add your description here
5
+ Requires-Python: >=3.8
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Requires-Dist: funutil>=1.0.42
9
+
10
+ # funapi-sciencedb
@@ -0,0 +1 @@
1
+ # funapi-sciencedb
@@ -0,0 +1,7 @@
1
+ [project]
2
+ name = "funapi-sciencedb"
3
+ version = "1.0.1"
4
+ description = "Add your description here"
5
+ readme = "README.md"
6
+ requires-python = ">=3.8"
7
+ dependencies = [ "funutil>=1.0.42",]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,10 @@
1
+ Metadata-Version: 2.1
2
+ Name: funapi-sciencedb
3
+ Version: 1.0.1
4
+ Summary: Add your description here
5
+ Requires-Python: >=3.8
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Requires-Dist: funutil>=1.0.42
9
+
10
+ # funapi-sciencedb
@@ -0,0 +1,57 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/funapi_sciencedb.egg-info/PKG-INFO
5
+ src/funapi_sciencedb.egg-info/SOURCES.txt
6
+ src/funapi_sciencedb.egg-info/dependency_links.txt
7
+ src/funapi_sciencedb.egg-info/requires.txt
8
+ src/funapi_sciencedb.egg-info/top_level.txt
9
+ src/sciencedb/__init__.py
10
+ src/sciencedb/client.py
11
+ src/sciencedb/errors.py
12
+ src/sciencedb/types.py
13
+ src/sciencedb/api/__init__.py
14
+ src/sciencedb/api/open_api_controller/__init__.py
15
+ src/sciencedb/api/open_api_controller/harvest_using_get.py
16
+ src/sciencedb/api/open_api_controller/json_using_get.py
17
+ src/sciencedb/api/open_api_controller/metrics_using_get.py
18
+ src/sciencedb/api/open_api_controller/search_using_get.py
19
+ src/sciencedb/api/sushi_controller/__init__.py
20
+ src/sciencedb/api/sushi_controller/get_api_status.py
21
+ src/sciencedb/api/sushi_controller/get_report_by_id_using_get.py
22
+ src/sciencedb/api/sushi_controller/get_reports.py
23
+ src/sciencedb/models/__init__.py
24
+ src/sciencedb/models/api_result_metrics_result.py
25
+ src/sciencedb/models/api_result_search_result.py
26
+ src/sciencedb/models/counter_dataset_attributes.py
27
+ src/sciencedb/models/counter_dataset_attributes_type.py
28
+ src/sciencedb/models/counter_dataset_contributors.py
29
+ src/sciencedb/models/counter_dataset_contributors_type.py
30
+ src/sciencedb/models/counter_dataset_dates.py
31
+ src/sciencedb/models/counter_dataset_dates_type.py
32
+ src/sciencedb/models/counter_dataset_identifiers.py
33
+ src/sciencedb/models/counter_dataset_identifiers_type.py
34
+ src/sciencedb/models/counter_dataset_instance.py
35
+ src/sciencedb/models/counter_dataset_instance_access_method.py
36
+ src/sciencedb/models/counter_dataset_instance_metric_type.py
37
+ src/sciencedb/models/counter_dataset_performance.py
38
+ src/sciencedb/models/counter_dataset_period.py
39
+ src/sciencedb/models/counter_dataset_report.py
40
+ src/sciencedb/models/counter_dataset_usage.py
41
+ src/sciencedb/models/counter_dataset_usage_data_type.py
42
+ src/sciencedb/models/counter_publisher_identifiers.py
43
+ src/sciencedb/models/counter_publisher_identifiers_type.py
44
+ src/sciencedb/models/metrics_result.py
45
+ src/sciencedb/models/search_record.py
46
+ src/sciencedb/models/search_result.py
47
+ src/sciencedb/models/sushi_error_model.py
48
+ src/sciencedb/models/sushi_error_model_severity.py
49
+ src/sciencedb/models/sushi_page_meta.py
50
+ src/sciencedb/models/sushi_report.py
51
+ src/sciencedb/models/sushi_report_header.py
52
+ src/sciencedb/models/sushi_report_header_report_attributes_item.py
53
+ src/sciencedb/models/sushi_report_header_report_filters_item.py
54
+ src/sciencedb/models/sushi_report_list.py
55
+ src/sciencedb/models/sushi_report_page.py
56
+ src/sciencedb/models/sushi_service_status.py
57
+ src/sciencedb/models/sushi_service_status_alerts_item.py
@@ -0,0 +1 @@
1
+ funutil>=1.0.42
@@ -0,0 +1,8 @@
1
+ """A client library for accessing ScienceDB API Doc"""
2
+
3
+ from .client import AuthenticatedClient, Client
4
+
5
+ __all__ = (
6
+ "AuthenticatedClient",
7
+ "Client",
8
+ )
@@ -0,0 +1 @@
1
+ """Contains methods for accessing the API"""
@@ -0,0 +1,211 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Dict, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.api_result_search_result import APIResultSearchResult
9
+ from ...types import UNSET, Response, Unset
10
+
11
+
12
+ def _get_kwargs(
13
+ *,
14
+ end_time: Union[Unset, str] = "2099-01-01",
15
+ page: Union[Unset, int] = 1,
16
+ size: Union[Unset, int] = 10,
17
+ start_time: Union[Unset, str] = "1970-01-01",
18
+ ) -> Dict[str, Any]:
19
+ params: Dict[str, Any] = {}
20
+
21
+ params["end_time"] = end_time
22
+
23
+ params["page"] = page
24
+
25
+ params["size"] = size
26
+
27
+ params["start_time"] = start_time
28
+
29
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
30
+
31
+ _kwargs: Dict[str, Any] = {
32
+ "method": "get",
33
+ "url": "/harvest",
34
+ "params": params,
35
+ }
36
+
37
+ return _kwargs
38
+
39
+
40
+ def _parse_response(
41
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
42
+ ) -> Optional[APIResultSearchResult]:
43
+ if response.status_code == 200:
44
+ response_200 = APIResultSearchResult.from_dict(response.json())
45
+
46
+ return response_200
47
+ if client.raise_on_unexpected_status:
48
+ raise errors.UnexpectedStatus(response.status_code, response.content)
49
+ else:
50
+ return None
51
+
52
+
53
+ def _build_response(
54
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
55
+ ) -> Response[APIResultSearchResult]:
56
+ return Response(
57
+ status_code=HTTPStatus(response.status_code),
58
+ content=response.content,
59
+ headers=response.headers,
60
+ parsed=_parse_response(client=client, response=response),
61
+ )
62
+
63
+
64
+ def sync_detailed(
65
+ *,
66
+ client: Union[AuthenticatedClient, Client],
67
+ end_time: Union[Unset, str] = "2099-01-01",
68
+ page: Union[Unset, int] = 1,
69
+ size: Union[Unset, int] = 10,
70
+ start_time: Union[Unset, str] = "1970-01-01",
71
+ ) -> Response[APIResultSearchResult]:
72
+ """harvest dataset by dataset's publish time period(start_time and end_time)
73
+
74
+ result is order by publish time desc
75
+
76
+ Args:
77
+ end_time (Union[Unset, str]): Default: '2099-01-01'.
78
+ page (Union[Unset, int]): Default: 1.
79
+ size (Union[Unset, int]): Default: 10.
80
+ start_time (Union[Unset, str]): Default: '1970-01-01'.
81
+
82
+ Raises:
83
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
84
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
85
+
86
+ Returns:
87
+ Response[APIResultSearchResult]
88
+ """
89
+
90
+ kwargs = _get_kwargs(
91
+ end_time=end_time,
92
+ page=page,
93
+ size=size,
94
+ start_time=start_time,
95
+ )
96
+
97
+ response = client.get_httpx_client().request(
98
+ **kwargs,
99
+ )
100
+
101
+ return _build_response(client=client, response=response)
102
+
103
+
104
+ def sync(
105
+ *,
106
+ client: Union[AuthenticatedClient, Client],
107
+ end_time: Union[Unset, str] = "2099-01-01",
108
+ page: Union[Unset, int] = 1,
109
+ size: Union[Unset, int] = 10,
110
+ start_time: Union[Unset, str] = "1970-01-01",
111
+ ) -> Optional[APIResultSearchResult]:
112
+ """harvest dataset by dataset's publish time period(start_time and end_time)
113
+
114
+ result is order by publish time desc
115
+
116
+ Args:
117
+ end_time (Union[Unset, str]): Default: '2099-01-01'.
118
+ page (Union[Unset, int]): Default: 1.
119
+ size (Union[Unset, int]): Default: 10.
120
+ start_time (Union[Unset, str]): Default: '1970-01-01'.
121
+
122
+ Raises:
123
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
124
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
125
+
126
+ Returns:
127
+ APIResultSearchResult
128
+ """
129
+
130
+ return sync_detailed(
131
+ client=client,
132
+ end_time=end_time,
133
+ page=page,
134
+ size=size,
135
+ start_time=start_time,
136
+ ).parsed
137
+
138
+
139
+ async def asyncio_detailed(
140
+ *,
141
+ client: Union[AuthenticatedClient, Client],
142
+ end_time: Union[Unset, str] = "2099-01-01",
143
+ page: Union[Unset, int] = 1,
144
+ size: Union[Unset, int] = 10,
145
+ start_time: Union[Unset, str] = "1970-01-01",
146
+ ) -> Response[APIResultSearchResult]:
147
+ """harvest dataset by dataset's publish time period(start_time and end_time)
148
+
149
+ result is order by publish time desc
150
+
151
+ Args:
152
+ end_time (Union[Unset, str]): Default: '2099-01-01'.
153
+ page (Union[Unset, int]): Default: 1.
154
+ size (Union[Unset, int]): Default: 10.
155
+ start_time (Union[Unset, str]): Default: '1970-01-01'.
156
+
157
+ Raises:
158
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
159
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
160
+
161
+ Returns:
162
+ Response[APIResultSearchResult]
163
+ """
164
+
165
+ kwargs = _get_kwargs(
166
+ end_time=end_time,
167
+ page=page,
168
+ size=size,
169
+ start_time=start_time,
170
+ )
171
+
172
+ response = await client.get_async_httpx_client().request(**kwargs)
173
+
174
+ return _build_response(client=client, response=response)
175
+
176
+
177
+ async def asyncio(
178
+ *,
179
+ client: Union[AuthenticatedClient, Client],
180
+ end_time: Union[Unset, str] = "2099-01-01",
181
+ page: Union[Unset, int] = 1,
182
+ size: Union[Unset, int] = 10,
183
+ start_time: Union[Unset, str] = "1970-01-01",
184
+ ) -> Optional[APIResultSearchResult]:
185
+ """harvest dataset by dataset's publish time period(start_time and end_time)
186
+
187
+ result is order by publish time desc
188
+
189
+ Args:
190
+ end_time (Union[Unset, str]): Default: '2099-01-01'.
191
+ page (Union[Unset, int]): Default: 1.
192
+ size (Union[Unset, int]): Default: 10.
193
+ start_time (Union[Unset, str]): Default: '1970-01-01'.
194
+
195
+ Raises:
196
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
197
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
198
+
199
+ Returns:
200
+ APIResultSearchResult
201
+ """
202
+
203
+ return (
204
+ await asyncio_detailed(
205
+ client=client,
206
+ end_time=end_time,
207
+ page=page,
208
+ size=size,
209
+ start_time=start_time,
210
+ )
211
+ ).parsed
@@ -0,0 +1,164 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Dict, Optional, Union, cast
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...types import UNSET, Response
9
+
10
+
11
+ def _get_kwargs(
12
+ *,
13
+ doi: str,
14
+ ) -> Dict[str, Any]:
15
+ params: Dict[str, Any] = {}
16
+
17
+ params["doi"] = doi
18
+
19
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
20
+
21
+ _kwargs: Dict[str, Any] = {
22
+ "method": "get",
23
+ "url": "/json",
24
+ "params": params,
25
+ }
26
+
27
+ return _kwargs
28
+
29
+
30
+ def _parse_response(
31
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
32
+ ) -> Optional[str]:
33
+ if response.status_code == 200:
34
+ response_200 = cast(str, response.json())
35
+ return response_200
36
+ if client.raise_on_unexpected_status:
37
+ raise errors.UnexpectedStatus(response.status_code, response.content)
38
+ else:
39
+ return None
40
+
41
+
42
+ def _build_response(
43
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
44
+ ) -> Response[str]:
45
+ return Response(
46
+ status_code=HTTPStatus(response.status_code),
47
+ content=response.content,
48
+ headers=response.headers,
49
+ parsed=_parse_response(client=client, response=response),
50
+ )
51
+
52
+
53
+ def sync_detailed(
54
+ *,
55
+ client: Union[AuthenticatedClient, Client],
56
+ doi: str,
57
+ ) -> Response[str]:
58
+ """get dataset's detail information by it's doi
59
+
60
+ information's format is referenced by https://schema.org/Dataset
61
+
62
+ Args:
63
+ doi (str):
64
+
65
+ Raises:
66
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
67
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
68
+
69
+ Returns:
70
+ Response[str]
71
+ """
72
+
73
+ kwargs = _get_kwargs(
74
+ doi=doi,
75
+ )
76
+
77
+ response = client.get_httpx_client().request(
78
+ **kwargs,
79
+ )
80
+
81
+ return _build_response(client=client, response=response)
82
+
83
+
84
+ def sync(
85
+ *,
86
+ client: Union[AuthenticatedClient, Client],
87
+ doi: str,
88
+ ) -> Optional[str]:
89
+ """get dataset's detail information by it's doi
90
+
91
+ information's format is referenced by https://schema.org/Dataset
92
+
93
+ Args:
94
+ doi (str):
95
+
96
+ Raises:
97
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
98
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
99
+
100
+ Returns:
101
+ str
102
+ """
103
+
104
+ return sync_detailed(
105
+ client=client,
106
+ doi=doi,
107
+ ).parsed
108
+
109
+
110
+ async def asyncio_detailed(
111
+ *,
112
+ client: Union[AuthenticatedClient, Client],
113
+ doi: str,
114
+ ) -> Response[str]:
115
+ """get dataset's detail information by it's doi
116
+
117
+ information's format is referenced by https://schema.org/Dataset
118
+
119
+ Args:
120
+ doi (str):
121
+
122
+ Raises:
123
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
124
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
125
+
126
+ Returns:
127
+ Response[str]
128
+ """
129
+
130
+ kwargs = _get_kwargs(
131
+ doi=doi,
132
+ )
133
+
134
+ response = await client.get_async_httpx_client().request(**kwargs)
135
+
136
+ return _build_response(client=client, response=response)
137
+
138
+
139
+ async def asyncio(
140
+ *,
141
+ client: Union[AuthenticatedClient, Client],
142
+ doi: str,
143
+ ) -> Optional[str]:
144
+ """get dataset's detail information by it's doi
145
+
146
+ information's format is referenced by https://schema.org/Dataset
147
+
148
+ Args:
149
+ doi (str):
150
+
151
+ Raises:
152
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
153
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
154
+
155
+ Returns:
156
+ str
157
+ """
158
+
159
+ return (
160
+ await asyncio_detailed(
161
+ client=client,
162
+ doi=doi,
163
+ )
164
+ ).parsed
@@ -0,0 +1,166 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Dict, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.api_result_metrics_result import APIResultMetricsResult
9
+ from ...types import UNSET, Response
10
+
11
+
12
+ def _get_kwargs(
13
+ *,
14
+ doi: str,
15
+ ) -> Dict[str, Any]:
16
+ params: Dict[str, Any] = {}
17
+
18
+ params["doi"] = doi
19
+
20
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
21
+
22
+ _kwargs: Dict[str, Any] = {
23
+ "method": "get",
24
+ "url": "/metrics",
25
+ "params": params,
26
+ }
27
+
28
+ return _kwargs
29
+
30
+
31
+ def _parse_response(
32
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
33
+ ) -> Optional[APIResultMetricsResult]:
34
+ if response.status_code == 200:
35
+ response_200 = APIResultMetricsResult.from_dict(response.json())
36
+
37
+ return response_200
38
+ if client.raise_on_unexpected_status:
39
+ raise errors.UnexpectedStatus(response.status_code, response.content)
40
+ else:
41
+ return None
42
+
43
+
44
+ def _build_response(
45
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
46
+ ) -> Response[APIResultMetricsResult]:
47
+ return Response(
48
+ status_code=HTTPStatus(response.status_code),
49
+ content=response.content,
50
+ headers=response.headers,
51
+ parsed=_parse_response(client=client, response=response),
52
+ )
53
+
54
+
55
+ def sync_detailed(
56
+ *,
57
+ client: Union[AuthenticatedClient, Client],
58
+ doi: str,
59
+ ) -> Response[APIResultMetricsResult]:
60
+ """search dataset metrics by doi
61
+
62
+ search dataset metrics by doi
63
+
64
+ Args:
65
+ doi (str):
66
+
67
+ Raises:
68
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
69
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
70
+
71
+ Returns:
72
+ Response[APIResultMetricsResult]
73
+ """
74
+
75
+ kwargs = _get_kwargs(
76
+ doi=doi,
77
+ )
78
+
79
+ response = client.get_httpx_client().request(
80
+ **kwargs,
81
+ )
82
+
83
+ return _build_response(client=client, response=response)
84
+
85
+
86
+ def sync(
87
+ *,
88
+ client: Union[AuthenticatedClient, Client],
89
+ doi: str,
90
+ ) -> Optional[APIResultMetricsResult]:
91
+ """search dataset metrics by doi
92
+
93
+ search dataset metrics by doi
94
+
95
+ Args:
96
+ doi (str):
97
+
98
+ Raises:
99
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
100
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
101
+
102
+ Returns:
103
+ APIResultMetricsResult
104
+ """
105
+
106
+ return sync_detailed(
107
+ client=client,
108
+ doi=doi,
109
+ ).parsed
110
+
111
+
112
+ async def asyncio_detailed(
113
+ *,
114
+ client: Union[AuthenticatedClient, Client],
115
+ doi: str,
116
+ ) -> Response[APIResultMetricsResult]:
117
+ """search dataset metrics by doi
118
+
119
+ search dataset metrics by doi
120
+
121
+ Args:
122
+ doi (str):
123
+
124
+ Raises:
125
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
126
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
127
+
128
+ Returns:
129
+ Response[APIResultMetricsResult]
130
+ """
131
+
132
+ kwargs = _get_kwargs(
133
+ doi=doi,
134
+ )
135
+
136
+ response = await client.get_async_httpx_client().request(**kwargs)
137
+
138
+ return _build_response(client=client, response=response)
139
+
140
+
141
+ async def asyncio(
142
+ *,
143
+ client: Union[AuthenticatedClient, Client],
144
+ doi: str,
145
+ ) -> Optional[APIResultMetricsResult]:
146
+ """search dataset metrics by doi
147
+
148
+ search dataset metrics by doi
149
+
150
+ Args:
151
+ doi (str):
152
+
153
+ Raises:
154
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
155
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
156
+
157
+ Returns:
158
+ APIResultMetricsResult
159
+ """
160
+
161
+ return (
162
+ await asyncio_detailed(
163
+ client=client,
164
+ doi=doi,
165
+ )
166
+ ).parsed