Index

namespace Index {
  export type Result<T extends object, R extends string> = {
    [K in R]: T[];
  } & {
    meta: {
      page: number,
      limit: number,
      page_count: number,
      total_count: number,
    };
  };
}

Extends Filter

Table on Contents

index.include()

class Index<T extends object> extends Filter<T> {
  public include(relations: string | string[]): this;
}

Includes the given relations

index.sort()

class Index<T extends object> extends Filter<T> {
  public sort(sort: string[]): this;
}

Sorts the resources

+field means ascending -field means descending

index.skip()

class Index<T extends object> extends Filter<T> {
  public skip(skip: number): this;
}

Skips the given number (skip parameter) of resources

index.limit()

class Index<T extends object> extends Filter<T> {
  public limit(limit: number): this;
}

Skips the given number (skip parameter) of resources

index.get()

class Index<T extends object> extends Filter<T> {
  public get(): Promise<Index.Result<T, R>>;
  public get(callback: Client.Callback<Index.Result<T, R>>): void;
}

Results an object containing array of queried resources and a meta