@slotchain/sdk 1.0.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -27,6 +27,20 @@ interface Tenant {
27
27
  id: string;
28
28
  slug: string;
29
29
  name: string;
30
+ primary_domain?: string;
31
+ subdomain?: string;
32
+ custom_domains?: string[];
33
+ branding?: {
34
+ logo?: string;
35
+ colors?: {
36
+ primary?: string;
37
+ secondary?: string;
38
+ };
39
+ };
40
+ is_public?: boolean;
41
+ metadata?: Record<string, unknown>;
42
+ created_at: string;
43
+ updated_at: string;
30
44
  }
31
45
  /**
32
46
  * Tenant branding configuration
@@ -139,6 +153,34 @@ interface DataQualityIssue {
139
153
  message: string;
140
154
  resolved: boolean;
141
155
  }
156
+ /**
157
+ * Organization type
158
+ */
159
+ interface Organization {
160
+ id: string;
161
+ slug?: string;
162
+ name: string;
163
+ description?: string;
164
+ metadata?: Record<string, unknown>;
165
+ tenant_slugs?: string[];
166
+ created_at: string;
167
+ updated_at: string;
168
+ }
169
+ /**
170
+ * Organization with nested tenants
171
+ */
172
+ interface OrganizationFullConfig extends Organization {
173
+ tenants: Tenant[];
174
+ }
175
+ /**
176
+ * Options for getting organization
177
+ */
178
+ interface GetOrganizationOptions {
179
+ includeTenants?: boolean;
180
+ page?: number;
181
+ limit?: number;
182
+ is_public?: boolean;
183
+ }
142
184
  /**
143
185
  * Full tenant configuration including branding, services, and service items
144
186
  * Service items are nested within each service object (not as a separate top-level array)
@@ -176,10 +218,32 @@ declare class TenantClient {
176
218
  */
177
219
  getById(id: string): Promise<ApiResponse<Tenant>>;
178
220
  /**
179
- * List all tenants
221
+ * List tenants with optional filters
180
222
  * GET /api/v1/tenants
223
+ *
224
+ * @param params - Query parameters
225
+ * - organization_id (optional) - Filter tenants by organization ID
226
+ * - org_id (optional) - Alias for organization_id
227
+ * - page (optional) - Page number for pagination
228
+ * - limit (optional) - Items per page
229
+ * @returns Paginated list of tenants
230
+ *
231
+ * @example
232
+ * ```typescript
233
+ * // List all tenants
234
+ * const allTenants = await slotly.tenant.list();
235
+ *
236
+ * // List tenants for a specific organization
237
+ * const orgTenants = await slotly.tenant.list({
238
+ * organization_id: 'org-123',
239
+ * page: 1,
240
+ * limit: 20
241
+ * });
242
+ * ```
181
243
  */
182
244
  list(params?: {
245
+ organization_id?: string;
246
+ org_id?: string;
183
247
  page?: number;
184
248
  limit?: number;
185
249
  }): Promise<ApiResponse<Tenant[]>>;
@@ -921,6 +985,53 @@ declare class DataQualityClient {
921
985
  getSummary(tenantId: string): Promise<ApiResponse<any>>;
922
986
  }
923
987
 
988
+ /**
989
+ * OrganizationClient provides methods for managing organizations
990
+ */
991
+ declare class OrganizationClient {
992
+ private client;
993
+ constructor(client: AxiosInstance);
994
+ /**
995
+ * Get organization by ID or slug
996
+ * GET /api/v1/organizations/:id
997
+ *
998
+ * @param identifier - Organization ID or slug
999
+ * @param options - Query options (includeTenants, page, limit, is_public)
1000
+ * @returns Organization or OrganizationFullConfig (with nested tenants if includeTenants=true)
1001
+ *
1002
+ * @example
1003
+ * ```typescript
1004
+ * // Get organization only
1005
+ * const org = await slotly.organization.getById('org-123');
1006
+ *
1007
+ * // Get organization with tenants
1008
+ * const orgWithTenants = await slotly.organization.getById('org-123', {
1009
+ * includeTenants: true,
1010
+ * page: 1,
1011
+ * limit: 10,
1012
+ * is_public: true
1013
+ * });
1014
+ * ```
1015
+ */
1016
+ getById(identifier: string, options?: GetOrganizationOptions): Promise<ApiResponse<Organization | OrganizationFullConfig>>;
1017
+ /**
1018
+ * Get organization by slug (alias for getById)
1019
+ * GET /api/v1/organizations/:slug
1020
+ *
1021
+ * @param slug - Organization slug
1022
+ * @param options - Query options (includeTenants, page, limit, is_public)
1023
+ * @returns Organization or OrganizationFullConfig (with nested tenants if includeTenants=true)
1024
+ *
1025
+ * @example
1026
+ * ```typescript
1027
+ * const org = await slotly.organization.getBySlug('acme-corp', {
1028
+ * includeTenants: true
1029
+ * });
1030
+ * ```
1031
+ */
1032
+ getBySlug(slug: string, options?: GetOrganizationOptions): Promise<ApiResponse<Organization | OrganizationFullConfig>>;
1033
+ }
1034
+
924
1035
  /**
925
1036
  * Custom error classes for Slotly SDK
926
1037
  */
