Interface MandeInstance

Object returned by mande

interface MandeInstance {
    options: Required<Pick<OptionsRaw, "headers">> & Omit<
        OptionsRaw,
        "headers",
    >;
    delete<T = unknown, R extends ResponseAsTypes = "json">(
        options?: Options<R>,
    ): MandeResponse<T, R>;
    delete<T = unknown, R extends ResponseAsTypes = "json">(
        url: string | number,
        options?: Options<R>,
    ): MandeResponse<T, R>;
    get<T = unknown, R extends ResponseAsTypes = "json">(
        options?: Options<R>,
    ): MandeResponse<T, R>;
    get<T = unknown, R extends ResponseAsTypes = "json">(
        url: string | number,
        options?: Options<R>,
    ): MandeResponse<T, R>;
    patch<T = unknown, R extends ResponseAsTypes = "json">(
        data?: any,
        options?: Options<R>,
    ): MandeResponse<T, R>;
    patch<T = unknown, R extends ResponseAsTypes = "json">(
        url: string | number,
        data?: any,
        options?: Options<R>,
    ): MandeResponse<T, R>;
    post<T = unknown, R extends ResponseAsTypes = "json">(
        data?: any,
        options?: Options<R>,
    ): MandeResponse<T, R>;
    post<T = unknown, R extends ResponseAsTypes = "json">(
        url: string | number,
        data?: any,
        options?: Options<R>,
    ): MandeResponse<T, R>;
    put<T = unknown, R extends ResponseAsTypes = "json">(
        data?: any,
        options?: Options<R>,
    ): MandeResponse<T, R>;
    put<T = unknown, R extends ResponseAsTypes = "json">(
        url: string | number,
        data?: any,
        options?: Options<R>,
    ): MandeResponse<T, R>;
}

Properties

Methods

Properties

options: Required<Pick<OptionsRaw, "headers">> & Omit<OptionsRaw, "headers">

Writable options.

Methods

  • Sends a POST request to the base url. This is equivalent to calling post with an empty string.

    Type Parameters

    Parameters

    • Optionaldata: any

      optional body of the request

    • Optionaloptions: Options<R>

      optional Options

    Returns MandeResponse<T, R>

    const createdUser = await users.post({ name: 'Eduardo' })
    
  • Sends a POST request to the given url.

    Type Parameters

    Parameters

    • url: string | number

      relative url to send the request to

    • Optionaldata: any

      optional body of the request

    • Optionaloptions: Options<R>

      optional Options

    Returns MandeResponse<T, R>

    const createdUser = await users.post('', { name: 'Eduardo' })