@vitable-inc/vitable-connect 2.1.0 → 4.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 (46) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/index.d.ts +0 -1
  3. package/dist/cjs/api/resources/index.js +0 -1
  4. package/dist/cjs/api/resources/organizations/client/Client.d.ts +2 -27
  5. package/dist/cjs/api/resources/organizations/client/Client.js +2 -80
  6. package/dist/cjs/api/resources/organizations/client/index.d.ts +1 -1
  7. package/dist/cjs/api/resources/organizations/client/index.js +0 -15
  8. package/dist/cjs/api/types/{Organization.d.ts → OrganizationMembership.d.ts} +10 -1
  9. package/dist/cjs/api/types/OrganizationUserRole.d.ts +13 -0
  10. package/dist/cjs/api/types/OrganizationUserRole.js +16 -0
  11. package/dist/cjs/api/types/OrganizationsListResponse.d.ts +1 -1
  12. package/dist/cjs/api/types/index.d.ts +2 -2
  13. package/dist/cjs/api/types/index.js +2 -2
  14. package/dist/cjs/version.d.ts +1 -1
  15. package/dist/cjs/version.js +1 -1
  16. package/dist/esm/BaseClient.mjs +2 -2
  17. package/dist/esm/api/resources/index.d.mts +0 -1
  18. package/dist/esm/api/resources/index.mjs +0 -1
  19. package/dist/esm/api/resources/organizations/client/Client.d.mts +2 -27
  20. package/dist/esm/api/resources/organizations/client/Client.mjs +2 -80
  21. package/dist/esm/api/resources/organizations/client/index.d.mts +1 -1
  22. package/dist/esm/api/resources/organizations/client/index.mjs +1 -1
  23. package/dist/esm/api/types/{Organization.d.mts → OrganizationMembership.d.mts} +10 -1
  24. package/dist/esm/api/types/OrganizationUserRole.d.mts +13 -0
  25. package/dist/esm/api/types/OrganizationUserRole.mjs +13 -0
  26. package/dist/esm/api/types/OrganizationsListResponse.d.mts +1 -1
  27. package/dist/esm/api/types/index.d.mts +2 -2
  28. package/dist/esm/api/types/index.mjs +2 -2
  29. package/dist/esm/version.d.mts +1 -1
  30. package/dist/esm/version.mjs +1 -1
  31. package/package.json +1 -1
  32. package/reference.md +1 -67
  33. package/dist/cjs/api/resources/organizations/client/requests/CreateOrganizationRequest.d.ts +0 -14
  34. package/dist/cjs/api/resources/organizations/client/requests/index.d.ts +0 -1
  35. package/dist/cjs/api/resources/organizations/client/requests/index.js +0 -2
  36. package/dist/cjs/api/types/CreateOrganizationRequestType.d.ts +0 -17
  37. package/dist/cjs/api/types/CreateOrganizationRequestType.js +0 -20
  38. package/dist/cjs/api/types/Organization.js +0 -3
  39. package/dist/esm/api/resources/organizations/client/requests/CreateOrganizationRequest.d.mts +0 -14
  40. package/dist/esm/api/resources/organizations/client/requests/index.d.mts +0 -1
  41. package/dist/esm/api/resources/organizations/client/requests/index.mjs +0 -1
  42. package/dist/esm/api/types/CreateOrganizationRequestType.d.mts +0 -17
  43. package/dist/esm/api/types/CreateOrganizationRequestType.mjs +0 -17
  44. package/dist/esm/api/types/Organization.mjs +0 -2
  45. /package/dist/cjs/api/{resources/organizations/client/requests/CreateOrganizationRequest.js → types/OrganizationMembership.js} +0 -0
  46. /package/dist/esm/api/{resources/organizations/client/requests/CreateOrganizationRequest.mjs → types/OrganizationMembership.mjs} +0 -0
