UNPKG

@e2y/occ-client

Version:

OCC client for SAP Commerce Cloud

36 lines (35 loc) 1.8 kB
import { OpenapiPaths } from 'openapi-typescript-fetch/dist/cjs/types'; import { OAuth2ClientCredentialsConfiguration } from './types/OAuth2ClientCredentialsConfiguration'; import { OAuth2PasswordConfiguration } from './types/OAuth2PasswordConfiguration'; /** * A client for making requests to an OCC API. * * If an OAuth2 configuration is provided, the client will automatically obtain an access token * and include it in requests that require authentication. */ export declare class OccClient { private readonly oauth2Configuration?; private readonly occUrl; /** * Creates a new instance of the OccClient class. * @constructor * @param {URL} occUrl - The URL of the OCC API. * @param {OAuth2ClientCredentialsConfiguration | OAuth2PasswordConfiguration} [oauth2Configuration] - The OAuth2 configuration for the client. */ constructor(occUrl: URL, oauth2Configuration?: OAuth2ClientCredentialsConfiguration | OAuth2PasswordConfiguration); /** * Creates a new instance of the Fetcher class for making requests to an OCC API. * If an OAuth2 configuration is provided, the client will automatically obtain an access token * and include it in requests that require authentication. * @returns {Fetcher} - An instance of the Fetcher class. */ create<path extends OpenapiPaths<path>>(): Promise<{ configure: (config: import("openapi-typescript-fetch/dist/cjs/types").FetchConfig) => void; use: (mw: import("openapi-typescript-fetch").Middleware) => number; path: <P extends keyof path>(path: P) => { method: <M extends keyof path[P]>(method: M) => { create: import("openapi-typescript-fetch/dist/cjs/types").CreateFetch<M, path[P][M]>; }; }; }>; }