UNPKG

ts-odata-client

Version:
61 lines (60 loc) 3.39 kB
import type { ODataQueryProvider } from "./ODataQueryProvider"; import { Expression } from "./Expression"; import type { BooleanPredicateBuilder } from "./BooleanPredicateBuilder"; import type { ExcludeProperties } from "./ExcludeProperties"; import { FilterAccessoryFunctions } from "./FilterAccessoryFunctions"; import type { ProjectorType } from "./ProxyFilterTypes"; import type { EntityProxy, PropertyProxy } from "./ProxyTypes"; import type { FieldsFor } from "./FieldsForType"; import type { JsonPrimitiveValueTypes } from "./JsonPrimitiveTypes"; /** * Represents a query against an OData source. * This query is agnostic of the version of OData supported by the server (the provided @type {ODataQueryProvider} is responsible for translating the query into the correct syntax for the desired OData version supported by the endpoint). */ export declare class ODataQueryBase<T, U = ExcludeProperties<T, unknown[]>> { readonly provider: ODataQueryProvider; readonly expression?: Expression | undefined; constructor(provider: ODataQueryProvider, expression?: Expression | undefined); /** * Limits the fields that are returned; the most recent call to select() will be used. * @param fields */ select<U extends FieldsFor<T>>(...fields: U[]): ODataQueryBase<T, U>; select<U extends ProjectorType>(projector: (proxy: T) => U): ODataQueryBase<T, U>; /** * Returns the top n records; the most recent call to top() will be used. * @param n */ top(n: number): import("./ODataQuery").ODataQuery<T, U>; /** * Omits the first n records from appear in the returned records; the most recent call to skip() will be used. * @param n */ skip(n: number): import("./ODataQuery").ODataQuery<T, U>; /** * Determines the sort order (ascending) of the records; calls or orderBy() and orderByDescending() are cumulative. * @param fields */ orderBy(fields: (entity: EntityProxy<T>) => PropertyProxy<unknown> | Array<PropertyProxy<unknown>>): import("./ODataQuery").ODataQuery<T, U>; /** * Determines the sort order (descending) of the records; calls to orderBy() and orderByDescending() are cumulative. * @param fields */ orderByDescending(fields: (entity: EntityProxy<T>) => PropertyProxy<unknown> | Array<PropertyProxy<unknown>>): import("./ODataQuery").ODataQuery<T, U>; /** * Filters the records based on the provided expression; multiple calls to filter() are cumulative (as well as UNIONed (AND)) * @param predicate A function that takes in an entity proxy and returns a BooleanPredicateBuilder. */ filter(predicate: BooleanPredicateBuilder<T> | ((builder: EntityProxy<T, true>, functions: FilterAccessoryFunctions<T>) => BooleanPredicateBuilder<T>)): import("./ODataQuery").ODataQuery<T, U>; /** * Includes the indicated arrays are to be returned as part of the query results. * @param fields */ expand<K extends keyof ExcludeProperties<T, JsonPrimitiveValueTypes | ArrayLike<JsonPrimitiveValueTypes> | Date | ArrayLike<Date>>>(...fields: K[]): import("./ODataQuery").ODataQuery<T, U & Pick<T, K>>; /** * Includes all arrays as part of the query results. * @param fields */ expandAll(): import("./ODataQuery").ODataQuery<T, U>; build(): import("./ODataV4ExpressionVisitor").ODataV4QuerySegments; }