OpenAPI NodeJS Client for Solace Event Portal
Generated Typescript Open API Client for Solace Event Portal.
Based on OpenAPI Typescript Codegen.
Version: 0.19.0
The following modifications are made:
Use of fetch-with-proxy
Node fetch replaced with fetch-with-proxy.
See node-fetch-with-proxy for details on usage.
Added async resolver
to BASE url
export type OpenAPIConfig = {
BASE: string | Resolver<string>;
VERSION: string;
WITH_CREDENTIALS: boolean;
CREDENTIALS: 'include' | 'omit' | 'same-origin';
TOKEN?: string | Resolver<string>;
USERNAME?: string | Resolver<string>;
PASSWORD?: string | Resolver<string>;
HEADERS?: Headers | Resolver<Headers>;
ENCODE_PATH?: (path: string) => string;
};
Use of a resolver
const getBase = async(): Promise<string> => {
const myBase = ..., or
const myBase = await ...
return myBase;
}
OpenAPI.BASE = async() => { return await getBase(); }
Install
npm install @solace-labs/ep-openapi-node
Usage
Configure OpenAPI object:
import { OpenAPI } from "@solace-labs/ep-openapi-node";
OpenAPI.BASE = "{base-url}";
OpenAPI.WITH_CREDENTIALS = true;
OpenAPI.CREDENTIALS = "include";
OpenAPI.TOKEN = "{token}";
Example: Create an Application Domain:
import {
ApplicationDomainResponse,
ApplicationDomainsService,
} from "@solace-labs/ep-openapi-node";
const applicationDomainResponse: ApplicationDomainResponse =
await ApplicationDomainsService.createApplicationDomain({
requestBody: {
name: "my-application-domain",
},
});