@@ -1082,6 +1193,7 @@ interface SlotlyApi {
1082
1193
  studio: StudioClient;
1083
1194
  notification: NotificationClient;
1084
1195
  dataQuality: DataQualityClient;
1196
+ organization: OrganizationClient;
1085
1197
  }
1086
1198
  /**
1087
1199
  * Initialize and configure a new Slotly API client with dual authentication.
@@ -1146,4 +1258,4 @@ interface SlotlyApi {
1146
1258
  */
1147
1259
  declare const useSlotly: (options: SlotlyClientOptions) => SlotlyApi;
1148
1260
 
1149
- export { type ApiResponse, type Booking, type Category, type Customer, type DataQualityIssue, type Flow, type FlowStep, type Notification, type Service, type ServiceItem, type ServiceItemWithService, type ServiceWithItems, type Slot, type SlotlyApi, SlotlyApiError, type SlotlyAuthContext, SlotlyAuthError, type SlotlyClientOptions, SlotlyConfigurationError, SlotlyNetworkError, type SlotlyRequest, type Studio, type Tenant, type TenantBranding, type TenantFullConfig, useSlotly as default, getSlotlyContext, useSlotly, validateSlotlyRequest };
1261
+ export { type ApiResponse, type Booking, type Category, type Customer, type DataQualityIssue, type Flow, type FlowStep, type GetOrganizationOptions, type Notification, type Organization, type OrganizationFullConfig, type Service, type ServiceItem, type ServiceItemWithService, type ServiceWithItems, type Slot, type SlotlyApi, SlotlyApiError, type SlotlyAuthContext, SlotlyAuthError, type SlotlyClientOptions, SlotlyConfigurationError, SlotlyNetworkError, type SlotlyRequest, type Studio, type Tenant, type TenantBranding, type TenantFullConfig, useSlotly as default, getSlotlyContext, useSlotly, validateSlotlyRequest };
package/dist/index.d.ts CHANGED
@@ -27,6 +27,20 @@ interface Tenant {
27
27
  id: string;
28
28
  slug: string;
29
29
  name: string;
30
+ primary_domain?: string;
31
+ subdomain?: string;
32
+ custom_domains?: string[];
33
+ branding?: {
34
+ logo?: string;
35
+ colors?: {
36
+ primary?: string;
37
+ secondary?: string;
38
+ };
39
+ };
40
+ is_public?: boolean;
41
+ metadata?: Record<string, unknown>;
42
+ created_at: string;
43
+ updated_at: string;
30
44
  }
31
45
  /**
32
46
  * Tenant branding configuration
@@ -139,6 +153,34 @@ interface DataQualityIssue {
139
153
  message: string;
140
154
  resolved: boolean;
141
155
  }
156
+ /**
157
+ * Organization type
158
+ */
159
+ interface Organization {
160
+ id: string;
161
+ slug?: string;
162
+ name: string;
163
+ description?: string;
164
+ metadata?: Record<string, unknown>;
165
+ tenant_slugs?: string[];
166
+ created_at: string;
167
+ updated_at: string;
168
+ }
169
+ /**
170
+ * Organization with nested tenants
171
+ */
172
+ interface OrganizationFullConfig extends Organization {
173
+ tenants: Tenant[];
174
+ }
175
+ /**
176
+ * Options for getting organization
177
+ */
178
+ interface GetOrganizationOptions {
179
+ includeTenants?: boolean;
180
+ page?: number;
181
+ limit?: number;
182
+ is_public?: boolean;
183
+ }
142
184
  /**
143
185
  * Full tenant configuration including branding, services, and service items
144
186
  * Service items are nested within each service object (not as a separate top-level array)
@@ -176,10 +218,32 @@ declare class TenantClient {
176
218
  */
177
219
  getById(id: string): Promise<ApiResponse<Tenant>>;
178
220
  /**
179
- * List all tenants
221
+ * List tenants with optional filters
180
222
  * GET /api/v1/tenants
223
+ *
224
+ * @param params - Query parameters
225
+ * - organization_id (optional) - Filter tenants by organization ID
226
+ * - org_id (optional) - Alias for organization_id
227
+ * - page (optional) - Page number for pagination
228
+ * - limit (optional) - Items per page
229
+ * @returns Paginated list of tenants
230
+ *
231
+ * @example
232
+ * ```typescript
233
+ * // List all tenants
234
+ * const allTenants = await slotly.tenant.list();
235
+ *
236
+ * // List tenants for a specific organization
237
+ * const orgTenants = await slotly.tenant.list({
238
+ * organization_id: 'org-123',
239
+ * page: 1,
240
+ * limit: 20
241
+ * });
242
+ * ```
181
243
  */
