entryscape 1.3.0__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 (82) hide show
  1. entryscape/__init__.py +219 -0
  2. entryscape/api/__init__.py +26 -0
  3. entryscape/api/app_token_api.py +835 -0
  4. entryscape/api/auth_api.py +965 -0
  5. entryscape/api/catalog_api.py +4473 -0
  6. entryscape/api/contact_api.py +3135 -0
  7. entryscape/api/dataservice_api.py +3135 -0
  8. entryscape/api/dataset_api.py +3804 -0
  9. entryscape/api/distribution_api.py +3135 -0
  10. entryscape/api/document_api.py +2740 -0
  11. entryscape/api/idea_api.py +2740 -0
  12. entryscape/api/job_api.py +360 -0
  13. entryscape/api/model_api.py +2446 -0
  14. entryscape/api/model_class_api.py +2611 -0
  15. entryscape/api/model_diagram_api.py +2611 -0
  16. entryscape/api/model_field_api.py +2611 -0
  17. entryscape/api/model_form_api.py +2611 -0
  18. entryscape/api/model_namespace_api.py +2611 -0
  19. entryscape/api/model_property_api.py +2611 -0
  20. entryscape/api/organization_api.py +3135 -0
  21. entryscape/api/search_api.py +1513 -0
  22. entryscape/api/showcase_api.py +2740 -0
  23. entryscape/api/suggestion_api.py +2740 -0
  24. entryscape/api/terminology_api.py +1726 -0
  25. entryscape/api/upload_api.py +814 -0
  26. entryscape/api_client.py +763 -0
  27. entryscape/api_response.py +20 -0
  28. entryscape/configuration.py +673 -0
  29. entryscape/exceptions.py +222 -0
  30. entryscape/models/__init__.py +71 -0
  31. entryscape/models/app_token.py +156 -0
  32. entryscape/models/app_token_create_request.py +98 -0
  33. entryscape/models/app_token_create_response.py +169 -0
  34. entryscape/models/app_token_status.py +35 -0
  35. entryscape/models/app_token_verify_request.py +109 -0
  36. entryscape/models/entity_list_item.py +175 -0
  37. entryscape/models/entity_list_response.py +139 -0
  38. entryscape/models/entity_reference.py +189 -0
  39. entryscape/models/entity_type.py +57 -0
  40. entryscape/models/error.py +135 -0
  41. entryscape/models/facet_field.py +115 -0
  42. entryscape/models/facet_field_values_inner.py +100 -0
  43. entryscape/models/facet_list.py +113 -0
  44. entryscape/models/facet_list_available_inner.py +107 -0
  45. entryscape/models/job_response.py +112 -0
  46. entryscape/models/job_status.py +189 -0
  47. entryscape/models/job_status_progress.py +100 -0
  48. entryscape/models/job_status_value.py +37 -0
  49. entryscape/models/job_type.py +37 -0
  50. entryscape/models/list_catalogs_entry_type_parameter.py +37 -0
  51. entryscape/models/list_catalogs_graph_type_parameter.py +44 -0
  52. entryscape/models/list_catalogs_resource_type_parameter.py +37 -0
  53. entryscape/models/login_request.py +108 -0
  54. entryscape/models/login_response.py +115 -0
  55. entryscape/models/metadata_format.py +38 -0
  56. entryscape/models/metadata_request.py +99 -0
  57. entryscape/models/parent_reference.py +130 -0
  58. entryscape/models/search_request.py +158 -0
  59. entryscape/models/search_request_filters.py +144 -0
  60. entryscape/models/search_request_filters_graph_type.py +44 -0
  61. entryscape/models/search_request_filters_resource_type.py +37 -0
  62. entryscape/models/search_request_sort.py +38 -0
  63. entryscape/models/search_request_sort_order.py +35 -0
  64. entryscape/models/search_response.py +175 -0
  65. entryscape/models/search_result.py +175 -0
  66. entryscape/models/search_result_graph_type.py +44 -0
  67. entryscape/models/search_result_resource_type.py +37 -0
  68. entryscape/models/search_sort_order_parameter.py +35 -0
  69. entryscape/models/terminology_import_mode.py +35 -0
  70. entryscape/models/validation_profile.py +36 -0
  71. entryscape/models/validation_response.py +149 -0
  72. entryscape/models/validation_result.py +162 -0
  73. entryscape/models/validation_severity.py +36 -0
  74. entryscape/models/validation_summary.py +122 -0
  75. entryscape/models/whoami_response.py +104 -0
  76. entryscape/py.typed +0 -0
  77. entryscape/rest.py +210 -0
  78. entryscape-1.3.0.dist-info/METADATA +696 -0
  79. entryscape-1.3.0.dist-info/RECORD +82 -0
  80. entryscape-1.3.0.dist-info/WHEEL +5 -0
  81. entryscape-1.3.0.dist-info/licenses/LICENSE.txt +165 -0
  82. entryscape-1.3.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,835 @@
