@nizam-os/dashboard-sdk 1.0.1 → 3.0.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 (80) hide show
  1. package/dist/Client.d.ts +8 -5
  2. package/dist/Client.js +13 -9
  3. package/dist/api/errors/BadRequestError.d.ts +6 -0
  4. package/dist/api/errors/BadRequestError.js +54 -0
  5. package/dist/api/errors/index.d.ts +1 -0
  6. package/dist/api/errors/index.js +1 -0
  7. package/dist/api/resources/assets/client/Client.d.ts +1 -0
  8. package/dist/api/resources/assets/client/Client.js +3 -0
  9. package/dist/api/resources/index.d.ts +4 -2
  10. package/dist/api/resources/index.js +5 -3
  11. package/dist/api/resources/invites/client/requests/CreateInviteRequest.d.ts +2 -2
  12. package/dist/api/resources/invites/client/requests/CreateInviteRequest.js +1 -1
  13. package/dist/api/resources/lookups/client/Client.d.ts +45 -1
  14. package/dist/api/resources/lookups/client/Client.js +192 -1
  15. package/dist/api/resources/memberships/client/Client.d.ts +52 -0
  16. package/dist/api/resources/memberships/client/Client.js +181 -0
  17. package/dist/api/resources/memberships/client/requests/ListMyMembershipsRequest.d.ts +15 -0
  18. package/dist/api/resources/memberships/client/requests/index.d.ts +2 -0
  19. package/dist/api/resources/memberships/exports.d.ts +2 -0
  20. package/dist/api/resources/memberships/exports.js +21 -0
  21. package/dist/api/resources/organizations/client/Client.d.ts +1 -34
  22. package/dist/api/resources/organizations/client/Client.js +1 -118
  23. package/dist/api/resources/organizations/client/requests/index.d.ts +0 -1
  24. package/dist/api/resources/{identity → users}/client/Client.d.ts +25 -21
  25. package/dist/api/resources/{identity → users}/client/Client.js +29 -19
  26. package/dist/api/resources/users/client/index.d.ts +1 -0
  27. package/dist/api/resources/users/client/index.js +17 -0
  28. package/dist/api/resources/users/client/requests/ListUsersRequest.d.ts +17 -0
  29. package/dist/api/resources/users/client/requests/UserUpdateRequest.js +3 -0
  30. package/dist/api/resources/users/client/requests/index.js +2 -0
  31. package/dist/api/resources/users/exports.d.ts +2 -0
  32. package/dist/api/resources/{identity → users}/exports.js +2 -2
  33. package/dist/api/resources/users/index.d.ts +1 -0
  34. package/dist/api/resources/users/index.js +17 -0
  35. package/dist/api/types/BusinessCategory.d.ts +18 -0
  36. package/dist/api/types/BusinessCategory.js +11 -0
  37. package/dist/api/types/Country.d.ts +20 -0
  38. package/dist/api/types/Country.js +11 -0
  39. package/dist/api/types/Currency.d.ts +22 -0
  40. package/dist/api/types/Currency.js +11 -0
  41. package/dist/api/types/Language.d.ts +20 -0
  42. package/dist/api/types/Language.js +11 -0
  43. package/dist/api/types/ListResponseBusinessCategory.d.ts +27 -0
  44. package/dist/api/types/ListResponseBusinessCategory.js +11 -0
  45. package/dist/api/types/ListResponseCountry.d.ts +27 -0
  46. package/dist/api/types/{ListResponse.js → ListResponseCountry.js} +5 -5
  47. package/dist/api/types/ListResponseCurrency.d.ts +27 -0
  48. package/dist/api/types/ListResponseCurrency.js +11 -0
  49. package/dist/api/types/ListResponseLanguage.d.ts +27 -0
  50. package/dist/api/types/ListResponseLanguage.js +11 -0
  51. package/dist/api/types/ListResponseMembership.d.ts +27 -0
  52. package/dist/api/types/ListResponseMembership.js +11 -0
  53. package/dist/api/types/ListResponseTimezone.d.ts +27 -0
  54. package/dist/api/types/ListResponseTimezone.js +11 -0
  55. package/dist/api/types/{ListResponse.d.ts → ListResponseUserResource.d.ts} +7 -3
  56. package/dist/api/types/ListResponseUserResource.js +11 -0
  57. package/dist/api/types/{OrganizationMembership.d.ts → Membership.d.ts} +5 -5
  58. package/dist/api/types/{OrganizationMembership.js → Membership.js} +7 -7
  59. package/dist/api/types/Timezone.d.ts +20 -0
  60. package/dist/api/types/Timezone.js +11 -0
  61. package/dist/api/types/index.d.ts +13 -2
  62. package/dist/api/types/index.js +13 -2
  63. package/package.json +1 -1
  64. package/dist/api/resources/identity/client/requests/ListUsersRequest.d.ts +0 -10
  65. package/dist/api/resources/identity/exports.d.ts +0 -2
  66. /package/dist/api/resources/{identity → memberships}/client/index.d.ts +0 -0
  67. /package/dist/api/resources/{identity → memberships}/client/index.js +0 -0
  68. /package/dist/api/resources/{organizations → memberships}/client/requests/LeaveOrganizationRequest.d.ts +0 -0
  69. /package/dist/api/resources/{organizations → memberships}/client/requests/LeaveOrganizationRequest.js +0 -0
  70. /package/dist/api/resources/{identity/client/requests/InviteUserRequest.js → memberships/client/requests/ListMyMembershipsRequest.js} +0 -0
  71. /package/dist/api/resources/{identity → memberships}/client/requests/index.js +0 -0
  72. /package/dist/api/resources/{identity → memberships}/index.d.ts +0 -0
  73. /package/dist/api/resources/{identity → memberships}/index.js +0 -0
  74. /package/dist/api/resources/{identity → users}/client/requests/InviteUserRequest.d.ts +0 -0
  75. /package/dist/api/resources/{identity/client/requests/ListUsersRequest.js → users/client/requests/InviteUserRequest.js} +0 -0
  76. /package/dist/api/resources/{identity/client/requests/SoftDeleteUserRequest.js → users/client/requests/ListUsersRequest.js} +0 -0
  77. /package/dist/api/resources/{identity → users}/client/requests/SoftDeleteUserRequest.d.ts +0 -0
  78. /package/dist/api/resources/{identity/client/requests/UserUpdateRequest.js → users/client/requests/SoftDeleteUserRequest.js} +0 -0
  79. /package/dist/api/resources/{identity → users}/client/requests/UserUpdateRequest.d.ts +0 -0
  80. /package/dist/api/resources/{identity → users}/client/requests/index.d.ts +0 -0
