Class JobService

Handles interacting with resources related to X Jobs.

Hierarchy (View Summary)

Constructors

Properties

Methods

Constructors

Properties

config: RettiwtConfig

The config object.

Methods

  • Get the details of an X Job.

    Parameters

    • id: string

      The ID of the target job.

    Returns Promise<undefined | Job>

    The details of the job.

  • Makes an HTTP request according to the given parameters.

    Type Parameters

    • T = unknown

      The type of the returned response data.

    Parameters

    Returns Promise<AxiosResponse<T, any, {}, any>>

    The raw Axios response.

    import { FetcherService, ResourceType } 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(ResourceType.USER_DETAILS_BY_USERNAME, { id: 'user1' })
    .then(res => {
    console.log(res);
    })
    .catch(err => {
    console.log(err);
    });
  • Search for X Jobs using a keyword.

    Parameters

    • keyword: string

      The keyword to be used for searching jobs.

    • Optionalcount: number

      The number of jobs to fetch.

    • Optionalcursor: string

      The cursor to the batch of jobs to fetch.

    Returns Promise<CursoredData<Job>>

    The list of jobs that match the given keyword.

  • Search for X Jobs using a filter.

    Parameters

    • filter: IJobSearchFilter

      The filter to be used for searching jobs.

    • Optionalcount: number

      The number of jobs to fetch.

    • Optionalcursor: string

      The cursor to the batch of jobs to fetch.

    Returns Promise<CursoredData<Job>>

    The list of jobs that match the given filter.