diff options
Diffstat (limited to 'packages/web-util/src/utils/request.ts')
-rw-r--r-- | packages/web-util/src/utils/request.ts | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/packages/web-util/src/utils/request.ts b/packages/web-util/src/utils/request.ts index 70f943540..23d3af468 100644 --- a/packages/web-util/src/utils/request.ts +++ b/packages/web-util/src/utils/request.ts @@ -17,6 +17,9 @@ import { HttpStatusCode } from "@gnu-taler/taler-util"; import { base64encode } from "./base64.js"; +/** + * @deprecated do not use it, it will be removed + */ export enum ErrorType { CLIENT, SERVER, @@ -32,6 +35,7 @@ export enum ErrorType { * @param baseUrl URL where the service is located * @param endpoint endpoint of the service to be called * @param options auth, method and params + * @deprecated do not use it, it will be removed * @returns */ export async function defaultRequestHandler<T>( @@ -189,16 +193,25 @@ export async function defaultRequestHandler<T>( } } +/** + * @deprecated do not use it, it will be removed + */ export type HttpResponse<T, ErrorDetail> = | HttpResponseOk<T> | HttpResponseLoading<T> | HttpError<ErrorDetail>; +/** + * @deprecated do not use it, it will be removed + */ export type HttpResponsePaginated<T, ErrorDetail> = | HttpResponseOkPaginated<T> | HttpResponseLoading<T> | HttpError<ErrorDetail>; +/** + * @deprecated do not use it, it will be removed + */ export interface RequestInfo { url: string; hasToken: boolean; @@ -215,6 +228,9 @@ interface HttpResponseLoading<T> { data?: T; } +/** + * @deprecated do not use it, it will be removed + */ export interface HttpResponseOk<T> { ok: true; loading?: false; @@ -225,8 +241,14 @@ export interface HttpResponseOk<T> { info?: RequestInfo; } +/** + * @deprecated do not use it, it will be removed + */ export type HttpResponseOkPaginated<T> = HttpResponseOk<T> & WithPagination; +/** + * @deprecated do not use it, it will be removed + */ export interface WithPagination { loadMore: () => void; loadMorePrev: () => void; @@ -234,6 +256,9 @@ export interface WithPagination { isReachingStart?: boolean; } +/** + * @deprecated do not use it, it will be removed + */ export type HttpError<ErrorDetail> = | HttpRequestTimeoutError | HttpResponseClientError<ErrorDetail> @@ -241,6 +266,9 @@ export type HttpError<ErrorDetail> = | HttpResponseUnreadableError | HttpResponseUnexpectedError; +/** + * @deprecated do not use it, it will be removed + */ export interface HttpResponseServerError<ErrorDetail> { ok?: false; loading?: false; @@ -292,6 +320,9 @@ interface HttpResponseUnreadableError { body: string; message: string; } +/** + * @deprecated do not use it, it will be removed + */ export class RequestError<ErrorDetail> extends Error { /** * @deprecated use cause @@ -307,6 +338,9 @@ export class RequestError<ErrorDetail> extends Error { type Methods = "GET" | "POST" | "PATCH" | "DELETE" | "PUT"; +/** + * @deprecated do not use it, it will be removed + */ export interface RequestOptions { method?: Methods; token?: string; @@ -323,6 +357,9 @@ export interface RequestOptions { talerAmlOfficerSignature?: string; } +/** + * @deprecated do not use it, it will be removed + */ async function buildRequestOk<T>( response: Response, url: string, @@ -345,6 +382,9 @@ async function buildRequestOk<T>( }; } +/** + * @deprecated do not use it, it will be removed + */ export function buildRequestFailed<ErrorDetail>( url: string, dataTxt: string, @@ -424,6 +464,9 @@ export function buildRequestFailed<ErrorDetail>( } } +/** + * @deprecated do not use it, it will be removed + */ function validateURL(baseUrl: string, endpoint: string): URL | undefined { try { return new URL(`${baseUrl}${endpoint}`) |