@sumup/sdk
Version:
The official TypeScript SDK for the SumUp API
43 lines • 1.54 kB
TypeScript
import type { SumUp } from "./index.js";
export declare class APIResource {
protected _client: SumUp;
constructor(client: SumUp);
}
type QueryParams = Record<string, any>;
/**
* Params that get passed to `fetch`. This ends up as an optional second
* argument to each generated request method. Properties are a subset of
* `RequestInit`.
*/
export type FetchParams = Omit<RequestInit, "body" | "method">;
/** All arguments to `request()` */
export type FullParams = FetchParams & {
path: string;
query?: QueryParams;
body?: unknown;
host?: string;
method?: string;
};
export declare class SumUpError extends Error {
}
export declare class APIError<T> extends SumUpError {
readonly status: number;
readonly error: T | string;
readonly response: Response;
constructor(status: number, error: T | string, response: Response);
}
export declare class APIPromise<T> implements Promise<T> {
private resp;
constructor(resp: Promise<Response>);
parse(): Promise<T>;
withResponse(): Promise<{
data: T;
response: Response;
}>;
then<TResult1 = T, TResult2 = never>(onFulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>, onRejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>;
catch<TResult = never>(onRejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<T | TResult>;
finally(onFinally?: () => void): Promise<T>;
[Symbol.toStringTag]: string;
}
export {};
//# sourceMappingURL=core.d.ts.map