@nizam-os/dashboard-sdk 8.0.1 → 8.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.
Files changed (137) hide show
  1. package/dist/Client.d.ts +9 -0
  2. package/dist/Client.js +36 -24
  3. package/dist/api/resources/devices/client/Client.d.ts +71 -0
  4. package/dist/api/resources/devices/client/Client.js +238 -0
  5. package/dist/api/resources/devices/client/index.d.ts +1 -0
  6. package/dist/api/resources/devices/client/index.js +17 -0
  7. package/dist/api/resources/devices/client/requests/DeregisterDeviceRequest.d.ts +9 -0
  8. package/dist/api/resources/devices/client/requests/DeregisterDeviceRequest.js +3 -0
  9. package/dist/api/resources/devices/client/requests/RegisterDevice.d.ts +22 -0
  10. package/dist/api/resources/devices/client/requests/RegisterDevice.js +13 -0
  11. package/dist/api/resources/devices/client/requests/index.d.ts +2 -0
  12. package/dist/api/resources/devices/client/requests/index.js +5 -0
  13. package/dist/api/resources/devices/exports.d.ts +2 -0
  14. package/dist/api/resources/devices/exports.js +21 -0
  15. package/dist/api/resources/devices/index.d.ts +1 -0
  16. package/dist/api/resources/devices/index.js +17 -0
  17. package/dist/api/resources/index.d.ts +6 -0
  18. package/dist/api/resources/index.js +7 -1
  19. package/dist/api/resources/notificationPreferences/client/Client.d.ts +49 -0
  20. package/dist/api/resources/notificationPreferences/client/Client.js +175 -0
  21. package/dist/api/resources/notificationPreferences/client/index.d.ts +1 -0
  22. package/dist/api/resources/notificationPreferences/client/index.js +17 -0
  23. package/dist/api/resources/notificationPreferences/client/requests/UpdateNotificationPreferences.d.ts +11 -0
  24. package/dist/api/resources/notificationPreferences/client/requests/UpdateNotificationPreferences.js +3 -0
  25. package/dist/api/resources/notificationPreferences/client/requests/index.d.ts +1 -0
  26. package/dist/api/resources/notificationPreferences/client/requests/index.js +2 -0
  27. package/dist/api/resources/notificationPreferences/exports.d.ts +2 -0
  28. package/dist/api/resources/notificationPreferences/exports.js +21 -0
  29. package/dist/api/resources/notificationPreferences/index.d.ts +1 -0
  30. package/dist/api/resources/notificationPreferences/index.js +17 -0
  31. package/dist/api/resources/notifications/client/Client.d.ts +88 -0
  32. package/dist/api/resources/notifications/client/Client.js +316 -0
  33. package/dist/api/resources/notifications/client/index.d.ts +1 -0
  34. package/dist/api/resources/notifications/client/index.js +17 -0
  35. package/dist/api/resources/notifications/client/requests/ListNotificationsRequest.d.ts +22 -0
  36. package/dist/api/resources/notifications/client/requests/ListNotificationsRequest.js +3 -0
  37. package/dist/api/resources/notifications/client/requests/MarkNotificationReadRequest.d.ts +9 -0
  38. package/dist/api/resources/notifications/client/requests/MarkNotificationReadRequest.js +3 -0
  39. package/dist/api/resources/notifications/client/requests/index.d.ts +2 -0
  40. package/dist/api/resources/notifications/client/requests/index.js +2 -0
  41. package/dist/api/resources/notifications/exports.d.ts +2 -0
  42. package/dist/api/resources/notifications/exports.js +21 -0
  43. package/dist/api/resources/notifications/index.d.ts +1 -0
  44. package/dist/api/resources/notifications/index.js +17 -0
  45. package/dist/api/types/ActiveOrganization.d.ts +2 -2
  46. package/dist/api/types/ActiveOrganization.js +1 -1
  47. package/dist/api/types/ActivityResource.d.ts +2 -2
  48. package/dist/api/types/ActivityResource.js +1 -1
  49. package/dist/api/types/Asset.d.ts +2 -2
  50. package/dist/api/types/Asset.js +1 -1
  51. package/dist/api/types/AssetListItem.d.ts +2 -2
  52. package/dist/api/types/AssetListItem.js +1 -1
  53. package/dist/api/types/Assignment.d.ts +2 -2
  54. package/dist/api/types/Assignment.js +1 -1
  55. package/dist/api/types/BusinessCategory.d.ts +2 -2
  56. package/dist/api/types/BusinessCategory.js +1 -1
  57. package/dist/api/types/Country.d.ts +2 -2
  58. package/dist/api/types/Country.js +1 -1
  59. package/dist/api/types/Currency.d.ts +2 -2
  60. package/dist/api/types/Currency.js +1 -1
  61. package/dist/api/types/Device.d.ts +24 -0
  62. package/dist/api/types/Device.js +11 -0
  63. package/dist/api/types/Devices.d.ts +17 -0
  64. package/dist/api/types/Devices.js +11 -0
  65. package/dist/api/types/Invite.d.ts +2 -2
  66. package/dist/api/types/Invite.js +1 -1
  67. package/dist/api/types/Language.d.ts +2 -2
  68. package/dist/api/types/Language.js +1 -1
  69. package/dist/api/types/ListResponseActivityResource.d.ts +3 -3
  70. package/dist/api/types/ListResponseActivityResource.js +1 -1
  71. package/dist/api/types/ListResponseAssetListItem.d.ts +3 -3
  72. package/dist/api/types/ListResponseAssetListItem.js +1 -1
  73. package/dist/api/types/ListResponseBusinessCategory.d.ts +3 -3
  74. package/dist/api/types/ListResponseBusinessCategory.js +1 -1
  75. package/dist/api/types/ListResponseCountry.d.ts +3 -3
  76. package/dist/api/types/ListResponseCountry.js +1 -1
  77. package/dist/api/types/ListResponseCurrency.d.ts +3 -3
  78. package/dist/api/types/ListResponseCurrency.js +1 -1
  79. package/dist/api/types/ListResponseFile.d.ts +3 -3
  80. package/dist/api/types/ListResponseFile.js +1 -1
  81. package/dist/api/types/ListResponseHeatmapCell.d.ts +3 -3
  82. package/dist/api/types/ListResponseHeatmapCell.js +1 -1
  83. package/dist/api/types/ListResponseJob.d.ts +3 -3
  84. package/dist/api/types/ListResponseJob.js +1 -1
  85. package/dist/api/types/ListResponseLanguage.d.ts +3 -3
  86. package/dist/api/types/ListResponseLanguage.js +1 -1
  87. package/dist/api/types/ListResponseMembership.d.ts +3 -3
  88. package/dist/api/types/ListResponseMembership.js +1 -1
  89. package/dist/api/types/ListResponseNotification.d.ts +27 -0
  90. package/dist/api/types/ListResponseNotification.js +11 -0
  91. package/dist/api/types/ListResponseNotificationDeadLetter.d.ts +27 -0
  92. package/dist/api/types/ListResponseNotificationDeadLetter.js +11 -0
  93. package/dist/api/types/ListResponseOperatorPosition.d.ts +3 -3
  94. package/dist/api/types/ListResponseOperatorPosition.js +1 -1
  95. package/dist/api/types/ListResponseOrganization.d.ts +3 -3
  96. package/dist/api/types/ListResponseOrganization.js +1 -1
  97. package/dist/api/types/ListResponsePosition.d.ts +3 -3
  98. package/dist/api/types/ListResponsePosition.js +1 -1
  99. package/dist/api/types/ListResponseTimezone.d.ts +3 -3
  100. package/dist/api/types/ListResponseTimezone.js +1 -1
  101. package/dist/api/types/ListResponseUserResource.d.ts +3 -3
  102. package/dist/api/types/ListResponseUserResource.js +1 -1
  103. package/dist/api/types/Membership.d.ts +2 -2
  104. package/dist/api/types/Membership.js +1 -1
  105. package/dist/api/types/Notification.d.ts +48 -0
  106. package/dist/api/types/Notification.js +27 -0
  107. package/dist/api/types/NotificationDeadLetter.d.ts +36 -0
  108. package/dist/api/types/NotificationDeadLetter.js +11 -0
  109. package/dist/api/types/NotificationPreference.d.ts +13 -0
  110. package/dist/api/types/NotificationPreference.js +3 -0
  111. package/dist/api/types/NotificationPreferenceItem.d.ts +13 -0
  112. package/dist/api/types/NotificationPreferenceItem.js +3 -0
  113. package/dist/api/types/NotificationPreferences.d.ts +17 -0
  114. package/dist/api/types/NotificationPreferences.js +11 -0
  115. package/dist/api/types/NotificationUnreadCount.d.ts +16 -0
  116. package/dist/api/types/NotificationUnreadCount.js +11 -0
  117. package/dist/api/types/NotificationsMarkedRead.d.ts +16 -0
  118. package/dist/api/types/NotificationsMarkedRead.js +11 -0
  119. package/dist/api/types/Operator.d.ts +2 -2
  120. package/dist/api/types/Operator.js +1 -1
  121. package/dist/api/types/Organization.d.ts +2 -2
  122. package/dist/api/types/Organization.js +1 -1
  123. package/dist/api/types/QuietHours.d.ts +11 -0
  124. package/dist/api/types/QuietHours.js +3 -0
  125. package/dist/api/types/RealtimeTicket.d.ts +2 -2
  126. package/dist/api/types/RealtimeTicket.js +1 -1
  127. package/dist/api/types/ReconcileResponse.d.ts +2 -2
  128. package/dist/api/types/ReconcileResponse.js +1 -1
  129. package/dist/api/types/Timezone.d.ts +2 -2
  130. package/dist/api/types/Timezone.js +1 -1
  131. package/dist/api/types/User.d.ts +2 -2
  132. package/dist/api/types/User.js +1 -1
  133. package/dist/api/types/UserResource.d.ts +2 -2
  134. package/dist/api/types/UserResource.js +1 -1
  135. package/dist/api/types/index.d.ts +12 -0
  136. package/dist/api/types/index.js +12 -0
  137. package/package.json +1 -1
