Base class for all WPJS classes.

Since

1.0.0

Type Parameters

  • T

Hierarchy (view full)

Constructors

Properties

_apiUrl: string = ...
_searchParams: URLSearchParams = ...
endpoint: string = 'posts'
_instance: WPJSSingleton

Methods

  • Private

    Construct the url for the request.

    Returns string

    Since

    1.0.0

  • Protected

    Fetch a single object from the endpoint.

    Returns Promise<T | T[]>

    Since

    2.0.0

  • Protected

    Fetch multiple objects from the endpoint.

    Returns Promise<T[]>

    Since

    2.0.0

  • Protected

    Get data about the current class.

    Type Parameters

    • T

    Returns Promise<T>

    Since

    1.0.0

  • Private

    Get the API url.

    Returns string

  • Private

    Get the endpoint.

    Returns string

  • Protected

    Get the search parameters.

    Returns URLSearchParams

  • Set search parameters for the request.

    Parameters

    • params: Record<string, string | number>

      Object containing search parameters.

    Returns this

    Since

    2.0.0

Generated using TypeDoc