182
244
  list(params?: {
245
+ organization_id?: string;
246
+ org_id?: string;
183
247
  page?: number;
184
248
  limit?: number;
185
249
  }): Promise<ApiResponse<Tenant[]>>;
@@ -921,6 +985,53 @@ declare class DataQualityClient {
921
985
  getSummary(tenantId: string): Promise<ApiResponse<any>>;
922
986
  }
923
987
 
988
+ /**
989
+ * OrganizationClient provides methods for managing organizations
990
+ */
991
+ declare class OrganizationClient {
992
+ private client;
993
+ constructor(client: AxiosInstance);
994
+ /**
995
+ * Get organization by ID or slug
996
+ * GET /api/v1/organizations/:id
997
+ *
998
+ * @param identifier - Organization ID or slug
999
+ * @param options - Query options (includeTenants, page, limit, is_public)
1000
+ * @returns Organization or OrganizationFullConfig (with nested tenants if includeTenants=true)
1001
+ *
1002
+ * @example
1003
+ * ```typescript
1004
+ * // Get organization only
1005
+ * const org = await slotly.organization.getById('org-123');
1006
+ *
1007
+ * // Get organization with tenants
1008
+ * const orgWithTenants = await slotly.organization.getById('org-123', {
1009
+ * includeTenants: true,
1010
+ * page: 1,
1011
+ * limit: 10,
1012
+ * is_public: true
1013
+ * });
1014
+ * ```
1015
+ */
1016
+ getById(identifier: string, options?: GetOrganizationOptions): Promise<ApiResponse<Organization | OrganizationFullConfig>>;
1017
+ /**
1018
+ * Get organization by slug (alias for getById)
1019
+ * GET /api/v1/organizations/:slug
1020
+ *
1021
+ * @param slug - Organization slug
1022
+ * @param options - Query options (includeTenants, page, limit, is_public)
1023
+ * @returns Organization or OrganizationFullConfig (with nested tenants if includeTenants=true)
1024
+ *
1025
+ * @example
1026
+ * ```typescript
1027
+ * const org = await slotly.organization.getBySlug('acme-corp', {
1028
+ * includeTenants: true
1029
+ * });
1030
+ * ```
1031
+ */
1032
+ getBySlug(slug: string, options?: GetOrganizationOptions): Promise<ApiResponse<Organization | OrganizationFullConfig>>;
1033
+ }
1034
+
924
1035
  /**
925
1036
  * Custom error classes for Slotly SDK
926
1037
  */
@@ -1082,6 +1193,7 @@ interface SlotlyApi {
1082
1193
  studio: StudioClient;
1083
1194
  notification: NotificationClient;
1084
1195
  dataQuality: DataQualityClient;
1196
+ organization: OrganizationClient;
1085
1197
  }
1086
1198
  /**
1087
1199
  * Initialize and configure a new Slotly API client with dual authentication.
@@ -1146,4 +1258,4 @@ interface SlotlyApi {
1146
1258
  */
1147
1259
  declare const useSlotly: (options: SlotlyClientOptions) => SlotlyApi;
1148
1260
 
1149
- export { type ApiResponse, type Booking, type Category, type Customer, type DataQualityIssue, type Flow, type FlowStep, type Notification, type Service, type ServiceItem, type ServiceItemWithService, type ServiceWithItems, type Slot, type SlotlyApi, SlotlyApiError, type SlotlyAuthContext, SlotlyAuthError, type SlotlyClientOptions, SlotlyConfigurationError, SlotlyNetworkError, type SlotlyRequest, type Studio, type Tenant, type TenantBranding, type TenantFullConfig, useSlotly as default, getSlotlyContext, useSlotly, validateSlotlyRequest };
1261
+ export { type ApiResponse, type Booking, type Category, type Customer, type DataQualityIssue, type Flow, type FlowStep, type GetOrganizationOptions, type Notification, type Organization, type OrganizationFullConfig, type Service, type ServiceItem, type ServiceItemWithService, type ServiceWithItems, type Slot, type SlotlyApi, SlotlyApiError, type SlotlyAuthContext, SlotlyAuthError, type SlotlyClientOptions, SlotlyConfigurationError, SlotlyNetworkError, type SlotlyRequest, type Studio, type Tenant, type TenantBranding, type TenantFullConfig, useSlotly as default, getSlotlyContext, useSlotly, validateSlotlyRequest };
package/dist/index.esm.js CHANGED
@@ -27,13 +27,41 @@ var TenantClient = class {
27
27
  return response.data;
28
28
  }