1
+ """
2
+ EntryScape API
3
+
4
+ This API provides structured access to EntryScape data following DCAT-AP standards. All entity endpoints follow a consistent pattern: - GET /{entity} - List all entities - POST /{entity} - Create a new entity (DCAT types only) - GET /{entity}/{context_id}/{entry_id} - Get entity reference info - DELETE /{entity}/{context_id}/{entry_id} - Delete an entity (DCAT types only) - GET /{entity}/{context_id}/{entry_id}/metadata - Get raw RDF metadata - PUT /{entity}/{context_id}/{entry_id}/metadata - Replace raw RDF metadata (JSON-LD, Turtle, RDF/XML, or N-Triples passthrough) ## Reading and consistency Reads of a single entity — `GET /{entity}/{context_id}/{entry_id}` and its `/metadata` — go straight to the store and always reflect the latest write. Lists and search do not. They are answered from a search index that is updated asynchronously, so for a short interval after a write: - an entry that was just created may be missing from the list it belongs to, while reading it by id already works; - an entry that was just deleted may still appear; - `results` counts what the index holds, not what the store holds. Write a client that tolerates this: after creating an entry, use the id the create returned rather than searching for what you just wrote. `results` is also an upper bound rather than an exact count when the caller cannot read every hit (see the field's own description). Separately, responses are cached for 15 minutes by default, which is a second and unrelated source of staleness. A write invalidates the cache entries it affects, but a read that lands in the indexing gap can cache a list that does not yet show it. ## Authentication Most endpoints require an authenticated session. Reading public data works without authentication, while creating, updating, and deleting entities requires a valid user session. 1. **Log in** with `POST /auth/login`, supplying an EntryStore username and password. The response returns an `auth_token`. 2. **Send the token** on subsequent requests via the `X-Auth-Token` header. This is the recommended method for SDK and programmatic access. Browser clients can instead rely on the `auth_token` cookie, which the server sets automatically on login (`SameSite=Lax; Secure`). 3. **Inspect the session** with `GET /auth/whoami`, which returns the current user or an anonymous/guest identity when no valid token is supplied. 4. **Log out** with `POST /auth/logout` to invalidate the token and clear the cookie. ### Writes and CSRF Send the token as the `X-Auth-Token` **header** and there is nothing else to do: creates, updates and deletes work as they are, which is how the SDKs and the MCP server are built. The `auth_token` cookie is different. A cookie is attached by the browser automatically, so a state-changing request authenticated by it alone is what cross-site request forgery abuses, and those requests additionally need a double-submit token: read the `XSRF-TOKEN` cookie the server sets on any response and send its value back as the `X-XSRF-TOKEN` header. Without it the request is rejected with `403` before it reaches the endpoint. A custom header cannot be forged this way — cross-origin JavaScript cannot set one without a CORS preflight, which this API grants only to configured origins — so the header is the recommended path for anything that is not a browser session. ### App Tokens An app token identifies an integration. Create one with `POST /app-token` (unauthenticated). Creation requires an email address: the token starts in the `pending` state and a 6-digit code is emailed to the owner. Confirm the code with `POST /app-token/verify` to activate the token and receive its value, which is shown only once — store it securely. `GET /app-token/{app_token_id}` then returns its details and quota usage, authenticated by the token itself via the `X-App-Token` header. **The `X-App-Token` header is accepted only by `GET /app-token/{app_token_id}`.** No other operation reads it, and the read quota is recorded but not yet enforced: reading public data needs no token of any kind, and sending an app token with a read neither grants nor meters anything. Metered public read access is the intent of the two-token model, not a description of this release — see the `security` declared on each operation for what it actually accepts. ## SDKs Generated clients for Python, TypeScript, JavaScript and C# wrap every operation below, and each operation on this page shows the SDK call beside the `curl` command. Two of them install from a public registry: ``` pip install entryscape # Python npm install @entryscape/api-client # TypeScript and JavaScript ``` `@entryscape/api-client` ships an ESM and a CommonJS build, so `import` and `require()` both work and TypeScript is not required to use it — the name describes what it is written in, not what you have to write. There is a separate generated JavaScript SDK, and it is deliberately **not** on npm; this package is the npm client for both languages. Every SDK, including the C# and JavaScript ones, is also published as a tarball. The downloads are linked in the sidebar, they are the route to take when a registry is unreachable or a build has to vendor its dependencies, and each archive carries the SDK's own README: - **Python** — `pip install entryscape`, or `python-sdk.tar.gz`. - **TypeScript and JavaScript** — `npm install @entryscape/api-client`, or `typescript-sdk.tar.gz`. - **JavaScript (the separate generated client)** — not published to a registry, by design; `javascript-sdk.tar.gz` only. - **C#** — not published to NuGet yet; `csharp-sdk.tar.gz` only. - **MCP server** — `npx -y @entryscape/mcp-server`, or `mcp-server.tar.gz`. ## MCP Server A Model Context Protocol (MCP) server is generated from this specification and published alongside the SDKs (`@entryscape/mcp-server`), exposing the API as tools for AI assistants and agents. Each operation becomes one tool named after its `operationId` — `listDatasets`, `createCatalog`, `search`, `getJobStatus`. The `auth` operations are the exception: the server reads its token once at startup, so a `login` tool could install nothing and a `logout` tool would only invalidate the token the server was started with. On connect the server also hands the assistant a short set of rules that hold across every tool: a token is bound to one EntryStore instance, the search index lags a write, uploads finish as jobs. ### Install The server is on npm, and MCP servers are normally launched straight from there, so nothing has to be installed first: ``` npx -y @entryscape/mcp-server ``` `npm install -g @entryscape/mcp-server` works too and puts an `entryscape-mcp` binary on `PATH`. It is also listed in the MCP Registry as `com.entryscape/mcp-server`, which is where clients and marketplaces look it up. Without npm, download `mcp-server.tar.gz` from the SDK downloads and unpack it. The package ships prebuilt; install its runtime dependency once: ``` mkdir entryscape-mcp && tar -xzf mcp-server.tar.gz -C entryscape-mcp cd entryscape-mcp && npm install --omit=dev ``` ### Configure The server is a stdio MCP server configured through environment variables, read once at startup: - `ENTRYSCAPE_API_URL` — base URL of the API server, path included. Required: there is no default, and the server refuses to start without it. - `ENTRYSCAPE_AUTH_TOKEN` — a session token from `POST /auth/login`, sent as the `X-Auth-Token` header. Optional: without it reads see public entries and every write is refused. A token is valid only for the EntryStore instance that issued it. - `ENTRYSCAPE_ENTRYSTORE_HOST` — the EntryStore instance the API server should use, for example `dev.entryscape.com/store/`. Unset means the API server's own default. - `ENTRYSCAPE_MCP_UPLOAD_ROOT` — the directory the upload tools may read files from. **Unset means uploads are disabled**: `addFileToDistribution`, `replaceFileInDistribution` and `importTerminology` refuse and say so. - `ENTRYSCAPE_MCP_TAGS` — comma-separated tags to serve tools for, for example `catalog,dataset,distribution,search`. Unset serves every tool. The package's `README.md` lists the remaining variables (timeouts and size caps). Register the server with any MCP-capable client by adding it to the client's `mcpServers` configuration: ```json { \"mcpServers\": { \"entryscape\": { \"command\": \"npx\", \"args\": [\"-y\", \"@entryscape/mcp-server\"], \"env\": { \"ENTRYSCAPE_API_URL\": \"https://<your EntryScape API host>\", \"ENTRYSCAPE_AUTH_TOKEN\": \"your-session-token\" } } } } ``` From an unpacked download instead, the command is `\"command\": \"node\", \"args\": [\"/path/to/entryscape-mcp/dist/bin/entryscape-mcp.js\"]`. ### Claude Code The unpacked package is also a Claude Code plugin, so one install gives the server and the skills below together. Claude Code installs plugins from marketplaces, and the package carries a one-entry marketplace pointing at itself: ``` claude plugin marketplace add /path/to/entryscape-mcp claude plugin install entryscape@entryscape --scope user ``` The plugin passes `ENTRYSCAPE_API_URL`, `ENTRYSCAPE_AUTH_TOKEN`, `ENTRYSCAPE_ENTRYSTORE_HOST`, `ENTRYSCAPE_MCP_TAGS` and `ENTRYSCAPE_MCP_UPLOAD_ROOT` through from the shell Claude Code was started in, so set them there. To try the plugin for one session without installing it, start Claude Code with `--plugin-dir /path/to/entryscape-mcp`. ### Skills `skills/` in the package holds procedures that span several tools, in the Agent Skills format (a `SKILL.md` with `name` and `description`): which tools to call in which order, what to check between calls, and where to stop. Claude Code loads them from the plugin; other clients that read the format can be pointed at the directory. The `find` skill covers discovery, facets and selective metadata reads; `publish-dataset` takes a dataset from catalog to validated distribution with its file; `edit-metadata` changes an entry that already exists without dropping the rest of its graph, models included; `migrate-from-taskrunner` moves an integration off the deprecated Taskrunner API. Every tool a skill names is checked against this specification when the package is built. ## Deprecation Policy When endpoints or features are deprecated: 1. The operation is marked with `deprecated: true` in this spec 2. The operation description documents the replacement endpoint and sunset date 3. Deprecated endpoints remain functional for at least 6 months after announcement 4. The server returns a `Sunset` header with the planned removal date 5. After the sunset date, the endpoint may be removed in a future release
5
+
6
+ The version of the OpenAPI document: 1.3.0
7
+ Contact: contact@entryscape.com
8
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
9
+
10
+ Do not edit the class manually.
11
+ """ # noqa: E501
12
+
13
+ import warnings
14
+ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
15
+ from typing import Any, Dict, List, Optional, Tuple, Union
16
+ from typing_extensions import Annotated
17
+
18
+ from pydantic import Field
19
+ from typing_extensions import Annotated
20
+ from uuid import UUID
21
+ from entryscape.models.app_token import AppToken
22
+ from entryscape.models.app_token_create_request import AppTokenCreateRequest
23
+ from entryscape.models.app_token_create_response import AppTokenCreateResponse
24
+ from entryscape.models.app_token_verify_request import AppTokenVerifyRequest
25
+
26
+ from entryscape.api_client import ApiClient, RequestSerialized
27
+ from entryscape.api_response import ApiResponse
28
+ from entryscape.rest import RESTResponseType
29
+
30
+
31
+ class AppTokenApi:
32
+ """NOTE: This class is auto generated by OpenAPI Generator
33
+ Ref: https://openapi-generator.tech
34
+
35
+ Do not edit the class manually.
36
+ """
37
+
38
+ def __init__(self, api_client=None) -> None:
39
+ if api_client is None:
40
+ api_client = ApiClient.get_default()
41
+ self.api_client = api_client
42
+
43
+ @validate_call
44
+ async def create_app_token(
45
+ self,
46
+ app_token_create_request: AppTokenCreateRequest,
47
+ _request_timeout: Union[
48
+ None,
49
+ Annotated[StrictFloat, Field(gt=0)],
50
+ Tuple[
51
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
52
+ ],
53
+ ] = None,
54
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
55
+ _content_type: Optional[StrictStr] = None,
56
+ _headers: Optional[Dict[StrictStr, Any]] = None,
57
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
58
+ ) -> AppTokenCreateResponse:
59
+ """Create app token
60
+
61
+ Creates a new app token for metered public API access. This endpoint is unauthenticated — no session or credentials are required. The token is created in the `pending` state and a 6-digit verification code is emailed to the supplied address. The token value is **not** issued yet — confirm the code with `POST /app-token/verify` to activate the token and receive its value (shown only once). The server assigns a default read quota. The token grants access to public data only, metered by the read quota. Once active, pass the token via the `X-App-Token` header on subsequent requests.
62
+
63
+ :param app_token_create_request: (required)
64
+ :type app_token_create_request: AppTokenCreateRequest
65
+ :param _request_timeout: timeout setting for this request. If one
66
+ number provided, it will be total request
67
+ timeout. It can also be a pair (tuple) of
68
+ (connection, read) timeouts.
69
+ :type _request_timeout: int, tuple(int, int), optional
70
+ :param _request_auth: set to override the auth_settings for an a single
71
+ request; this effectively ignores the
72
+ authentication in the spec for a single request.
73
+ :type _request_auth: dict, optional
74
+ :param _content_type: force content-type for the request.
75
+ :type _content_type: str, Optional
76
+ :param _headers: set to override the headers for a single
77
+ request; this effectively ignores the headers
78
+ in the spec for a single request.
79
+ :type _headers: dict, optional
80
+ :param _host_index: set to override the host_index for a single
81
+ request; this effectively ignores the host_index
82
+ in the spec for a single request.
83
+ :type _host_index: int, optional
84
+ :return: Returns the result object.
85
+ """ # noqa: E501
86
+
87
+ _param = self._create_app_token_serialize(
88
+ app_token_create_request=app_token_create_request,
89
+ _request_auth=_request_auth,
90
+ _content_type=_content_type,
91
+ _headers=_headers,
92
+ _host_index=_host_index,
93
+ )
94
+
95
+ _response_types_map: Dict[str, Optional[str]] = {
96
+ "201": "AppTokenCreateResponse",
97
+ "400": "Error",
98
+ "422": "Error",
99
+ "500": "Error",
100
+ "503": "Error",
101
+ }
102
+ response_data = await self.api_client.call_api(
103
+ *_param, _request_timeout=_request_timeout
104
+ )
105
+ await response_data.read()
106
+ return self.api_client.response_deserialize(
107
+ response_data=response_data,
108
+ response_types_map=_response_types_map,
109
+ ).data
110
+
111
+ @validate_call
112
+ async def create_app_token_with_http_info(
113
+ self,
114
+ app_token_create_request: AppTokenCreateRequest,
115
+ _request_timeout: Union[
116
+ None,
117
+ Annotated[StrictFloat, Field(gt=0)],
118
+ Tuple[
119
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
120
+ ],
121
+ ] = None,
122
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
123
+ _content_type: Optional[StrictStr] = None,
124
+ _headers: Optional[Dict[StrictStr, Any]] = None,
125
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
126
+ ) -> ApiResponse[AppTokenCreateResponse]:
127
+ """Create app token
128
+
129
+ Creates a new app token for metered public API access. This endpoint is unauthenticated — no session or credentials are required. The token is created in the `pending` state and a 6-digit verification code is emailed to the supplied address. The token value is **not** issued yet — confirm the code with `POST /app-token/verify` to activate the token and receive its value (shown only once). The server assigns a default read quota. The token grants access to public data only, metered by the read quota. Once active, pass the token via the `X-App-Token` header on subsequent requests.
130
+
131
+ :param app_token_create_request: (required)
132
+ :type app_token_create_request: AppTokenCreateRequest
133
+ :param _request_timeout: timeout setting for this request. If one
134
+ number provided, it will be total request
135
+ timeout. It can also be a pair (tuple) of
136
+ (connection, read) timeouts.
137
+ :type _request_timeout: int, tuple(int, int), optional
138
+ :param _request_auth: set to override the auth_settings for an a single
139
+ request; this effectively ignores the
140
+ authentication in the spec for a single request.
141
+ :type _request_auth: dict, optional
142
+ :param _content_type: force content-type for the request.
143
+ :type _content_type: str, Optional
144
+ :param _headers: set to override the headers for a single
145
+ request; this effectively ignores the headers
146
+ in the spec for a single request.
147
+ :type _headers: dict, optional
148
+ :param _host_index: set to override the host_index for a single
149
+ request; this effectively ignores the host_index
150
+ in the spec for a single request.
151
+ :type _host_index: int, optional
152
+ :return: Returns the result object.
153
+ """ # noqa: E501
154
+
155
+ _param = self._create_app_token_serialize(
156
+ app_token_create_request=app_token_create_request,
157
+ _request_auth=_request_auth,
158
+ _content_type=_content_type,
159
+ _headers=_headers,
160
+ _host_index=_host_index,
161
+ )
162
+
163
+ _response_types_map: Dict[str, Optional[str]] = {
164
+ "201": "AppTokenCreateResponse",
165
+ "400": "Error",
166
+ "422": "Error",
167
+ "500": "Error",
168
+ "503": "Error",
169
+ }
170
+ response_data = await self.api_client.call_api(
171
+ *_param, _request_timeout=_request_timeout
172
+ )
173
+ await response_data.read()
174
+ return self.api_client.response_deserialize(
175
+ response_data=response_data,
176
+ response_types_map=_response_types_map,
177
+ )
178
+
179
+ @validate_call
180
+ async def create_app_token_without_preload_content(
181
+ self,
182
+ app_token_create_request: AppTokenCreateRequest,
183
+ _request_timeout: Union[
184
+ None,
185
+ Annotated[StrictFloat, Field(gt=0)],
186
+ Tuple[
187
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
188
+ ],
189
+ ] = None,
190
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
191
+ _content_type: Optional[StrictStr] = None,
192
+ _headers: Optional[Dict[StrictStr, Any]] = None,
193
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
194
+ ) -> RESTResponseType:
195
+ """Create app token
196
+
197
+ Creates a new app token for metered public API access. This endpoint is unauthenticated — no session or credentials are required. The token is created in the `pending` state and a 6-digit verification code is emailed to the supplied address. The token value is **not** issued yet — confirm the code with `POST /app-token/verify` to activate the token and receive its value (shown only once). The server assigns a default read quota. The token grants access to public data only, metered by the read quota. Once active, pass the token via the `X-App-Token` header on subsequent requests.
198
+
199
+ :param app_token_create_request: (required)
200
+ :type app_token_create_request: AppTokenCreateRequest
201
+ :param _request_timeout: timeout setting for this request. If one
202
+ number provided, it will be total request
203
+ timeout. It can also be a pair (tuple) of
204
+ (connection, read) timeouts.
205
+ :type _request_timeout: int, tuple(int, int), optional
206
+ :param _request_auth: set to override the auth_settings for an a single
207
+ request; this effectively ignores the
208
+ authentication in the spec for a single request.
209
+ :type _request_auth: dict, optional
210
+ :param _content_type: force content-type for the request.
211
+ :type _content_type: str, Optional
212
+ :param _headers: set to override the headers for a single
213
+ request; this effectively ignores the headers
214
+ in the spec for a single request.
215
+ :type _headers: dict, optional
216
+ :param _host_index: set to override the host_index for a single
217
+ request; this effectively ignores the host_index
218
+ in the spec for a single request.
219
+ :type _host_index: int, optional
220
+ :return: Returns the result object.
221
+ """ # noqa: E501
222
+
223
+ _param = self._create_app_token_serialize(
224
+ app_token_create_request=app_token_create_request,
225
+ _request_auth=_request_auth,
226
+ _content_type=_content_type,
227
+ _headers=_headers,
228
+ _host_index=_host_index,
229
+ )
230
+
231
+ _response_types_map: Dict[str, Optional[str]] = {
232
+ "201": "AppTokenCreateResponse",
233
+ "400": "Error",
234
+ "422": "Error",
235
+ "500": "Error",
236
+ "503": "Error",
237
+ }
238
+ response_data = await self.api_client.call_api(
239
+ *_param, _request_timeout=_request_timeout
240
+ )
241
+ return response_data.response
242
+
243
+ def _create_app_token_serialize(
244
+ self,
245
+ app_token_create_request,
246
+ _request_auth,
247
+ _content_type,
248
+ _headers,
249
+ _host_index,
250
+ ) -> RequestSerialized:
251
+
252
+ _host = None
253
+
254
+ _collection_formats: Dict[str, str] = {}
255
+
256
+ _path_params: Dict[str, str] = {}
257
+ _query_params: List[Tuple[str, str]] = []
258
+ _header_params: Dict[str, Optional[str]] = _headers or {}
259
+ _form_params: List[Tuple[str, str]] = []
260
+ _files: Dict[
261
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
262
+ ] = {}
263
+ _body_params: Optional[bytes] = None
264
+
265
+ # process the path parameters
266
+ # process the query parameters
267
+ # process the header parameters
268
+ # process the form parameters
269
+ # process the body parameter
270
+ if app_token_create_request is not None:
271
+ _body_params = app_token_create_request
272
+
273
+ # set the HTTP header `Accept`
274
+ if "Accept" not in _header_params:
275
+ _header_params["Accept"] = self.api_client.select_header_accept(
276
+ ["application/json"]
277
+ )
278
+
279
+ # set the HTTP header `Content-Type`
280
+ if _content_type:
281
+ _header_params["Content-Type"] = _content_type
282
+ else:
283
+ _default_content_type = self.api_client.select_header_content_type(
284
+ ["application/json"]
285
+ )
286
+ if _default_content_type is not None:
287
+ _header_params["Content-Type"] = _default_content_type
288
+
289
+ # authentication setting
290
+ _auth_settings: List[str] = []
291
+
292
+ return self.api_client.param_serialize(
293
+ method="POST",
294
+ resource_path="/app-token",
295
+ path_params=_path_params,
296
+ query_params=_query_params,
297
+ header_params=_header_params,
298
+ body=_body_params,
299
+ post_params=_form_params,
300
+ files=_files,
301
+ auth_settings=_auth_settings,
302
+ collection_formats=_collection_formats,
303
+ _host=_host,
304
+ _request_auth=_request_auth,
305
+ )
306
+
307
+ @validate_call
308
+ async def get_app_token(
309
+ self,
310
+ app_token_id: Annotated[
311
+ UUID, Field(description="Unique identifier for the app token")
312
+ ],
313
+ _request_timeout: Union[
314
+ None,
315
+ Annotated[StrictFloat, Field(gt=0)],
316
+ Tuple[
317
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
318
+ ],
319
+ ] = None,
320
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
321
+ _content_type: Optional[StrictStr] = None,
322
+ _headers: Optional[Dict[StrictStr, Any]] = None,
323
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
324
+ ) -> AppToken:
325
+ """Get app token details
326
+
327
+ Returns details and quota usage for a specific app token. Requires authentication via the `X-App-Token` header. The token in the header must match the token associated with the requested app token ID.
328
+
329
+ :param app_token_id: Unique identifier for the app token (required)
330
+ :type app_token_id: UUID
331
+ :param _request_timeout: timeout setting for this request. If one
332
+ number provided, it will be total request
333
+ timeout. It can also be a pair (tuple) of
334
+ (connection, read) timeouts.
335
+ :type _request_timeout: int, tuple(int, int), optional
336
+ :param _request_auth: set to override the auth_settings for an a single
337
+ request; this effectively ignores the
338
+ authentication in the spec for a single request.
339
+ :type _request_auth: dict, optional
340
+ :param _content_type: force content-type for the request.
341
+ :type _content_type: str, Optional
342
+ :param _headers: set to override the headers for a single
343
+ request; this effectively ignores the headers
344
+ in the spec for a single request.
345
+ :type _headers: dict, optional
346
+ :param _host_index: set to override the host_index for a single
347
+ request; this effectively ignores the host_index
348
+ in the spec for a single request.
349
+ :type _host_index: int, optional
350
+ :return: Returns the result object.
351
+ """ # noqa: E501
352
+
353
+ _param = self._get_app_token_serialize(
354
+ app_token_id=app_token_id,
355
+ _request_auth=_request_auth,
356
+ _content_type=_content_type,
357
+ _headers=_headers,
358
+ _host_index=_host_index,
359
+ )
360
+
361
+ _response_types_map: Dict[str, Optional[str]] = {
362
+ "200": "AppToken",
363
+ "401": "Error",
364
+ "404": "Error",
365
+ "500": "Error",
366
+ "503": "Error",
367
+ }
368
+ response_data = await self.api_client.call_api(
369
+ *_param, _request_timeout=_request_timeout
370
+ )
371
+ await response_data.read()
372
+ return self.api_client.response_deserialize(
373
+ response_data=response_data,
374
+ response_types_map=_response_types_map,
375
+ ).data
376
+
377
+ @validate_call
378
+ async def get_app_token_with_http_info(
379
+ self,
380
+ app_token_id: Annotated[
381
+ UUID, Field(description="Unique identifier for the app token")
382
+ ],
383
+ _request_timeout: Union[
384
+ None,
385
+ Annotated[StrictFloat, Field(gt=0)],
386
+ Tuple[
387
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
388
+ ],
389
+ ] = None,
390
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
391
+ _content_type: Optional[StrictStr] = None,
392
+ _headers: Optional[Dict[StrictStr, Any]] = None,
393
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
394
+ ) -> ApiResponse[AppToken]:
395
+ """Get app token details
396
+
397
+ Returns details and quota usage for a specific app token. Requires authentication via the `X-App-Token` header. The token in the header must match the token associated with the requested app token ID.
398
+
399
+ :param app_token_id: Unique identifier for the app token (required)
400
+ :type app_token_id: UUID
401
+ :param _request_timeout: timeout setting for this request. If one
402
+ number provided, it will be total request
403
+ timeout. It can also be a pair (tuple) of
404
+ (connection, read) timeouts.
405
+ :type _request_timeout: int, tuple(int, int), optional
406
+ :param _request_auth: set to override the auth_settings for an a single
407
+ request; this effectively ignores the
408
+ authentication in the spec for a single request.
409
+ :type _request_auth: dict, optional
410
+ :param _content_type: force content-type for the request.
411
+ :type _content_type: str, Optional
412
+ :param _headers: set to override the headers for a single
413
+ request; this effectively ignores the headers
414
+ in the spec for a single request.
415
+ :type _headers: dict, optional
416
+ :param _host_index: set to override the host_index for a single
417
+ request; this effectively ignores the host_index
418
+ in the spec for a single request.
419
+ :type _host_index: int, optional
420
+ :return: Returns the result object.
421
+ """ # noqa: E501
422
+
423
+ _param = self._get_app_token_serialize(
424
+ app_token_id=app_token_id,
425
+ _request_auth=_request_auth,
426
+ _content_type=_content_type,
427
+ _headers=_headers,
428
+ _host_index=_host_index,
429
+ )
430
+
431
+ _response_types_map: Dict[str, Optional[str]] = {
432
+ "200": "AppToken",
433
+ "401": "Error",
434
+ "404": "Error",
435
+ "500": "Error",
436
+ "503": "Error",
437
+ }
438
+ response_data = await self.api_client.call_api(
439
+ *_param, _request_timeout=_request_timeout
440
+ )
441
+ await response_data.read()
442
+ return self.api_client.response_deserialize(
443
+ response_data=response_data,
444
+ response_types_map=_response_types_map,
445
+ )
446
+
447
+ @validate_call
448
+ async def get_app_token_without_preload_content(
449
+ self,
450
+ app_token_id: Annotated[
451
+ UUID, Field(description="Unique identifier for the app token")
452
+ ],
453
+ _request_timeout: Union[
454
+ None,
455
+ Annotated[StrictFloat, Field(gt=0)],
456
+ Tuple[
457
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
458
+ ],
459
+ ] = None,
460
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
461
+ _content_type: Optional[StrictStr] = None,
462
+ _headers: Optional[Dict[StrictStr, Any]] = None,
463
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
464
+ ) -> RESTResponseType:
465
+ """Get app token details
466
+
467
+ Returns details and quota usage for a specific app token. Requires authentication via the `X-App-Token` header. The token in the header must match the token associated with the requested app token ID.
468
+
469
+ :param app_token_id: Unique identifier for the app token (required)
470
+ :type app_token_id: UUID
471
+ :param _request_timeout: timeout setting for this request. If one
472
+ number provided, it will be total request
473
+ timeout. It can also be a pair (tuple) of
474
+ (connection, read) timeouts.
475
+ :type _request_timeout: int, tuple(int, int), optional
476
+ :param _request_auth: set to override the auth_settings for an a single
477
+ request; this effectively ignores the
478
+ authentication in the spec for a single request.
479
+ :type _request_auth: dict, optional
480
+ :param _content_type: force content-type for the request.
481
+ :type _content_type: str, Optional
482
+ :param _headers: set to override the headers for a single
483
+ request; this effectively ignores the headers
484
+ in the spec for a single request.
485
+ :type _headers: dict, optional
486
+ :param _host_index: set to override the host_index for a single
487
+ request; this effectively ignores the host_index
488
+ in the spec for a single request.
489
+ :type _host_index: int, optional
490
+ :return: Returns the result object.
491
+ """ # noqa: E501
492
+
493
+ _param = self._get_app_token_serialize(
494
+ app_token_id=app_token_id,
495
+ _request_auth=_request_auth,
496
+ _content_type=_content_type,
497
+ _headers=_headers,
498
+ _host_index=_host_index,
499
+ )
500
+
501
+ _response_types_map: Dict[str, Optional[str]] = {
502
+ "200": "AppToken",
503
+ "401": "Error",
504
+ "404": "Error",
505
+ "500": "Error",
506
+ "503": "Error",
507
+ }
508
+ response_data = await self.api_client.call_api(
509
+ *_param, _request_timeout=_request_timeout
510
+ )
511
+ return response_data.response
512
+
513
+ def _get_app_token_serialize(
514
+ self,
515
+ app_token_id,
516
+ _request_auth,
517
+ _content_type,
518
+ _headers,
519
+ _host_index,
520
+ ) -> RequestSerialized:
521
+
522
+ _host = None
523
+
524
+ _collection_formats: Dict[str, str] = {}
525
+
526
+ _path_params: Dict[str, str] = {}
527
+ _query_params: List[Tuple[str, str]] = []
528
+ _header_params: Dict[str, Optional[str]] = _headers or {}
529
+ _form_params: List[Tuple[str, str]] = []
530
+ _files: Dict[
531
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
532
+ ] = {}
533
+ _body_params: Optional[bytes] = None
534
+
535
+ # process the path parameters
536
+ if app_token_id is not None:
537
+ _path_params["app_token_id"] = app_token_id
538
+ # process the query parameters
539
+ # process the header parameters
540
+ # process the form parameters
541
+ # process the body parameter
542
+
543
+ # set the HTTP header `Accept`
544
+ if "Accept" not in _header_params:
545
+ _header_params["Accept"] = self.api_client.select_header_accept(
546
+ ["application/json"]
547
+ )
548
+
549
+ # authentication setting
550
+ _auth_settings: List[str] = ["app_token_header"]
551
+
552
+ return self.api_client.param_serialize(
553
+ method="GET",
554
+ resource_path="/app-token/{app_token_id}",
555
+ path_params=_path_params,
556
+ query_params=_query_params,
557
+ header_params=_header_params,
558
+ body=_body_params,
559
+ post_params=_form_params,
560
+ files=_files,
561
+ auth_settings=_auth_settings,
562
+ collection_formats=_collection_formats,
563
+ _host=_host,
564
+ _request_auth=_request_auth,
565
+ )
566
+
567
+ @validate_call
568
+ async def verify_app_token(
569
+ self,
570
+ app_token_verify_request: AppTokenVerifyRequest,
571
+ _request_timeout: Union[
572
+ None,
573
+ Annotated[StrictFloat, Field(gt=0)],
574
+ Tuple[
575
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
576
+ ],
577
+ ] = None,
578
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
579
+ _content_type: Optional[StrictStr] = None,
580
+ _headers: Optional[Dict[StrictStr, Any]] = None,
581
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
582
+ ) -> AppTokenCreateResponse:
583
+ """Verify app token
584
+
585
+ Verifies a pending app token by confirming the 6-digit code that was emailed to the owner at creation time. This endpoint is unauthenticated — no session or credentials are required. On success the token transitions from `pending` to `active` and the response includes the token value, which is only shown once. Store it securely; it cannot be retrieved again. Pass the token via the `X-App-Token` header on subsequent requests.
586
+
587
+ :param app_token_verify_request: (required)
588
+ :type app_token_verify_request: AppTokenVerifyRequest
589
+ :param _request_timeout: timeout setting for this request. If one
590
+ number provided, it will be total request
591
+ timeout. It can also be a pair (tuple) of
592
+ (connection, read) timeouts.
593
+ :type _request_timeout: int, tuple(int, int), optional
594
+ :param _request_auth: set to override the auth_settings for an a single
595
+ request; this effectively ignores the
596
+ authentication in the spec for a single request.
597
+ :type _request_auth: dict, optional
598
+ :param _content_type: force content-type for the request.
599
+ :type _content_type: str, Optional
600
+ :param _headers: set to override the headers for a single
601
+ request; this effectively ignores the headers
602
+ in the spec for a single request.
603
+ :type _headers: dict, optional
604
+ :param _host_index: set to override the host_index for a single
605
+ request; this effectively ignores the host_index
606
+ in the spec for a single request.
607
+ :type _host_index: int, optional
608
+ :return: Returns the result object.
609
+ """ # noqa: E501
610
+
611
+ _param = self._verify_app_token_serialize(
612
+ app_token_verify_request=app_token_verify_request,
613
+ _request_auth=_request_auth,
614
+ _content_type=_content_type,
615
+ _headers=_headers,
616
+ _host_index=_host_index,
617
+ )
618
+
619
+ _response_types_map: Dict[str, Optional[str]] = {
620
+ "200": "AppTokenCreateResponse",
621
+ "400": "Error",
622
+ "404": "Error",
623
+ "410": "Error",
624
+ "429": "Error",
625
+ "500": "Error",
626
+ "503": "Error",
627
+ }
628
+ response_data = await self.api_client.call_api(
629
+ *_param, _request_timeout=_request_timeout
630
+ )
631
+ await response_data.read()
632
+ return self.api_client.response_deserialize(
633
+ response_data=response_data,
634
+ response_types_map=_response_types_map,
635
+ ).data
636
+
637
+ @validate_call
638
+ async def verify_app_token_with_http_info(
639
+ self,
640
+ app_token_verify_request: AppTokenVerifyRequest,
641
+ _request_timeout: Union[
642
+ None,
643
+ Annotated[StrictFloat, Field(gt=0)],
644
+ Tuple[
645
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
646
+ ],
647
+ ] = None,
648
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
649
+ _content_type: Optional[StrictStr] = None,
650
+ _headers: Optional[Dict[StrictStr, Any]] = None,
651
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
652
+ ) -> ApiResponse[AppTokenCreateResponse]:
653
+ """Verify app token
654
+
655
+ Verifies a pending app token by confirming the 6-digit code that was emailed to the owner at creation time. This endpoint is unauthenticated — no session or credentials are required. On success the token transitions from `pending` to `active` and the response includes the token value, which is only shown once. Store it securely; it cannot be retrieved again. Pass the token via the `X-App-Token` header on subsequent requests.
656
+
657
+ :param app_token_verify_request: (required)
658
+ :type app_token_verify_request: AppTokenVerifyRequest
659
+ :param _request_timeout: timeout setting for this request. If one
660
+ number provided, it will be total request
661
+ timeout. It can also be a pair (tuple) of
662
+ (connection, read) timeouts.
663
+ :type _request_timeout: int, tuple(int, int), optional
664
+ :param _request_auth: set to override the auth_settings for an a single
665
+ request; this effectively ignores the
666
+ authentication in the spec for a single request.
667
+ :type _request_auth: dict, optional
668
+ :param _content_type: force content-type for the request.
669
+ :type _content_type: str, Optional
670
+ :param _headers: set to override the headers for a single
671
+ request; this effectively ignores the headers
672
+ in the spec for a single request.
673
+ :type _headers: dict, optional
674
+ :param _host_index: set to override the host_index for a single
675
+ request; this effectively ignores the host_index
676
+ in the spec for a single request.
677
+ :type _host_index: int, optional
678
+ :return: Returns the result object.
679
+ """ # noqa: E501
680
+
681
+ _param = self._verify_app_token_serialize(
682
+ app_token_verify_request=app_token_verify_request,
683
+ _request_auth=_request_auth,
684
+ _content_type=_content_type,
685
+ _headers=_headers,
686
+ _host_index=_host_index,
687
+ )
688
+
689
+ _response_types_map: Dict[str, Optional[str]] = {
690
+ "200": "AppTokenCreateResponse",
691
+ "400": "Error",
692
+ "404": "Error",
693
+ "410": "Error",
694
+ "429": "Error",
695
+ "500": "Error",
696
+ "503": "Error",
697
+ }
698
+ response_data = await self.api_client.call_api(
699
+ *_param, _request_timeout=_request_timeout
700
+ )
701
+ await response_data.read()
702
+ return self.api_client.response_deserialize(
703
+ response_data=response_data,
704
+ response_types_map=_response_types_map,
705
+ )
706
+
707
+ @validate_call
708
+ async def verify_app_token_without_preload_content(
709
+ self,
710
+ app_token_verify_request: AppTokenVerifyRequest,
711
+ _request_timeout: Union[
712
+ None,
713
+ Annotated[StrictFloat, Field(gt=0)],
714
+ Tuple[
715
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
716
+ ],
717
+ ] = None,
718
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
719
+ _content_type: Optional[StrictStr] = None,
720
+ _headers: Optional[Dict[StrictStr, Any]] = None,
721
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
722
+ ) -> RESTResponseType:
723
+ """Verify app token
724
+
725
+ Verifies a pending app token by confirming the 6-digit code that was emailed to the owner at creation time. This endpoint is unauthenticated — no session or credentials are required. On success the token transitions from `pending` to `active` and the response includes the token value, which is only shown once. Store it securely; it cannot be retrieved again. Pass the token via the `X-App-Token` header on subsequent requests.
726
+
727
+ :param app_token_verify_request: (required)
728
+ :type app_token_verify_request: AppTokenVerifyRequest
729
+ :param _request_timeout: timeout setting for this request. If one
730
+ number provided, it will be total request
731
+ timeout. It can also be a pair (tuple) of
732
+ (connection, read) timeouts.
733
+ :type _request_timeout: int, tuple(int, int), optional
734
+ :param _request_auth: set to override the auth_settings for an a single
735
+ request; this effectively ignores the
736
+ authentication in the spec for a single request.
737
+ :type _request_auth: dict, optional
738
+ :param _content_type: force content-type for the request.
739
+ :type _content_type: str, Optional
740
+ :param _headers: set to override the headers for a single
741
+ request; this effectively ignores the headers
742
+ in the spec for a single request.
743
+ :type _headers: dict, optional
744
+ :param _host_index: set to override the host_index for a single
745
+ request; this effectively ignores the host_index
746
+ in the spec for a single request.
747
+ :type _host_index: int, optional
748
+ :return: Returns the result object.
749
+ """ # noqa: E501
750
+
751
+ _param = self._verify_app_token_serialize(
752
+ app_token_verify_request=app_token_verify_request,
753
+ _request_auth=_request_auth,
754
+ _content_type=_content_type,
755
+ _headers=_headers,
756
+ _host_index=_host_index,
757
+ )
758
+
759
+ _response_types_map: Dict[str, Optional[str]] = {
760
+ "200": "AppTokenCreateResponse",
761
+ "400": "Error",
762
+ "404": "Error",
763
+ "410": "Error",
764
+ "429": "Error",
765
+ "500": "Error",
766
+ "503": "Error",
767
+ }
768
+ response_data = await self.api_client.call_api(
769
+ *_param, _request_timeout=_request_timeout
770
+ )
771
+ return response_data.response
772
+
773
+ def _verify_app_token_serialize(
774
+ self,
775
+ app_token_verify_request,
776
+ _request_auth,
777
+ _content_type,
778
+ _headers,
779
+ _host_index,
780
+ ) -> RequestSerialized:
781
+
782
+ _host = None
783
+
784
+ _collection_formats: Dict[str, str] = {}
785
+
786
+ _path_params: Dict[str, str] = {}
787
+ _query_params: List[Tuple[str, str]] = []
788
+ _header_params: Dict[str, Optional[str]] = _headers or {}
789
+ _form_params: List[Tuple[str, str]] = []
790
+ _files: Dict[
791
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
792
+ ] = {}
793
+ _body_params: Optional[bytes] = None
794
+
795
+ # process the path parameters
796
+ # process the query parameters
797
+ # process the header parameters
798
+ # process the form parameters
799
+ # process the body parameter
800
+ if app_token_verify_request is not None:
801
+ _body_params = app_token_verify_request
802
+
803
+ # set the HTTP header `Accept`
804
+ if "Accept" not in _header_params:
805
+ _header_params["Accept"] = self.api_client.select_header_accept(
806
+ ["application/json"]
807
+ )
808
+
809
+ # set the HTTP header `Content-Type`
810
+ if _content_type:
811
+ _header_params["Content-Type"] = _content_type
812
+ else:
813
+ _default_content_type = self.api_client.select_header_content_type(
814
+ ["application/json"]
815
+ )
816
+ if _default_content_type is not None:
817
+ _header_params["Content-Type"] = _default_content_type
818
+
819
+ # authentication setting
820
+ _auth_settings: List[str] = []
821
+
822
+ return self.api_client.param_serialize(
823
+ method="POST",
824
+ resource_path="/app-token/verify",
825
+ path_params=_path_params,
826
+ query_params=_query_params,
827
+ header_params=_header_params,
828
+ body=_body_params,
829
+ post_params=_form_params,
830
+ files=_files,
831
+ auth_settings=_auth_settings,
832
+ collection_formats=_collection_formats,
833
+ _host=_host,
834
+ _request_auth=_request_auth,
835
+ )