From 97d733f3b6560055e08798f1a15aff74d7e1af94 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 12 Jun 2026 19:24:43 +0000 Subject: [PATCH 1/4] feat(digests): document digest REST endpoints in OpenAPI spec --- .stats.yml | 8 +- api.md | 15 +++ src/client.ts | 15 +++ src/resources/digests.ts | 3 + src/resources/digests/digests.ts | 120 ++++++++++++++++++ src/resources/digests/index.ts | 9 ++ src/resources/digests/schedules.ts | 51 ++++++++ src/resources/index.ts | 6 + tests/api-resources/digests/schedules.test.ts | 46 +++++++ 9 files changed, 269 insertions(+), 4 deletions(-) create mode 100644 src/resources/digests.ts create mode 100644 src/resources/digests/digests.ts create mode 100644 src/resources/digests/index.ts create mode 100644 src/resources/digests/schedules.ts create mode 100644 tests/api-resources/digests/schedules.test.ts diff --git a/.stats.yml b/.stats.yml index 1692bab..daedc5a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -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-2ffdd7412416851da17d4cf5b0b82ed842f730866bef1d76653f7ca83d5f622e.yml +openapi_spec_hash: e5296b102c88bb2226842167ba5d8731 +config_hash: 822a92efc80e63cdb2d496dbd6176620 diff --git a/api.md b/api.md index d25051f..1629020 100644 --- a/api.md +++ b/api.md @@ -281,6 +281,21 @@ Methods: - client.bulk.retrieveJob(jobID) -> BulkRetrieveJobResponse - client.bulk.runJob(jobID) -> void +# Digests + +Types: + +- DigestCategory +- DigestInstance +- DigestInstanceListResponse + +## Schedules + +Methods: + +- client.digests.schedules.listInstances(scheduleID, { ...params }) -> DigestInstanceListResponse +- client.digests.schedules.release(scheduleID) -> void + # Inbound Types: diff --git a/src/client.ts b/src/client.ts index 8773424..d184e42 100644 --- a/src/client.ts +++ b/src/client.ts @@ -105,6 +105,12 @@ import { AutomationTemplateListResponse, Automations, } from './resources/automations/automations'; +import { + DigestCategory, + DigestInstance, + DigestInstanceListResponse, + Digests, +} from './resources/digests/digests'; import { CreateJourneyRequest, Journey, @@ -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); @@ -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; @@ -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, diff --git a/src/resources/digests.ts b/src/resources/digests.ts new file mode 100644 index 0000000..9fcbf88 --- /dev/null +++ b/src/resources/digests.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './digests/index'; diff --git a/src/resources/digests/digests.ts b/src/resources/digests/digests.ts new file mode 100644 index 0000000..2dae9ad --- /dev/null +++ b/src/resources/digests/digests.ts @@ -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; + + /** + * 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; + + /** + * 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 }; +} diff --git a/src/resources/digests/index.ts b/src/resources/digests/index.ts new file mode 100644 index 0000000..f5f409e --- /dev/null +++ b/src/resources/digests/index.ts @@ -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'; diff --git a/src/resources/digests/schedules.ts b/src/resources/digests/schedules.ts new file mode 100644 index 0000000..671bd1d --- /dev/null +++ b/src/resources/digests/schedules.ts @@ -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 { + 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 { + 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 }; +} diff --git a/src/resources/index.ts b/src/resources/index.ts index 66263e9..a100ed7 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -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, diff --git a/tests/api-resources/digests/schedules.test.ts b/tests/api-resources/digests/schedules.test.ts new file mode 100644 index 0000000..806aa7f --- /dev/null +++ b/tests/api-resources/digests/schedules.test.ts @@ -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); + }); +}); From ee7658e2124c67f7982c751d532d4fdca02970ba Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 12 Jun 2026 21:44:47 +0000 Subject: [PATCH 2/4] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index daedc5a..27e7c56 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 119 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-2ffdd7412416851da17d4cf5b0b82ed842f730866bef1d76653f7ca83d5f622e.yml -openapi_spec_hash: e5296b102c88bb2226842167ba5d8731 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-40a1678baebc2a397e88f984d193460f97b535ad7f8b160a25ae217adce5b369.yml +openapi_spec_hash: a0c742f9a202374774303bc339143422 config_hash: 822a92efc80e63cdb2d496dbd6176620 From dfc908388c4be6c8464a88225995676b25c42c0a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 12 Jun 2026 21:57:21 +0000 Subject: [PATCH 3/4] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 27e7c56..6ee7bef 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 119 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-40a1678baebc2a397e88f984d193460f97b535ad7f8b160a25ae217adce5b369.yml -openapi_spec_hash: a0c742f9a202374774303bc339143422 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-a64bb97c3455b0689de7f6a297ba1dc1e747561ce310ddb18b9c4a5f4d3d510a.yml +openapi_spec_hash: 6a3b89f3ea7600e784902f61680f8f1a config_hash: 822a92efc80e63cdb2d496dbd6176620 From 6b7cd7209d1eb6232a9b602ef3f1b1f56ffdc608 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 12 Jun 2026 21:57:40 +0000 Subject: [PATCH 4/4] release: 7.13.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ package.json | 2 +- src/version.ts | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4acbbec..3b65b14 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "7.12.0" + ".": "7.13.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 96177c2..c96b322 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/package.json b/package.json index da0bb39..21f2604 100644 --- a/package.json +++ b/package.json @@ -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 ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index ef5fdab..ed8673f 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '7.12.0'; // x-release-please-version +export const VERSION = '7.13.0'; // x-release-please-version