Webigail
    Preparing search index...

    Interface IZRestfulService<T>

    A service that conforms to all known restful standards.

    interface IZRestfulService<T> {
        count(request: IZDataRequest): Promise<number>;
        create(body: T): Promise<T>;
        delete(identification: string): Promise<void>;
        get(identification: string | number): Promise<T>;
        retrieve(request: IZDataRequest): Promise<T[]>;
        update(identification: string, fields: Partial<T>): Promise<T>;
        upsert(body: T): Promise<T>;
    }

    Type Parameters

    • T

      The type of resource being retrieved or mutated.

    Hierarchy (View Summary)

    Implemented by

    Index

    Methods

    • Retrieves the total count of data items before pagination.

      Parameters

      • request: IZDataRequest

        The data request being made. The page and size fields are ignored in this instance.

      Returns Promise<number>

      The total number of items across pages that the request data set will represent.

    • Retrieves a single item by it's identification.

      This uses a GET verb.

      Parameters

      • identification: string | number

        The identification of the resource to retrieve.

      Returns Promise<T>

      The json representation of the entity.

    • Retrieves a single page of data.

      Parameters

      • request: IZDataRequest

        The data request that contains the sorting, filtering, search, and pagination info to construct a data view.

      Returns Promise<T[]>

      A single page of data elements.

    • Partially updates an existing resource entity.

      This uses the PATCH verb.

      Parameters

      • identification: string

        The identification of the resource to update.

      • fields: Partial<T>

        The partial fields to update.

      Returns Promise<T>

      The resource that was updated.

    • Creates a new entity or updates an existing entity.

      This is determined by the body parameters on whether or not an entity already exists.

      This uses the PUT verb.

      Parameters

      • body: T

        The post body that represents the resource to create or update.

      Returns Promise<T>

      The resource that was created or updated.