UNPKG

@sirhc77/signalwire-rest-sdk

Version:

An SDK for the SignalWire REST API

24 lines 1.09 kB
import { AxiosInstance, AxiosResponse } from "axios"; import { Headers } from "./SignalWireRESTClientTypes"; export interface PagedResponse<T> { data: T[]; hasNextPage: boolean; nextPage: () => Promise<PagedResponse<T>>; nextPageUrl?: string; hasPreviousPage: boolean; previousPage: () => Promise<PagedResponse<T>>; previousPageUrl?: string; } type MakePagedResponseOptions<T> = { data: T[]; nextPageUrl?: string; previousPageUrl?: string; fetchPage: (url: string) => Promise<AxiosResponse<any>>; extractData: (response: AxiosResponse<any>) => T[]; extractNextPageUrl: (response: AxiosResponse<any>) => string | undefined; extractPreviousPageUrl: (response: AxiosResponse<any>) => string | undefined; }; export declare function makePagedResponse<T>(options: MakePagedResponseOptions<T>): PagedResponse<T>; export declare function defaultMakePagedResponse<T>(json: any, axiosInstance: AxiosInstance, headers: Headers, deserializer: (item: any) => T, baseUrl: string): PagedResponse<T>; export {}; //# sourceMappingURL=PagedResponse.d.ts.map