29
29
  /**
30
- * List all tenants
30
+ * List tenants with optional filters
31
31
  * GET /api/v1/tenants
32
+ *
33
+ * @param params - Query parameters
34
+ * - organization_id (optional) - Filter tenants by organization ID
35
+ * - org_id (optional) - Alias for organization_id
36
+ * - page (optional) - Page number for pagination
37
+ * - limit (optional) - Items per page
38
+ * @returns Paginated list of tenants
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * // List all tenants
43
+ * const allTenants = await slotly.tenant.list();
44
+ *
45
+ * // List tenants for a specific organization
46
+ * const orgTenants = await slotly.tenant.list({
47
+ * organization_id: 'org-123',
48
+ * page: 1,
49
+ * limit: 20
50
+ * });
51
+ * ```
32
52
  */
33
53
  async list(params) {
54
+ const queryParams = {};
55
+ if (params?.organization_id) {
56
+ queryParams.organization_id = params.organization_id;
57
+ } else if (params?.org_id) {
58
+ queryParams.organization_id = params.org_id;
59
+ }
60
+ if (params?.page !== void 0) queryParams.page = params.page;
61
+ if (params?.limit !== void 0) queryParams.limit = params.limit;
34
62
  const response = await this.client.get(
35
63
  "/api/v1/tenants",
36
- { params }
64
+ { params: queryParams }
37
65
  );
38
66
  return response.data;
39
67
  }
@@ -1074,6 +1102,73 @@ var DataQualityClient = class {
1074
1102
  }
1075
1103
  };
1076
1104
 
1105
+ // src/clients/organization-client.ts
1106
+ var OrganizationClient = class {
1107
+ constructor(client) {
1108
+ this.client = client;
1109
+ }
1110
+ /**
1111
+ * Get organization by ID or slug
1112
+ * GET /api/v1/organizations/:id
1113
+ *
1114
+ * @param identifier - Organization ID or slug
1115
+ * @param options - Query options (includeTenants, page, limit, is_public)
1116
+ * @returns Organization or OrganizationFullConfig (with nested tenants if includeTenants=true)
1117
+ *
1118
+ * @example
1119
+ * ```typescript
1120
+ * // Get organization only
1121
+ * const org = await slotly.organization.getById('org-123');
1122
+ *
1123
+ * // Get organization with tenants
1124
+ * const orgWithTenants = await slotly.organization.getById('org-123', {
1125
+ * includeTenants: true,
1126
+ * page: 1,
1127
+ * limit: 10,
1128
+ * is_public: true
1129
+ * });
1130
+ * ```
1131
+ */
1132
+ async getById(identifier, options) {
1133
+ const params = {};
1134
+ if (options?.includeTenants) {
1135
+ params.includeTenants = "true";
1136
+ }
1137
+ if (options?.page !== void 0) {
1138
+ params.page = options.page;
1139
+ }
1140
+ if (options?.limit !== void 0) {
1141
+ params.limit = options.limit;
1142
+ }
1143
+ if (options?.is_public !== void 0) {
1144
+ params.is_public = options.is_public;
1145
+ }
1146
+ const response = await this.client.get(
1147
+ `/api/v1/organizations/${identifier}`,
1148
+ { params }
1149
+ );
1150
+ return response.data;
1151
+ }
1152
+ /**
1153
+ * Get organization by slug (alias for getById)
1154
+ * GET /api/v1/organizations/:slug
1155
+ *
1156
+ * @param slug - Organization slug
1157
+ * @param options - Query options (includeTenants, page, limit, is_public)
1158
+ * @returns Organization or OrganizationFullConfig (with nested tenants if includeTenants=true)
1159
+ *
1160
+ * @example
1161
+ * ```typescript
1162
+ * const org = await slotly.organization.getBySlug('acme-corp', {
1163
+ * includeTenants: true
1164
+ * });
1165
+ * ```
1166
+ */
1167
+ async getBySlug(slug, options) {
1168
+ return this.getById(slug, options);
1169
+ }
1170
+ };
1171
+
1077
1172
  // src/errors.ts
1078
1173
  var SlotlyApiError = class _SlotlyApiError extends Error {
1079
1174
  constructor(code, message, statusCode, details) {
@@ -1405,7 +1500,8 @@ var useSlotly = (options) => {
1405
1500
  flow: new FlowClient(client),
1406
1501
  studio: new StudioClient(client),
1407
1502
  notification: new NotificationClient(client),
1408
- dataQuality: new DataQualityClient(client)
1503
+ dataQuality: new DataQualityClient(client),
1504
+ organization: new OrganizationClient(client)
1409
1505
  };
1410
1506
  };
1411
1507
  var index_default = useSlotly;