slavafomin/tinkoff-payment-sdk

View on GitHub
src/http-client/http-client.ts

Summary

Maintainability
A
0 mins
Test Coverage

export interface HttpRequest<PayloadType = any> {
  url: string;
  method?: HttpRequestMethod;
  payload?: PayloadType;
  headers?: Record<string, string | string[]>;
}

export interface HttpResponse<PayloadType = any> {
  status: number;
  payload: PayloadType;
}

export enum HttpRequestMethod {
  GET = 'GET',
  POST = 'POST',
}

export interface HttpClient {

  sendRequest<ResponsePayloadType>(request: HttpRequest): (
    Promise<HttpResponse<ResponsePayloadType>>
  );

}