npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

emailoctopus-api-client

v2.0.4

Published

Type-safe EmailOctopus API client generated with @hey-api/openapi-ts

Downloads

259

Readme

EmailOctopus API Client

Type-safe SDK for the EmailOctopus REST API v2, generated with @hey-api/openapi-ts. The package wraps the official OpenAPI schema and exposes fully typed helpers for every endpoint.

The published package name is emailoctopus-api-client.

Installation

pnpm add emailoctopus-api-client
# or
npm install emailoctopus-api-client
# or
yarn add emailoctopus-api-client

Quick Start

import { apiListsListIdcontactsPost } from "emailoctopus-api-client";

const clientOptions = {
  auth: process.env.EMAILOCTOPUS_API_KEY,
};

async function subscribeContact(listId: string) {
  const result = await apiListsListIdcontactsPost({
    path: { list_id: listId },
    auth: clientOptions.auth,
    body: {
      email_address: "[email protected]",
      fields: {
        FirstName: "Ada",
      },
      status: "SUBSCRIBED",
    },
  });

  if (result.error) {
    console.error(result.error);
    return;
  }

  console.log(result.data);
}

subscribeContact("your-list-id");

Response Handling Modes

Each generated helper returns { data, error, request, response } by default. Set throwOnError to true to raise errors instead, or responseStyle: 'data' to unwrap the data:

const { data } = await apiCampaignsGet({
  auth: process.env.EMAILOCTOPUS_API_KEY,
  throwOnError: true,
});

Advanced contributors can reuse configuration by importing the generated client utilities from src/client/. The published package currently exposes typed endpoint helpers only.

Available Endpoints

Every OpenAPI endpoint has a matching exported function under src/sdk.gen.ts. Examples:

  • apiCampaignsGet – list campaigns
  • apiListsListIdcontactsPost – create a contact
  • apiAutomationsAutomationIdqueuePost – trigger an automation for a contact

Refer to the official documentation or inspect src/sdk.gen.ts for the full list and parameter typings.

Configuration Reference

All helper functions share a common options object:

  • auth: API key or async getter. Required for authenticated endpoints (EmailOctopus uses Bearer tokens).
  • path: path parameters object, e.g. { list_id: '123' }.
  • query: query parameters object.
  • body: request payload. Typed per endpoint.
  • headers: additional headers merged with defaults.
  • client: pass a custom client instance as shown above.
  • throwOnError: when true, rejected promises are thrown instead of returned in { error }.
  • responseStyle: set to 'data' to receive only response data.

Regenerating the SDK

The SDK is produced from the public OpenAPI schema. Update generated code after schema changes:

pnpm install
pnpm run generate
pnpm run build

Generation settings live in openapi-ts.config.ts. Regeneration overwrites everything under src/ marked as generated—avoid manual edits to those files.

Development

  • pnpm run build – clean, regenerate, and compile to dist/
  • pnpm run generate – only refresh generated sources
  • pnpm run clean – remove build artifacts

Publishing

Build the package before publishing to ensure dist/ is up to date:

pnpm run build
pnpm publish --access public

Contributing

  1. Fork and clone the repo.
  2. Install dependencies with pnpm install.
  3. Regenerate the SDK if you changed the OpenAPI config.
  4. Submit a PR with a clear summary of your changes.

Please open issues for schema mismatches or endpoint coverage gaps.

License

MIT © 2025 spookyuser