-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature/mx-1670 backend api connector (#263)
# PR Context - as a prep for MX-1382, MX-1669, MX-1406, MX-1416 and MX-1581 # Added - added `BackendApiConnector` methods to cover all current (and near future) endpoints: `fetch_extracted_items`, `fetch_merged_items`, `get_merged_item`, `preview_merged_item` and `get_rule_set` - complete the list of exported names in `models` and `types` modules # Deprecated - deprecated `BackendApiConnector.post_models` in favor of `post_extracted_items` # Fixed - added the `rki/mex` user-agent to all requests of the HTTPConnector
- Loading branch information
1 parent
915406c
commit 9b4c9f8
Showing
12 changed files
with
588 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,46 @@ | ||
from mex.common.models import BaseModel | ||
from mex.common.types import AnyExtractedIdentifier | ||
from typing import Annotated | ||
|
||
from pydantic import Field, TypeAdapter | ||
|
||
class BulkInsertResponse(BaseModel): | ||
"""Response body for the bulk ingestion endpoint.""" | ||
from mex.common.models import ( | ||
AnyExtractedModel, | ||
AnyMergedModel, | ||
AnyRuleSetResponse, | ||
BaseModel, | ||
) | ||
from mex.common.types import Identifier | ||
|
||
identifiers: list[AnyExtractedIdentifier] | ||
|
||
class ExtractedItemsRequest(BaseModel): | ||
"""Request model for a list of extracted items.""" | ||
|
||
items: list[AnyExtractedModel] | ||
|
||
|
||
class ExtractedItemsResponse(BaseModel): | ||
"""Response model for a list of extracted items including a total count.""" | ||
|
||
items: list[AnyExtractedModel] | ||
total: int | ||
|
||
|
||
class MergedItemsResponse(BaseModel): | ||
"""Response model for a list of merged items including a total count.""" | ||
|
||
items: list[AnyMergedModel] | ||
total: int | ||
|
||
|
||
class IdentifiersResponse(BaseModel): | ||
"""Response models for a list of identifiers.""" | ||
|
||
identifiers: list[Identifier] | ||
|
||
|
||
MergedModelTypeAdapter: TypeAdapter[AnyMergedModel] = TypeAdapter( | ||
Annotated[AnyMergedModel, Field(discriminator="entityType")] | ||
) | ||
RuleSetResponseTypeAdapter: TypeAdapter[AnyRuleSetResponse] = TypeAdapter( | ||
Annotated[AnyRuleSetResponse, Field(discriminator="entityType")] | ||
) | ||
BulkInsertResponse = IdentifiersResponse # deprecated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.