package/dist/Client.d.ts CHANGED
@@ -2,12 +2,15 @@ import { ActiveOrganizationClient } from "./api/resources/activeOrganization/cli
2
2
  import { ActivityClient } from "./api/resources/activity/client/Client.js";
3
3
  import { AssetsClient } from "./api/resources/assets/client/Client.js";
4
4
  import { AssignmentsClient } from "./api/resources/assignments/client/Client.js";
5
+ import { DevicesClient } from "./api/resources/devices/client/Client.js";
5
6
  import { FilesClient } from "./api/resources/files/client/Client.js";
6
7
  import { ImportsClient } from "./api/resources/imports/client/Client.js";
7
8
  import { InvitesClient } from "./api/resources/invites/client/Client.js";
8
9
  import { JobsClient } from "./api/resources/jobs/client/Client.js";
9
10
  import { LookupsClient } from "./api/resources/lookups/client/Client.js";
10
11
  import { MembershipsClient } from "./api/resources/memberships/client/Client.js";
12
+ import { NotificationPreferencesClient } from "./api/resources/notificationPreferences/client/Client.js";
13
+ import { NotificationsClient } from "./api/resources/notifications/client/Client.js";
11
14
  import { OperatorsClient } from "./api/resources/operators/client/Client.js";
12
15
  import { OrganizationsClient } from "./api/resources/organizations/client/Client.js";