@@ -44,8 +44,8 @@ function normalizeClientOptions(options) {
44
44
  const headers = (0, headers_js_1.mergeHeaders)({
45
45
  "X-Fern-Language": "JavaScript",
46
46
  "X-Fern-SDK-Name": "@vitable-inc/vitable-connect",
47
- "X-Fern-SDK-Version": "2.1.0",
48
- "User-Agent": "@vitable-inc/vitable-connect/2.1.0",
47
+ "X-Fern-SDK-Version": "4.0.0",
48
+ "User-Agent": "@vitable-inc/vitable-connect/4.0.0",
49
49
  "X-Fern-Runtime": core.RUNTIME.type,
50
50
  "X-Fern-Runtime-Version": core.RUNTIME.version,
51
51
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -10,7 +10,6 @@ export * from "./groups/client/requests/index.js";
10
10
  export * as groups from "./groups/index.js";
11
11
  export * from "./members/client/requests/index.js";
12
12
  export * as members from "./members/index.js";
13
- export * from "./organizations/client/requests/index.js";
14
13
  export * as organizations from "./organizations/index.js";
15
14
  export * from "./plans/client/requests/index.js";
16
15
  export * as plans from "./plans/index.js";
@@ -49,7 +49,6 @@ __exportStar(require("./groups/client/requests/index.js"), exports);
49
49
  exports.groups = __importStar(require("./groups/index.js"));
50
50
  __exportStar(require("./members/client/requests/index.js"), exports);
51
51
  exports.members = __importStar(require("./members/index.js"));
52
- __exportStar(require("./organizations/client/requests/index.js"), exports);
53
52
  exports.organizations = __importStar(require("./organizations/index.js"));
54
53
  __exportStar(require("./plans/client/requests/index.js"), exports);
55
54
  exports.plans = __importStar(require("./plans/index.js"));
@@ -8,13 +8,13 @@ export declare namespace OrganizationsClient {
8
8
  }
9
9
  }
10
10
  /**
11
- * Onboard a partner organization and list the organizations the authenticated caller is an active member of.
11
+ * List the organizations the authenticated caller is an active member of, to discover the ids accepted by `X-Vitable-Organization`.
12
12
  */
13
13
  export declare class OrganizationsClient {
14
14
  protected readonly _options: NormalizedClientOptionsWithAuth<OrganizationsClient.Options>;
15
15
  constructor(options?: OrganizationsClient.Options);
16
16
  /**
17
- * Lists the organizations the authenticated caller is an active member of (paginated). Returns an empty list when the caller belongs to no organizations.
17
+ * Lists the organizations the authenticated caller is an active member of (paginated), each with the role the caller holds in it. Returns an empty list when the caller belongs to no organizations.
18
18
  *
19
19
  * @param {OrganizationsClient.RequestOptions} requestOptions - Request-specific configuration.
20
20
  *
@@ -34,29 +34,4 @@ export declare class OrganizationsClient {
34
34
  */
35
35
  list(requestOptions?: OrganizationsClient.RequestOptions): core.HttpResponsePromise<VitableConnect.OrganizationsListResponse>;
36
36
  private __list;
37
- /**
38
- * Onboards the authenticated user's partner Organization: creates the local Organization + the creator's admin membership atomically, then mirrors it to WorkOS (creates the WorkOS org and binds the creator as admin). A user may hold several organizations and selects which one a request acts as with the `X-Vitable-Organization` header. The founder's email domain is claimed only when no other organization holds it, so a taken domain is left with its owner rather than rejected.
39
- *
40
- * @param {VitableConnect.CreateOrganizationRequest} request
41
- * @param {OrganizationsClient.RequestOptions} requestOptions - Request-specific configuration.
42
- *
43
- * @throws {@link VitableConnect.BadRequestError}
44
- * @throws {@link VitableConnect.UnauthorizedError}
45
- * @throws {@link VitableConnect.ForbiddenError}
46
- * @throws {@link VitableConnect.NotFoundError}
47
- * @throws {@link VitableConnect.ConflictError}
48
- * @throws {@link VitableConnect.TooManyRequestsError}
49
- * @throws {@link VitableConnect.InternalServerError}
50
- * @throws {@link VitableConnect.BadGatewayError}
51
- * @throws {@link errors.VitableConnectError}
52
- * @throws {@link errors.VitableConnectTimeoutError}
53
- *
54
- * @example
55
- * await client.organizations.create({
56
- * name: "Acme Brokerage",
57
- * type: "BROKERAGE"
58
- * })
59
- */
60
- create(request: VitableConnect.CreateOrganizationRequest, requestOptions?: OrganizationsClient.RequestOptions): core.HttpResponsePromise<VitableConnect.Organization>;
61
- private __create;
62
37
  }
@@ -47,20 +47,19 @@ exports.OrganizationsClient = void 0;
47
47
  const BaseClient_js_1 = require("../../../../BaseClient.js");
48
48
  const headers_js_1 = require("../../../../core/headers.js");
49
49
  const core = __importStar(require("../../../../core/index.js"));
50
- const requestBody_js_1 = require("../../../../core/requestBody.js");
51
50
  const environments = __importStar(require("../../../../environments.js"));
52
51
  const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
53
52
  const errors = __importStar(require("../../../../errors/index.js"));
54
53
  const VitableConnect = __importStar(require("../../../index.js"));
55
54
  /**
56
- * Onboard a partner organization and list the organizations the authenticated caller is an active member of.
55
+ * List the organizations the authenticated caller is an active member of, to discover the ids accepted by `X-Vitable-Organization`.
57
56
  */
58
57
  class OrganizationsClient {
59
58
  constructor(options = {}) {
60
59
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
61
60
  }
62
61
  /**
63
- * Lists the organizations the authenticated caller is an active member of (paginated). Returns an empty list when the caller belongs to no organizations.
62
+ * Lists the organizations the authenticated caller is an active member of (paginated), each with the role the caller holds in it. Returns an empty list when the caller belongs to no organizations.
64
63
  *
65
64
  * @param {OrganizationsClient.RequestOptions} requestOptions - Request-specific configuration.
66
65
  *
@@ -132,82 +131,5 @@ class OrganizationsClient {
132
131
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/organizations");
133
132
  });
134
133
  }
135
- /**
136
- * Onboards the authenticated user's partner Organization: creates the local Organization + the creator's admin membership atomically, then mirrors it to WorkOS (creates the WorkOS org and binds the creator as admin). A user may hold several organizations and selects which one a request acts as with the `X-Vitable-Organization` header. The founder's email domain is claimed only when no other organization holds it, so a taken domain is left with its owner rather than rejected.
137
- *
138
- * @param {VitableConnect.CreateOrganizationRequest} request
139
- * @param {OrganizationsClient.RequestOptions} requestOptions - Request-specific configuration.
140
- *
141
- * @throws {@link VitableConnect.BadRequestError}
142
- * @throws {@link VitableConnect.UnauthorizedError}
143
- * @throws {@link VitableConnect.ForbiddenError}
144
- * @throws {@link VitableConnect.NotFoundError}
145
- * @throws {@link VitableConnect.ConflictError}
146
- * @throws {@link VitableConnect.TooManyRequestsError}
147
- * @throws {@link VitableConnect.InternalServerError}
148
- * @throws {@link VitableConnect.BadGatewayError}
149
- * @throws {@link errors.VitableConnectError}
150
- * @throws {@link errors.VitableConnectTimeoutError}
151
- *
152
- * @example
153
- * await client.organizations.create({
154
- * name: "Acme Brokerage",
155
- * type: "BROKERAGE"
156
- * })
157
- */
158
- create(request, requestOptions) {
159
- return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
160
- }
161
- __create(request, requestOptions) {
162
- return __awaiter(this, void 0, void 0, function* () {
163
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
164
- const _authRequest = yield this._options.authProvider.getAuthRequest();
165
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
166
- const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
167
- url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.VitableConnectEnvironment.Production, "v1/organizations"),
168
- method: "POST",
169
- headers: _headers,
170
- contentType: "application/json",
171
- queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
172
- requestType: "json",
173
- body: (0, requestBody_js_1.mergeAdditionalBodyParameters)(request, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
174
- timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
175
- maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
176
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
177
- fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
178
- logging: this._options.logging,
179
- });
180
- if (_response.ok) {
181
- return { data: _response.body, rawResponse: _response.rawResponse };
182
- }
183
- if (_response.error.reason === "status-code") {
184
- switch (_response.error.statusCode) {
185
- case 400:
186
- throw new VitableConnect.BadRequestError(_response.error.body, _response.rawResponse);
187
- case 401:
188
- throw new VitableConnect.UnauthorizedError(_response.error.body, _response.rawResponse);
189
- case 403:
190
- throw new VitableConnect.ForbiddenError(_response.error.body, _response.rawResponse);
191
- case 404:
192
- throw new VitableConnect.NotFoundError(_response.error.body, _response.rawResponse);
193
- case 409:
194
- throw new VitableConnect.ConflictError(_response.error.body, _response.rawResponse);
195
- case 429:
196
- throw new VitableConnect.TooManyRequestsError(_response.error.body, _response.rawResponse);
197
- case 500:
198
- throw new VitableConnect.InternalServerError(_response.error.body, _response.rawResponse);
199
- case 502:
200
- throw new VitableConnect.BadGatewayError(_response.error.body, _response.rawResponse);
201
- default:
202
- throw new errors.VitableConnectError({
203
- statusCode: _response.error.statusCode,
204
- body: _response.error.body,
205
- rawResponse: _response.rawResponse,
206
- });
207
- }
208
- }
209
- return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/organizations");
210
- });
211
- }
212
134
  }
