oep
get_oep_client()
¶
Provides a generator function to yield an instance of the OepClient class.
This function accesses environment variables to retrieve the necessary
credentials and configurations required for creating an OepClient instance.
It uses os.getenv
to get the OEP_TOKEN
and OEP_TOPIC
values for
authentication and topic management, respectively. The OepClient instance is
yielded, allowing the caller to manage resources appropriately.
Returns:
Type | Description |
---|---|
OepClient
|
OepClient: A generator that yields an instance of the OepClient class configured with a token and a default schema retrieved from the environment variables. |
Source code in backend/app/oep/router.py
get_oep_data(token, table_name, oep_cli=Depends(get_oep_client))
async
¶
Get OEP Data from a specified table.
This endpoint retrieves data from a specified table using the provided table_name
.
The OEP client instance is used to interact with the database, and token-based
authentication is required for accessing the endpoint. The data response includes
the retrieved items, their total count, and a success status indicator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
token
|
Annotated[str, Depends(oauth2_scheme)]
|
A bearer token for authentication. |
required |
table_name
|
str
|
The name of the table to retrieve data from. |
required |
oep_cli
|
OepClient
|
An instance of the OEP client to interact with the backend database. Dependency injection. |
Depends(get_oep_client)
|
Returns:
Type | Description |
---|---|
DataResponse
|
A |
Raises:
Type | Description |
---|---|
HTTPException
|
If the token is invalid or not provided. |
Source code in backend/app/oep/router.py
get_oep_metadata(token, table_name, oep_cli=Depends(get_oep_client))
async
¶
Retrieve metadata for a specific table.
This endpoint fetches metadata for the provided table name using the OEP client. It requires authentication via the provided token. If the token is invalid or not provided, an authentication error will be raised.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
token
|
Annotated[str, Depends(oauth2_scheme)]
|
The authentication token obtained via the OAuth2 scheme. |
required |
table_name
|
str
|
The name of the table for which metadata is to be retrieved. |
required |
oep_cli
|
OepClient
|
Instance of the OepClient dependency for interacting with the OEP API. Dependency injection. |
Depends(get_oep_client)
|
Returns:
Type | Description |
---|---|
DataResponse
|
A DataResponse containing the retrieved metadata and its total count. |
Raises:
Type | Description |
---|---|
HTTPException
|
If the token is invalid or not provided. |