{"_id":"@codeforge-main/buttondown-sdk","_rev":"4-ec81b01689b75a223a92765e2639ab55","name":"@codeforge-main/buttondown-sdk","dist-tags":{"latest":"2.2.0"},"versions":{"1.0.0":{"name":"@codeforge-main/buttondown-sdk","version":"1.0.0","author":{"name":"codeforge"},"_id":"@codeforge-main/buttondown-sdk@1.0.0","maintainers":[{"name":"codeforge-main","email":"codeforge.info@gmail.com"}],"dist":{"shasum":"8f25e9d99e0299e0d90b4eca7ec81c7a6b111ea8","tarball":"https://registry.npmjs.org/@codeforge-main/buttondown-sdk/-/buttondown-sdk-1.0.0.tgz","fileCount":3570,"integrity":"sha512-sJD+sy89USYSN0LoVgErt0uyatrAWih9eg6Ugpe6jd52tsCKfJrrf8ujv4I2tLIFDc1++GMn1Msxa9MJCfprzg==","signatures":[{"sig":"MEUCID/vExl1noriB59zdjlxrbp+8d7YWD8XkxDmcI+j2RfzAiEAxNMNEHMOF4q1AtSlwtOcpaEN6RCL8gNtaJ7Dl77URKs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4707008},"main":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"}},"scripts":{"build":"tsc"},"_npmUser":{"name":"codeforge-main","email":"codeforge.info@gmail.com"},"_npmVersion":"10.9.8","description":"> **Unofficial SDK** — generated from @codeforge-main/buttondown-sdk's public OpenAPI specification by the [CodeForge platform](https://www.code-forge.net). Not affiliated with or endorsed by @codeforge-main/buttondown-sdk.","directories":{},"_nodeVersion":"22.23.2","dependencies":{},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.2"},"_npmOperationalInternal":{"tmp":"tmp/buttondown-sdk_1.0.0_1788723849945_0.6977722785467115","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@codeforge-main/buttondown-sdk","version":"2.0.0","author":{"name":"codeforge"},"_id":"@codeforge-main/buttondown-sdk@2.0.0","maintainers":[{"name":"codeforge-main","email":"codeforge.info@gmail.com"}],"dist":{"shasum":"5e933c42053bb884f513861c98fcf8d0262e30af","tarball":"https://registry.npmjs.org/@codeforge-main/buttondown-sdk/-/buttondown-sdk-2.0.0.tgz","fileCount":3570,"integrity":"sha512-KdcvQTB/wYYNW9KEYUpvUCwWI+vhOR/OEqMW105cS/894xmXhEQrQokKK4gps6xu9i39lKBu4d0iCWCwS89r4A==","signatures":[{"sig":"MEUCIBz1Mr5dbalbAP5mBdBc0FEbTpDwl1WQg+YaSgg5dxP3AiEAmLHsH+L0N8nnfK2+u3FeOA0uyWh3C0rhC7RulJWwJz0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4706871},"main":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"}},"scripts":{"build":"tsc"},"_npmUser":{"name":"codeforge-main","email":"codeforge.info@gmail.com"},"_npmVersion":"10.9.8","description":"> **Unofficial SDK** — generated from [CodeForge platform](https://www.code-forge.net)","directories":{},"_nodeVersion":"22.23.2","dependencies":{},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.2"},"_npmOperationalInternal":{"tmp":"tmp/buttondown-sdk_2.0.0_1788723934704_0.48094823474082093","host":"s3://npm-registry-packages-npm-production"}},"2.1.0":{"name":"@codeforge-main/buttondown-sdk","version":"2.1.0","author":{"name":"codeforge"},"_id":"@codeforge-main/buttondown-sdk@2.1.0","maintainers":[{"name":"codeforge-main","email":"codeforge.info@gmail.com"}],"dist":{"shasum":"74089711089b3acbda386f2d6e78c70dd6705f51","tarball":"https://registry.npmjs.org/@codeforge-main/buttondown-sdk/-/buttondown-sdk-2.1.0.tgz","fileCount":3570,"integrity":"sha512-MWD7YDOskPM2Q/v8JUxAL5FiZpXH7oM2TqI7dGEh6KYEwOpA2a/QUm//wsHLs2d+h/7ZGGy0RMPe16D54xVjTA==","signatures":[{"sig":"MEUCIECRniZk+GxskIercEZcPgkjKLYg0jjXTDLDjTRCKB3nAiEAjMWIpMPvuLAt64An4JlpyfwCSPIoPbTRARZjzq32j7k=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4706871},"main":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"}},"scripts":{"build":"tsc"},"_npmUser":{"name":"codeforge-main","email":"codeforge.info@gmail.com"},"_npmVersion":"10.9.8","description":"> **Unofficial SDK** — generated from [CodeForge platform](https://www.code-forge.net)","directories":{},"_nodeVersion":"22.23.2","dependencies":{},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.2"},"_npmOperationalInternal":{"tmp":"tmp/buttondown-sdk_2.1.0_1788825745953_0.20072184511132907","host":"s3://npm-registry-packages-npm-production"}},"2.2.0":{"name":"@codeforge-main/buttondown-sdk","version":"2.2.0","description":"> **Unofficial SDK** — generated from [CodeForge platform](https://www.code-forge.net)","author":{"name":"codeforge"},"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"}},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"scripts":{"build":"tsc"},"engines":{"node":">=20"},"dependencies":{},"devDependencies":{"typescript":"^5.9.2"},"_id":"@codeforge-main/buttondown-sdk@2.2.0","_nodeVersion":"22.23.2","_npmVersion":"10.9.8","dist":{"integrity":"sha512-bkgVK/i+mVa3nLS4AWJNFDePQR+M6cQssN4VVpc4ep6/jfdhAo9EsYQHFQCDrKdHyJ6HGyWjKamaaBJYIrLl7g==","shasum":"203e0750cfef4e43c0b30fad53e5ba2a1cb70743","tarball":"https://registry.npmjs.org/@codeforge-main/buttondown-sdk/-/buttondown-sdk-2.2.0.tgz","fileCount":3570,"unpackedSize":4706871,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIAX7PNkT1I2VDMZP/d7CaWvwNi6fDiniw7j8CN6USXvOAiAT1scKqsxVWOsyRHxctjQn2vEp4H7NkttSMoACScdc/A=="}]},"_npmUser":{"name":"codeforge-main","email":"codeforge.info@gmail.com"},"directories":{},"maintainers":[{"name":"codeforge-main","email":"codeforge.info@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/buttondown-sdk_2.2.0_1788912217997_0.49916737419439716"},"_hasShrinkwrap":false}},"time":{"created":"2026-09-06T19:44:09.770Z","modified":"2026-09-09T00:03:38.353Z","1.0.0":"2026-09-06T19:44:10.125Z","2.0.0":"2026-09-06T19:45:34.879Z","2.1.0":"2026-09-08T00:02:26.112Z","2.2.0":"2026-09-09T00:03:38.191Z"},"author":{"name":"codeforge"},"description":"> **Unofficial SDK** — generated from [CodeForge platform](https://www.code-forge.net)","maintainers":[{"name":"codeforge-main","email":"codeforge.info@gmail.com"}],"readme":"> **Unofficial SDK** — generated from [CodeForge platform](https://www.code-forge.net)\n\n---\n\n# @codeforge-main/buttondown-sdk\n\nVersion 2.2.0\n\nFull generator behavior documentation: https://www.code-forge.net/docs\n\nRequires Node 20+ (or a modern browser) — the generated transport uses `AbortSignal.any`\nand `AbortSignal.timeout`.\n\n## Install\n\n```bash\nnpm install @codeforge-main/buttondown-sdk\n```\n\n```bash\nyarn add @codeforge-main/buttondown-sdk\n```\n\n```bash\npnpm add @codeforge-main/buttondown-sdk\n```\n\n## Usage\n\nThis SDK is exposed as a single, fully typed client class. Construct it once with your\nshared configuration and call any API operation as a method — each returns the deserialized\nresponse alongside HTTP metadata.\n\n```ts\nimport { ButtondownClient } from '@codeforge-main/buttondown-sdk'\n\nconst client = new ButtondownClient({\n\tbaseUrl: 'https://api.buttondown.com/v1',\n\tauth: { type: 'apiKey', key: 'YOUR_API_KEY' },\n})\n\nconst response = await client.getAccount()\n\nconsole.log(response.status) // HTTP status code\nconsole.log(response.data)   // typed as GetAccountResponse\n```\n\nThe client holds the shared configuration (`baseUrl`, `auth`, `retry`, `hooks`).\nEach method accepts a per-call context extending `HttpClientContext` — supply the\noperation-specific `payload` / `parameters`, and override any shared field per call.\n\n### Available operations\n\n- `getAccount`\n- `listAdvertisingUnits`\n- `createAdvertisingUnit`\n- `updateAdvertisingUnit`\n- `deleteAdvertisingUnit`\n- `listAdvertisingSlots`\n- `updateAdvertisingSlot`\n- `retrieveApiRequest`\n- `listApiRequests`\n- `listAttachments`\n- `createAttachment`\n- `retrieveAttachment`\n- `deleteAttachment`\n- `listAutomations`\n- `createAutomation`\n- `retrieveAutomation`\n- `updateAutomation`\n- `deleteAutomation`\n- `invokeAutomation`\n- `retrieveAutomationAnalytics`\n- `listBooks`\n- `createBook`\n- `retrieveBook`\n- `updateBook`\n- `deleteBook`\n- `createBulkAction`\n- `retrieveBulkAction`\n- `listComments`\n- `createComment`\n- `retrieveComment`\n- `updateComment`\n- `deleteComment`\n- `listCoupons`\n- `listEmails`\n- `createEmail`\n- `retrieveEmail`\n- `updateEmail`\n- `deleteEmail`\n- `retrieveEmailHistory`\n- `retrieveEmailHistoryById`\n- `retrieveEmailAnalytics`\n- `retrieveEmailRenders`\n- `sendDraft`\n- `publishEmail`\n- `listEvents`\n- `getEvent`\n- `listExports`\n- `createExport`\n- `retrieveExport`\n- `listExternalFeed`\n- `createExternalFeed`\n- `retrieveExternalFeed`\n- `updateExternalFeed`\n- `deleteExternalFeed`\n- `retrieveItems`\n- `pollItems`\n- `listForms`\n- `createForm`\n- `retrieveForm`\n- `updateForm`\n- `deleteForm`\n- `listImages`\n- `createImage`\n- `updateImage`\n- `deleteImage`\n- `listImports`\n- `createImport`\n- `retrieveImport`\n- `updateImport`\n- `deleteImport`\n- `listNewsletters`\n- `createNewsletter`\n- `retrieveNewsletter`\n- `updateNewsletter`\n- `deleteNewsletter`\n- `retrieveSendingDomain`\n- `retrieveHostingDomain`\n- `listNotes`\n- `createNoteEndpoint`\n- `deleteNoteEndpoint`\n- `ping`\n- `listPrices`\n- `createPrice`\n- `deletePrice`\n- `listPublicEmails`\n- `listSegments`\n- `createSegment`\n- `retrieveSegment`\n- `updateSegment`\n- `deleteSegment`\n- `listSnippets`\n- `createSnippet`\n- `retrieveSnippet`\n- `updateSnippet`\n- `deleteSnippet`\n- `listSubscribers`\n- `createSubscriber`\n- `retrieveSubscriber`\n- `updateSubscriber`\n- `deleteSubscriber`\n- `sendReminder`\n- `sendMagicLinkToSubscriber`\n- `sendEmailTo`\n- `getReferrals`\n- `getAutomations`\n- `updateAutomationAttempt`\n- `getStripeSubscriptions`\n- `retrieveSurveyResponses`\n- `createSurveyResponse`\n- `updateSurveyResponse`\n- `listSurveys`\n- `createSurvey`\n- `retrieveSurvey`\n- `updateSurvey`\n- `deleteSurvey`\n- `listTags`\n- `createTag`\n- `retrieveTag`\n- `updateTag`\n- `deleteTag`\n- `retrieveTagAnalytics`\n- `listUsers`\n- `createUser`\n- `retrieveUser`\n- `updateUser`\n- `deleteUser`\n- `listWebhooks`\n- `createWebhook`\n- `retrieveWebhook`\n- `updateWebhook`\n- `deleteWebhook`\n- `retrieveWebhookAttempts`\n- `testWebhook`\n\n## Transport\n\nEvery request goes through the same transport: a per-attempt timeout, cancellation via\n`AbortSignal`, and an optional custom `fetch`.\n\n```ts\nconst client = new ButtondownClient({\n\ttimeoutMs: 10_000, // default 60000ms, applied fresh to each retry attempt\n})\n\nconst controller = new AbortController()\nsetTimeout(() => controller.abort(), 5_000)\n\nawait client.getAccount({ signal: controller.signal })\n```\n\n`timeoutMs` is per attempt, not per call — a request that times out and then retries gets a\nfresh timer on each attempt, and throws `TimeoutError` if every attempt times out. A\ncaller-triggered `AbortSignal` is never retried; a timeout is, under the same rule as a\nnetwork error. Streaming operations ignore `timeoutMs` and support only caller\ncancellation.\n\n### Custom fetch\n\nPass a `fetch` implementation to route every request through it — a proxy included, via\n[undici](https://github.com/nodejs/undici)'s `ProxyAgent`:\n\n```ts\nimport { ProxyAgent, fetch as undiciFetch } from 'undici'\n\nconst dispatcher = new ProxyAgent('http://localhost:8080')\nconst client = new ButtondownClient({\n\tfetch: (url, init) => undiciFetch(url, { ...init, dispatcher }),\n})\n```\n\n`hooks.makeRequest` wins when both are set — it replaces the whole transport, and `fetch`\nis read only by the built-in one.\n\n### Raw requests\n\nAn endpoint the generated operations don’t model is still reachable, through the same\nauth, retries, timeout and hooks:\n\n```ts\nconst { data, response } = await client.get('/v1/status')\nawait client.post('/v1/events', { body: { type: 'ping' } })\n\n// the general form, for a method the verb helpers don’t cover:\nawait client.request({ method: 'OPTIONS', path: '/v1/status' })\n```\n\n`path` is joined onto `baseUrl` with the `URL` constructor — a leading `/` resolves from\nthe origin (dropping any path segment `baseUrl` itself carries); a relative segment\nappends after it. A plain-object `body` is JSON-serialized with a JSON `Content-Type`;\npass an already-encoded value (a `string`, `FormData`, ...) to send anything else.\n`data` parses by the response’s own `Content-Type`: JSON via `.json()`, a textual type\nvia `.text()`, anything else as a `Blob`.\n\n## Uploads\n\nA multipart operation's binary part accepts a `File` directly. The `toFile` helper builds\none from bytes, a `Blob`, or a Node stream — `fs.createReadStream(...)` included, since every\nNode stream is async-iterable. The source is read fully into memory before the request goes\nout, so this is not a fit for uploads too large to hold in memory at once.\n\n```ts\nimport { toFile } from '@codeforge-main/buttondown-sdk'\nimport fs from 'node:fs'\n\nconst file = await toFile(fs.createReadStream('./report.pdf'), 'report.pdf', {\n\tcontentType: 'application/pdf',\n})\n\n// pass `file` as the operation's multipart field, e.g. `{ payload: { file } }`\n```\n\nA `Blob`, a `Uint8Array` (a Node `Buffer` included), or a `File` you already have works the\nsame way, without `toFile`.\n\n## Webhooks\n\nThis SDK implements the [Standard Webhooks](https://www.standardwebhooks.com/) convention:\nHMAC-SHA256 over `id.timestamp.payload`, computed from the raw request body. Verify a\ndelivery before parsing it — a body that fails verification should never be trusted.\n\n```ts\nimport { verifyWebhook, WebhookVerificationError } from '@codeforge-main/buttondown-sdk'\n\nconst secret = process.env.WEBHOOK_SECRET\nif (!secret) {\n\tthrow new Error('WEBHOOK_SECRET is not set')\n}\n\ntry {\n\tawait verifyWebhook({\n\t\tpayload: rawBody, // the raw request body, exactly as received — do not re-serialize it\n\t\theaders: request.headers,\n\t\tsecret, // the 'whsec_' form your provider issued, or a raw string\n\t})\n} catch (error) {\n\tif (error instanceof WebhookVerificationError) {\n\t\t// reject the delivery — do not process an unverified payload\n\t}\n\tthrow error\n}\n\nconst event = JSON.parse(rawBody)\n```\n\nA verified body parses to one member of the `WebhookPayload` union — narrow `event` before\nreading its fields:\n\n```ts\nimport type { WebhookPayload } from '@codeforge-main/buttondown-sdk'\n\nconst typedEvent = event as WebhookPayload\n// if ('someField' in typedEvent) { ... }\n```\n\nPayload types: `WebhookEvent`.\n\n## Errors\n\nA non-OK response throws one of these `HttpError` subclasses, picked by an exact status\nmatch first, then any `>= 500` response as `InternalServerError`, then plain `HttpError`\nfor anything else. Every one of them is also an `instanceof HttpError`, so a catch-all\nkeeps working alongside a narrower check.\n\n| Class | Status |\n| --- | --- |\n| `BadRequestError` | 400 |\n| `AuthenticationError` | 401 |\n| `PermissionDeniedError` | 403 |\n| `NotFoundError` | 404 |\n| `ConflictError` | 409 |\n| `UnprocessableEntityError` | 422 |\n| `RateLimitError` | 429 |\n| `InternalServerError` | any `>= 500` |\n\n```ts\nimport { HttpError, NotFoundError } from '@codeforge-main/buttondown-sdk'\n\ntry {\n\tawait client.getAccount()\n} catch (error) {\n\tif (error instanceof NotFoundError) {\n\t\t// error.status is narrowed to 404\n\t} else if (error instanceof HttpError) {\n\t\t// any other non-OK response — error.status is number\n\t}\n\tthrow error\n}\n```\n\n## Validation\n\nEvery model is plain data — the shape it has on the wire. This SDK carries no schemas and\nno runtime dependency, so nothing is validated for you: `response.data` is the parsed body\ntyped as the operation declares it.\n\nRegenerate the SDK with validation schemas turned on to get a zod schema exported beside\nevery model type.\n\n> Generated by CodeForge v0.86.9.\n","readmeFilename":"README.md"}