Skip to content

TypeScript API / contentia/assets / validateListFilters

Function: validateListFilters() ​

ts
function validateListFilters(filters, filtering): 
  | ContentiaError<ErrorCode, number>
  | undefined;

Validate requested ListResourcesOptions.filters against a declared filtering capability. Returns undefined when every requested filter name is declared (or none were requested); otherwise returns an InvalidData error naming the offending filters. Implementations call this at the top of listResources so undeclared filters fail loudly instead of silently returning unfiltered results.

Parameters ​

ParameterType
filtersReadonly<Record<string, string>> | undefined
filtering| { description: string; supported: false; } | { description: string; filters: readonly object[]; supported: true; } | undefined

Returns ​

| ContentiaError<ErrorCode, number> | undefined