@@ -0,0 +1,181 @@
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.MembershipsClient = 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
+ * User ↔ organization memberships — list, join, leave, role checks.
47
+ */
48
+ class MembershipsClient {
49
+ constructor(options) {
50
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
51
+ }
52
+ /**
53
+ * Returns the caller's organization memberships — each entry is a `{organization, role}` pair, so the role per org is available without a second fetch. Bounded by the caller's own memberships — typically under 50 — and returned in a single page; the response carries the standard `ListResponse` envelope and a `first` Link header rel for wire-shape consistency with paginated endpoints, but the `starting_after` / `ending_before` cursors are no-ops here. Promote to keyset pagination when membership counts grow to where a single page is no longer enough.
54
+ *
55
+ * @param {NizamDashboard.ListMyMembershipsRequest} request
56
+ * @param {MembershipsClient.RequestOptions} requestOptions - Request-specific configuration.
57
+ *
58
+ * @throws {@link NizamDashboard.UnauthorizedError}
59
+ * @throws {@link NizamDashboard.ForbiddenError}
60
+ * @throws {@link NizamDashboard.InternalServerError}
61
+ *
62
+ * @example
63
+ * await client.memberships.listMyMemberships({
64
+ * starting_after: "Y3Vyc29yX25leHRfMDFKNVE=",
65
+ * ending_before: "Y3Vyc29yX25leHRfMDFKNVE="
66
+ * })
67
+ */
68
+ listMyMemberships(request = {}, requestOptions) {
69
+ return core.HttpResponsePromise.fromPromise(this.__listMyMemberships(request, requestOptions));
70
+ }
71
+ async __listMyMemberships(request = {}, requestOptions) {
72
+ const { limit, starting_after: startingAfter, ending_before: endingBefore } = request;
73
+ const _queryParams = {
74
+ limit,
75
+ starting_after: startingAfter,
76
+ ending_before: endingBefore,
77
+ };
78
+ const _authRequest = await this._options.authProvider.getAuthRequest();
79
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
80
+ const _response = await core.fetcher({
81
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
82
+ (await core.Supplier.get(this._options.environment)) ??
83
+ environments.NizamDashboardEnvironment.Production, "v1/me/memberships"),
84
+ method: "GET",
85
+ headers: _headers,
86
+ queryString: core.url
87
+ .queryBuilder()
88
+ .addMany(_queryParams)
89
+ .mergeAdditional(requestOptions?.queryParams)
90
+ .build(),
91
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
92
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
93
+ abortSignal: requestOptions?.abortSignal,
94
+ fetchFn: this._options?.fetch,
95
+ logging: this._options.logging,
96
+ });
97
+ if (_response.ok) {
98
+ return {
99
+ data: _response.body,
100
+ rawResponse: _response.rawResponse,
101
+ };
102
+ }
103
+ if (_response.error.reason === "status-code") {
104
+ switch (_response.error.statusCode) {
105
+ case 401:
106
+ throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
107
+ case 403:
108
+ throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
109
+ case 500:
110
+ throw new NizamDashboard.InternalServerError(_response.error.body, _response.rawResponse);
111
+ default:
112
+ throw new errors.NizamDashboardError({
113
+ statusCode: _response.error.statusCode,
114
+ body: _response.error.body,
115
+ rawResponse: _response.rawResponse,
116
+ });
117
+ }
118
+ }
119
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/me/memberships");
120
+ }
121
+ /**
122
+ * Removes the caller's membership from the organization. The owner cannot leave — they must transfer ownership (future endpoint) or delete the org instead.
123
+ *
124
+ * @param {NizamDashboard.LeaveOrganizationRequest} request
125
+ * @param {MembershipsClient.RequestOptions} requestOptions - Request-specific configuration.
126
+ *
127
+ * @throws {@link NizamDashboard.UnauthorizedError}
128
+ * @throws {@link NizamDashboard.ForbiddenError}
129
+ * @throws {@link NizamDashboard.ConflictError}
130
+ * @throws {@link NizamDashboard.InternalServerError}
131
+ *
132
+ * @example
133
+ * await client.memberships.leaveOrganization({
134
+ * id: "00000000-0000-0000-0000-000000000000"
135
+ * })
136
+ */
137
+ leaveOrganization(request, requestOptions) {
138
+ return core.HttpResponsePromise.fromPromise(this.__leaveOrganization(request, requestOptions));
139
+ }
140
+ async __leaveOrganization(request, requestOptions) {
141
+ const { id } = request;
142
+ const _authRequest = await this._options.authProvider.getAuthRequest();
143
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
144
+ const _response = await core.fetcher({
145
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
146
+ (await core.Supplier.get(this._options.environment)) ??
147
+ environments.NizamDashboardEnvironment.Production, `v1/organizations/${core.url.encodePathParam(id)}/members/me`),
148
+ method: "DELETE",
149
+ headers: _headers,
150
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
151
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
152
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
153
+ abortSignal: requestOptions?.abortSignal,
154
+ fetchFn: this._options?.fetch,
155
+ logging: this._options.logging,
156
+ });
157
+ if (_response.ok) {
158
+ return { data: undefined, rawResponse: _response.rawResponse };
159
+ }
160
+ if (_response.error.reason === "status-code") {
161
+ switch (_response.error.statusCode) {
162
+ case 401:
163
+ throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
164
+ case 403:
165
+ throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
166
+ case 409:
167
+ throw new NizamDashboard.ConflictError(_response.error.body, _response.rawResponse);
168
+ case 500:
169
+ throw new NizamDashboard.InternalServerError(_response.error.body, _response.rawResponse);
170
+ default:
171
+ throw new errors.NizamDashboardError({
172
+ statusCode: _response.error.statusCode,
173
+ body: _response.error.body,
174
+ rawResponse: _response.rawResponse,
175
+ });
176
+ }
177
+ }
178
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/v1/organizations/{id}/members/me");
179
+ }
180
+ }
181
+ exports.MembershipsClient = MembershipsClient;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * starting_after: "Y3Vyc29yX25leHRfMDFKNVE=",
5
+ * ending_before: "Y3Vyc29yX25leHRfMDFKNVE="
6
+ * }
7
+ */
8
+ export interface ListMyMembershipsRequest {
9
+ /** Page size. Default 20, maximum 100. Out-of-range values are silently clamped; the response body's `limit` field reflects what was applied. */
10
+ limit?: number;
11
+ /** Opaque cursor — return the page starting strictly after this entity in the sort order. Mutually exclusive with `ending_before`. */
12
+ starting_after?: string;
13
+ /** Opaque cursor — return the page ending strictly before this entity in the sort order. Mutually exclusive with `starting_after`. */
14
+ ending_before?: string;
15
+ }
@@ -0,0 +1,2 @@
1
+ export type { LeaveOrganizationRequest } from "./LeaveOrganizationRequest.js";
2
+ export type { ListMyMembershipsRequest } from "./ListMyMembershipsRequest.js";
@@ -0,0 +1,2 @@
1
+ export { MembershipsClient } 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.MembershipsClient = void 0;
19
+ var Client_js_1 = require("./client/Client.js");
20
+ Object.defineProperty(exports, "MembershipsClient", { enumerable: true, get: function () { return Client_js_1.MembershipsClient; } });
21
+ __exportStar(require("./client/index.js"), exports);
@@ -8,25 +8,11 @@ export declare namespace OrganizationsClient {
8
8
  }
