Catalog client#
- class geonemo.client.CatalogClient(
- base_url=None,
- *,
- transport=None,
- project_id=None,
- token=None,
- timeout=10.0,
- client=None,
- headers=None,
Use catalog and vector capabilities without storage implementation access.
- browse(request)#
List a collection’s records in order (
POST /v1/catalog/records).- Parameters:
request – Collection, filters, sort, limit and cursor.
- Returns:
A
CatalogBrowseResponse.- Raises:
ServicesNotFoundError – If the collection does not exist.
ServicesClientError – On transport or HTTP failure, or an invalid response.
- collection_stats(collection)#
Get a collection’s record count, bounds and time range (
GET /v1/catalog/collections/{collection}/stats).- Parameters:
collection – Collection name.
- Returns:
The
CatalogCollectionStats.- Raises:
ValueError – If
collectionis invalid.ServicesNotFoundError – If the collection does not exist.
ServicesClientError – On transport or HTTP failure, or an invalid response.
- facets(request)#
Count the values of metadata fields (
POST /v1/catalog/facets).- Parameters:
request – Collection, fields, filters and limit.
- Returns:
A
CatalogFacetResponse.- Raises:
ServicesNotFoundError – If the collection does not exist.
ServicesClientError – On transport or HTTP failure, or an invalid response.
- get_record(collection, record_id)#
Read one record (
GET /v1/catalog/collections/{collection}/records/{record_id}).- Parameters:
collection – Collection name.
record_id – Record ID; any text up to 4096 bytes.
- Returns:
The
CatalogRecord, orNoneif it does not exist.- Raises:
ValueError – If
collectionorrecord_idis invalid.ServicesClientError – On transport or HTTP failure, or an invalid response.
- get_records(request)#
Read several records by ID (
POST /v1/catalog/records/batch).- Parameters:
request – Collection and up to 500 record IDs.
- Returns:
The found records and the IDs that were missing.
- Raises:
ServicesNotFoundError – If the collection does not exist.
ServicesClientError – On transport or HTTP failure, or an invalid response.
- ingest(request, *, idempotency_key=None)#
Ingest records into a collection (
POST /v1/catalog/ingest).- Parameters:
request – Collection and records.
idempotency_key – Replay key (1-256 visible ASCII characters); defaults to a hash of the request, so repeating an identical ingest is a safe replay.
- Returns:
The
CatalogIngestReceipt.- Raises:
ValueError – If the key is malformed.
ServicesConflictError – If the key was used for a different request.
ServicesClientError – On transport or HTTP failure, or an invalid response.
- list_collections()#
List every collection (
GET /v1/catalog/collections), following its pages.- Returns:
The
CollectionInfoentries.- Raises:
ServicesProtocolError – If a page’s continuation does not advance.
ServicesClientError – On transport or HTTP failure, or an invalid response.
- list_collections_page(*, after=None, limit=64)#
List one page of collections by name (
GET /v1/catalog/collections).- Parameters:
after – The previous page’s
next_after; omit for the first page.limit – Page size, 1 to 64.
- Returns:
A
CollectionList; itsnext_afteris set when more collections follow.- Raises:
ServicesClientError – On transport or HTTP failure, or an invalid response.
- metadata_fields(collection)#
List a collection’s metadata fields (
GET /v1/catalog/collections/{collection}/metadata- fields).- Parameters:
collection – Collection name.
- Returns:
The
MetadataFieldList.- Raises:
ValueError – If
collectionis invalid.ServicesNotFoundError – If the collection does not exist.
ServicesClientError – On transport or HTTP failure, or an invalid response.
- scan(request)#
Read one page of a full scan of a collection (
POST /v1/catalog/scan).- Parameters:
request – A
CatalogScanRequestwith the collection, cursor, limit and exact filters.- Returns:
A
CatalogScanResponse; pass itsnext_cursorto continue.- Raises:
ServicesNotFoundError – If the collection does not exist.
ServicesClientError – On transport or HTTP failure, or an invalid response.
- search(request)#
Search a collection (
POST /v1/catalog/search).- Parameters:
request – Search criteria and limit.
- Returns:
A
CatalogSearchResponse.- Raises:
ServicesNotFoundError – If the collection does not exist.
ServicesClientError – On transport or HTTP failure, or an invalid response.
- search_page(request)#
Search a collection and also get the total match count (
POST /v1/catalog/search- page).- Parameters:
request – Search criteria, limit and cursor.
- Returns:
A
CatalogSearchPageResponse.- Raises:
ServicesNotFoundError – If the collection does not exist.
ServicesClientError – On transport or HTTP failure, or an invalid response.