The Search class.

Since

3.0.0

Type Parameters

Hierarchy (view full)

Constructors

Properties

endpoint: string = 'posts'
_instance: WPJSSingleton

Methods

  • Protected

    Fetch a single object from the endpoint.

    Returns Promise<T | T[]>

    Since

    2.0.0

  • Fetch multiple search results.

    Returns Promise<T[]>

    Since

    3.0.0

    Example

    import { Search } from "@quickdevelopment/wp-js";

    const search = new Search();
    search.setSubtype('post').fetch().then((search) => {
    console.log(search);
    })
  • Protected

    Get data about the current class.

    Type Parameters

    • T

    Returns Promise<T>

    Since

    1.0.0

  • 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

  • Set the search subtype.

    Parameters

    • subtype: string

    Returns this

    Since

    3.0.0

    Example

    import { Search } from "@quickdevelopment/wp-js";

    const search = new Search();
    search.setSubtype('post');

Generated using TypeDoc