IQRF Gateway Webapp API client class

Client is a wrapper around API methods of IQRF Gateway Webapp providing shared configuration for Axios instance.

const client = new Client();
const config: AxiosRequestConfig = {
baseURL: 'https://iqrf-gw.exaple.org/api/',
};
const client = new Client({ config });
const config: AxiosRequestConfig = {
baseURL: 'https://iqrf-gw.exaple.org/api/',
}
const axiosInstance = axios.create(config);
const client = new Client({ axiosInstance

Constructors

Methods

  • Clear all request interceptors

    Returns void

  • Clear all response interceptors

    Returns void

  • Eject a request interceptor

    Parameters

    • interceptorId: number

      Interceptor ID

    Returns void

  • Eject a response interceptor

    Parameters

    • interceptorId: number

      Interceptor ID

    Returns void

  • Sets API key or JWT token

    Parameters

    • token: null | string

      API key or JWT token

    Returns void

    Implement API key and JWT validation

  • Add a request interceptor

    Parameters

    • OptionalonFulfilled:
          | null
          | (
              value: InternalAxiosRequestConfig,
          ) => InternalAxiosRequestConfig | Promise<InternalAxiosRequestConfig>

      Fulfilled callback

    • OptionalonRejected: null | (error: any) => any

      Rejected callback

    • Optionaloptions: AxiosInterceptorOptions

      Interceptor options

    Returns number

    Interceptor ID