26 lines · 757 B · Text
RawDownload
{/_This file is generated by scripts/generate-doc-snippets.ts.Edit examples/docs-sdk-quickstart/src/main.ts between the docs:start/docs:end markers instead._/} ```ts// An integration is the API surface. The auth template declares where a// connection's credential is placed on each request — here, an `X-API-Key`// header. `variable("token")` is the slot the resolved credential renders into.await executor.openapi.addSpec({  slug: "inventory",  description: "Inventory API",  baseUrl: "https://inventory.example.com",  spec: {    kind: "blob",    value: JSON.stringify(inventoryApi),  },  authenticationTemplate: [    {      slug: "apiKey",      type: "apiKey",      headers: { "X-API-Key": [variable("token")] },    },  ],});```