UNPKG

@the-any-thing/mollie-api-client-inline-pem

Version:
22 lines (21 loc) 1.17 kB
import { AxiosInstance } from 'axios'; import List from '../data/list/List'; export default class Resource<R, T extends R> { protected readonly httpClient: AxiosInstance; protected readonly network: { post: <S extends T | true = T>(url: string, data: any) => Promise<S>; get: (url: string, query?: Record<string, any>) => Promise<T>; list: (url: string, resourceName: string, query?: Record<string, any>) => Promise<Omit<List<T>, 'nextPage' | 'previousPage'>>; patch: (url: string, data: any) => Promise<T>; delete: <S extends T | true>(url: string, context?: any) => Promise<S>; }; constructor(httpClient: AxiosInstance); /** * Injects `nextPage`, `nextPageCursor`, `previousPage`, and `previousPageCursor` into the passed list. */ protected injectPaginationHelpers<P>(input: Omit<List<T>, 'nextPage' | 'nextPageCursor' | 'previousPage' | 'previousPageCursor'>, list: (parameters: P) => Promise<List<T>>, selfParameters: P): List<T>; /** * Injects prototypes ‒ where necessary ‒ into the response received from the Mollie server. */ protected injectPrototypes(input: R): T; }