@trycourier/courier 7.0.0 → 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 7.1.0 (2025-11-18)
4
+
5
+ Full Changelog: [v7.0.0...v7.1.0](https://github.com/trycourier/courier-node/compare/v7.0.0...v7.1.0)
6
+
7
+ ### Features
8
+
9
+ * JWT scope updates ([d9fb88a](https://github.com/trycourier/courier-node/commit/d9fb88ad4c217438b599c7e9102fdaec3ae83602))
10
+ * Test ([3353a72](https://github.com/trycourier/courier-node/commit/3353a72311650979908b120068bbcd40328753c4))
11
+
3
12
  ## 7.0.0 (2025-11-12)
4
13
 
5
14
  Full Changelog: [v6.7.0-alpha14...v7.0.0](https://github.com/trycourier/courier-node/compare/v6.7.0-alpha14...v7.0.0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trycourier/courier",
3
- "version": "7.0.0",
3
+ "version": "7.1.0",
4
4
  "description": "The official TypeScript library for the Courier API",
5
5
  "author": "Courier <support@courier.com>",
6
6
  "types": "./index.d.ts",
@@ -4,6 +4,15 @@ import { RequestOptions } from "../internal/request-options.mjs";
4
4
  export declare class Auth extends APIResource {
5
5
  /**
6
6
  * Returns a new access token.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const response = await client.auth.issueToken({
11
+ * expires_in: '$YOUR_NUMBER days',
12
+ * scope:
13
+ * 'user_id:$YOUR_USER_ID write:user-tokens inbox:read:messages inbox:write:events read:preferences write:preferences read:brands',
14
+ * });
15
+ * ```
7
16
  */
8
17
  issueToken(body: AuthIssueTokenParams, options?: RequestOptions): APIPromise<AuthIssueTokenResponse>;
9
18
  }
@@ -11,7 +20,37 @@ export interface AuthIssueTokenResponse {
11
20
  token: string;
12
21
  }
13
22
  export interface AuthIssueTokenParams {
23
+ /**
24
+ * Duration for token expiration. Accepts various time formats:
25
+ *
26
+ * - "2 hours" - 2 hours from now
27
+ * - "1d" - 1 day
28
+ * - "3 days" - 3 days
29
+ * - "10h" - 10 hours
30
+ * - "2.5 hrs" - 2.5 hours
31
+ * - "1m" - 1 minute
32
+ * - "5s" - 5 seconds
33
+ * - "1y" - 1 year
34
+ */
14
35
  expires_in: string;
36
+ /**
37
+ * Available scopes:
38
+ *
39
+ * - `user_id:<user-id>` - Defines which user the token will be scoped to. Multiple
40
+ * can be listed if needed. Ex `user_id:pigeon user_id:bluebird`.
41
+ * - `read:messages` - Read messages.
42
+ * - `read:user-tokens` - Read user push tokens.
43
+ * - `write:user-tokens` - Write user push tokens.
44
+ * - `read:brands[:<brand_id>]` - Read brands, optionally restricted to a specific
45
+ * brand_id. Examples `read:brands`, `read:brands:my_brand`.
46
+ * - `write:brands[:<brand_id>]` - Write brands, optionally restricted to a
47
+ * specific brand_id. Examples `write:brands`, `write:brands:my_brand`.
48
+ * - `inbox:read:messages` - Read inbox messages.
49
+ * - `inbox:write:events` - Write inbox events, such as mark message as read.
50
+ * - `read:preferences` - Read user preferences.
51
+ * - `write:preferences` - Write user preferences. Example:
52
+ * `user_id:user123 write:user-tokens inbox:read:messages inbox:write:events read:preferences write:preferences read:brands`
53
+ */
15
54
  scope: string;
16
55
  }
17
56
  export declare namespace Auth {
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.mts","sourceRoot":"","sources":["../src/resources/auth.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,IAAK,SAAQ,WAAW;IACnC;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,sBAAsB,CAAC;CAGrG;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IAEnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,OAAO,EACL,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,oBAAoB,IAAI,oBAAoB,GAClD,CAAC;CACH"}
1
+ {"version":3,"file":"auth.d.mts","sourceRoot":"","sources":["../src/resources/auth.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,IAAK,SAAQ,WAAW;IACnC;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,sBAAsB,CAAC;CAGrG;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;;;;OAWG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,OAAO,EACL,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,oBAAoB,IAAI,oBAAoB,GAClD,CAAC;CACH"}
@@ -4,6 +4,15 @@ import { RequestOptions } from "../internal/request-options.js";
4
4
  export declare class Auth extends APIResource {
5
5
  /**
6
6
  * Returns a new access token.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const response = await client.auth.issueToken({
11
+ * expires_in: '$YOUR_NUMBER days',
12
+ * scope:
13
+ * 'user_id:$YOUR_USER_ID write:user-tokens inbox:read:messages inbox:write:events read:preferences write:preferences read:brands',
14
+ * });
15
+ * ```
7
16
  */
8
17
  issueToken(body: AuthIssueTokenParams, options?: RequestOptions): APIPromise<AuthIssueTokenResponse>;
9
18
  }
@@ -11,7 +20,37 @@ export interface AuthIssueTokenResponse {
11
20
  token: string;
12
21
  }
13
22
  export interface AuthIssueTokenParams {
23
+ /**
24
+ * Duration for token expiration. Accepts various time formats:
25
+ *
26
+ * - "2 hours" - 2 hours from now
27
+ * - "1d" - 1 day
28
+ * - "3 days" - 3 days
29
+ * - "10h" - 10 hours
30
+ * - "2.5 hrs" - 2.5 hours
31
+ * - "1m" - 1 minute
32
+ * - "5s" - 5 seconds
33
+ * - "1y" - 1 year
34
+ */
14
35
  expires_in: string;
36
+ /**
37
+ * Available scopes:
38
+ *
39
+ * - `user_id:<user-id>` - Defines which user the token will be scoped to. Multiple
40
+ * can be listed if needed. Ex `user_id:pigeon user_id:bluebird`.
41
+ * - `read:messages` - Read messages.
42
+ * - `read:user-tokens` - Read user push tokens.
43
+ * - `write:user-tokens` - Write user push tokens.
44
+ * - `read:brands[:<brand_id>]` - Read brands, optionally restricted to a specific
45
+ * brand_id. Examples `read:brands`, `read:brands:my_brand`.
46
+ * - `write:brands[:<brand_id>]` - Write brands, optionally restricted to a
47
+ * specific brand_id. Examples `write:brands`, `write:brands:my_brand`.
48
+ * - `inbox:read:messages` - Read inbox messages.
49
+ * - `inbox:write:events` - Write inbox events, such as mark message as read.
50
+ * - `read:preferences` - Read user preferences.
51
+ * - `write:preferences` - Write user preferences. Example:
52
+ * `user_id:user123 write:user-tokens inbox:read:messages inbox:write:events read:preferences write:preferences read:brands`
53
+ */
15
54
  scope: string;
16
55
  }
17
56
  export declare namespace Auth {
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/resources/auth.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,IAAK,SAAQ,WAAW;IACnC;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,sBAAsB,CAAC;CAGrG;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IAEnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,OAAO,EACL,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,oBAAoB,IAAI,oBAAoB,GAClD,CAAC;CACH"}
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/resources/auth.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,IAAK,SAAQ,WAAW;IACnC;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,sBAAsB,CAAC;CAGrG;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;;;;OAWG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,OAAO,EACL,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,oBAAoB,IAAI,oBAAoB,GAClD,CAAC;CACH"}
package/resources/auth.js CHANGED
@@ -6,6 +6,15 @@ const resource_1 = require("../core/resource.js");
6
6
  class Auth extends resource_1.APIResource {
7
7
  /**
8
8
  * Returns a new access token.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const response = await client.auth.issueToken({
13
+ * expires_in: '$YOUR_NUMBER days',
14
+ * scope:
15
+ * 'user_id:$YOUR_USER_ID write:user-tokens inbox:read:messages inbox:write:events read:preferences write:preferences read:brands',
16
+ * });
17
+ * ```
9
18
  */
10
19
  issueToken(body, options) {
11
20
  return this._client.post('/auth/issue-token', { body, ...options });
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/resources/auth.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,MAAa,IAAK,SAAQ,sBAAW;IACnC;;OAEG;IACH,UAAU,CAAC,IAA0B,EAAE,OAAwB;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtE,CAAC;CACF;AAPD,oBAOC"}
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/resources/auth.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,MAAa,IAAK,SAAQ,sBAAW;IACnC;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,IAA0B,EAAE,OAAwB;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtE,CAAC;CACF;AAhBD,oBAgBC"}
@@ -3,6 +3,15 @@ import { APIResource } from "../core/resource.mjs";
3
3
  export class Auth extends APIResource {
4
4
  /**
5
5
  * Returns a new access token.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * const response = await client.auth.issueToken({
10
+ * expires_in: '$YOUR_NUMBER days',
11
+ * scope:
12
+ * 'user_id:$YOUR_USER_ID write:user-tokens inbox:read:messages inbox:write:events read:preferences write:preferences read:brands',
13
+ * });
14
+ * ```
6
15
  */
7
16
  issueToken(body, options) {
8
17
  return this._client.post('/auth/issue-token', { body, ...options });
@@ -1 +1 @@
1
- {"version":3,"file":"auth.mjs","sourceRoot":"","sources":["../src/resources/auth.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAItB,MAAM,OAAO,IAAK,SAAQ,WAAW;IACnC;;OAEG;IACH,UAAU,CAAC,IAA0B,EAAE,OAAwB;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtE,CAAC;CACF"}
1
+ {"version":3,"file":"auth.mjs","sourceRoot":"","sources":["../src/resources/auth.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAItB,MAAM,OAAO,IAAK,SAAQ,WAAW;IACnC;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,IAA0B,EAAE,OAAwB;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtE,CAAC;CACF"}
@@ -7,6 +7,15 @@ import { RequestOptions } from '../internal/request-options';
7
7
  export class Auth extends APIResource {
8
8
  /**
9
9
  * Returns a new access token.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const response = await client.auth.issueToken({
14
+ * expires_in: '$YOUR_NUMBER days',
15
+ * scope:
16
+ * 'user_id:$YOUR_USER_ID write:user-tokens inbox:read:messages inbox:write:events read:preferences write:preferences read:brands',
17
+ * });
18
+ * ```
10
19
  */
11
20
  issueToken(body: AuthIssueTokenParams, options?: RequestOptions): APIPromise<AuthIssueTokenResponse> {
12
21
  return this._client.post('/auth/issue-token', { body, ...options });
@@ -18,8 +27,38 @@ export interface AuthIssueTokenResponse {
18
27
  }
19
28
 
20
29
  export interface AuthIssueTokenParams {
30
+ /**
31
+ * Duration for token expiration. Accepts various time formats:
32
+ *
33
+ * - "2 hours" - 2 hours from now
34
+ * - "1d" - 1 day
35
+ * - "3 days" - 3 days
36
+ * - "10h" - 10 hours
37
+ * - "2.5 hrs" - 2.5 hours
38
+ * - "1m" - 1 minute
39
+ * - "5s" - 5 seconds
40
+ * - "1y" - 1 year
41
+ */
21
42
  expires_in: string;
22
43
 
44
+ /**
45
+ * Available scopes:
46
+ *
47
+ * - `user_id:<user-id>` - Defines which user the token will be scoped to. Multiple
48
+ * can be listed if needed. Ex `user_id:pigeon user_id:bluebird`.
49
+ * - `read:messages` - Read messages.
50
+ * - `read:user-tokens` - Read user push tokens.
51
+ * - `write:user-tokens` - Write user push tokens.
52
+ * - `read:brands[:<brand_id>]` - Read brands, optionally restricted to a specific
53
+ * brand_id. Examples `read:brands`, `read:brands:my_brand`.
54
+ * - `write:brands[:<brand_id>]` - Write brands, optionally restricted to a
55
+ * specific brand_id. Examples `write:brands`, `write:brands:my_brand`.
56
+ * - `inbox:read:messages` - Read inbox messages.
57
+ * - `inbox:write:events` - Write inbox events, such as mark message as read.
58
+ * - `read:preferences` - Read user preferences.
59
+ * - `write:preferences` - Write user preferences. Example:
60
+ * `user_id:user123 write:user-tokens inbox:read:messages inbox:write:events read:preferences write:preferences read:brands`
61
+ */
23
62
  scope: string;
24
63
  }
25
64
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '7.0.0'; // x-release-please-version
1
+ export const VERSION = '7.1.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "7.0.0";
1
+ export declare const VERSION = "7.1.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "7.0.0";
1
+ export declare const VERSION = "7.1.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '7.0.0'; // x-release-please-version
4
+ exports.VERSION = '7.1.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '7.0.0'; // x-release-please-version
1
+ export const VERSION = '7.1.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map