9
9
  }
10
10
  /**
11
- * Tenantsthe top-level container for users, merchants, and operations.
11
+ * Organization aggregate tenant CRUD.
12
12
  */
13
13
  export declare class OrganizationsClient {
14
14
  protected readonly _options: NormalizedClientOptionsWithAuth<OrganizationsClient.Options>;
15
15
  constructor(options: OrganizationsClient.Options);
16
- /**
17
- * Returns every organization the calling user is a member of, with their role inside.
18
- *
19
- * @param {OrganizationsClient.RequestOptions} requestOptions - Request-specific configuration.
20
- *
21
- * @throws {@link NizamDashboard.UnauthorizedError}
22
- * @throws {@link NizamDashboard.ForbiddenError}
23
- * @throws {@link NizamDashboard.InternalServerError}
24
- *
25
- * @example
26
- * await client.organizations.listMyOrganizations()
27
- */
28
- listMyOrganizations(requestOptions?: OrganizationsClient.RequestOptions): core.HttpResponsePromise<NizamDashboard.OrganizationMembership[]>;
29
- private __listMyOrganizations;
30
16
  /**
31
17
  * Creates a brand-new tenant with the calling user as the founding admin. The id is assigned by Keycloak so the same value identifies the organization in both systems. Slug is derived from the name when not supplied.
32
18
  *
@@ -114,23 +100,4 @@ export declare class OrganizationsClient {
114
100
  */
115
101
  updateOrganization(request: NizamDashboard.UpdateOrganizationRequest, requestOptions?: OrganizationsClient.RequestOptions): core.HttpResponsePromise<NizamDashboard.Organization>;
116
102
  private __updateOrganization;
117
- /**
118
- * Removes the caller's membership from the organization. The owner cannot leave — they must transfer ownership (future endpoint) or delete the org instead.
119
- *
120
- * @param {NizamDashboard.LeaveOrganizationRequest} request
121
- * @param {OrganizationsClient.RequestOptions} requestOptions - Request-specific configuration.
122
- *
123
- * @throws {@link NizamDashboard.UnauthorizedError}
124
- * @throws {@link NizamDashboard.ForbiddenError}
125
- * @throws {@link NizamDashboard.NotFoundError}
126
- * @throws {@link NizamDashboard.ConflictError}
127
- * @throws {@link NizamDashboard.InternalServerError}
128
- *
129
- * @example
130
- * await client.organizations.leaveOrganization({
131
- * id: "00000000-0000-0000-0000-000000000000"
132
- * })
133
- */
134
- leaveOrganization(request: NizamDashboard.LeaveOrganizationRequest, requestOptions?: OrganizationsClient.RequestOptions): core.HttpResponsePromise<void>;
135
- private __leaveOrganization;
136
103
  }
