coloquent-test2
Version:
Library for retrieving model objects from a JSON-API, with a fluent syntax inspired by Laravel Eloquent.
26 lines (25 loc) • 1.18 kB
TypeScript
import { Model } from "./Model";
import { SingularResponse } from "./response/SingularResponse";
import { QueryMethods } from "./QueryMethods";
import { Response } from "./response/Response";
import { SortDirection } from "./SortDirection";
export declare class Builder implements QueryMethods {
protected modelType: any;
private httpClient;
private query;
/**
* If true, then this function will in all cases return a SingularResponse. This is used by ToOneRelations, which
* when queried spawn a Builder with this property set to true.
*/
private forceSingular;
constructor(modelType: typeof Model, queriedRelationName?: string, baseModelJsonApiType?: string, forceSingular?: boolean);
get(page?: number): Promise<Response>;
first(): Promise<SingularResponse>;
find(id: string | number): Promise<SingularResponse>;
where(attribute: string, value: string): Builder;
with(value: any): Builder;
orderBy(attribute: string, direction?: SortDirection | string): Builder;
option(queryParameter: string, value: string): Builder;
private initPaginationSpec();
private getHttpClient();
}