@zyphr-dev/node-sdk 0.1.14 → 0.1.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyphr-dev/node-sdk",
3
- "version": "0.1.14",
3
+ "version": "0.1.17",
4
4
  "description": "Official Zyphr SDK for Node.js, React, and React Native",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
package/src/client.ts CHANGED
@@ -103,7 +103,10 @@ export class Zyphr {
103
103
  readonly webauthn: AuthWebAuthnApi;
104
104
  };
105
105
 
106
+ private readonly options: ZyphrOptions;
107
+
106
108
  constructor(options: ZyphrOptions) {
109
+ this.options = options;
107
110
  const config = new Configuration({
108
111
  basePath: options.baseUrl,
109
112
  apiKey: (name: string) => {
@@ -154,6 +157,9 @@ export class Zyphr {
154
157
  * Use this when calling profile, session, or MFA endpoints that
155
158
  * require the end user's access token instead of the API key.
156
159
  *
160
+ * Includes both the end-user Bearer token and the application
161
+ * public key (X-Application-Key) required by user-scoped endpoints.
162
+ *
157
163
  * @example
158
164
  * ```ts
159
165
  * const login = await zyphr.auth.login.loginEndUser({ ... });
@@ -165,8 +171,12 @@ export class Zyphr {
165
171
  * ```
166
172
  */
167
173
  asEndUser(accessToken: string): RequestInit {
168
- return {
169
- headers: { Authorization: `Bearer ${accessToken}` },
174
+ const headers: Record<string, string> = {
175
+ Authorization: `Bearer ${accessToken}`,
170
176
  };
177
+ if (this.options.applicationKey) {
178
+ headers['X-Application-Key'] = this.options.applicationKey;
179
+ }
180
+ return { headers };
171
181
  }
172
182
  }
@@ -102,6 +102,15 @@ export interface InboxApiGetUnreadCountRequest {
102
102
  externalId?: string;
103
103
  }
104
104
 
105
+ export interface InboxApiListAllInboxRequest {
106
+ subscriberId?: string;
107
+ status?: ListAllInboxStatusEnum;
108
+ category?: string;
109
+ search?: string;
110
+ limit?: number;
111
+ offset?: number;
112
+ }
113
+
105
114
  export interface InboxApiListInboxRequest {
106
115
  subscriberId?: string;
107
116
  externalId?: string;
@@ -319,6 +328,27 @@ export interface InboxApiInterface {
319
328
  */
320
329
  getUnreadCount(subscriberId?: string, externalId?: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UnreadCountResponse>;
321
330
 
331
+ /**
332
+ * List all in-app notifications for the current project. Used by the dashboard to display all notifications without requiring a subscriber selection.
333
+ * @summary List all project notifications
334
+ * @param {string} [subscriberId] Optional subscriber filter
335
+ * @param {'unread' | 'read' | 'archived'} [status] Filter by notification status
336
+ * @param {string} [category] Filter by category
337
+ * @param {string} [search] Search by title or body
338
+ * @param {number} [limit]
339
+ * @param {number} [offset]
340
+ * @param {*} [options] Override http request option.
341
+ * @throws {RequiredError}
342
+ * @memberof InboxApiInterface
343
+ */
344
+ listAllInboxRaw(requestParameters: InboxApiListAllInboxRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
345
+
346
+ /**
347
+ * List all in-app notifications for the current project. Used by the dashboard to display all notifications without requiring a subscriber selection.
348
+ * List all project notifications
349
+ */
350
+ listAllInbox(subscriberId?: string, status?: ListAllInboxStatusEnum, category?: string, search?: string, limit?: number, offset?: number, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
351
+
322
352
  /**
323
353
  * Retrieve in-app notifications for a subscriber. Requires subscriber_id or external_id.
324
354
  * @summary List inbox notifications
@@ -889,6 +919,61 @@ export class InboxApi extends runtime.BaseAPI implements InboxApiInterface {
889
919
  return await response.value();
890
920
  }
891
921
 
922
+ /**
923
+ * List all in-app notifications for the current project. Used by the dashboard to display all notifications without requiring a subscriber selection.
924
+ * List all project notifications
925
+ */
926
+ async listAllInboxRaw(requestParameters: InboxApiListAllInboxRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
927
+ const queryParameters: any = {};
928
+
929
+ if (requestParameters['subscriberId'] != null) {
930
+ queryParameters['subscriber_id'] = requestParameters['subscriberId'];
931
+ }
932
+
933
+ if (requestParameters['status'] != null) {
934
+ queryParameters['status'] = requestParameters['status'];
935
+ }
936
+
937
+ if (requestParameters['category'] != null) {
938
+ queryParameters['category'] = requestParameters['category'];
939
+ }
940
+
941
+ if (requestParameters['search'] != null) {
942
+ queryParameters['search'] = requestParameters['search'];
943
+ }
944
+
945
+ if (requestParameters['limit'] != null) {
946
+ queryParameters['limit'] = requestParameters['limit'];
947
+ }
948
+
949
+ if (requestParameters['offset'] != null) {
950
+ queryParameters['offset'] = requestParameters['offset'];
951
+ }
952
+
953
+ const headerParameters: runtime.HTTPHeaders = {};
954
+
955
+ if (this.configuration && this.configuration.apiKey) {
956
+ headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
957
+ }
958
+
959
+ const response = await this.request({
960
+ path: `/inbox/all`,
961
+ method: 'GET',
962
+ headers: headerParameters,
963
+ query: queryParameters,
964
+ }, initOverrides);
965
+
966
+ return new runtime.VoidApiResponse(response);
967
+ }
968
+
969
+ /**
970
+ * List all in-app notifications for the current project. Used by the dashboard to display all notifications without requiring a subscriber selection.
971
+ * List all project notifications
972
+ */
973
+ async listAllInbox(subscriberId?: string, status?: ListAllInboxStatusEnum, category?: string, search?: string, limit?: number, offset?: number, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
974
+ await this.listAllInboxRaw({ subscriberId: subscriberId, status: status, category: category, search: search, limit: limit, offset: offset }, initOverrides);
975
+ }
976
+
892
977
  /**
893
978
  * Retrieve in-app notifications for a subscriber. Requires subscriber_id or external_id.
894
979
  * List inbox notifications
@@ -1298,3 +1383,13 @@ export class InboxApi extends runtime.BaseAPI implements InboxApiInterface {
1298
1383
  }
1299
1384
 
1300
1385
  }
1386
+
1387
+ /**
1388
+ * @export
1389
+ */
1390
+ export const ListAllInboxStatusEnum = {
1391
+ UNREAD: 'unread',
1392
+ READ: 'read',
1393
+ ARCHIVED: 'archived'
1394
+ } as const;
1395
+ export type ListAllInboxStatusEnum = typeof ListAllInboxStatusEnum[keyof typeof ListAllInboxStatusEnum];