Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "7.12.0"
".": "7.13.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 117
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-545ac9b590445e90e11113a1bdeb893a94389d69d95e0a7e5c6450bb15f5453a.yml
openapi_spec_hash: 9e243ec62800fb4a2e443eb6481afa30
config_hash: 10bd597dd6cc89023541bc551b6532b8
configured_endpoints: 119
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-a64bb97c3455b0689de7f6a297ba1dc1e747561ce310ddb18b9c4a5f4d3d510a.yml
openapi_spec_hash: 6a3b89f3ea7600e784902f61680f8f1a
config_hash: 822a92efc80e63cdb2d496dbd6176620
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 7.13.0 (2026-06-12)

Full Changelog: [v7.12.0...v7.13.0](https://github.com/trycourier/courier-node/compare/v7.12.0...v7.13.0)

### Features

* **digests:** document digest REST endpoints in OpenAPI spec ([97d733f](https://github.com/trycourier/courier-node/commit/97d733f3b6560055e08798f1a15aff74d7e1af94))

## 7.12.0 (2026-05-28)

Full Changelog: [v7.11.0...v7.12.0](https://github.com/trycourier/courier-node/compare/v7.11.0...v7.12.0)
Expand Down
15 changes: 15 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,21 @@ Methods:
- <code title="get /bulk/{job_id}">client.bulk.<a href="./src/resources/bulk.ts">retrieveJob</a>(jobID) -> BulkRetrieveJobResponse</code>
- <code title="post /bulk/{job_id}/run">client.bulk.<a href="./src/resources/bulk.ts">runJob</a>(jobID) -> void</code>

# Digests

Types:

- <code><a href="./src/resources/digests/digests.ts">DigestCategory</a></code>
- <code><a href="./src/resources/digests/digests.ts">DigestInstance</a></code>
- <code><a href="./src/resources/digests/digests.ts">DigestInstanceListResponse</a></code>

## Schedules

Methods:

- <code title="get /digests/schedules/{schedule_id}/instances">client.digests.schedules.<a href="./src/resources/digests/schedules.ts">listInstances</a>(scheduleID, { ...params }) -> DigestInstanceListResponse</code>
- <code title="post /digests/schedules/{schedule_id}/trigger">client.digests.schedules.<a href="./src/resources/digests/schedules.ts">release</a>(scheduleID) -> void</code>

# Inbound

Types:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@trycourier/courier",
"version": "7.12.0",
"version": "7.13.0",
"description": "The official TypeScript library for the Courier API",
"author": "Courier <support@courier.com>",
"types": "dist/index.d.ts",
Expand Down
15 changes: 15 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ import {
AutomationTemplateListResponse,
Automations,
} from './resources/automations/automations';
import {
DigestCategory,
DigestInstance,
DigestInstanceListResponse,
Digests,
} from './resources/digests/digests';
import {
CreateJourneyRequest,
Journey,
Expand Down Expand Up @@ -945,6 +951,7 @@ export class Courier {
journeys: API.Journeys = new API.Journeys(this);
brands: API.Brands = new API.Brands(this);
bulk: API.Bulk = new API.Bulk(this);
digests: API.Digests = new API.Digests(this);
inbound: API.Inbound = new API.Inbound(this);
lists: API.Lists = new API.Lists(this);
messages: API.Messages = new API.Messages(this);
Expand All @@ -966,6 +973,7 @@ Courier.Automations = Automations;
Courier.Journeys = Journeys;
Courier.Brands = Brands;
Courier.Bulk = Bulk;
Courier.Digests = Digests;
Courier.Inbound = Inbound;
Courier.Lists = Lists;
Courier.Messages = Messages;
Expand Down Expand Up @@ -1105,6 +1113,13 @@ export declare namespace Courier {
type BulkListUsersParams as BulkListUsersParams,
};

export {
Digests as Digests,
type DigestCategory as DigestCategory,
type DigestInstance as DigestInstance,
type DigestInstanceListResponse as DigestInstanceListResponse,
};

export {
Inbound as Inbound,
type InboundTrackEventResponse as InboundTrackEventResponse,
Expand Down
3 changes: 3 additions & 0 deletions src/resources/digests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

export * from './digests/index';
120 changes: 120 additions & 0 deletions src/resources/digests/digests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { APIResource } from '../../core/resource';
import * as SchedulesAPI from './schedules';
import { ScheduleListInstancesParams, Schedules } from './schedules';

export class Digests extends APIResource {
schedules: SchedulesAPI.Schedules = new SchedulesAPI.Schedules(this._client);
}

export interface DigestCategory {
/**
* The key that identifies the category within the digest.
*/
category_key: string;

/**
* Which events to keep when the number of events exceeds the retention limit for
* the category.
*/
retain: 'first' | 'last' | 'highest' | 'lowest' | 'none';

/**
* The data key used to order events when `retain` is `highest` or `lowest`.
*/
sort_key?: string;
}

export interface DigestInstance {
/**
* A unique identifier for the digest instance.
*/
digest_instance_id: string;

/**
* The total number of events received for this instance.
*/
event_count: number;

/**
* The status of the digest instance. `IN_PROGRESS` instances are still
* accumulating events; `COMPLETED` instances have been released.
*/
status: 'IN_PROGRESS' | 'COMPLETED';

/**
* The ID of the user this digest instance belongs to.
*/
user_id: string;

/**
* The categories configured for the digest.
*/
categories?: Array<DigestCategory>;

/**
* A map of category key to the number of events received for that category.
*/
category_key_counts?: { [key: string]: number };

/**
* An ISO 8601 timestamp of when the digest instance was created.
*/
created_at?: string;

/**
* Whether the digest instance has been disabled.
*/
disabled?: boolean;

/**
* The ID of the tenant this digest instance belongs to, if any.
*/
tenant_id?: string | null;
}

export interface DigestInstanceListResponse {
/**
* Whether there are more digest instances to fetch using the cursor.
*/
has_more: boolean;

/**
* The digest instances for this page of results.
*/
items: Array<DigestInstance>;

/**
* Always `list` for a paginated list response.
*/
type: 'list';

/**
* A cursor token for fetching the next page of results, or null when there are
* none.
*/
cursor?: string | null;

/**
* The path to fetch the next page of results, or null when there are none.
*/
next_url?: string | null;

/**
* The path of the current request.
*/
url?: string;
}

Digests.Schedules = Schedules;

export declare namespace Digests {
export {
type DigestCategory as DigestCategory,
type DigestInstance as DigestInstance,
type DigestInstanceListResponse as DigestInstanceListResponse,
};

export { Schedules as Schedules, type ScheduleListInstancesParams as ScheduleListInstancesParams };
}
9 changes: 9 additions & 0 deletions src/resources/digests/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

export {
Digests,
type DigestCategory,
type DigestInstance,
type DigestInstanceListResponse,
} from './digests';
export { Schedules, type ScheduleListInstancesParams } from './schedules';
51 changes: 51 additions & 0 deletions src/resources/digests/schedules.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { APIResource } from '../../core/resource';
import * as DigestsAPI from './digests';
import { APIPromise } from '../../core/api-promise';
import { buildHeaders } from '../../internal/headers';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';

export class Schedules extends APIResource {
/**
* List the digest instances for a schedule. Each instance represents the events
* accumulated for a single user against the schedule, and can be used to monitor
* digest accumulation before the digest is released.
*/
listInstances(
scheduleID: string,
query: ScheduleListInstancesParams | null | undefined = {},
options?: RequestOptions,
): APIPromise<DigestsAPI.DigestInstanceListResponse> {
return this._client.get(path`/digests/schedules/${scheduleID}/instances`, { query, ...options });
}

/**
* Send a digest now instead of waiting for its scheduled time, so your users get
* what they have collected so far right away.
*/
release(scheduleID: string, options?: RequestOptions): APIPromise<void> {
return this._client.post(path`/digests/schedules/${scheduleID}/trigger`, {
...options,
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
});
}
}

export interface ScheduleListInstancesParams {
/**
* A cursor token from a previous response, used to fetch the next page of results.
*/
cursor?: string;

/**
* The maximum number of digest instances to return. Defaults to 20, with a maximum
* of 100.
*/
limit?: number;
}

export declare namespace Schedules {
export { type ScheduleListInstancesParams as ScheduleListInstancesParams };
}
6 changes: 6 additions & 0 deletions src/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ export {
type BulkCreateJobParams,
type BulkListUsersParams,
} from './bulk';
export {
Digests,
type DigestCategory,
type DigestInstance,
type DigestInstanceListResponse,
} from './digests/digests';
export { Inbound, type InboundTrackEventResponse, type InboundTrackEventParams } from './inbound';
export {
Journeys,
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '7.12.0'; // x-release-please-version
export const VERSION = '7.13.0'; // x-release-please-version
46 changes: 46 additions & 0 deletions tests/api-resources/digests/schedules.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import Courier from '@trycourier/courier';

const client = new Courier({
apiKey: 'My API Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});

describe('resource schedules', () => {
// Mock server tests are disabled
test.skip('listInstances', async () => {
const responsePromise = client.digests.schedules.listInstances('schedule_id');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
expect(response).not.toBeInstanceOf(Response);
const dataAndResponse = await responsePromise.withResponse();
expect(dataAndResponse.data).toBe(response);
expect(dataAndResponse.response).toBe(rawResponse);
});

// Mock server tests are disabled
test.skip('listInstances: request options and params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
client.digests.schedules.listInstances(
'schedule_id',
{ cursor: 'cursor', limit: 100 },
{ path: '/_stainless_unknown_path' },
),
).rejects.toThrow(Courier.NotFoundError);
});

// Mock server tests are disabled
test.skip('release', async () => {
const responsePromise = client.digests.schedules.release('schedule_id');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
expect(response).not.toBeInstanceOf(Response);
const dataAndResponse = await responsePromise.withResponse();
expect(dataAndResponse.data).toBe(response);
expect(dataAndResponse.response).toBe(rawResponse);
});
});
Loading