Published Dossier API – getEntities and getEntitiesTotalCount

getEntities is used to search published content. getEntitiesTotalCount is used to get the total number of published entities matching the query.

An optional query argument can be used to filter the content and control the sort order.

The result is a connection which represents a page of entities. An optional paging argument can be used to control the paging.

interface PublishedDossierClient {
getEntities(
query?: PublishedEntityQuery,
paging?: Paging,
): PromiseResult<
Connection<Edge<PublishedEntity, ErrorType>> | null,
"BadRequest" | "NotAuthorized" | "Generic"
>;

getEntitiesTotalCount(
query?: PublishedEntitySharedQuery,
): PromiseResult<number, "BadRequest" | "NotAuthorized" | "Generic">;
}

interface PublishedEntitySharedQuery {
authKeys?: string[];
entityTypes?: string[];
componentTypes?: string[];
linksTo?: EntityReference;
linksFrom?: EntityReference;
boundingBox?: BoundingBox;
text?: string;
}

type PublishedEntityQueryOrder = "createdAt" | "name";

interface PublishedEntityQuery extends PublishedEntitySharedQuery {
order?: PublishedEntityQueryOrder;
reverse?: boolean;
}

interface Paging {
first?: number;
after?: string;
last?: number;
before?: string;
}

interface Connection<T extends Edge<unknown, ErrorType>> {
pageInfo: PageInfo;
edges: T[];
}

interface Edge<TOk, TError extends ErrorType> {
node: Result<TOk, TError>;
cursor: string;
}

interface PageInfo {
hasPreviousPage: boolean;
hasNextPage: boolean;
startCursor: string;
endCursor: string;
}