{"version":3,"sources":["../../src/client/types.ts"],"sourcesContent":["// Copyright © Endless\n// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { EndlessRequest } from \"../types\";\n\n/**\n * The API response type\n *\n * @param status - the response status. i.e. 200\n * @param statusText - the response message\n * @param data the response data\n * @param url the url the request was made to\n * @param headers the response headers\n * @param config (optional) - the request object\n * @param request (optional) - the request object\n */\nexport interface EndlessResponse<Req, Res> {\n  status: number;\n  statusText: string;\n  data: Res;\n  url: string;\n  headers: any;\n  config?: any;\n  request?: Req;\n}\n\n/**\n * The type returned from an API error\n *\n * @param name - the error name \"EndlessApiError\"\n * @param url the url the request was made to\n * @param status - the response status. i.e. 400\n * @param statusText - the response message\n * @param data the response data\n * @param request - the EndlessRequest\n */\nexport class EndlessApiError extends Error {\n  readonly url: string;\n\n  readonly status: number;\n\n  readonly statusText: string;\n\n  readonly data: any;\n\n  readonly request: EndlessRequest;\n\n  constructor(request: EndlessRequest, response: EndlessResponse<any, any>, message: string) {\n    super(message);\n\n    this.name = \"EndlessApiError\";\n    this.url = response.url;\n    this.status = response.status;\n    this.statusText = response.statusText;\n    this.data = response.data;\n    this.request = request;\n  }\n}\n"],"mappings":"AAqCO,IAAMA,EAAN,cAA8B,KAAM,CAWzC,YAAYC,EAAyBC,EAAqCC,EAAiB,CACzF,MAAMA,CAAO,EAEb,KAAK,KAAO,kBACZ,KAAK,IAAMD,EAAS,IACpB,KAAK,OAASA,EAAS,OACvB,KAAK,WAAaA,EAAS,WAC3B,KAAK,KAAOA,EAAS,KACrB,KAAK,QAAUD,CACjB,CACF","names":["EndlessApiError","request","response","message"]}