13
16
  import { PositionsClient } from "./api/resources/positions/client/Client.js";
@@ -35,7 +38,10 @@ export declare class NizamDashboardClient {
35
38
  protected _lookups: LookupsClient | undefined;
36
39
  protected _users: UsersClient | undefined;
37
40
  protected _activeOrganization: ActiveOrganizationClient | undefined;
41
+ protected _devices: DevicesClient | undefined;
38
42
  protected _memberships: MembershipsClient | undefined;
43
+ protected _notificationPreferences: NotificationPreferencesClient | undefined;
44
+ protected _notifications: NotificationsClient | undefined;
39
45
  protected _operators: OperatorsClient | undefined;
40
46
  protected _organizations: OrganizationsClient | undefined;
41
47
  protected _realtime: RealtimeClient | undefined;
@@ -52,7 +58,10 @@ export declare class NizamDashboardClient {
52
58
  get lookups(): LookupsClient;
53
59
  get users(): UsersClient;
54
60
  get activeOrganization(): ActiveOrganizationClient;
61
+ get devices(): DevicesClient;
55
62
  get memberships(): MembershipsClient;
63
+ get notificationPreferences(): NotificationPreferencesClient;
64
+ get notifications(): NotificationsClient;
56
65
  get operators(): OperatorsClient;
57
66
  get organizations(): OrganizationsClient;
58
67
  get realtime(): RealtimeClient;
package/dist/Client.js CHANGED
@@ -39,18 +39,21 @@ const Client_js_1 = require("./api/resources/activeOrganization/client/Client.js
39
39
  const Client_js_2 = require("./api/resources/activity/client/Client.js");
40
40
  const Client_js_3 = require("./api/resources/assets/client/Client.js");
41
41
  const Client_js_4 = require("./api/resources/assignments/client/Client.js");
42
- const Client_js_5 = require("./api/resources/files/client/Client.js");
43
- const Client_js_6 = require("./api/resources/imports/client/Client.js");
44
- const Client_js_7 = require("./api/resources/invites/client/Client.js");
45
- const Client_js_8 = require("./api/resources/jobs/client/Client.js");
46
- const Client_js_9 = require("./api/resources/lookups/client/Client.js");
47
- const Client_js_10 = require("./api/resources/memberships/client/Client.js");
48
- const Client_js_11 = require("./api/resources/operators/client/Client.js");
49
- const Client_js_12 = require("./api/resources/organizations/client/Client.js");
50
- const Client_js_13 = require("./api/resources/positions/client/Client.js");
51
- const Client_js_14 = require("./api/resources/realtime/client/Client.js");
52
- const Client_js_15 = require("./api/resources/taskAttempts/client/Client.js");
53
- const Client_js_16 = require("./api/resources/users/client/Client.js");
42
+ const Client_js_5 = require("./api/resources/devices/client/Client.js");
43
+ const Client_js_6 = require("./api/resources/files/client/Client.js");
44
+ const Client_js_7 = require("./api/resources/imports/client/Client.js");
45
+ const Client_js_8 = require("./api/resources/invites/client/Client.js");
46
+ const Client_js_9 = require("./api/resources/jobs/client/Client.js");
47
+ const Client_js_10 = require("./api/resources/lookups/client/Client.js");
48
+ const Client_js_11 = require("./api/resources/memberships/client/Client.js");
49
+ const Client_js_12 = require("./api/resources/notificationPreferences/client/Client.js");
50
+ const Client_js_13 = require("./api/resources/notifications/client/Client.js");
51
+ const Client_js_14 = require("./api/resources/operators/client/Client.js");
52
+ const Client_js_15 = require("./api/resources/organizations/client/Client.js");
53
+ const Client_js_16 = require("./api/resources/positions/client/Client.js");
54
+ const Client_js_17 = require("./api/resources/realtime/client/Client.js");
55
+ const Client_js_18 = require("./api/resources/taskAttempts/client/Client.js");
56
+ const Client_js_19 = require("./api/resources/users/client/Client.js");
54
57
  const BaseClient_js_1 = require("./BaseClient.js");
55
58
  const core = __importStar(require("./core/index.js"));
56
59
  class NizamDashboardClient {
@@ -67,43 +70,52 @@ class NizamDashboardClient {
67
70
  return (this._assignments ?? (this._assignments = new Client_js_4.AssignmentsClient(this._options)));
68
71
  }
69
72
  get files() {
70
- return (this._files ?? (this._files = new Client_js_5.FilesClient(this._options)));
73
+ return (this._files ?? (this._files = new Client_js_6.FilesClient(this._options)));
71
74
  }
72
75
  get positions() {
73
- return (this._positions ?? (this._positions = new Client_js_13.PositionsClient(this._options)));
76
+ return (this._positions ?? (this._positions = new Client_js_16.PositionsClient(this._options)));
74
77
  }
75
78
  get imports() {
76
- return (this._imports ?? (this._imports = new Client_js_6.ImportsClient(this._options)));
79
+ return (this._imports ?? (this._imports = new Client_js_7.ImportsClient(this._options)));
77
80
  }
78
81
  get invites() {
79
- return (this._invites ?? (this._invites = new Client_js_7.InvitesClient(this._options)));
82
+ return (this._invites ?? (this._invites = new Client_js_8.InvitesClient(this._options)));
80
83
  }
81
84
  get jobs() {
82
- return (this._jobs ?? (this._jobs = new Client_js_8.JobsClient(this._options)));
85
+ return (this._jobs ?? (this._jobs = new Client_js_9.JobsClient(this._options)));
83
86
  }
84
87
  get lookups() {
85
- return (this._lookups ?? (this._lookups = new Client_js_9.LookupsClient(this._options)));
88
+ return (this._lookups ?? (this._lookups = new Client_js_10.LookupsClient(this._options)));
86
89
  }
87
90
  get users() {
88
- return (this._users ?? (this._users = new Client_js_16.UsersClient(this._options)));
91
+ return (this._users ?? (this._users = new Client_js_19.UsersClient(this._options)));
89
92
  }
90
93
  get activeOrganization() {
91
94
  return (this._activeOrganization ?? (this._activeOrganization = new Client_js_1.ActiveOrganizationClient(this._options)));
92
95
  }
96
+ get devices() {
97
+ return (this._devices ?? (this._devices = new Client_js_5.DevicesClient(this._options)));
98
+ }
93
99
  get memberships() {
94
- return (this._memberships ?? (this._memberships = new Client_js_10.MembershipsClient(this._options)));
100
+ return (this._memberships ?? (this._memberships = new Client_js_11.MembershipsClient(this._options)));
101
+ }
102
+ get notificationPreferences() {
103
+ return (this._notificationPreferences ?? (this._notificationPreferences = new Client_js_12.NotificationPreferencesClient(this._options)));
104
+ }
105
+ get notifications() {
106
+ return (this._notifications ?? (this._notifications = new Client_js_13.NotificationsClient(this._options)));
95
107
  }
96
108
  get operators() {
97
- return (this._operators ?? (this._operators = new Client_js_11.OperatorsClient(this._options)));
109
+ return (this._operators ?? (this._operators = new Client_js_14.OperatorsClient(this._options)));
98
110
  }
99
111
  get organizations() {
100
- return (this._organizations ?? (this._organizations = new Client_js_12.OrganizationsClient(this._options)));
112
+ return (this._organizations ?? (this._organizations = new Client_js_15.OrganizationsClient(this._options)));
101
113
  }
102
114
  get realtime() {
103
- return (this._realtime ?? (this._realtime = new Client_js_14.RealtimeClient(this._options)));
115
+ return (this._realtime ?? (this._realtime = new Client_js_17.RealtimeClient(this._options)));
104
116
  }
105
117
  get taskAttempts() {
106
- return (this._taskAttempts ?? (this._taskAttempts = new Client_js_15.TaskAttemptsClient(this._options)));
118
+ return (this._taskAttempts ?? (this._taskAttempts = new Client_js_18.TaskAttemptsClient(this._options)));
107
119
  }
108
120
  /**
109
121
  * Make a passthrough request using the SDK's configured auth, retry, logging, etc.
@@ -0,0 +1,71 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
3
+ import * as core from "../../../../core/index.js";
4
+ import * as NizamDashboard from "../../../index.js";
5
+ export declare namespace DevicesClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ /**
11
+ * The authenticated user's registered push devices.
12
+ */
13
+ export declare class DevicesClient {
14
+ protected readonly _options: NormalizedClientOptionsWithAuth<DevicesClient.Options>;
15
+ constructor(options: DevicesClient.Options);
16
+ /**
17
+ * The caller's live push-device registrations, most-recently-registered first. Tokens are omitted — they are delivery secrets.
18
+ *
19
+ * @param {DevicesClient.RequestOptions} requestOptions - Request-specific configuration.
20
+ *
21
+ * @throws {@link NizamDashboard.UnauthorizedError}
22
+ * @throws {@link NizamDashboard.ForbiddenError}
23
+ * @throws {@link NizamDashboard.TooManyRequestsError}
24
+ * @throws {@link NizamDashboard.InternalServerError}
25
+ *
26
+ * @example
27
+ * await client.devices.listDevices()
28
+ */
29
+ listDevices(requestOptions?: DevicesClient.RequestOptions): core.HttpResponsePromise<NizamDashboard.Devices>;
30
+ private __listDevices;
31
+ /**
32
+ * Registers the calling user's device for push delivery, or refreshes an existing registration of the same token. Idempotent on the (user, token) key: re-posting a token refreshes its row — reviving it if the user had logged out — instead of duplicating the delivery target. The token is a secret and is never echoed back.
33
+ *
34
+ * @param {NizamDashboard.RegisterDevice} request
35
+ * @param {DevicesClient.RequestOptions} requestOptions - Request-specific configuration.
36
+ *
37
+ * @throws {@link NizamDashboard.UnauthorizedError}
38
+ * @throws {@link NizamDashboard.ForbiddenError}
39
+ * @throws {@link NizamDashboard.ConflictError}
40
+ * @throws {@link NizamDashboard.UnprocessableEntityError}
41
+ * @throws {@link NizamDashboard.TooManyRequestsError}
42
+ * @throws {@link NizamDashboard.InternalServerError}
43
+ *
44
+ * @example
45
+ * await client.devices.registerDevice({
46
+ * platform: "android",
47
+ * token: "fcm-Aa1Bb2Cc3\u2026"
48
+ * })
49
+ */
50
+ registerDevice(request: NizamDashboard.RegisterDevice, requestOptions?: DevicesClient.RequestOptions): core.HttpResponsePromise<NizamDashboard.Device>;
51
+ private __registerDevice;
52
+ /**
53
+ * Soft-deletes the caller's device so it stops receiving pushes (typically called on logout). Reversible: re-registering the same token revives the row.
54
+ *
55
+ * @param {NizamDashboard.DeregisterDeviceRequest} request
56
+ * @param {DevicesClient.RequestOptions} requestOptions - Request-specific configuration.
57
+ *
58
+ * @throws {@link NizamDashboard.UnauthorizedError}
59
+ * @throws {@link NizamDashboard.ForbiddenError}
60
+ * @throws {@link NizamDashboard.NotFoundError}
61
+ * @throws {@link NizamDashboard.TooManyRequestsError}
62
+ * @throws {@link NizamDashboard.InternalServerError}
63
+ *
64
+ * @example
65
+ * await client.devices.deregisterDevice({
66
+ * deviceId: "<string>"
67
+ * })
68
+ */
69
+ deregisterDevice(request: NizamDashboard.DeregisterDeviceRequest, requestOptions?: DevicesClient.RequestOptions): core.HttpResponsePromise<void>;
70
+ private __deregisterDevice;
71
+ }
@@ -0,0 +1,238 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.DevicesClient = void 0;
38
+ const BaseClient_js_1 = require("../../../../BaseClient.js");
39
+ const headers_js_1 = require("../../../../core/headers.js");
40
+ const core = __importStar(require("../../../../core/index.js"));
41
+ const environments = __importStar(require("../../../../environments.js"));
42
+ const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
43
+ const errors = __importStar(require("../../../../errors/index.js"));
44
+ const NizamDashboard = __importStar(require("../../../index.js"));
45
+ /**
46
+ * The authenticated user's registered push devices.
47
+ */
48
+ class DevicesClient {
49
+ constructor(options) {
50
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
51
+ }
52
+ /**
53
+ * The caller's live push-device registrations, most-recently-registered first. Tokens are omitted — they are delivery secrets.
54
+ *
55
+ * @param {DevicesClient.RequestOptions} requestOptions - Request-specific configuration.
56
+ *
57
+ * @throws {@link NizamDashboard.UnauthorizedError}
58
+ * @throws {@link NizamDashboard.ForbiddenError}
59
+ * @throws {@link NizamDashboard.TooManyRequestsError}
60
+ * @throws {@link NizamDashboard.InternalServerError}
61
+ *
62
+ * @example
63
+ * await client.devices.listDevices()
64
+ */
65
+ listDevices(requestOptions) {
66
+ return core.HttpResponsePromise.fromPromise(this.__listDevices(requestOptions));
67
+ }
68
+ async __listDevices(requestOptions) {
69
+ const _authRequest = await this._options.authProvider.getAuthRequest();
70
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
71
+ const _response = await core.fetcher({
72
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
73
+ (await core.Supplier.get(this._options.environment)) ??
74
+ environments.NizamDashboardEnvironment.Production, "v1/me/devices"),
75
+ method: "GET",
76
+ headers: _headers,
77
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
78
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
79
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
80
+ abortSignal: requestOptions?.abortSignal,
81
+ fetchFn: this._options?.fetch,
82
+ logging: this._options.logging,
83
+ });
84
+ if (_response.ok) {
85
+ return { data: _response.body, rawResponse: _response.rawResponse };
86
+ }
87
+ if (_response.error.reason === "status-code") {
88
+ switch (_response.error.statusCode) {
89
+ case 401:
90
+ throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
91
+ case 403:
92
+ throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
93
+ case 429:
94
+ throw new NizamDashboard.TooManyRequestsError(_response.error.body, _response.rawResponse);
95
+ case 500:
96
+ throw new NizamDashboard.InternalServerError(_response.error.body, _response.rawResponse);
97
+ default:
98
+ throw new errors.NizamDashboardError({
99
+ statusCode: _response.error.statusCode,
100
+ body: _response.error.body,
101
+ rawResponse: _response.rawResponse,
102
+ });
103
+ }
104
+ }
105
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/me/devices");
106
+ }
107
+ /**
108
+ * Registers the calling user's device for push delivery, or refreshes an existing registration of the same token. Idempotent on the (user, token) key: re-posting a token refreshes its row — reviving it if the user had logged out — instead of duplicating the delivery target. The token is a secret and is never echoed back.
109
+ *
110
+ * @param {NizamDashboard.RegisterDevice} request
111
+ * @param {DevicesClient.RequestOptions} requestOptions - Request-specific configuration.
112
+ *
113
+ * @throws {@link NizamDashboard.UnauthorizedError}
114
+ * @throws {@link NizamDashboard.ForbiddenError}
115
+ * @throws {@link NizamDashboard.ConflictError}
116
+ * @throws {@link NizamDashboard.UnprocessableEntityError}
117
+ * @throws {@link NizamDashboard.TooManyRequestsError}
118
+ * @throws {@link NizamDashboard.InternalServerError}
119
+ *
120
+ * @example
121
+ * await client.devices.registerDevice({
122
+ * platform: "android",
123
+ * token: "fcm-Aa1Bb2Cc3\u2026"
124
+ * })
125
+ */
126
+ registerDevice(request, requestOptions) {
127
+ return core.HttpResponsePromise.fromPromise(this.__registerDevice(request, requestOptions));
128
+ }
129
+ async __registerDevice(request, requestOptions) {
130
+ const _authRequest = await this._options.authProvider.getAuthRequest();
131
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
132
+ const _response = await core.fetcher({
133
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
134
+ (await core.Supplier.get(this._options.environment)) ??
135
+ environments.NizamDashboardEnvironment.Production, "v1/me/devices"),
136
+ method: "POST",
137
+ headers: _headers,
138
+ contentType: "application/json",
139
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
140
+ requestType: "json",
141
+ body: request,
142
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
143
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
144
+ abortSignal: requestOptions?.abortSignal,
145
+ fetchFn: this._options?.fetch,
146
+ logging: this._options.logging,
147
+ });
148
+ if (_response.ok) {
149
+ return { data: _response.body, rawResponse: _response.rawResponse };
150
+ }
151
+ if (_response.error.reason === "status-code") {
152
+ switch (_response.error.statusCode) {
153
+ case 401:
154
+ throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
155
+ case 403:
156
+ throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
157
+ case 409:
158
+ throw new NizamDashboard.ConflictError(_response.error.body, _response.rawResponse);
159
+ case 422:
160
+ throw new NizamDashboard.UnprocessableEntityError(_response.error.body, _response.rawResponse);
161
+ case 429:
162
+ throw new NizamDashboard.TooManyRequestsError(_response.error.body, _response.rawResponse);
163
+ case 500:
164
+ throw new NizamDashboard.InternalServerError(_response.error.body, _response.rawResponse);
165
+ default:
166
+ throw new errors.NizamDashboardError({
167
+ statusCode: _response.error.statusCode,
168
+ body: _response.error.body,
169
+ rawResponse: _response.rawResponse,
170
+ });
171
+ }
172
+ }
173
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/me/devices");
174
+ }
175
+ /**
176
+ * Soft-deletes the caller's device so it stops receiving pushes (typically called on logout). Reversible: re-registering the same token revives the row.
177
+ *
178
+ * @param {NizamDashboard.DeregisterDeviceRequest} request
179
+ * @param {DevicesClient.RequestOptions} requestOptions - Request-specific configuration.
180
+ *
181
+ * @throws {@link NizamDashboard.UnauthorizedError}
182
+ * @throws {@link NizamDashboard.ForbiddenError}
183
+ * @throws {@link NizamDashboard.NotFoundError}
184
+ * @throws {@link NizamDashboard.TooManyRequestsError}
185
+ * @throws {@link NizamDashboard.InternalServerError}
186
+ *
187
+ * @example
188
+ * await client.devices.deregisterDevice({
189
+ * deviceId: "<string>"
190
+ * })
191
+ */
192
+ deregisterDevice(request, requestOptions) {
193
+ return core.HttpResponsePromise.fromPromise(this.__deregisterDevice(request, requestOptions));
194
+ }
195
+ async __deregisterDevice(request, requestOptions) {
196
+ const { deviceId } = request;
197
+ const _authRequest = await this._options.authProvider.getAuthRequest();
198
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
199
+ const _response = await core.fetcher({
200
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
201
+ (await core.Supplier.get(this._options.environment)) ??
202
+ environments.NizamDashboardEnvironment.Production, `v1/me/devices/${core.url.encodePathParam(deviceId)}`),
203
+ method: "DELETE",
204
+ headers: _headers,
205
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
206
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
207
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
208
+ abortSignal: requestOptions?.abortSignal,
209
+ fetchFn: this._options?.fetch,
210
+ logging: this._options.logging,
211
+ });
212
+ if (_response.ok) {
213
+ return { data: undefined, rawResponse: _response.rawResponse };
214
+ }
215
+ if (_response.error.reason === "status-code") {
216
+ switch (_response.error.statusCode) {
217
+ case 401:
218
+ throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
219
+ case 403:
220
+ throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
221
+ case 404:
222
+ throw new NizamDashboard.NotFoundError(_response.error.body, _response.rawResponse);
223
+ case 429:
224
+ throw new NizamDashboard.TooManyRequestsError(_response.error.body, _response.rawResponse);
225
+ case 500:
226
+ throw new NizamDashboard.InternalServerError(_response.error.body, _response.rawResponse);
227
+ default:
228
+ throw new errors.NizamDashboardError({
229
+ statusCode: _response.error.statusCode,
230
+ body: _response.error.body,
231
+ rawResponse: _response.rawResponse,
232
+ });
233
+ }
234
+ }
235
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/v1/me/devices/{deviceId}");
236
+ }
237
+ }
238
+ exports.DevicesClient = DevicesClient;
@@ -0,0 +1 @@
1
+ export * from "./requests/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests/index.js"), exports);
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * deviceId: "<string>"
5
+ * }
6
+ */
7
+ export interface DeregisterDeviceRequest {
8
+ deviceId: string;
9
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * platform: "android",
5
+ * token: "fcm-Aa1Bb2Cc3\u2026"
6
+ * }
7
+ */
8
+ export interface RegisterDevice {
9
+ /** Push transport. */
10
+ platform: RegisterDevice.Platform;
11
+ /** The raw APNs/FCM/web-push token. Treated as a secret — never logged. */
12
+ token: string;
13
+ }
14
+ export declare namespace RegisterDevice {
15
+ /** Push transport. */
16
+ const Platform: {
17
+ readonly Ios: "ios";
18
+ readonly Android: "android";
19
+ readonly Web: "web";
20
+ };
21
+ type Platform = (typeof Platform)[keyof typeof Platform];
22
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.RegisterDevice = void 0;
5
+ var RegisterDevice;
6
+ (function (RegisterDevice) {
7
+ /** Push transport. */
8
+ RegisterDevice.Platform = {
9
+ Ios: "ios",
10
+ Android: "android",
11
+ Web: "web",
12
+ };
13
+ })(RegisterDevice || (exports.RegisterDevice = RegisterDevice = {}));
@@ -0,0 +1,2 @@
1
+ export type { DeregisterDeviceRequest } from "./DeregisterDeviceRequest.js";
2
+ export { RegisterDevice } from "./RegisterDevice.js";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RegisterDevice = void 0;
4
+ var RegisterDevice_js_1 = require("./RegisterDevice.js");
5
+ Object.defineProperty(exports, "RegisterDevice", { enumerable: true, get: function () { return RegisterDevice_js_1.RegisterDevice; } });
@@ -0,0 +1,2 @@
1
+ export { DevicesClient } from "./client/Client.js";
2
+ export * from "./client/index.js";
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.DevicesClient = void 0;
19
+ var Client_js_1 = require("./client/Client.js");
20
+ Object.defineProperty(exports, "DevicesClient", { enumerable: true, get: function () { return Client_js_1.DevicesClient; } });
21
+ __exportStar(require("./client/index.js"), exports);
@@ -0,0 +1 @@
1
+ export * from "./client/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client/index.js"), exports);
@@ -6,6 +6,8 @@ export * from "./assets/client/requests/index.js";
6
6
  export * as assets from "./assets/index.js";