213
135
  exports.OrganizationsClient = OrganizationsClient;
@@ -1 +1 @@
1
- export * from "./requests/index.js";
1
+ export {};
@@ -1,17 +1,2 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./requests/index.js"), exports);
@@ -1,5 +1,5 @@
1
1
  import type * as VitableConnect from "../index.js";
2
- export interface Organization {
2
+ export interface OrganizationMembership {
3
3
  /** Prefixed organization identifier (`org_<base64-encoded-uuid>`). */
4
4
  id: string;
5
5
  /** Human-readable organization name. */
@@ -26,4 +26,13 @@ export interface Organization {
26
26
  idp_provider: VitableConnect.IdpProvider | null;
27
27
  /** Whether this organization reads across every organization. */
28
28
  super_in: boolean;
29
+ /**
30
+ * The caller's role in this organization.
31
+ *
32
+ * * `ADMIN` - Admin
33
+ * * `OPERATIONS` - Operations
34
+ * * `SALES` - Sales
35
+ * * `ENROLLMENT_AGENT` - Enrollment Agent
36
+ */
37
+ role: VitableConnect.OrganizationUserRole;
29
38
  }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * * `ADMIN` - Admin
3
+ * * `OPERATIONS` - Operations
4
+ * * `SALES` - Sales
5
+ * * `ENROLLMENT_AGENT` - Enrollment Agent
6
+ */
7
+ export declare const OrganizationUserRole: {
8
+ readonly Admin: "ADMIN";
9
+ readonly Operations: "OPERATIONS";
10
+ readonly Sales: "SALES";
11
+ readonly EnrollmentAgent: "ENROLLMENT_AGENT";
12
+ };
13
+ export type OrganizationUserRole = (typeof OrganizationUserRole)[keyof typeof OrganizationUserRole];
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.OrganizationUserRole = void 0;
5
+ /**
6
+ * * `ADMIN` - Admin
7
+ * * `OPERATIONS` - Operations
8
+ * * `SALES` - Sales
9
+ * * `ENROLLMENT_AGENT` - Enrollment Agent
10
+ */
11
+ exports.OrganizationUserRole = {
12
+ Admin: "ADMIN",
13
+ Operations: "OPERATIONS",
14
+ Sales: "SALES",
15
+ EnrollmentAgent: "ENROLLMENT_AGENT",
16
+ };
@@ -4,7 +4,7 @@ import type * as VitableConnect from "../index.js";
4
4
  */
5
5
  export interface OrganizationsListResponse {
6
6
  /** This page of organizations. */
7
- organizations: VitableConnect.Organization[];
7
+ organizations: VitableConnect.OrganizationMembership[];
8
8
  /** Total number of organizations the caller belongs to. */
9
9
  total: number;
10
10
  }
@@ -32,7 +32,6 @@ export * from "./ContributionTier.js";
32
32
  export * from "./CoverageTier.js";
33
33
  export * from "./CreatedAfter.js";
34
34
  export * from "./CreatedBefore.js";
35
- export * from "./CreateOrganizationRequestType.js";
36
35
  export * from "./DeductionDetail.js";
37
36
  export * from "./DeductionFrequency.js";
38
37
  export * from "./DigitalBenefitCard.js";
@@ -130,13 +129,14 @@ export * from "./MemberStatus.js";
130
129
  export * from "./MissingEmployeeResolution.js";
131
130
  export * from "./NameSuffix.js";
132
131
  export * from "./Offset.js";
133
- export * from "./Organization.js";
134
132
  export * from "./OrganizationEmployer.js";
135
133
  export * from "./OrganizationEmployerListResponse.js";
136
134
  export * from "./OrganizationHrisProvider.js";
137
135
  export * from "./OrganizationHrisProvidersResponse.js";
136
+ export * from "./OrganizationMembership.js";
138
137
  export * from "./OrganizationsListResponse.js";
139
138
  export * from "./OrganizationType.js";
139
+ export * from "./OrganizationUserRole.js";
140
140
  export * from "./Page.js";
141
141
  export * from "./Pagination.js";
142
142
  export * from "./PayrollAccessSetupStatus.js";
@@ -48,7 +48,6 @@ __exportStar(require("./ContributionTier.js"), exports);
48
48
  __exportStar(require("./CoverageTier.js"), exports);
49
49
  __exportStar(require("./CreatedAfter.js"), exports);
50
50
  __exportStar(require("./CreatedBefore.js"), exports);
51
- __exportStar(require("./CreateOrganizationRequestType.js"), exports);
52
51
  __exportStar(require("./DeductionDetail.js"), exports);
53
52
  __exportStar(require("./DeductionFrequency.js"), exports);
54
53
  __exportStar(require("./DigitalBenefitCard.js"), exports);
@@ -146,13 +145,14 @@ __exportStar(require("./MemberStatus.js"), exports);
146
145
  __exportStar(require("./MissingEmployeeResolution.js"), exports);
147
146
  __exportStar(require("./NameSuffix.js"), exports);
148
147
  __exportStar(require("./Offset.js"), exports);
149
- __exportStar(require("./Organization.js"), exports);
150
148
  __exportStar(require("./OrganizationEmployer.js"), exports);
151
149
  __exportStar(require("./OrganizationEmployerListResponse.js"), exports);
152
150
  __exportStar(require("./OrganizationHrisProvider.js"), exports);
153
151
  __exportStar(require("./OrganizationHrisProvidersResponse.js"), exports);
152
+ __exportStar(require("./OrganizationMembership.js"), exports);
154
153
  __exportStar(require("./OrganizationsListResponse.js"), exports);
155
154
  __exportStar(require("./OrganizationType.js"), exports);
155
+ __exportStar(require("./OrganizationUserRole.js"), exports);
156
156
  __exportStar(require("./Page.js"), exports);
157
157
  __exportStar(require("./Pagination.js"), exports);
158
158
  __exportStar(require("./PayrollAccessSetupStatus.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "2.1.0";
1
+ export declare const SDK_VERSION = "4.0.0";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "2.1.0";
4
+ exports.SDK_VERSION = "4.0.0";
@@ -7,8 +7,8 @@ export function normalizeClientOptions(options) {
7
7
  const headers = mergeHeaders({
8
8
  "X-Fern-Language": "JavaScript",
9
9
  "X-Fern-SDK-Name": "@vitable-inc/vitable-connect",
10
- "X-Fern-SDK-Version": "2.1.0",
11
- "User-Agent": "@vitable-inc/vitable-connect/2.1.0",
10
+ "X-Fern-SDK-Version": "4.0.0",
11
+ "User-Agent": "@vitable-inc/vitable-connect/4.0.0",
12
12
  "X-Fern-Runtime": core.RUNTIME.type,
13
13
  "X-Fern-Runtime-Version": core.RUNTIME.version,
14
14
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -10,7 +10,6 @@ export * from "./groups/client/requests/index.mjs";
10
10
  export * as groups from "./groups/index.mjs";
11
11
  export * from "./members/client/requests/index.mjs";
12
12
  export * as members from "./members/index.mjs";
13
- export * from "./organizations/client/requests/index.mjs";
14
13
  export * as organizations from "./organizations/index.mjs";
15
14
  export * from "./plans/client/requests/index.mjs";
16
15
  export * as plans from "./plans/index.mjs";
@@ -10,7 +10,6 @@ export * from "./groups/client/requests/index.mjs";
10
10
  export * as groups from "./groups/index.mjs";
11
11
  export * from "./members/client/requests/index.mjs";
12
12
  export * as members from "./members/index.mjs";
13
- export * from "./organizations/client/requests/index.mjs";
14
13
  export * as organizations from "./organizations/index.mjs";
15
14
  export * from "./plans/client/requests/index.mjs";
16
15
  export * as plans from "./plans/index.mjs";
@@ -8,13 +8,13 @@ export declare namespace OrganizationsClient {
8
8
  }
9
9
  }
10
10
  /**
11
- * Onboard a partner organization and list the organizations the authenticated caller is an active member of.
11
+ * List the organizations the authenticated caller is an active member of, to discover the ids accepted by `X-Vitable-Organization`.
12
12
  */
13
13
  export declare class OrganizationsClient {
14
14
  protected readonly _options: NormalizedClientOptionsWithAuth<OrganizationsClient.Options>;
15
15
  constructor(options?: OrganizationsClient.Options);
16
16
  /**
17
- * Lists the organizations the authenticated caller is an active member of (paginated). Returns an empty list when the caller belongs to no organizations.
17
+ * Lists the organizations the authenticated caller is an active member of (paginated), each with the role the caller holds in it. Returns an empty list when the caller belongs to no organizations.
18
18
  *
19
19
  * @param {OrganizationsClient.RequestOptions} requestOptions - Request-specific configuration.
20
20
  *
@@ -34,29 +34,4 @@ export declare class OrganizationsClient {
34
34
  */
35
35
  list(requestOptions?: OrganizationsClient.RequestOptions): core.HttpResponsePromise<VitableConnect.OrganizationsListResponse>;
36
36
  private __list;
37
- /**
38
- * Onboards the authenticated user's partner Organization: creates the local Organization + the creator's admin membership atomically, then mirrors it to WorkOS (creates the WorkOS org and binds the creator as admin). A user may hold several organizations and selects which one a request acts as with the `X-Vitable-Organization` header. The founder's email domain is claimed only when no other organization holds it, so a taken domain is left with its owner rather than rejected.
39
- *
40
- * @param {VitableConnect.CreateOrganizationRequest} request
41
- * @param {OrganizationsClient.RequestOptions} requestOptions - Request-specific configuration.
42
- *
43
- * @throws {@link VitableConnect.BadRequestError}
44
- * @throws {@link VitableConnect.UnauthorizedError}
45
- * @throws {@link VitableConnect.ForbiddenError}
46
- * @throws {@link VitableConnect.NotFoundError}
47
- * @throws {@link VitableConnect.ConflictError}
48
- * @throws {@link VitableConnect.TooManyRequestsError}
49
- * @throws {@link VitableConnect.InternalServerError}
50
- * @throws {@link VitableConnect.BadGatewayError}
51
- * @throws {@link errors.VitableConnectError}
52
- * @throws {@link errors.VitableConnectTimeoutError}
53
- *
54
- * @example
55
- * await client.organizations.create({
56
- * name: "Acme Brokerage",
57
- * type: "BROKERAGE"
58
- * })
59
- */
60
- create(request: VitableConnect.CreateOrganizationRequest, requestOptions?: OrganizationsClient.RequestOptions): core.HttpResponsePromise<VitableConnect.Organization>;
61
- private __create;
62
37
  }
@@ -11,20 +11,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
12
12
  import { mergeHeaders } from "../../../../core/headers.mjs";
13
13
  import * as core from "../../../../core/index.mjs";
14
- import { mergeAdditionalBodyParameters } from "../../../../core/requestBody.mjs";
15
14
  import * as environments from "../../../../environments.mjs";
16
15
  import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
17
16
  import * as errors from "../../../../errors/index.mjs";
18
17
  import * as VitableConnect from "../../../index.mjs";
19
18
  /**
20
- * Onboard a partner organization and list the organizations the authenticated caller is an active member of.
19
+ * List the organizations the authenticated caller is an active member of, to discover the ids accepted by `X-Vitable-Organization`.
21
20
  */
22
21
  export class OrganizationsClient {
23
22
  constructor(options = {}) {
24
23
  this._options = normalizeClientOptionsWithAuth(options);
25
24
  }
26
25
  /**
27
- * Lists the organizations the authenticated caller is an active member of (paginated). Returns an empty list when the caller belongs to no organizations.
26
+ * Lists the organizations the authenticated caller is an active member of (paginated), each with the role the caller holds in it. Returns an empty list when the caller belongs to no organizations.
28
27
  *
29
28
  * @param {OrganizationsClient.RequestOptions} requestOptions - Request-specific configuration.
30
29
  *
@@ -96,81 +95,4 @@ export class OrganizationsClient {
96
95
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/organizations");
97
96
  });
98
97
  }
99
- /**
100
- * Onboards the authenticated user's partner Organization: creates the local Organization + the creator's admin membership atomically, then mirrors it to WorkOS (creates the WorkOS org and binds the creator as admin). A user may hold several organizations and selects which one a request acts as with the `X-Vitable-Organization` header. The founder's email domain is claimed only when no other organization holds it, so a taken domain is left with its owner rather than rejected.
101
- *
102
- * @param {VitableConnect.CreateOrganizationRequest} request
103
- * @param {OrganizationsClient.RequestOptions} requestOptions - Request-specific configuration.
104
- *
105
- * @throws {@link VitableConnect.BadRequestError}
106
- * @throws {@link VitableConnect.UnauthorizedError}
107
- * @throws {@link VitableConnect.ForbiddenError}
108
- * @throws {@link VitableConnect.NotFoundError}
109
- * @throws {@link VitableConnect.ConflictError}
110
- * @throws {@link VitableConnect.TooManyRequestsError}
111
- * @throws {@link VitableConnect.InternalServerError}
112
- * @throws {@link VitableConnect.BadGatewayError}
113
- * @throws {@link errors.VitableConnectError}
114
- * @throws {@link errors.VitableConnectTimeoutError}
115
- *
116
- * @example
117
- * await client.organizations.create({
118
- * name: "Acme Brokerage",
119
- * type: "BROKERAGE"
120
- * })
121
- */
122
- create(request, requestOptions) {
123
- return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
124
- }
125
- __create(request, requestOptions) {
126
- return __awaiter(this, void 0, void 0, function* () {
127
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
128
- const _authRequest = yield this._options.authProvider.getAuthRequest();
129
- const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
130
- const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
131
- url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.VitableConnectEnvironment.Production, "v1/organizations"),
132
- method: "POST",
133
- headers: _headers,
134
- contentType: "application/json",
135
- queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
136
- requestType: "json",
137
- body: mergeAdditionalBodyParameters(request, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
138
- timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
139
- maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
140
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
141
- fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
142
- logging: this._options.logging,
143
- });
144
- if (_response.ok) {
145
- return { data: _response.body, rawResponse: _response.rawResponse };
146
- }
147
- if (_response.error.reason === "status-code") {
148
- switch (_response.error.statusCode) {
149
- case 400:
150
- throw new VitableConnect.BadRequestError(_response.error.body, _response.rawResponse);
151
- case 401:
152
- throw new VitableConnect.UnauthorizedError(_response.error.body, _response.rawResponse);
153
- case 403:
154
- throw new VitableConnect.ForbiddenError(_response.error.body, _response.rawResponse);
155
- case 404:
156
- throw new VitableConnect.NotFoundError(_response.error.body, _response.rawResponse);
157
- case 409:
158
- throw new VitableConnect.ConflictError(_response.error.body, _response.rawResponse);
159
- case 429:
160
- throw new VitableConnect.TooManyRequestsError(_response.error.body, _response.rawResponse);
161
- case 500:
162
- throw new VitableConnect.InternalServerError(_response.error.body, _response.rawResponse);
163
- case 502:
164
- throw new VitableConnect.BadGatewayError(_response.error.body, _response.rawResponse);
165
- default:
166
- throw new errors.VitableConnectError({
167
- statusCode: _response.error.statusCode,
168
- body: _response.error.body,
169
- rawResponse: _response.rawResponse,
170
- });
171
- }
172
- }
173
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/organizations");
174
- });
175
- }
176
98
  }
@@ -1 +1 @@
1
- export * from "./requests/index.mjs";
1
+ export {};
@@ -1 +1 @@
1
- export * from "./requests/index.mjs";
1
+ export {};
@@ -1,5 +1,5 @@
1
1
  import type * as VitableConnect from "../index.mjs";
2
- export interface Organization {
2
+ export interface OrganizationMembership {
3
3
  /** Prefixed organization identifier (`org_<base64-encoded-uuid>`). */
4
4
  id: string;
5
5
  /** Human-readable organization name. */
@@ -26,4 +26,13 @@ export interface Organization {
26
26
  idp_provider: VitableConnect.IdpProvider | null;
27
27
  /** Whether this organization reads across every organization. */
28
28
  super_in: boolean;
29
+ /**
30
+ * The caller's role in this organization.
31
+ *
32
+ * * `ADMIN` - Admin
33
+ * * `OPERATIONS` - Operations
34
+ * * `SALES` - Sales
35
+ * * `ENROLLMENT_AGENT` - Enrollment Agent
36
+ */
37
+ role: VitableConnect.OrganizationUserRole;
29
38
  }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * * `ADMIN` - Admin
3
+ * * `OPERATIONS` - Operations
4
+ * * `SALES` - Sales
5
+ * * `ENROLLMENT_AGENT` - Enrollment Agent
6
+ */
7
+ export declare const OrganizationUserRole: {
8
+ readonly Admin: "ADMIN";
9
+ readonly Operations: "OPERATIONS";
10
+ readonly Sales: "SALES";
11
+ readonly EnrollmentAgent: "ENROLLMENT_AGENT";
12
+ };
13
+ export type OrganizationUserRole = (typeof OrganizationUserRole)[keyof typeof OrganizationUserRole];
@@ -0,0 +1,13 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ /**
3
+ * * `ADMIN` - Admin
4
+ * * `OPERATIONS` - Operations
5
+ * * `SALES` - Sales
6
+ * * `ENROLLMENT_AGENT` - Enrollment Agent
7
+ */
8
+ export const OrganizationUserRole = {
9
+ Admin: "ADMIN",
10
+ Operations: "OPERATIONS",
11
+ Sales: "SALES",
12
+ EnrollmentAgent: "ENROLLMENT_AGENT",
13
+ };
@@ -4,7 +4,7 @@ import type * as VitableConnect from "../index.mjs";
4
4
  */
5
5
  export interface OrganizationsListResponse {
6
6
  /** This page of organizations. */
7
- organizations: VitableConnect.Organization[];
7
+ organizations: VitableConnect.OrganizationMembership[];
8
8
  /** Total number of organizations the caller belongs to. */
9
9
  total: number;
10
10
  }
@@ -32,7 +32,6 @@ export * from "./ContributionTier.mjs";
32
32
  export * from "./CoverageTier.mjs";
33
33
  export * from "./CreatedAfter.mjs";
34
34
  export * from "./CreatedBefore.mjs";
35
- export * from "./CreateOrganizationRequestType.mjs";
36
35
  export * from "./DeductionDetail.mjs";
37
36
  export * from "./DeductionFrequency.mjs";
38
37
  export * from "./DigitalBenefitCard.mjs";
@@ -130,13 +129,14 @@ export * from "./MemberStatus.mjs";
130
129
  export * from "./MissingEmployeeResolution.mjs";
131
130
  export * from "./NameSuffix.mjs";
132
131
  export * from "./Offset.mjs";
133
- export * from "./Organization.mjs";
134
132
  export * from "./OrganizationEmployer.mjs";
135
133
  export * from "./OrganizationEmployerListResponse.mjs";
136
134
  export * from "./OrganizationHrisProvider.mjs";
137
135
  export * from "./OrganizationHrisProvidersResponse.mjs";
136
+ export * from "./OrganizationMembership.mjs";
138
137
  export * from "./OrganizationsListResponse.mjs";
139
138
  export * from "./OrganizationType.mjs";
139
+ export * from "./OrganizationUserRole.mjs";
140
140
  export * from "./Page.mjs";
141
141
  export * from "./Pagination.mjs";
142
142
  export * from "./PayrollAccessSetupStatus.mjs";
@@ -32,7 +32,6 @@ export * from "./ContributionTier.mjs";
32
32
  export * from "./CoverageTier.mjs";
33
33
  export * from "./CreatedAfter.mjs";
34
34
  export * from "./CreatedBefore.mjs";
35
- export * from "./CreateOrganizationRequestType.mjs";
36
35
  export * from "./DeductionDetail.mjs";
37
36
  export * from "./DeductionFrequency.mjs";
38
37
  export * from "./DigitalBenefitCard.mjs";
@@ -130,13 +129,14 @@ export * from "./MemberStatus.mjs";
130
129
  export * from "./MissingEmployeeResolution.mjs";
131
130
  export * from "./NameSuffix.mjs";
132
131
  export * from "./Offset.mjs";
133
- export * from "./Organization.mjs";
134
132
  export * from "./OrganizationEmployer.mjs";
135
133
  export * from "./OrganizationEmployerListResponse.mjs";
136
134
  export * from "./OrganizationHrisProvider.mjs";
137
135
  export * from "./OrganizationHrisProvidersResponse.mjs";
136
+ export * from "./OrganizationMembership.mjs";
138
137
  export * from "./OrganizationsListResponse.mjs";
139
138
  export * from "./OrganizationType.mjs";
139
+ export * from "./OrganizationUserRole.mjs";
140
140
  export * from "./Page.mjs";
141
141
  export * from "./Pagination.mjs";
142
142
  export * from "./PayrollAccessSetupStatus.mjs";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "2.1.0";
1
+ export declare const SDK_VERSION = "4.0.0";
@@ -1 +1 @@
1
- export const SDK_VERSION = "2.1.0";
1
+ export const SDK_VERSION = "4.0.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitable-inc/vitable-connect",
3
- "version": "2.1.0",
3
+ "version": "4.0.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
package/reference.md CHANGED
@@ -2626,7 +2626,7 @@ const response = page.response;
2626
2626
  <dl>
2627
2627
  <dd>
2628
2628
 
2629
- Lists the organizations the authenticated caller is an active member of (paginated). Returns an empty list when the caller belongs to no organizations.
2629
+ Lists the organizations the authenticated caller is an active member of (paginated), each with the role the caller holds in it. Returns an empty list when the caller belongs to no organizations.
2630
2630
  </dd>
2631
2631
  </dl>
2632
2632
  </dd>
@@ -2665,72 +2665,6 @@ await client.organizations.list();
2665
2665
  </dl>
2666
2666
 
2667
2667
 
2668
- </dd>
2669
- </dl>
2670
- </details>
2671
-
2672
- <details><summary><code>client.organizations.<a href="/src/api/resources/organizations/client/Client.ts">create</a>({ ...params }) -> VitableConnect.Organization</code></summary>
2673
- <dl>
2674
- <dd>
2675
-
2676
- #### 📝 Description
2677
-
2678
- <dl>
2679
- <dd>
2680
-
2681
- <dl>
2682
- <dd>
2683
-
2684
- Onboards the authenticated user's partner Organization: creates the local Organization + the creator's admin membership atomically, then mirrors it to WorkOS (creates the WorkOS org and binds the creator as admin). A user may hold several organizations and selects which one a request acts as with the `X-Vitable-Organization` header. The founder's email domain is claimed only when no other organization holds it, so a taken domain is left with its owner rather than rejected.
2685
- </dd>
2686
- </dl>
2687
- </dd>
2688
- </dl>
2689
-
2690
- #### 🔌 Usage
2691
-
2692
- <dl>
2693
- <dd>
2694
-
2695
- <dl>
2696
- <dd>
2697
-
2698
- ```typescript
2699
- await client.organizations.create({
2700
- name: "Acme Brokerage",
2701
- type: "BROKERAGE"
2702
- });
2703
-
2704
- ```
2705
- </dd>
2706
- </dl>
2707
- </dd>
2708
- </dl>
2709
-
2710
- #### ⚙️ Parameters
2711
-
2712
- <dl>
2713
- <dd>
2714
-
2715
- <dl>
2716
- <dd>
2717
-
2718
- **request:** `VitableConnect.CreateOrganizationRequest`
2719
-
2720
- </dd>
2721
- </dl>
2722
-
2723
- <dl>
2724
- <dd>
2725
-
2726
- **requestOptions:** `OrganizationsClient.RequestOptions`
2727
-
2728
- </dd>
2729
- </dl>
2730
- </dd>
2731
- </dl>
2732
-
2733
-
2734
2668
  </dd>
2735
2669
  </dl>
2736
2670
  </details>
@@ -1,14 +0,0 @@
1
- import type * as VitableConnect from "../../../../index.js";
2
- /**
3
- * @example
4
- * {
5
- * name: "Acme Brokerage",
6
- * type: "BROKERAGE"
7
- * }
8
- */
9
- export interface CreateOrganizationRequest {
10
- /** Legal or trading name of the organization. */
11
- name: string;
12
- /** Category of organization being onboarded. */
13
- type?: VitableConnect.CreateOrganizationRequestType | null;
14
- }
@@ -1 +0,0 @@
1
- export type { CreateOrganizationRequest } from "./CreateOrganizationRequest.js";
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,17 +0,0 @@
1
- /**
2
- * * `BROKERAGE` - BROKERAGE
3
- * * `TPA` - TPA
4
- * * `GENERAL_AGENT` - GENERAL_AGENT
5
- * * `CHANNEL_PARTNER` - CHANNEL_PARTNER
6
- * * `CONSULTING_FIRM` - CONSULTING_FIRM
7
- * * `API_PLATFORM` - API_PLATFORM
8
- */
9
- export declare const CreateOrganizationRequestType: {
10
- readonly Brokerage: "BROKERAGE";
11
- readonly Tpa: "TPA";
12
- readonly GeneralAgent: "GENERAL_AGENT";
13
- readonly ChannelPartner: "CHANNEL_PARTNER";
14
- readonly ConsultingFirm: "CONSULTING_FIRM";
15
- readonly ApiPlatform: "API_PLATFORM";
16
- };
17
- export type CreateOrganizationRequestType = (typeof CreateOrganizationRequestType)[keyof typeof CreateOrganizationRequestType];
@@ -1,20 +0,0 @@
1
- "use strict";
2
- // This file was auto-generated by Fern from our API Definition.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.CreateOrganizationRequestType = void 0;
5
- /**
6
- * * `BROKERAGE` - BROKERAGE
7
- * * `TPA` - TPA
8
- * * `GENERAL_AGENT` - GENERAL_AGENT
9
- * * `CHANNEL_PARTNER` - CHANNEL_PARTNER
10
- * * `CONSULTING_FIRM` - CONSULTING_FIRM
11
- * * `API_PLATFORM` - API_PLATFORM
12
- */
13
- exports.CreateOrganizationRequestType = {
14
- Brokerage: "BROKERAGE",
15
- Tpa: "TPA",
16
- GeneralAgent: "GENERAL_AGENT",
17
- ChannelPartner: "CHANNEL_PARTNER",
18
- ConsultingFirm: "CONSULTING_FIRM",
19
- ApiPlatform: "API_PLATFORM",
20
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // This file was auto-generated by Fern from our API Definition.
3
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,14 +0,0 @@
1
- import type * as VitableConnect from "../../../../index.mjs";
2
- /**
3
- * @example
4
- * {
5
- * name: "Acme Brokerage",
6
- * type: "BROKERAGE"
7
- * }
8
- */
9
- export interface CreateOrganizationRequest {
10
- /** Legal or trading name of the organization. */
11
- name: string;
12
- /** Category of organization being onboarded. */
13
- type?: VitableConnect.CreateOrganizationRequestType | null;
14
- }
@@ -1 +0,0 @@
1
- export type { CreateOrganizationRequest } from "./CreateOrganizationRequest.mjs";
@@ -1,17 +0,0 @@
1
- /**
2
- * * `BROKERAGE` - BROKERAGE
3
- * * `TPA` - TPA
4
- * * `GENERAL_AGENT` - GENERAL_AGENT
5
- * * `CHANNEL_PARTNER` - CHANNEL_PARTNER
6
- * * `CONSULTING_FIRM` - CONSULTING_FIRM
7
- * * `API_PLATFORM` - API_PLATFORM
8
- */
9
- export declare const CreateOrganizationRequestType: {
10
- readonly Brokerage: "BROKERAGE";
11
- readonly Tpa: "TPA";
12
- readonly GeneralAgent: "GENERAL_AGENT";
13
- readonly ChannelPartner: "CHANNEL_PARTNER";
14
- readonly ConsultingFirm: "CONSULTING_FIRM";
15
- readonly ApiPlatform: "API_PLATFORM";
16
- };
17
- export type CreateOrganizationRequestType = (typeof CreateOrganizationRequestType)[keyof typeof CreateOrganizationRequestType];
@@ -1,17 +0,0 @@
1
- // This file was auto-generated by Fern from our API Definition.
2
- /**
3
- * * `BROKERAGE` - BROKERAGE
4
- * * `TPA` - TPA
5
- * * `GENERAL_AGENT` - GENERAL_AGENT
6
- * * `CHANNEL_PARTNER` - CHANNEL_PARTNER
7
- * * `CONSULTING_FIRM` - CONSULTING_FIRM
8
- * * `API_PLATFORM` - API_PLATFORM
9
- */
10
- export const CreateOrganizationRequestType = {
11
- Brokerage: "BROKERAGE",
12
- Tpa: "TPA",
13
- GeneralAgent: "GENERAL_AGENT",
14
- ChannelPartner: "CHANNEL_PARTNER",
15
- ConsultingFirm: "CONSULTING_FIRM",
16
- ApiPlatform: "API_PLATFORM",
17
- };
@@ -1,2 +0,0 @@
1
- // This file was auto-generated by Fern from our API Definition.
2
- export {};