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,965 @@
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, StrictStr
19
+ from typing import Optional
20
+ from typing_extensions import Annotated
21
+ from entryscape.models.login_request import LoginRequest
22
+ from entryscape.models.login_response import LoginResponse
23
+ from entryscape.models.whoami_response import WhoamiResponse
24
+
25
+ from entryscape.api_client import ApiClient, RequestSerialized
26
+ from entryscape.api_response import ApiResponse
27
+ from entryscape.rest import RESTResponseType
28
+
29
+
30
+ class AuthApi:
31
+ """NOTE: This class is auto generated by OpenAPI Generator
32
+ Ref: https://openapi-generator.tech
33
+
34
+ Do not edit the class manually.
35
+ """
36
+
37
+ def __init__(self, api_client=None) -> None:
38
+ if api_client is None:
39
+ api_client = ApiClient.get_default()
40
+ self.api_client = api_client
41
+
42
+ @validate_call
43
+ async def login(
44
+ self,
45
+ login_request: LoginRequest,
46
+ x_entrystore_host: Annotated[
47
+ Optional[StrictStr],
48
+ Field(
49
+ description="Target EntryStore instance (alternative to the entrystore_host query parameter, which wins if both are sent). The value has to be an instance this deployment has been configured to allow; any other host is refused with 400. Omit it for the deployment's default instance. "
50
+ ),
51
+ ] = None,
52
+ entrystore_host: Annotated[
53
+ Optional[StrictStr],
54
+ Field(
55
+ description="Target EntryStore instance. Overrides the X-Entrystore-Host header if both are provided. The value has to be an instance this deployment has been configured to allow; any other host is refused with 400, so a target you cannot reach is a request to the deployment's operator, not a different value to try. Omit it for the deployment's default instance. "
56
+ ),
57
+ ] = None,
58
+ _request_timeout: Union[
59
+ None,
60
+ Annotated[StrictFloat, Field(gt=0)],
61
+ Tuple[
62
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
63
+ ],
64
+ ] = None,
65
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
66
+ _content_type: Optional[StrictStr] = None,
67
+ _headers: Optional[Dict[StrictStr, Any]] = None,
68
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
69
+ ) -> LoginResponse:
70
+ """Log in (start a user session)
71
+
72
+ Authenticates an EntryStore user and starts a session. The API server forwards the credentials to EntryStore's `auth/cookie` endpoint and never logs or stores them. On success the response body contains the `auth_token` — send it on subsequent requests via the `X-Auth-Token` header. The same token is also set as the `auth_token` cookie (`SameSite=Lax; Secure`) for browser clients. This endpoint is unauthenticated and CSRF-exempt, and is rate-limited per client to deter credential stuffing.
73
+
74
+ :param login_request: (required)
75
+ :type login_request: LoginRequest
76
+ :param x_entrystore_host: Target EntryStore instance (alternative to the entrystore_host query parameter, which wins if both are sent). The value has to be an instance this deployment has been configured to allow; any other host is refused with 400. Omit it for the deployment's default instance.
77
+ :type x_entrystore_host: str
78
+ :param entrystore_host: Target EntryStore instance. Overrides the X-Entrystore-Host header if both are provided. The value has to be an instance this deployment has been configured to allow; any other host is refused with 400, so a target you cannot reach is a request to the deployment's operator, not a different value to try. Omit it for the deployment's default instance.
79
+ :type entrystore_host: str
80
+ :param _request_timeout: timeout setting for this request. If one
81
+ number provided, it will be total request
82
+ timeout. It can also be a pair (tuple) of
83
+ (connection, read) timeouts.
84
+ :type _request_timeout: int, tuple(int, int), optional
85
+ :param _request_auth: set to override the auth_settings for an a single
86
+ request; this effectively ignores the
87
+ authentication in the spec for a single request.
88
+ :type _request_auth: dict, optional
89
+ :param _content_type: force content-type for the request.
90
+ :type _content_type: str, Optional
91
+ :param _headers: set to override the headers for a single
92
+ request; this effectively ignores the headers
93
+ in the spec for a single request.
94
+ :type _headers: dict, optional
95
+ :param _host_index: set to override the host_index for a single
96
+ request; this effectively ignores the host_index
97
+ in the spec for a single request.
98
+ :type _host_index: int, optional
99
+ :return: Returns the result object.
100
+ """ # noqa: E501
101
+
102
+ _param = self._login_serialize(
103
+ login_request=login_request,
104
+ x_entrystore_host=x_entrystore_host,
105
+ entrystore_host=entrystore_host,
106
+ _request_auth=_request_auth,
107
+ _content_type=_content_type,
108
+ _headers=_headers,
109
+ _host_index=_host_index,
110
+ )
111
+
112
+ _response_types_map: Dict[str, Optional[str]] = {
113
+ "200": "LoginResponse",
114
+ "400": "Error",
115
+ "401": "Error",
116
+ "429": "Error",
117
+ "500": "Error",
118
+ "503": "Error",
119
+ }
120
+ response_data = await self.api_client.call_api(
121
+ *_param, _request_timeout=_request_timeout
122
+ )
123
+ await response_data.read()
124
+ return self.api_client.response_deserialize(
125
+ response_data=response_data,
126
+ response_types_map=_response_types_map,
127
+ ).data
128
+
129
+ @validate_call
130
+ async def login_with_http_info(
131
+ self,
132
+ login_request: LoginRequest,
133
+ x_entrystore_host: Annotated[
134
+ Optional[StrictStr],
135
+ Field(
136
+ description="Target EntryStore instance (alternative to the entrystore_host query parameter, which wins if both are sent). The value has to be an instance this deployment has been configured to allow; any other host is refused with 400. Omit it for the deployment's default instance. "
137
+ ),
138
+ ] = None,
139
+ entrystore_host: Annotated[
140
+ Optional[StrictStr],
141
+ Field(
142
+ description="Target EntryStore instance. Overrides the X-Entrystore-Host header if both are provided. The value has to be an instance this deployment has been configured to allow; any other host is refused with 400, so a target you cannot reach is a request to the deployment's operator, not a different value to try. Omit it for the deployment's default instance. "
143
+ ),
144
+ ] = None,
145
+ _request_timeout: Union[
146
+ None,
147
+ Annotated[StrictFloat, Field(gt=0)],
148
+ Tuple[
149
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
150
+ ],
151
+ ] = None,
152
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
153
+ _content_type: Optional[StrictStr] = None,
154
+ _headers: Optional[Dict[StrictStr, Any]] = None,
155
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
156
+ ) -> ApiResponse[LoginResponse]:
157
+ """Log in (start a user session)
158
+
159
+ Authenticates an EntryStore user and starts a session. The API server forwards the credentials to EntryStore's `auth/cookie` endpoint and never logs or stores them. On success the response body contains the `auth_token` — send it on subsequent requests via the `X-Auth-Token` header. The same token is also set as the `auth_token` cookie (`SameSite=Lax; Secure`) for browser clients. This endpoint is unauthenticated and CSRF-exempt, and is rate-limited per client to deter credential stuffing.
160
+
161
+ :param login_request: (required)
162
+ :type login_request: LoginRequest
163
+ :param x_entrystore_host: Target EntryStore instance (alternative to the entrystore_host query parameter, which wins if both are sent). The value has to be an instance this deployment has been configured to allow; any other host is refused with 400. Omit it for the deployment's default instance.
164
+ :type x_entrystore_host: str
165
+ :param entrystore_host: Target EntryStore instance. Overrides the X-Entrystore-Host header if both are provided. The value has to be an instance this deployment has been configured to allow; any other host is refused with 400, so a target you cannot reach is a request to the deployment's operator, not a different value to try. Omit it for the deployment's default instance.
166
+ :type entrystore_host: str
167
+ :param _request_timeout: timeout setting for this request. If one
168
+ number provided, it will be total request
169
+ timeout. It can also be a pair (tuple) of
170
+ (connection, read) timeouts.
171
+ :type _request_timeout: int, tuple(int, int), optional
172
+ :param _request_auth: set to override the auth_settings for an a single
173
+ request; this effectively ignores the
174
+ authentication in the spec for a single request.
175
+ :type _request_auth: dict, optional
176
+ :param _content_type: force content-type for the request.
177
+ :type _content_type: str, Optional
178
+ :param _headers: set to override the headers for a single
179
+ request; this effectively ignores the headers
180
+ in the spec for a single request.
181
+ :type _headers: dict, optional
182
+ :param _host_index: set to override the host_index for a single
183
+ request; this effectively ignores the host_index
184
+ in the spec for a single request.
185
+ :type _host_index: int, optional
186
+ :return: Returns the result object.
187
+ """ # noqa: E501
188
+
189
+ _param = self._login_serialize(
190
+ login_request=login_request,
191
+ x_entrystore_host=x_entrystore_host,
192
+ entrystore_host=entrystore_host,
193
+ _request_auth=_request_auth,
194
+ _content_type=_content_type,
195
+ _headers=_headers,
196
+ _host_index=_host_index,
197
+ )
198
+
199
+ _response_types_map: Dict[str, Optional[str]] = {
200
+ "200": "LoginResponse",
201
+ "400": "Error",
202
+ "401": "Error",
203
+ "429": "Error",
204
+ "500": "Error",
205
+ "503": "Error",
206
+ }
207
+ response_data = await self.api_client.call_api(
208
+ *_param, _request_timeout=_request_timeout
209
+ )
210
+ await response_data.read()
211
+ return self.api_client.response_deserialize(
212
+ response_data=response_data,
213
+ response_types_map=_response_types_map,
214
+ )
215
+
216
+ @validate_call
217
+ async def login_without_preload_content(
218
+ self,
219
+ login_request: LoginRequest,
220
+ x_entrystore_host: Annotated[
221
+ Optional[StrictStr],
222
+ Field(
223
+ description="Target EntryStore instance (alternative to the entrystore_host query parameter, which wins if both are sent). The value has to be an instance this deployment has been configured to allow; any other host is refused with 400. Omit it for the deployment's default instance. "
224
+ ),
225
+ ] = None,
226
+ entrystore_host: Annotated[
227
+ Optional[StrictStr],
228
+ Field(
229
+ description="Target EntryStore instance. Overrides the X-Entrystore-Host header if both are provided. The value has to be an instance this deployment has been configured to allow; any other host is refused with 400, so a target you cannot reach is a request to the deployment's operator, not a different value to try. Omit it for the deployment's default instance. "
230
+ ),
231
+ ] = None,
232
+ _request_timeout: Union[
233
+ None,
234
+ Annotated[StrictFloat, Field(gt=0)],
235
+ Tuple[
236
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
237
+ ],
238
+ ] = None,
239
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
240
+ _content_type: Optional[StrictStr] = None,
241
+ _headers: Optional[Dict[StrictStr, Any]] = None,
242
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
243
+ ) -> RESTResponseType:
244
+ """Log in (start a user session)
245
+
246
+ Authenticates an EntryStore user and starts a session. The API server forwards the credentials to EntryStore's `auth/cookie` endpoint and never logs or stores them. On success the response body contains the `auth_token` — send it on subsequent requests via the `X-Auth-Token` header. The same token is also set as the `auth_token` cookie (`SameSite=Lax; Secure`) for browser clients. This endpoint is unauthenticated and CSRF-exempt, and is rate-limited per client to deter credential stuffing.
247
+
248
+ :param login_request: (required)
249
+ :type login_request: LoginRequest
250
+ :param x_entrystore_host: Target EntryStore instance (alternative to the entrystore_host query parameter, which wins if both are sent). The value has to be an instance this deployment has been configured to allow; any other host is refused with 400. Omit it for the deployment's default instance.
251
+ :type x_entrystore_host: str
252
+ :param entrystore_host: Target EntryStore instance. Overrides the X-Entrystore-Host header if both are provided. The value has to be an instance this deployment has been configured to allow; any other host is refused with 400, so a target you cannot reach is a request to the deployment's operator, not a different value to try. Omit it for the deployment's default instance.
253
+ :type entrystore_host: str
254
+ :param _request_timeout: timeout setting for this request. If one
255
+ number provided, it will be total request
256
+ timeout. It can also be a pair (tuple) of
257
+ (connection, read) timeouts.
258
+ :type _request_timeout: int, tuple(int, int), optional
259
+ :param _request_auth: set to override the auth_settings for an a single
260
+ request; this effectively ignores the
261
+ authentication in the spec for a single request.
262
+ :type _request_auth: dict, optional
263
+ :param _content_type: force content-type for the request.
264
+ :type _content_type: str, Optional
265
+ :param _headers: set to override the headers for a single
266
+ request; this effectively ignores the headers
267
+ in the spec for a single request.
268
+ :type _headers: dict, optional
269
+ :param _host_index: set to override the host_index for a single
270
+ request; this effectively ignores the host_index
271
+ in the spec for a single request.
272
+ :type _host_index: int, optional
273
+ :return: Returns the result object.
274
+ """ # noqa: E501
275
+
276
+ _param = self._login_serialize(
277
+ login_request=login_request,
278
+ x_entrystore_host=x_entrystore_host,
279
+ entrystore_host=entrystore_host,
280
+ _request_auth=_request_auth,
281
+ _content_type=_content_type,
282
+ _headers=_headers,
283
+ _host_index=_host_index,
284
+ )
285
+
286
+ _response_types_map: Dict[str, Optional[str]] = {
287
+ "200": "LoginResponse",
288
+ "400": "Error",
289
+ "401": "Error",
290
+ "429": "Error",
291
+ "500": "Error",
292
+ "503": "Error",
293
+ }
294
+ response_data = await self.api_client.call_api(
295
+ *_param, _request_timeout=_request_timeout
296
+ )
297
+ return response_data.response
298
+
299
+ def _login_serialize(
300
+ self,
301
+ login_request,
302
+ x_entrystore_host,
303
+ entrystore_host,
304
+ _request_auth,
305
+ _content_type,
306
+ _headers,
307
+ _host_index,
308
+ ) -> RequestSerialized:
309
+
310
+ _host = None
311
+
312
+ _collection_formats: Dict[str, str] = {}
313
+
314
+ _path_params: Dict[str, str] = {}
315
+ _query_params: List[Tuple[str, str]] = []
316
+ _header_params: Dict[str, Optional[str]] = _headers or {}
317
+ _form_params: List[Tuple[str, str]] = []
318
+ _files: Dict[
319
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
320
+ ] = {}
321
+ _body_params: Optional[bytes] = None
322
+
323
+ # process the path parameters
324
+ # process the query parameters
325
+ if entrystore_host is not None:
326
+
327
+ _query_params.append(("entrystore_host", entrystore_host))
328
+
329
+ # process the header parameters
330
+ if x_entrystore_host is not None:
331
+ _header_params["X-Entrystore-Host"] = x_entrystore_host
332
+ # process the form parameters
333
+ # process the body parameter
334
+ if login_request is not None:
335
+ _body_params = login_request
336
+
337
+ # set the HTTP header `Accept`
338
+ if "Accept" not in _header_params:
339
+ _header_params["Accept"] = self.api_client.select_header_accept(
340
+ ["application/json"]
341
+ )
342
+
343
+ # set the HTTP header `Content-Type`
344
+ if _content_type:
345
+ _header_params["Content-Type"] = _content_type
346
+ else:
347
+ _default_content_type = self.api_client.select_header_content_type(
348
+ ["application/json"]
349
+ )
350
+ if _default_content_type is not None:
351
+ _header_params["Content-Type"] = _default_content_type
352
+
353
+ # authentication setting
354
+ _auth_settings: List[str] = []
355
+
356
+ return self.api_client.param_serialize(
357
+ method="POST",
358
+ resource_path="/auth/login",
359
+ path_params=_path_params,
360
+ query_params=_query_params,
361
+ header_params=_header_params,
362
+ body=_body_params,
363
+ post_params=_form_params,
364
+ files=_files,
365
+ auth_settings=_auth_settings,
366
+ collection_formats=_collection_formats,
367
+ _host=_host,
368
+ _request_auth=_request_auth,
369
+ )
370
+
371
+ @validate_call
372
+ async def logout(
373
+ self,
374
+ x_entrystore_host: Annotated[
375
+ Optional[StrictStr],
376
+ Field(
377
+ description="Target EntryStore instance (alternative to the entrystore_host query parameter, which wins if both are sent). The value has to be an instance this deployment has been configured to allow; any other host is refused with 400. Omit it for the deployment's default instance. "
378
+ ),
379
+ ] = None,
380
+ entrystore_host: Annotated[
381
+ Optional[StrictStr],
382
+ Field(
383
+ description="Target EntryStore instance. Overrides the X-Entrystore-Host header if both are provided. The value has to be an instance this deployment has been configured to allow; any other host is refused with 400, so a target you cannot reach is a request to the deployment's operator, not a different value to try. Omit it for the deployment's default instance. "
384
+ ),
385
+ ] = None,
386
+ _request_timeout: Union[
387
+ None,
388
+ Annotated[StrictFloat, Field(gt=0)],
389
+ Tuple[
390
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
391
+ ],
392
+ ] = None,
393
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
394
+ _content_type: Optional[StrictStr] = None,
395
+ _headers: Optional[Dict[StrictStr, Any]] = None,
396
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
397
+ ) -> None:
398
+ """Log out (end the user session)
399
+
400
+ Ends the session by invalidating the token via EntryStore's `auth/logout` endpoint, and clears the `auth_token` cookie. Send the token in the `X-Auth-Token` header (or the `auth_token` cookie in browsers).
401
+
402
+ :param x_entrystore_host: Target EntryStore instance (alternative to the entrystore_host query parameter, which wins if both are sent). The value has to be an instance this deployment has been configured to allow; any other host is refused with 400. Omit it for the deployment's default instance.
403
+ :type x_entrystore_host: str
404
+ :param entrystore_host: Target EntryStore instance. Overrides the X-Entrystore-Host header if both are provided. The value has to be an instance this deployment has been configured to allow; any other host is refused with 400, so a target you cannot reach is a request to the deployment's operator, not a different value to try. Omit it for the deployment's default instance.
405
+ :type entrystore_host: str
406
+ :param _request_timeout: timeout setting for this request. If one
407
+ number provided, it will be total request
408
+ timeout. It can also be a pair (tuple) of
409
+ (connection, read) timeouts.
410
+ :type _request_timeout: int, tuple(int, int), optional
411
+ :param _request_auth: set to override the auth_settings for an a single
412
+ request; this effectively ignores the
413
+ authentication in the spec for a single request.
414
+ :type _request_auth: dict, optional
415
+ :param _content_type: force content-type for the request.
416
+ :type _content_type: str, Optional
417
+ :param _headers: set to override the headers for a single
418
+ request; this effectively ignores the headers
419
+ in the spec for a single request.
420
+ :type _headers: dict, optional
421
+ :param _host_index: set to override the host_index for a single
422
+ request; this effectively ignores the host_index
423
+ in the spec for a single request.
424
+ :type _host_index: int, optional
425
+ :return: Returns the result object.
426
+ """ # noqa: E501
427
+
428
+ _param = self._logout_serialize(
429
+ x_entrystore_host=x_entrystore_host,
430
+ entrystore_host=entrystore_host,
431
+ _request_auth=_request_auth,
432
+ _content_type=_content_type,
433
+ _headers=_headers,
434
+ _host_index=_host_index,
435
+ )
436
+
437
+ _response_types_map: Dict[str, Optional[str]] = {
438
+ "204": None,
439
+ "400": "Error",
440
+ "500": "Error",
441
+ "503": "Error",
442
+ }
443
+ response_data = await self.api_client.call_api(
444
+ *_param, _request_timeout=_request_timeout
445
+ )
446
+ await response_data.read()
447
+ return self.api_client.response_deserialize(
448
+ response_data=response_data,
449
+ response_types_map=_response_types_map,
450
+ ).data
451
+
452
+ @validate_call
453
+ async def logout_with_http_info(
454
+ self,
455
+ x_entrystore_host: Annotated[
456
+ Optional[StrictStr],
457
+ Field(
458
+ description="Target EntryStore instance (alternative to the entrystore_host query parameter, which wins if both are sent). The value has to be an instance this deployment has been configured to allow; any other host is refused with 400. Omit it for the deployment's default instance. "
459
+ ),
460
+ ] = None,
461
+ entrystore_host: Annotated[
462
+ Optional[StrictStr],
463
+ Field(
464
+ description="Target EntryStore instance. Overrides the X-Entrystore-Host header if both are provided. The value has to be an instance this deployment has been configured to allow; any other host is refused with 400, so a target you cannot reach is a request to the deployment's operator, not a different value to try. Omit it for the deployment's default instance. "
465
+ ),
466
+ ] = None,
467
+ _request_timeout: Union[
468
+ None,
469
+ Annotated[StrictFloat, Field(gt=0)],
470
+ Tuple[
471
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
472
+ ],
473
+ ] = None,
474
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
475
+ _content_type: Optional[StrictStr] = None,
476
+ _headers: Optional[Dict[StrictStr, Any]] = None,
477
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
478
+ ) -> ApiResponse[None]:
479
+ """Log out (end the user session)
480
+
481
+ Ends the session by invalidating the token via EntryStore's `auth/logout` endpoint, and clears the `auth_token` cookie. Send the token in the `X-Auth-Token` header (or the `auth_token` cookie in browsers).
482
+
483
+ :param x_entrystore_host: Target EntryStore instance (alternative to the entrystore_host query parameter, which wins if both are sent). The value has to be an instance this deployment has been configured to allow; any other host is refused with 400. Omit it for the deployment's default instance.
484
+ :type x_entrystore_host: str
485
+ :param entrystore_host: Target EntryStore instance. Overrides the X-Entrystore-Host header if both are provided. The value has to be an instance this deployment has been configured to allow; any other host is refused with 400, so a target you cannot reach is a request to the deployment's operator, not a different value to try. Omit it for the deployment's default instance.
486
+ :type entrystore_host: str
487
+ :param _request_timeout: timeout setting for this request. If one
488
+ number provided, it will be total request
489
+ timeout. It can also be a pair (tuple) of
490
+ (connection, read) timeouts.
491
+ :type _request_timeout: int, tuple(int, int), optional
492
+ :param _request_auth: set to override the auth_settings for an a single
493
+ request; this effectively ignores the
494
+ authentication in the spec for a single request.
495
+ :type _request_auth: dict, optional
496
+ :param _content_type: force content-type for the request.
497
+ :type _content_type: str, Optional
498
+ :param _headers: set to override the headers for a single
499
+ request; this effectively ignores the headers
500
+ in the spec for a single request.
501
+ :type _headers: dict, optional
502
+ :param _host_index: set to override the host_index for a single
503
+ request; this effectively ignores the host_index
504
+ in the spec for a single request.
505
+ :type _host_index: int, optional
506
+ :return: Returns the result object.
507
+ """ # noqa: E501
508
+
509
+ _param = self._logout_serialize(
510
+ x_entrystore_host=x_entrystore_host,
511
+ entrystore_host=entrystore_host,
512
+ _request_auth=_request_auth,
513
+ _content_type=_content_type,
514
+ _headers=_headers,
515
+ _host_index=_host_index,
516
+ )
517
+
518
+ _response_types_map: Dict[str, Optional[str]] = {
519
+ "204": None,
520
+ "400": "Error",
521
+ "500": "Error",
522
+ "503": "Error",
523
+ }
524
+ response_data = await self.api_client.call_api(
525
+ *_param, _request_timeout=_request_timeout
526
+ )
527
+ await response_data.read()
528
+ return self.api_client.response_deserialize(
529
+ response_data=response_data,
530
+ response_types_map=_response_types_map,
531
+ )
532
+
533
+ @validate_call
534
+ async def logout_without_preload_content(
535
+ self,
536
+ x_entrystore_host: Annotated[
537
+ Optional[StrictStr],
538
+ Field(
539
+ description="Target EntryStore instance (alternative to the entrystore_host query parameter, which wins if both are sent). The value has to be an instance this deployment has been configured to allow; any other host is refused with 400. Omit it for the deployment's default instance. "
540
+ ),
541
+ ] = None,
542
+ entrystore_host: Annotated[
543
+ Optional[StrictStr],
544
+ Field(
545
+ description="Target EntryStore instance. Overrides the X-Entrystore-Host header if both are provided. The value has to be an instance this deployment has been configured to allow; any other host is refused with 400, so a target you cannot reach is a request to the deployment's operator, not a different value to try. Omit it for the deployment's default instance. "
546
+ ),
547
+ ] = None,
548
+ _request_timeout: Union[
549
+ None,
550
+ Annotated[StrictFloat, Field(gt=0)],
551
+ Tuple[
552
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
553
+ ],
554
+ ] = None,
555
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
556
+ _content_type: Optional[StrictStr] = None,
557
+ _headers: Optional[Dict[StrictStr, Any]] = None,
558
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
559
+ ) -> RESTResponseType:
560
+ """Log out (end the user session)
561
+
562
+ Ends the session by invalidating the token via EntryStore's `auth/logout` endpoint, and clears the `auth_token` cookie. Send the token in the `X-Auth-Token` header (or the `auth_token` cookie in browsers).
563
+
564
+ :param x_entrystore_host: Target EntryStore instance (alternative to the entrystore_host query parameter, which wins if both are sent). The value has to be an instance this deployment has been configured to allow; any other host is refused with 400. Omit it for the deployment's default instance.
565
+ :type x_entrystore_host: str
566
+ :param entrystore_host: Target EntryStore instance. Overrides the X-Entrystore-Host header if both are provided. The value has to be an instance this deployment has been configured to allow; any other host is refused with 400, so a target you cannot reach is a request to the deployment's operator, not a different value to try. Omit it for the deployment's default instance.
567
+ :type entrystore_host: str
568
+ :param _request_timeout: timeout setting for this request. If one
569
+ number provided, it will be total request
570
+ timeout. It can also be a pair (tuple) of
571
+ (connection, read) timeouts.
572
+ :type _request_timeout: int, tuple(int, int), optional
573
+ :param _request_auth: set to override the auth_settings for an a single
574
+ request; this effectively ignores the
575
+ authentication in the spec for a single request.
576
+ :type _request_auth: dict, optional
577
+ :param _content_type: force content-type for the request.
578
+ :type _content_type: str, Optional
579
+ :param _headers: set to override the headers for a single
580
+ request; this effectively ignores the headers
581
+ in the spec for a single request.
582
+ :type _headers: dict, optional
583
+ :param _host_index: set to override the host_index for a single
584
+ request; this effectively ignores the host_index
585
+ in the spec for a single request.
586
+ :type _host_index: int, optional
587
+ :return: Returns the result object.
588
+ """ # noqa: E501
589
+
590
+ _param = self._logout_serialize(
591
+ x_entrystore_host=x_entrystore_host,
592
+ entrystore_host=entrystore_host,
593
+ _request_auth=_request_auth,
594
+ _content_type=_content_type,
595
+ _headers=_headers,
596
+ _host_index=_host_index,
597
+ )
598
+
599
+ _response_types_map: Dict[str, Optional[str]] = {
600
+ "204": None,
601
+ "400": "Error",
602
+ "500": "Error",
603
+ "503": "Error",
604
+ }
605
+ response_data = await self.api_client.call_api(
606
+ *_param, _request_timeout=_request_timeout
607
+ )
608
+ return response_data.response
609
+
610
+ def _logout_serialize(
611
+ self,
612
+ x_entrystore_host,
613
+ entrystore_host,
614
+ _request_auth,
615
+ _content_type,
616
+ _headers,
617
+ _host_index,
618
+ ) -> RequestSerialized:
619
+
620
+ _host = None
621
+
622
+ _collection_formats: Dict[str, str] = {}
623
+
624
+ _path_params: Dict[str, str] = {}
625
+ _query_params: List[Tuple[str, str]] = []
626
+ _header_params: Dict[str, Optional[str]] = _headers or {}
627
+ _form_params: List[Tuple[str, str]] = []
628
+ _files: Dict[
629
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
630
+ ] = {}
631
+ _body_params: Optional[bytes] = None
632
+
633
+ # process the path parameters
634
+ # process the query parameters
635
+ if entrystore_host is not None:
636
+
637
+ _query_params.append(("entrystore_host", entrystore_host))
638
+
639
+ # process the header parameters
640
+ if x_entrystore_host is not None:
641
+ _header_params["X-Entrystore-Host"] = x_entrystore_host
642
+ # process the form parameters
643
+ # process the body parameter
644
+
645
+ # set the HTTP header `Accept`
646
+ if "Accept" not in _header_params:
647
+ _header_params["Accept"] = self.api_client.select_header_accept(
648
+ ["application/json"]
649
+ )
650
+
651
+ # authentication setting
652
+ _auth_settings: List[str] = ["auth_token", "auth_header"]
653
+
654
+ return self.api_client.param_serialize(
655
+ method="POST",
656
+ resource_path="/auth/logout",
657
+ path_params=_path_params,
658
+ query_params=_query_params,
659
+ header_params=_header_params,
660
+ body=_body_params,
661
+ post_params=_form_params,
662
+ files=_files,
663
+ auth_settings=_auth_settings,
664
+ collection_formats=_collection_formats,
665
+ _host=_host,
666
+ _request_auth=_request_auth,
667
+ )
668
+
669
+ @validate_call
670
+ async def whoami(
671
+ self,
672
+ x_entrystore_host: Annotated[
673
+ Optional[StrictStr],
674
+ Field(
675
+ description="Target EntryStore instance (alternative to the entrystore_host query parameter, which wins if both are sent). The value has to be an instance this deployment has been configured to allow; any other host is refused with 400. Omit it for the deployment's default instance. "
676
+ ),
677
+ ] = None,
678
+ entrystore_host: Annotated[
679
+ Optional[StrictStr],
680
+ Field(
681
+ description="Target EntryStore instance. Overrides the X-Entrystore-Host header if both are provided. The value has to be an instance this deployment has been configured to allow; any other host is refused with 400, so a target you cannot reach is a request to the deployment's operator, not a different value to try. Omit it for the deployment's default instance. "
682
+ ),
683
+ ] = None,
684
+ _request_timeout: Union[
685
+ None,
686
+ Annotated[StrictFloat, Field(gt=0)],
687
+ Tuple[
688
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
689
+ ],
690
+ ] = None,
691
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
692
+ _content_type: Optional[StrictStr] = None,
693
+ _headers: Optional[Dict[StrictStr, Any]] = None,
694
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
695
+ ) -> WhoamiResponse:
696
+ """Current user for the session
697
+
698
+ Returns the EntryStore user associated with the supplied session token, resolved via EntryStore's `auth/user` endpoint. Send the token in the `X-Auth-Token` header (or the `auth_token` cookie in browsers). A request with no or an invalid token returns `authenticated: false` with a guest/anonymous user rather than an error.
699
+
700
+ :param x_entrystore_host: Target EntryStore instance (alternative to the entrystore_host query parameter, which wins if both are sent). The value has to be an instance this deployment has been configured to allow; any other host is refused with 400. Omit it for the deployment's default instance.
701
+ :type x_entrystore_host: str
702
+ :param entrystore_host: Target EntryStore instance. Overrides the X-Entrystore-Host header if both are provided. The value has to be an instance this deployment has been configured to allow; any other host is refused with 400, so a target you cannot reach is a request to the deployment's operator, not a different value to try. Omit it for the deployment's default instance.
703
+ :type entrystore_host: str
704
+ :param _request_timeout: timeout setting for this request. If one
705
+ number provided, it will be total request
706
+ timeout. It can also be a pair (tuple) of
707
+ (connection, read) timeouts.
708
+ :type _request_timeout: int, tuple(int, int), optional
709
+ :param _request_auth: set to override the auth_settings for an a single
710
+ request; this effectively ignores the
711
+ authentication in the spec for a single request.
712
+ :type _request_auth: dict, optional
713
+ :param _content_type: force content-type for the request.
714
+ :type _content_type: str, Optional
715
+ :param _headers: set to override the headers for a single
716
+ request; this effectively ignores the headers
717
+ in the spec for a single request.
718
+ :type _headers: dict, optional
719
+ :param _host_index: set to override the host_index for a single
720
+ request; this effectively ignores the host_index
721
+ in the spec for a single request.
722
+ :type _host_index: int, optional
723
+ :return: Returns the result object.
724
+ """ # noqa: E501
725
+
726
+ _param = self._whoami_serialize(
727
+ x_entrystore_host=x_entrystore_host,
728
+ entrystore_host=entrystore_host,
729
+ _request_auth=_request_auth,
730
+ _content_type=_content_type,
731
+ _headers=_headers,
732
+ _host_index=_host_index,
733
+ )
734
+
735
+ _response_types_map: Dict[str, Optional[str]] = {
736
+ "200": "WhoamiResponse",
737
+ "400": "Error",
738
+ "500": "Error",
739
+ "503": "Error",
740
+ }
741
+ response_data = await self.api_client.call_api(
742
+ *_param, _request_timeout=_request_timeout
743
+ )
744
+ await response_data.read()
745
+ return self.api_client.response_deserialize(
746
+ response_data=response_data,
747
+ response_types_map=_response_types_map,
748
+ ).data
749
+
750
+ @validate_call
751
+ async def whoami_with_http_info(
752
+ self,
753
+ x_entrystore_host: Annotated[
754
+ Optional[StrictStr],
755
+ Field(
756
+ description="Target EntryStore instance (alternative to the entrystore_host query parameter, which wins if both are sent). The value has to be an instance this deployment has been configured to allow; any other host is refused with 400. Omit it for the deployment's default instance. "
757
+ ),
758
+ ] = None,
759
+ entrystore_host: Annotated[
760
+ Optional[StrictStr],
761
+ Field(
762
+ description="Target EntryStore instance. Overrides the X-Entrystore-Host header if both are provided. The value has to be an instance this deployment has been configured to allow; any other host is refused with 400, so a target you cannot reach is a request to the deployment's operator, not a different value to try. Omit it for the deployment's default instance. "
763
+ ),
764
+ ] = None,
765
+ _request_timeout: Union[
766
+ None,
767
+ Annotated[StrictFloat, Field(gt=0)],
768
+ Tuple[
769
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
770
+ ],
771
+ ] = None,
772
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
773
+ _content_type: Optional[StrictStr] = None,
774
+ _headers: Optional[Dict[StrictStr, Any]] = None,
775
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
776
+ ) -> ApiResponse[WhoamiResponse]:
777
+ """Current user for the session
778
+
779
+ Returns the EntryStore user associated with the supplied session token, resolved via EntryStore's `auth/user` endpoint. Send the token in the `X-Auth-Token` header (or the `auth_token` cookie in browsers). A request with no or an invalid token returns `authenticated: false` with a guest/anonymous user rather than an error.
780
+
781
+ :param x_entrystore_host: Target EntryStore instance (alternative to the entrystore_host query parameter, which wins if both are sent). The value has to be an instance this deployment has been configured to allow; any other host is refused with 400. Omit it for the deployment's default instance.
782
+ :type x_entrystore_host: str
783
+ :param entrystore_host: Target EntryStore instance. Overrides the X-Entrystore-Host header if both are provided. The value has to be an instance this deployment has been configured to allow; any other host is refused with 400, so a target you cannot reach is a request to the deployment's operator, not a different value to try. Omit it for the deployment's default instance.
784
+ :type entrystore_host: str
785
+ :param _request_timeout: timeout setting for this request. If one
786
+ number provided, it will be total request
787
+ timeout. It can also be a pair (tuple) of
788
+ (connection, read) timeouts.
789
+ :type _request_timeout: int, tuple(int, int), optional
790
+ :param _request_auth: set to override the auth_settings for an a single
791
+ request; this effectively ignores the
792
+ authentication in the spec for a single request.
793
+ :type _request_auth: dict, optional
794
+ :param _content_type: force content-type for the request.
795
+ :type _content_type: str, Optional
796
+ :param _headers: set to override the headers for a single
797
+ request; this effectively ignores the headers
798
+ in the spec for a single request.
799
+ :type _headers: dict, optional
800
+ :param _host_index: set to override the host_index for a single
801
+ request; this effectively ignores the host_index
802
+ in the spec for a single request.
803
+ :type _host_index: int, optional
804
+ :return: Returns the result object.
805
+ """ # noqa: E501
806
+
807
+ _param = self._whoami_serialize(
808
+ x_entrystore_host=x_entrystore_host,
809
+ entrystore_host=entrystore_host,
810
+ _request_auth=_request_auth,
811
+ _content_type=_content_type,
812
+ _headers=_headers,
813
+ _host_index=_host_index,
814
+ )
815
+
816
+ _response_types_map: Dict[str, Optional[str]] = {
817
+ "200": "WhoamiResponse",
818
+ "400": "Error",
819
+ "500": "Error",
820
+ "503": "Error",
821
+ }
822
+ response_data = await self.api_client.call_api(
823
+ *_param, _request_timeout=_request_timeout
824
+ )
825
+ await response_data.read()
826
+ return self.api_client.response_deserialize(
827
+ response_data=response_data,
828
+ response_types_map=_response_types_map,
829
+ )
830
+
831
+ @validate_call
832
+ async def whoami_without_preload_content(
833
+ self,
834
+ x_entrystore_host: Annotated[
835
+ Optional[StrictStr],
836
+ Field(
837
+ description="Target EntryStore instance (alternative to the entrystore_host query parameter, which wins if both are sent). The value has to be an instance this deployment has been configured to allow; any other host is refused with 400. Omit it for the deployment's default instance. "
838
+ ),
839
+ ] = None,
840
+ entrystore_host: Annotated[
841
+ Optional[StrictStr],
842
+ Field(
843
+ description="Target EntryStore instance. Overrides the X-Entrystore-Host header if both are provided. The value has to be an instance this deployment has been configured to allow; any other host is refused with 400, so a target you cannot reach is a request to the deployment's operator, not a different value to try. Omit it for the deployment's default instance. "
844
+ ),
845
+ ] = None,
846
+ _request_timeout: Union[
847
+ None,
848
+ Annotated[StrictFloat, Field(gt=0)],
849
+ Tuple[
850
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
851
+ ],
852
+ ] = None,
853
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
854
+ _content_type: Optional[StrictStr] = None,
855
+ _headers: Optional[Dict[StrictStr, Any]] = None,
856
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
857
+ ) -> RESTResponseType:
858
+ """Current user for the session
859
+
860
+ Returns the EntryStore user associated with the supplied session token, resolved via EntryStore's `auth/user` endpoint. Send the token in the `X-Auth-Token` header (or the `auth_token` cookie in browsers). A request with no or an invalid token returns `authenticated: false` with a guest/anonymous user rather than an error.
861
+
862
+ :param x_entrystore_host: Target EntryStore instance (alternative to the entrystore_host query parameter, which wins if both are sent). The value has to be an instance this deployment has been configured to allow; any other host is refused with 400. Omit it for the deployment's default instance.
863
+ :type x_entrystore_host: str
864
+ :param entrystore_host: Target EntryStore instance. Overrides the X-Entrystore-Host header if both are provided. The value has to be an instance this deployment has been configured to allow; any other host is refused with 400, so a target you cannot reach is a request to the deployment's operator, not a different value to try. Omit it for the deployment's default instance.
865
+ :type entrystore_host: str
866
+ :param _request_timeout: timeout setting for this request. If one
867
+ number provided, it will be total request
868
+ timeout. It can also be a pair (tuple) of
869
+ (connection, read) timeouts.
870
+ :type _request_timeout: int, tuple(int, int), optional
871
+ :param _request_auth: set to override the auth_settings for an a single
872
+ request; this effectively ignores the
873
+ authentication in the spec for a single request.
874
+ :type _request_auth: dict, optional
875
+ :param _content_type: force content-type for the request.
876
+ :type _content_type: str, Optional
877
+ :param _headers: set to override the headers for a single
878
+ request; this effectively ignores the headers
879
+ in the spec for a single request.
880
+ :type _headers: dict, optional
881
+ :param _host_index: set to override the host_index for a single
882
+ request; this effectively ignores the host_index
883
+ in the spec for a single request.
884
+ :type _host_index: int, optional
885
+ :return: Returns the result object.
886
+ """ # noqa: E501
887
+
888
+ _param = self._whoami_serialize(
889
+ x_entrystore_host=x_entrystore_host,
890
+ entrystore_host=entrystore_host,
891
+ _request_auth=_request_auth,
892
+ _content_type=_content_type,
893
+ _headers=_headers,
894
+ _host_index=_host_index,
895
+ )
896
+
897
+ _response_types_map: Dict[str, Optional[str]] = {
898
+ "200": "WhoamiResponse",
899
+ "400": "Error",
900
+ "500": "Error",
901
+ "503": "Error",
902
+ }
903
+ response_data = await self.api_client.call_api(
904
+ *_param, _request_timeout=_request_timeout
905
+ )
906
+ return response_data.response
907
+
908
+ def _whoami_serialize(
909
+ self,
910
+ x_entrystore_host,
911
+ entrystore_host,
912
+ _request_auth,
913
+ _content_type,
914
+ _headers,
915
+ _host_index,
916
+ ) -> RequestSerialized:
917
+
918
+ _host = None
919
+
920
+ _collection_formats: Dict[str, str] = {}
921
+
922
+ _path_params: Dict[str, str] = {}
923
+ _query_params: List[Tuple[str, str]] = []
924
+ _header_params: Dict[str, Optional[str]] = _headers or {}
925
+ _form_params: List[Tuple[str, str]] = []
926
+ _files: Dict[
927
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
928
+ ] = {}
929
+ _body_params: Optional[bytes] = None
930
+
931
+ # process the path parameters
932
+ # process the query parameters
933
+ if entrystore_host is not None:
934
+
935
+ _query_params.append(("entrystore_host", entrystore_host))
936
+
937
+ # process the header parameters
938
+ if x_entrystore_host is not None:
939
+ _header_params["X-Entrystore-Host"] = x_entrystore_host
940
+ # process the form parameters
941
+ # process the body parameter
942
+
943
+ # set the HTTP header `Accept`
944
+ if "Accept" not in _header_params:
945
+ _header_params["Accept"] = self.api_client.select_header_accept(
946
+ ["application/json"]
947
+ )
948
+
949
+ # authentication setting
950
+ _auth_settings: List[str] = ["auth_token", "auth_header"]
951
+
952
+ return self.api_client.param_serialize(
953
+ method="GET",
954
+ resource_path="/auth/whoami",
955
+ path_params=_path_params,
956
+ query_params=_query_params,
957
+ header_params=_header_params,
958
+ body=_body_params,
959
+ post_params=_form_params,
960
+ files=_files,
961
+ auth_settings=_auth_settings,
962
+ collection_formats=_collection_formats,
963
+ _host=_host,
964
+ _request_auth=_request_auth,
965
+ )