@slotchain/sdk 1.1.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/README.md +23 -0
- package/dist/index.cjs.js +69 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +91 -1
- package/dist/index.d.ts +91 -1
- package/dist/index.esm.js +69 -1
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/clients/organization-client.ts +83 -0
- package/src/index.ts +6 -0
- package/src/types/api.ts +45 -1
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)
|
|
@@ -943,6 +985,53 @@ declare class DataQualityClient {
|
|
|
943
985
|
getSummary(tenantId: string): Promise<ApiResponse<any>>;
|
|
944
986
|
}
|
|
945
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
|
+
|
|
946
1035
|
/**
|
|
947
1036
|
* Custom error classes for Slotly SDK
|
|
948
1037
|
*/
|
|
@@ -1104,6 +1193,7 @@ interface SlotlyApi {
|
|
|
1104
1193
|
studio: StudioClient;
|
|
1105
1194
|
notification: NotificationClient;
|
|
1106
1195
|
dataQuality: DataQualityClient;
|
|
1196
|
+
organization: OrganizationClient;
|
|
1107
1197
|
}
|
|
1108
1198
|
/**
|
|
1109
1199
|
* Initialize and configure a new Slotly API client with dual authentication.
|
|
@@ -1168,4 +1258,4 @@ interface SlotlyApi {
|
|
|
1168
1258
|
*/
|
|
1169
1259
|
declare const useSlotly: (options: SlotlyClientOptions) => SlotlyApi;
|
|
1170
1260
|
|
|
1171
|
-
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)
|
|
@@ -943,6 +985,53 @@ declare class DataQualityClient {
|
|
|
943
985
|
getSummary(tenantId: string): Promise<ApiResponse<any>>;
|
|
944
986
|
}
|
|
945
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
|
+
|
|
946
1035
|
/**
|
|
947
1036
|
* Custom error classes for Slotly SDK
|
|
948
1037
|
*/
|
|
@@ -1104,6 +1193,7 @@ interface SlotlyApi {
|
|
|
1104
1193
|
studio: StudioClient;
|
|
1105
1194
|
notification: NotificationClient;
|
|
1106
1195
|
dataQuality: DataQualityClient;
|
|
1196
|
+
organization: OrganizationClient;
|
|
1107
1197
|
}
|
|
1108
1198
|
/**
|
|
1109
1199
|
* Initialize and configure a new Slotly API client with dual authentication.
|
|
@@ -1168,4 +1258,4 @@ interface SlotlyApi {
|
|
|
1168
1258
|
*/
|
|
1169
1259
|
declare const useSlotly: (options: SlotlyClientOptions) => SlotlyApi;
|
|
1170
1260
|
|
|
1171
|
-
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
|
@@ -1102,6 +1102,73 @@ var DataQualityClient = class {
|
|
|
1102
1102
|
}
|
|
1103
1103
|
};
|
|
1104
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
|
+
|
|
1105
1172
|
// src/errors.ts
|
|
1106
1173
|
var SlotlyApiError = class _SlotlyApiError extends Error {
|
|
1107
1174
|
constructor(code, message, statusCode, details) {
|
|
@@ -1433,7 +1500,8 @@ var useSlotly = (options) => {
|
|
|
1433
1500
|
flow: new FlowClient(client),
|
|
1434
1501
|
studio: new StudioClient(client),
|
|
1435
1502
|
notification: new NotificationClient(client),
|
|
1436
|
-
dataQuality: new DataQualityClient(client)
|
|
1503
|
+
dataQuality: new DataQualityClient(client),
|
|
1504
|
+
organization: new OrganizationClient(client)
|
|
1437
1505
|
};
|
|
1438
1506
|
};
|
|
1439
1507
|
var index_default = useSlotly;
|