import type { SDKError } from "./types_external.js"; /** * Represents a response from the client. * * @template TOk - The type of the successful response data. * @template TErr - The type of the error details. */ export type ClientResponse = { ok: true; data: TOk; } | (SDKError & { retry?: boolean; }); /** * Represents a base client for making requests. */ export type BaseClient = { readonly sdkVersion: string; readonly makeRequest: (requestData: RequestData) => Promise>; }; /** * Represents a factory for creating request data. */ export type RequestFactory = { [key: string]: (...args: any[]) => RequestData; }; /** * Represents a proxy for API requests. * * This type transforms a `RequestFactory` type into a type where each method * returns a `Promise` that resolves to a `ClientResponse`. * * @template TFac - The type of the request factory. */ export type ApiProxy = { [key in keyof TFac]: TFac[key] extends (...args: infer TArgs) => RequestData ? (...args: TArgs) => Promise> : never; }; /** * Represents the data required to make a request. * * @template TOk - The type of the successful response data. * @template TErr - The type of the error details. */ export type RequestData = { method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE"; url: string; additionalHeaders?: Record; omitHeaders?: OmitHeaders; body?: unknown; token?: string; }; /** * Represents the default headers used in requests. */ export type DefaultHeaders = { "Content-Type": "application/json"; "Authorization": string; "User-Agent": string; "Ocp-Apim-Subscription-Key": string; "Merchant-Serial-Number": string; "Vipps-System-Name": string; "Vipps-System-Version": string; "Vipps-System-Plugin-Name": string; "Vipps-System-Plugin-Version": string; "Idempotency-Key": string; }; /** * Represents an array of keys from the DefaultHeaders type that should be omitted. * * @example * const headersToOmit: OmitHeaders = ["Authorization", "Content-Type"]; */ export type OmitHeaders = (keyof DefaultHeaders)[]; /** * A utility type that makes the type `T` more readable by flattening its structure. * * @template T - The type to prettify. */ export type PrettifyType = { [K in keyof T]: T[K]; } & unknown; /** * A utility type that makes the specified property `K` of type `T` optional. * * @template T - The type containing the property to make optional. * @template K - The key of the property to make optional. */ export type MakePropertyOptional = Omit & { [P in K]?: T[P]; }; /** * A utility type that makes the specified nested property `N` of type `T[K]` optional. * * @template T - The type containing the nested property to make optional. * @template K - The key of the property containing the nested property. * @template N - The key of the nested property to make optional. */ export type MakeNestedPropertyOptional = { [P in keyof T]: P extends K ? Omit & Partial> : T[P]; }; //# sourceMappingURL=types_internal.d.ts.map