Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AppClient

The ApiClient used for making API requests to Twitter on behalf of an application. If a bearer token exists in the config, it is automatically added as an authorization header.

Hierarchy

  • ApiClient
    • AppClient

Index

Constructors

constructor

Properties

Protected client

client: AxiosInstance

config

config: Config

Methods

get

  • get<T>(url: string, config?: AxiosRequestConfig): Promise<T>
  • A generic GET request.

    Type parameters

    • T

    Parameters

    • url: string
    • config: AxiosRequestConfig = ...

    Returns Promise<T>

getBearerToken

  • getBearerToken(): Promise<unknown>

getStream

  • getStream(url: string, config?: AxiosRequestConfig): Promise<StreamEventEmitter>
  • Creates an event emitter stream from a GET request. This application/x-www-form-urlencoded content-type.

    Parameters

    • url: string
    • config: AxiosRequestConfig = ...

    Returns Promise<StreamEventEmitter>

post

  • post<T>(url: string, body: any, config?: AxiosRequestConfig): Promise<T>
  • A generic POST request

    Type parameters

    • T

    Parameters

    • url: string
    • body: any
    • config: AxiosRequestConfig = ...

    Returns Promise<T>

postForm

  • postForm<T>(url: string, body: any, config?: AxiosRequestConfig): Promise<T>
  • A POST request which stringifys the body. This submits application/x-www-form-urlencoded content-type

    Type parameters

    • T

    Parameters

    • url: string
    • body: any
    • config: AxiosRequestConfig = ...

    Returns Promise<T>

postStream

  • postStream(url: string, body: any, config?: AxiosRequestConfig): Promise<StreamEventEmitter>
  • Creates an event emitter stream from a POST request. This application/x-www-form-urlencoded content-type.

    Parameters

    • url: string
    • body: any
    • config: AxiosRequestConfig = ...

    Returns Promise<StreamEventEmitter>

put

  • put<T>(url: string, body: any, config?: AxiosRequestConfig): Promise<T>
  • A generic PUT request

    Type parameters

    • T

    Parameters

    • url: string
    • body: any
    • config: AxiosRequestConfig = ...

    Returns Promise<T>

putForm

  • putForm<T>(url: string, body: any, config?: AxiosRequestConfig): Promise<T>
  • A PUT request which stringifys the body. This submits application/x-www-form-urlencoded content-type

    Type parameters

    • T

    Parameters

    • url: string
    • body: any
    • config: AxiosRequestConfig = ...

    Returns Promise<T>

setBearerToken

  • setBearerToken(bearerToken: string): void
  • Set a new bearer token

    Parameters

    • bearerToken: string

    Returns void

Generated using TypeDoc