7
7
  export * from "./assignments/client/requests/index.js";
8
8
  export * as assignments from "./assignments/index.js";
9
+ export * from "./devices/client/requests/index.js";
10
+ export * as devices from "./devices/index.js";
9
11
  export * from "./files/client/requests/index.js";
10
12
  export * as files from "./files/index.js";
11
13
  export * from "./imports/client/requests/index.js";
@@ -17,6 +19,10 @@ export * as jobs from "./jobs/index.js";
17
19
  export * as lookups from "./lookups/index.js";
18
20
  export * from "./memberships/client/requests/index.js";
19
21
  export * as memberships from "./memberships/index.js";
22
+ export * from "./notificationPreferences/client/requests/index.js";
23
+ export * as notificationPreferences from "./notificationPreferences/index.js";
24
+ export * from "./notifications/client/requests/index.js";
25
+ export * as notifications from "./notifications/index.js";
20
26
  export * from "./operators/client/requests/index.js";
21
27
  export * as operators from "./operators/index.js";
22
28
  export * from "./organizations/client/requests/index.js";
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  };
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.users = exports.taskAttempts = exports.realtime = exports.positions = exports.organizations = exports.operators = exports.memberships = exports.lookups = exports.jobs = exports.invites = exports.imports = exports.files = exports.assignments = exports.assets = exports.activity = exports.activeOrganization = void 0;
39
+ exports.users = exports.taskAttempts = exports.realtime = exports.positions = exports.organizations = exports.operators = exports.notifications = exports.notificationPreferences = exports.memberships = exports.lookups = exports.jobs = exports.invites = exports.imports = exports.files = exports.devices = exports.assignments = exports.assets = exports.activity = exports.activeOrganization = void 0;
40
40
  __exportStar(require("./activeOrganization/client/requests/index.js"), exports);