@@ -43,67 +43,12 @@ const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatu
43
43
  const errors = __importStar(require("../../../../errors/index.js"));
44
44
  const NizamDashboard = __importStar(require("../../../index.js"));
45
45
  /**
46
- * Tenantsthe top-level container for users, merchants, and operations.
46
+ * Organization aggregate tenant CRUD.
47
47
  */
48
48
  class OrganizationsClient {
49
49
  constructor(options) {
50
50
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
51
51
  }
52
- /**
53
- * Returns every organization the calling user is a member of, with their role inside.
54
- *
55
- * @param {OrganizationsClient.RequestOptions} requestOptions - Request-specific configuration.
56
- *
57
- * @throws {@link NizamDashboard.UnauthorizedError}
58
- * @throws {@link NizamDashboard.ForbiddenError}
59
- * @throws {@link NizamDashboard.InternalServerError}
60
- *
61
- * @example
62
- * await client.organizations.listMyOrganizations()
63
- */
64
- listMyOrganizations(requestOptions) {
65
- return core.HttpResponsePromise.fromPromise(this.__listMyOrganizations(requestOptions));
66
- }
67
- async __listMyOrganizations(requestOptions) {
68
- const _authRequest = await this._options.authProvider.getAuthRequest();
69
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
70
- const _response = await core.fetcher({
71
- url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
72
- (await core.Supplier.get(this._options.environment)) ??
73
- environments.NizamDashboardEnvironment.Production, "v1/me/organizations"),
74
- method: "GET",
75
- headers: _headers,
76
- queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
77
- timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
78
- maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
79
- abortSignal: requestOptions?.abortSignal,
80
- fetchFn: this._options?.fetch,
81
- logging: this._options.logging,
82
- });
83
- if (_response.ok) {
84
- return {
85
- data: _response.body,
86
- rawResponse: _response.rawResponse,
87
- };
88
- }
89
- if (_response.error.reason === "status-code") {
90
- switch (_response.error.statusCode) {
91
- case 401:
92
- throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
93
- case 403:
94
- throw new NizamDashboard.ForbiddenError(_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/organizations");
106
- }
107
52
  /**
108
53
  * Creates a brand-new tenant with the calling user as the founding admin. The id is assigned by Keycloak so the same value identifies the organization in both systems. Slug is derived from the name when not supplied.
109
54
  *
@@ -366,67 +311,5 @@ class OrganizationsClient {
366
311
  }
367
312
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/v1/organizations/{id}");
368
313
  }
369
- /**
370
- * Removes the caller's membership from the organization. The owner cannot leave — they must transfer ownership (future endpoint) or delete the org instead.
371
- *
372
- * @param {NizamDashboard.LeaveOrganizationRequest} request
373
- * @param {OrganizationsClient.RequestOptions} requestOptions - Request-specific configuration.
374
- *
375
- * @throws {@link NizamDashboard.UnauthorizedError}
376
- * @throws {@link NizamDashboard.ForbiddenError}
377
- * @throws {@link NizamDashboard.NotFoundError}
378
- * @throws {@link NizamDashboard.ConflictError}
379
- * @throws {@link NizamDashboard.InternalServerError}
380
- *
381
- * @example
382
- * await client.organizations.leaveOrganization({
383
- * id: "00000000-0000-0000-0000-000000000000"
384
- * })
385
- */
386
- leaveOrganization(request, requestOptions) {
387
- return core.HttpResponsePromise.fromPromise(this.__leaveOrganization(request, requestOptions));
388
- }
389
- async __leaveOrganization(request, requestOptions) {
390
- const { id } = request;
391
- const _authRequest = await this._options.authProvider.getAuthRequest();
392
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
393
- const _response = await core.fetcher({
394
- url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
395
- (await core.Supplier.get(this._options.environment)) ??
396
- environments.NizamDashboardEnvironment.Production, `v1/organizations/${core.url.encodePathParam(id)}/members/me`),
397
- method: "DELETE",
398
- headers: _headers,
399
- queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
400
- timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
401
- maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
402
- abortSignal: requestOptions?.abortSignal,
403
- fetchFn: this._options?.fetch,
404
- logging: this._options.logging,
405
- });
406
- if (_response.ok) {
407
- return { data: undefined, rawResponse: _response.rawResponse };
408
- }
409
- if (_response.error.reason === "status-code") {
410
- switch (_response.error.statusCode) {
411
- case 401:
412
- throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
413
- case 403:
414
- throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
415
- case 404:
416
- throw new NizamDashboard.NotFoundError(_response.error.body, _response.rawResponse);
417
- case 409:
418
- throw new NizamDashboard.ConflictError(_response.error.body, _response.rawResponse);
419
- case 500:
420
- throw new NizamDashboard.InternalServerError(_response.error.body, _response.rawResponse);
421
- default:
422
- throw new errors.NizamDashboardError({
423
- statusCode: _response.error.statusCode,
424
- body: _response.error.body,
425
- rawResponse: _response.rawResponse,
426
- });
427
- }
428
- }
429
- return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/v1/organizations/{id}/members/me");
430
- }
431
314
  }
432
315
  exports.OrganizationsClient = OrganizationsClient;
@@ -1,5 +1,4 @@
1
1
  export type { CreateOrganizationRequest } from "./CreateOrganizationRequest.js";
2
2
  export type { DeleteOrganizationRequest } from "./DeleteOrganizationRequest.js";
3
3
  export type { GetOrganizationRequest } from "./GetOrganizationRequest.js";
4
- export type { LeaveOrganizationRequest } from "./LeaveOrganizationRequest.js";
5
4
  export type { UpdateOrganizationRequest } from "./UpdateOrganizationRequest.js";
@@ -2,17 +2,17 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie
2
2
  import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
3
3
  import * as core from "../../../../core/index.js";
4
4
  import * as NizamDashboard from "../../../index.js";
5
- export declare namespace IdentityClient {
5
+ export declare namespace UsersClient {
6
6
  type Options = BaseClientOptions;
7
7
  interface RequestOptions extends BaseRequestOptions {
8
8
  }
9
9
  }
10
10
  /**
11
- * Users, organizations, and the active session.
11
+ * User aggregate — current session (`/me`) and user-entity operations (invite, list, lifecycle, platform-staff admin).
12
12
  */
13
- export declare class IdentityClient {
14
- protected readonly _options: NormalizedClientOptionsWithAuth<IdentityClient.Options>;
15
- constructor(options: IdentityClient.Options);
13
+ export declare class UsersClient {
14
+ protected readonly _options: NormalizedClientOptionsWithAuth<UsersClient.Options>;
15
+ constructor(options: UsersClient.Options);
16
16
  /**
17
17
  * Returns the authenticated user merged with profile claims from their JWT.
18
18
  *
@@ -24,7 +24,7 @@ export declare class IdentityClient {
24
24
  * client roles (prefixed, e.g. `dashboard:dispatcher`). The frontend usually drops the
25
25
  * portal prefix when rendering since it knows its own portal.
26
26
  *
27
- * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
27
+ * @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
28
28
  *
29
29
  * @throws {@link NizamDashboard.UnauthorizedError}
30
30
  * @throws {@link NizamDashboard.ForbiddenError}
@@ -32,30 +32,34 @@ export declare class IdentityClient {
32
32
  * @throws {@link NizamDashboard.InternalServerError}
33
33
  *
34
34
  * @example
35
- * await client.identity.me()
35
+ * await client.users.me()
36
36
  */
37
- me(requestOptions?: IdentityClient.RequestOptions): core.HttpResponsePromise<NizamDashboard.User>;
37
+ me(requestOptions?: UsersClient.RequestOptions): core.HttpResponsePromise<NizamDashboard.User>;
38
38
  private __me;
39
39
  /**
40
- * Dashboard sees the active set; platform staff additionally see soft-deleted rows and may sort by `deleted_at`.
40
+ * Dashboard sees co-members of the caller's active organization (tenant-scoped via the organization_users join). Platform staff bypass RLS and see across tenants, and may sort by `deleted_at`. RFC 8288 Link header carries `first`, `prev`, `next` rels alongside the body's bidirectional cursors.
41
41
  *
42
42
  * @param {NizamDashboard.ListUsersRequest} request
43
- * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
43
+ * @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
44
44
  *
45
+ * @throws {@link NizamDashboard.BadRequestError}
45
46
  * @throws {@link NizamDashboard.UnauthorizedError}
46
47
  * @throws {@link NizamDashboard.ForbiddenError}
47
48
  * @throws {@link NizamDashboard.InternalServerError}
48
49
  *
49
50
  * @example
50
- * await client.identity.listUsers()
51
+ * await client.users.listUsers({
52
+ * starting_after: "Y3Vyc29yX25leHRfMDFKNVE=",
53
+ * ending_before: "Y3Vyc29yX25leHRfMDFKNVE="
54
+ * })
51
55
  */
52
- listUsers(request?: NizamDashboard.ListUsersRequest, requestOptions?: IdentityClient.RequestOptions): core.HttpResponsePromise<NizamDashboard.ListResponse>;
56
+ listUsers(request?: NizamDashboard.ListUsersRequest, requestOptions?: UsersClient.RequestOptions): core.HttpResponsePromise<NizamDashboard.ListResponseUserResource>;
53
57
  private __listUsers;
54
58
  /**
55
59
  * Tenant-admin operation. Creates a placeholder User row that JIT provisioning replaces once the recipient completes Keycloak signup.
56
60
  *
57
61
  * @param {NizamDashboard.InviteUserRequest} request
58
- * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
62
+ * @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
59
63
  *
60
64
  * @throws {@link NizamDashboard.UnauthorizedError}
61
65
  * @throws {@link NizamDashboard.ForbiddenError}
@@ -64,18 +68,18 @@ export declare class IdentityClient {
64
68
  * @throws {@link NizamDashboard.InternalServerError}
65
69
  *
66
70
  * @example
67
- * await client.identity.inviteUser({
71
+ * await client.users.inviteUser({
68
72
  * email: "newhire@acme.example",
69
73
  * name: "New Hire"
70
74
  * })
71
75
  */
72
- inviteUser(request: NizamDashboard.InviteUserRequest, requestOptions?: IdentityClient.RequestOptions): core.HttpResponsePromise<NizamDashboard.UserResource>;
76
+ inviteUser(request: NizamDashboard.InviteUserRequest, requestOptions?: UsersClient.RequestOptions): core.HttpResponsePromise<NizamDashboard.UserResource>;
73
77
  private __inviteUser;
74
78
  /**
75
79
  * Tenant-admin operation. Sets `deleted_at = NOW()`. Subsequent dashboard reads filter the row out; platform staff can still surface and act on it.
76
80
  *
77
81
  * @param {NizamDashboard.SoftDeleteUserRequest} request
78
- * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
82
+ * @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
79
83
  *
80
84
  * @throws {@link NizamDashboard.UnauthorizedError}
81
85
  * @throws {@link NizamDashboard.ForbiddenError}
@@ -83,17 +87,17 @@ export declare class IdentityClient {
83
87
  * @throws {@link NizamDashboard.InternalServerError}
84
88
  *
85
89
  * @example
86
- * await client.identity.softDeleteUser({
90
+ * await client.users.softDeleteUser({
87
91
  * id: "00000000-0000-0000-0000-000000000000"
88
92
  * })
89
93
  */
90
- softDeleteUser(request: NizamDashboard.SoftDeleteUserRequest, requestOptions?: IdentityClient.RequestOptions): core.HttpResponsePromise<void>;
94
+ softDeleteUser(request: NizamDashboard.SoftDeleteUserRequest, requestOptions?: UsersClient.RequestOptions): core.HttpResponsePromise<void>;
91
95
  private __softDeleteUser;
92
96
  /**
93
97
  * Tenant-admin operation. Body has no `status` — lifecycle changes go through the platform-staff surface.
94
98
  *
95
99
  * @param {NizamDashboard.UserUpdateRequest} request
96
- * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
100
+ * @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
97
101
  *
98
102
  * @throws {@link NizamDashboard.UnauthorizedError}
99
103
  * @throws {@link NizamDashboard.ForbiddenError}
@@ -103,12 +107,12 @@ export declare class IdentityClient {
103
107
  * @throws {@link NizamDashboard.InternalServerError}
104
108
  *
105
109
  * @example
106
- * await client.identity.updateUser({
110
+ * await client.users.updateUser({
107
111
  * id: "00000000-0000-0000-0000-000000000000",
108
112
  * email: "renamed@acme.example",
109
113
  * name: "Ali Issa"
110
114
  * })
111
115
  */
112
- updateUser(request: NizamDashboard.UserUpdateRequest, requestOptions?: IdentityClient.RequestOptions): core.HttpResponsePromise<NizamDashboard.UserResource>;
116
+ updateUser(request: NizamDashboard.UserUpdateRequest, requestOptions?: UsersClient.RequestOptions): core.HttpResponsePromise<NizamDashboard.UserResource>;
113
117
  private __updateUser;
114
118
  }