TypeScript SDK
Install and start using the TypeScript SDK.
Intro
The APIMatic Portal Artifacts API SDK provides access to the APIMatic Portal Artifacts API REST APIs.
Generate the artifacts an APIMatic API Portal needs (SDKs, code samples, getting started guides and, optionally, a context plugin) from a Portal Build Input, asynchronously.
The generation flow is:
- Upload your build directory as a zip file using Generate Portal Artifacts Async. You get back an
idand links to check the status and download the artifacts. - Poll Get Portal Artifacts Generation Status until generation completes, or pass the
X-APIMatic-CallbackUrlheader in step 1 to be notified instead. - Download the generated artifacts using Download Generated Portal Artifacts.
Installation
The SDK compiles to dist/ before it can be referenced — run its build script once in the SDK folder, then add it to your project by path:
npm install <path-to-sdk>Quick Start
Create one client and reuse it. Configure its behaviour through ClientOptions.
import { ApiMaticPortalArtifactsApiClient } from "apimatic-portal-artifacts-api";
const client = new ApiMaticPortalArtifactsApiClient({
authorization: "YOUR_API_KEY",
});Nothing in ClientOptions is required — new ApiMaticPortalArtifactsApiClient() compiles — and each option left out falls back to its default. This API declares one environment, so there is no environment to select and no host to state at the construction site.
From CommonJS
The package ships both dialects from a single entry, so require works with full types. In a TypeScript CommonJS file use the import ... = require(...) form — a plain destructuring require runs fine but gives you any.
import sdk = require("apimatic-portal-artifacts-api");
const client = new sdk.ApiMaticPortalArtifactsApiClient({
authorization: "YOUR_API_KEY",
});