41
41
  exports.activeOrganization = __importStar(require("./activeOrganization/index.js"));
42
42
  __exportStar(require("./activity/client/requests/index.js"), exports);
@@ -45,6 +45,8 @@ __exportStar(require("./assets/client/requests/index.js"), exports);
45
45
  exports.assets = __importStar(require("./assets/index.js"));
46
46
  __exportStar(require("./assignments/client/requests/index.js"), exports);
47
47
  exports.assignments = __importStar(require("./assignments/index.js"));
48
+ __exportStar(require("./devices/client/requests/index.js"), exports);
49
+ exports.devices = __importStar(require("./devices/index.js"));
48
50
  __exportStar(require("./files/client/requests/index.js"), exports);
49
51
  exports.files = __importStar(require("./files/index.js"));
50
52
  __exportStar(require("./imports/client/requests/index.js"), exports);
@@ -56,6 +58,10 @@ exports.jobs = __importStar(require("./jobs/index.js"));
56
58
  exports.lookups = __importStar(require("./lookups/index.js"));
57
59
  __exportStar(require("./memberships/client/requests/index.js"), exports);
58
60
  exports.memberships = __importStar(require("./memberships/index.js"));
61
+ __exportStar(require("./notificationPreferences/client/requests/index.js"), exports);
62
+ exports.notificationPreferences = __importStar(require("./notificationPreferences/index.js"));
63
+ __exportStar(require("./notifications/client/requests/index.js"), exports);
64
+ exports.notifications = __importStar(require("./notifications/index.js"));
59
65
  __exportStar(require("./operators/client/requests/index.js"), exports);
60
66
  exports.operators = __importStar(require("./operators/index.js"));
61
67
  __exportStar(require("./organizations/client/requests/index.js"), exports);