Class FetcherService

The base service that handles all HTTP requests.

Hierarchy (View Summary)

Constructors

Properties

Methods

Constructors

Properties

config: RettiwtConfig

The config object.

Methods

  • Makes an HTTP request according to the given parameters.

    Type Parameters

    • T = unknown

      The type of the returned response data.

    Parameters

    Returns Promise<T>

    The raw data response received.

    import { FetcherService, EResourceType } from 'rettiwt-api';

    // Creating a new FetcherService instance using the given 'API_KEY'
    const fetcher = new FetcherService({ apiKey: API_KEY });

    // Fetching the details of the User with username 'user1'
    fetcher.request(EResourceType.USER_DETAILS_BY_USERNAME, { id: 'user1' })
    .then(res => {
    console.log(res);
    })
    .catch(err => {
    console.log(err);
    });