@cosmosapp/pay_sdkDefinitionenServer

REST

The HTTP layer. Owns the base URL, authentication and retry/timeout policy, and exposes thin verb helpers (get/post/patch/delete).

The HTTP layer. Owns the base URL, authentication and retry/timeout policy, and exposes thin verb helpers (get/post/patch/delete). Managers call these — they never touch fetch directly.

Constructor

REST

constructor(options: RESTOptions)

Parameters

  • options: RESTOptions

Properties

baseURL

baseURL: string

version

readonly version: string

Methods

setApiKey()

Replace the API key used for subsequent requests.

setApiKey(apiKey: string): this

Parameters

  • apiKey: string

Returns this

get()

get<T>(path: string, options?: RequestOptions): Promise<T>

Parameters

  • path: string
  • options (optional): RequestOptions

Returns Promise<T>

post()

post<T>(path: string, options?: RequestOptions): Promise<T>

Parameters

  • path: string
  • options (optional): RequestOptions

Returns Promise<T>

put()

put<T>(path: string, options?: RequestOptions): Promise<T>

Parameters

  • path: string
  • options (optional): RequestOptions

Returns Promise<T>

patch()

patch<T>(path: string, options?: RequestOptions): Promise<T>

Parameters

  • path: string
  • options (optional): RequestOptions

Returns Promise<T>

delete()

delete<T>(path: string, options?: RequestOptions): Promise<T>

Parameters

  • path: string
  • options (optional): RequestOptions

Returns Promise<T>

buildURL()

Build the absolute URL for a route, applying the version prefix + query.

buildURL(path: string, query?: RequestOptions['query']): string

Parameters

  • path: string
  • query (optional): RequestOptions['query']

Returns string

request()

Core request with retry, timeout and structured error handling.

request<T>(method: string, path: string, options?: RequestOptions): Promise<T>

Parameters

  • method: string
  • path: string
  • options (optional): RequestOptions

Returns Promise<T>

Auf dieser Seite