@back23/promptly-sdk 1.3.1 → 2.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.
- package/dist/index.d.mts +35 -8
- package/dist/index.d.ts +35 -8
- package/dist/index.js +54 -8
- package/dist/index.mjs +54 -8
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
interface PromptlyConfig {
|
|
5
5
|
/** Tenant ID (subdomain) */
|
|
6
6
|
tenantId: string;
|
|
7
|
+
/** API key (required) - Get from Dashboard > Settings > API Tokens */
|
|
8
|
+
apiKey: string;
|
|
7
9
|
/** Base URL of Promptly API */
|
|
8
10
|
baseUrl?: string;
|
|
9
11
|
/** Request timeout in milliseconds */
|
|
@@ -744,6 +746,7 @@ declare class HttpClient {
|
|
|
744
746
|
private tenantId;
|
|
745
747
|
private timeout;
|
|
746
748
|
private token;
|
|
749
|
+
private apiKey;
|
|
747
750
|
constructor(config: PromptlyConfig);
|
|
748
751
|
/**
|
|
749
752
|
* Set authentication token
|
|
@@ -757,12 +760,21 @@ declare class HttpClient {
|
|
|
757
760
|
* Check if authenticated
|
|
758
761
|
*/
|
|
759
762
|
isAuthenticated(): boolean;
|
|
763
|
+
/**
|
|
764
|
+
* Set API key for server-to-server authentication
|
|
765
|
+
*/
|
|
766
|
+
setApiKey(apiKey: string | null): void;
|
|
767
|
+
/**
|
|
768
|
+
* Get current API key
|
|
769
|
+
*/
|
|
770
|
+
getApiKey(): string | null;
|
|
760
771
|
/**
|
|
761
772
|
* Build full URL with query params
|
|
762
773
|
*/
|
|
763
774
|
private buildUrl;
|
|
764
775
|
/**
|
|
765
776
|
* Build request headers
|
|
777
|
+
* API key takes precedence over bearer token for server-to-server auth
|
|
766
778
|
*/
|
|
767
779
|
private buildHeaders;
|
|
768
780
|
/**
|
|
@@ -1354,6 +1366,7 @@ declare class ReservationResource {
|
|
|
1354
1366
|
* Promptly SDK
|
|
1355
1367
|
*
|
|
1356
1368
|
* A TypeScript/JavaScript SDK for the Promptly AI CMS platform.
|
|
1369
|
+
* API Key is required for all API requests.
|
|
1357
1370
|
*
|
|
1358
1371
|
* @example
|
|
1359
1372
|
* ```typescript
|
|
@@ -1361,18 +1374,12 @@ declare class ReservationResource {
|
|
|
1361
1374
|
*
|
|
1362
1375
|
* const client = new Promptly({
|
|
1363
1376
|
* tenantId: 'my-site',
|
|
1364
|
-
*
|
|
1377
|
+
* apiKey: 'pky_your_api_key_here', // Required
|
|
1365
1378
|
* });
|
|
1366
1379
|
*
|
|
1367
|
-
* //
|
|
1380
|
+
* // All APIs require API key
|
|
1368
1381
|
* const posts = await client.blog.list();
|
|
1369
1382
|
* const products = await client.shop.listProducts();
|
|
1370
|
-
*
|
|
1371
|
-
* // Authentication
|
|
1372
|
-
* await client.auth.login({ email: 'user@example.com', password: 'password' });
|
|
1373
|
-
*
|
|
1374
|
-
* // Protected API
|
|
1375
|
-
* const orders = await client.shop.listOrders();
|
|
1376
1383
|
* ```
|
|
1377
1384
|
*/
|
|
1378
1385
|
|
|
@@ -1419,6 +1426,26 @@ declare class Promptly {
|
|
|
1419
1426
|
* Get current authentication token
|
|
1420
1427
|
*/
|
|
1421
1428
|
getToken(): string | null;
|
|
1429
|
+
/**
|
|
1430
|
+
* Set API key for server-to-server authentication
|
|
1431
|
+
* Alternative to user token authentication
|
|
1432
|
+
*
|
|
1433
|
+
* @example
|
|
1434
|
+
* ```typescript
|
|
1435
|
+
* const client = new Promptly({
|
|
1436
|
+
* tenantId: 'my-site',
|
|
1437
|
+
* apiKey: 'pky_your_api_key_here',
|
|
1438
|
+
* });
|
|
1439
|
+
*
|
|
1440
|
+
* // Or set later
|
|
1441
|
+
* client.setApiKey('pky_your_api_key_here');
|
|
1442
|
+
* ```
|
|
1443
|
+
*/
|
|
1444
|
+
setApiKey(apiKey: string | null): void;
|
|
1445
|
+
/**
|
|
1446
|
+
* Get current API key
|
|
1447
|
+
*/
|
|
1448
|
+
getApiKey(): string | null;
|
|
1422
1449
|
}
|
|
1423
1450
|
|
|
1424
1451
|
export { type AddToCartData, type ApiError, type ApiResponse, type ApplyCouponData, type AuthResponse, type AvailableDatesParams, type AvailableSlotsParams, type BlogListParams, type BlogPost, type Board, type BoardComment, type BoardListParams, type BoardPost, type BoardSettings, type Cart, type CartItem, type Coupon, type CouponType, type CouponValidation, type CreateCommentData, type CreateEntityRecordData, type CreateOrderData, type CreatePostData, type CreateReservationData, type CreateReservationResult, type CustomEntity, type EntityField, type EntityListParams, type EntityRecord, type EntitySchema, type ForgotPasswordData, type Form, type FormField, type FormFieldOption, type FormFieldType, type FormFieldValidation, type FormListParams, type FormSettings, type FormSubmission, type ListParams, type ListResponse, type LoginCredentials, type Media, type Member, type Order, type OrderItem, type OrderListParams, type OrderStatus, type PaginatedResponse, type PaginationMeta, type Payment, type PaymentCancelData, type PaymentConfirmData, type PaymentMethod, type PaymentReadyData, type PaymentStatus, type PostListParams, type Product, type ProductCategory, type ProductListParams, type ProductOption, type ProductOptionValue, type ProductStatus, type ProductVariant, Promptly, type PromptlyConfig, PromptlyError, type RegisterData, type Reservation, type ReservationListParams, type ReservationService, type ReservationSettings, type ReservationSlot, type ReservationStaff, type ReservationStaffSummary, type ResetPasswordData, type SocialAuthUrl, type SocialProvider, type SubmissionListParams, type SubmitFormData, type UpdateCartItemData, type UpdateCommentData, type UpdateEntityRecordData, type UpdatePostData, type UpdateProfileData, Promptly as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
interface PromptlyConfig {
|
|
5
5
|
/** Tenant ID (subdomain) */
|
|
6
6
|
tenantId: string;
|
|
7
|
+
/** API key (required) - Get from Dashboard > Settings > API Tokens */
|
|
8
|
+
apiKey: string;
|
|
7
9
|
/** Base URL of Promptly API */
|
|
8
10
|
baseUrl?: string;
|
|
9
11
|
/** Request timeout in milliseconds */
|
|
@@ -744,6 +746,7 @@ declare class HttpClient {
|
|
|
744
746
|
private tenantId;
|
|
745
747
|
private timeout;
|
|
746
748
|
private token;
|
|
749
|
+
private apiKey;
|
|
747
750
|
constructor(config: PromptlyConfig);
|
|
748
751
|
/**
|
|
749
752
|
* Set authentication token
|
|
@@ -757,12 +760,21 @@ declare class HttpClient {
|
|
|
757
760
|
* Check if authenticated
|
|
758
761
|
*/
|
|
759
762
|
isAuthenticated(): boolean;
|
|
763
|
+
/**
|
|
764
|
+
* Set API key for server-to-server authentication
|
|
765
|
+
*/
|
|
766
|
+
setApiKey(apiKey: string | null): void;
|
|
767
|
+
/**
|
|
768
|
+
* Get current API key
|
|
769
|
+
*/
|
|
770
|
+
getApiKey(): string | null;
|
|
760
771
|
/**
|
|
761
772
|
* Build full URL with query params
|
|
762
773
|
*/
|
|
763
774
|
private buildUrl;
|
|
764
775
|
/**
|
|
765
776
|
* Build request headers
|
|
777
|
+
* API key takes precedence over bearer token for server-to-server auth
|
|
766
778
|
*/
|
|
767
779
|
private buildHeaders;
|
|
768
780
|
/**
|
|
@@ -1354,6 +1366,7 @@ declare class ReservationResource {
|
|
|
1354
1366
|
* Promptly SDK
|
|
1355
1367
|
*
|
|
1356
1368
|
* A TypeScript/JavaScript SDK for the Promptly AI CMS platform.
|
|
1369
|
+
* API Key is required for all API requests.
|
|
1357
1370
|
*
|
|
1358
1371
|
* @example
|
|
1359
1372
|
* ```typescript
|
|
@@ -1361,18 +1374,12 @@ declare class ReservationResource {
|
|
|
1361
1374
|
*
|
|
1362
1375
|
* const client = new Promptly({
|
|
1363
1376
|
* tenantId: 'my-site',
|
|
1364
|
-
*
|
|
1377
|
+
* apiKey: 'pky_your_api_key_here', // Required
|
|
1365
1378
|
* });
|
|
1366
1379
|
*
|
|
1367
|
-
* //
|
|
1380
|
+
* // All APIs require API key
|
|
1368
1381
|
* const posts = await client.blog.list();
|
|
1369
1382
|
* const products = await client.shop.listProducts();
|
|
1370
|
-
*
|
|
1371
|
-
* // Authentication
|
|
1372
|
-
* await client.auth.login({ email: 'user@example.com', password: 'password' });
|
|
1373
|
-
*
|
|
1374
|
-
* // Protected API
|
|
1375
|
-
* const orders = await client.shop.listOrders();
|
|
1376
1383
|
* ```
|
|
1377
1384
|
*/
|
|
1378
1385
|
|
|
@@ -1419,6 +1426,26 @@ declare class Promptly {
|
|
|
1419
1426
|
* Get current authentication token
|
|
1420
1427
|
*/
|
|
1421
1428
|
getToken(): string | null;
|
|
1429
|
+
/**
|
|
1430
|
+
* Set API key for server-to-server authentication
|
|
1431
|
+
* Alternative to user token authentication
|
|
1432
|
+
*
|
|
1433
|
+
* @example
|
|
1434
|
+
* ```typescript
|
|
1435
|
+
* const client = new Promptly({
|
|
1436
|
+
* tenantId: 'my-site',
|
|
1437
|
+
* apiKey: 'pky_your_api_key_here',
|
|
1438
|
+
* });
|
|
1439
|
+
*
|
|
1440
|
+
* // Or set later
|
|
1441
|
+
* client.setApiKey('pky_your_api_key_here');
|
|
1442
|
+
* ```
|
|
1443
|
+
*/
|
|
1444
|
+
setApiKey(apiKey: string | null): void;
|
|
1445
|
+
/**
|
|
1446
|
+
* Get current API key
|
|
1447
|
+
*/
|
|
1448
|
+
getApiKey(): string | null;
|
|
1422
1449
|
}
|
|
1423
1450
|
|
|
1424
1451
|
export { type AddToCartData, type ApiError, type ApiResponse, type ApplyCouponData, type AuthResponse, type AvailableDatesParams, type AvailableSlotsParams, type BlogListParams, type BlogPost, type Board, type BoardComment, type BoardListParams, type BoardPost, type BoardSettings, type Cart, type CartItem, type Coupon, type CouponType, type CouponValidation, type CreateCommentData, type CreateEntityRecordData, type CreateOrderData, type CreatePostData, type CreateReservationData, type CreateReservationResult, type CustomEntity, type EntityField, type EntityListParams, type EntityRecord, type EntitySchema, type ForgotPasswordData, type Form, type FormField, type FormFieldOption, type FormFieldType, type FormFieldValidation, type FormListParams, type FormSettings, type FormSubmission, type ListParams, type ListResponse, type LoginCredentials, type Media, type Member, type Order, type OrderItem, type OrderListParams, type OrderStatus, type PaginatedResponse, type PaginationMeta, type Payment, type PaymentCancelData, type PaymentConfirmData, type PaymentMethod, type PaymentReadyData, type PaymentStatus, type PostListParams, type Product, type ProductCategory, type ProductListParams, type ProductOption, type ProductOptionValue, type ProductStatus, type ProductVariant, Promptly, type PromptlyConfig, PromptlyError, type RegisterData, type Reservation, type ReservationListParams, type ReservationService, type ReservationSettings, type ReservationSlot, type ReservationStaff, type ReservationStaffSummary, type ResetPasswordData, type SocialAuthUrl, type SocialProvider, type SubmissionListParams, type SubmitFormData, type UpdateCartItemData, type UpdateCommentData, type UpdateEntityRecordData, type UpdatePostData, type UpdateProfileData, Promptly as default };
|
package/dist/index.js
CHANGED
|
@@ -70,9 +70,11 @@ var PromptlyError = class extends Error {
|
|
|
70
70
|
var HttpClient = class {
|
|
71
71
|
constructor(config) {
|
|
72
72
|
this.token = null;
|
|
73
|
+
this.apiKey = null;
|
|
73
74
|
this.tenantId = config.tenantId;
|
|
74
75
|
this.baseUrl = (config.baseUrl || "https://promptly.webbyon.com").replace(/\/$/, "");
|
|
75
76
|
this.timeout = config.timeout || 3e4;
|
|
77
|
+
this.apiKey = config.apiKey || null;
|
|
76
78
|
}
|
|
77
79
|
/**
|
|
78
80
|
* Set authentication token
|
|
@@ -90,7 +92,19 @@ var HttpClient = class {
|
|
|
90
92
|
* Check if authenticated
|
|
91
93
|
*/
|
|
92
94
|
isAuthenticated() {
|
|
93
|
-
return this.token !== null;
|
|
95
|
+
return this.token !== null || this.apiKey !== null;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Set API key for server-to-server authentication
|
|
99
|
+
*/
|
|
100
|
+
setApiKey(apiKey) {
|
|
101
|
+
this.apiKey = apiKey;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Get current API key
|
|
105
|
+
*/
|
|
106
|
+
getApiKey() {
|
|
107
|
+
return this.apiKey;
|
|
94
108
|
}
|
|
95
109
|
/**
|
|
96
110
|
* Build full URL with query params
|
|
@@ -108,6 +122,7 @@ var HttpClient = class {
|
|
|
108
122
|
}
|
|
109
123
|
/**
|
|
110
124
|
* Build request headers
|
|
125
|
+
* API key takes precedence over bearer token for server-to-server auth
|
|
111
126
|
*/
|
|
112
127
|
buildHeaders(customHeaders) {
|
|
113
128
|
const headers = {
|
|
@@ -115,7 +130,9 @@ var HttpClient = class {
|
|
|
115
130
|
"Accept": "application/json",
|
|
116
131
|
...customHeaders
|
|
117
132
|
};
|
|
118
|
-
if (this.
|
|
133
|
+
if (this.apiKey) {
|
|
134
|
+
headers["X-API-Key"] = this.apiKey;
|
|
135
|
+
} else if (this.token) {
|
|
119
136
|
headers["Authorization"] = `Bearer ${this.token}`;
|
|
120
137
|
}
|
|
121
138
|
return headers;
|
|
@@ -208,7 +225,9 @@ var HttpClient = class {
|
|
|
208
225
|
const headers = {
|
|
209
226
|
"Accept": "application/json"
|
|
210
227
|
};
|
|
211
|
-
if (this.
|
|
228
|
+
if (this.apiKey) {
|
|
229
|
+
headers["X-API-Key"] = this.apiKey;
|
|
230
|
+
} else if (this.token) {
|
|
212
231
|
headers["Authorization"] = `Bearer ${this.token}`;
|
|
213
232
|
}
|
|
214
233
|
const controller = new AbortController();
|
|
@@ -971,14 +990,14 @@ var ReservationResource = class {
|
|
|
971
990
|
* @returns Reservation settings for the tenant
|
|
972
991
|
*/
|
|
973
992
|
async getSettings() {
|
|
974
|
-
return this.http.get("/public/
|
|
993
|
+
return this.http.get("/public/reservation/settings");
|
|
975
994
|
}
|
|
976
995
|
/**
|
|
977
996
|
* List available services
|
|
978
997
|
* @returns Array of services (always an array)
|
|
979
998
|
*/
|
|
980
999
|
async listServices() {
|
|
981
|
-
const response = await this.http.getList("/public/
|
|
1000
|
+
const response = await this.http.getList("/public/reservation/services");
|
|
982
1001
|
return response.data;
|
|
983
1002
|
}
|
|
984
1003
|
/**
|
|
@@ -988,7 +1007,7 @@ var ReservationResource = class {
|
|
|
988
1007
|
*/
|
|
989
1008
|
async listStaff(serviceId) {
|
|
990
1009
|
const params = serviceId ? { service_id: serviceId } : void 0;
|
|
991
|
-
const response = await this.http.getList("/public/
|
|
1010
|
+
const response = await this.http.getList("/public/reservation/staffs", params);
|
|
992
1011
|
return response.data;
|
|
993
1012
|
}
|
|
994
1013
|
/**
|
|
@@ -996,7 +1015,7 @@ var ReservationResource = class {
|
|
|
996
1015
|
* @returns Array of available date strings (YYYY-MM-DD)
|
|
997
1016
|
*/
|
|
998
1017
|
async getAvailableDates(params) {
|
|
999
|
-
const response = await this.http.get("/public/
|
|
1018
|
+
const response = await this.http.get("/public/reservation/available-dates", params);
|
|
1000
1019
|
return Array.isArray(response) ? response : response?.data ?? [];
|
|
1001
1020
|
}
|
|
1002
1021
|
/**
|
|
@@ -1004,7 +1023,7 @@ var ReservationResource = class {
|
|
|
1004
1023
|
* @returns Array of available slots (always an array)
|
|
1005
1024
|
*/
|
|
1006
1025
|
async getAvailableSlots(params) {
|
|
1007
|
-
const response = await this.http.get("/public/
|
|
1026
|
+
const response = await this.http.get("/public/reservation/available-slots", params);
|
|
1008
1027
|
return Array.isArray(response) ? response : response?.data ?? [];
|
|
1009
1028
|
}
|
|
1010
1029
|
// ============================================
|
|
@@ -1065,6 +1084,9 @@ var ReservationResource = class {
|
|
|
1065
1084
|
// src/index.ts
|
|
1066
1085
|
var Promptly = class {
|
|
1067
1086
|
constructor(config) {
|
|
1087
|
+
if (!config.apiKey) {
|
|
1088
|
+
throw new Error("API key is required. Get your API key from Dashboard > Settings > API Tokens");
|
|
1089
|
+
}
|
|
1068
1090
|
this.http = new HttpClient(config);
|
|
1069
1091
|
this.auth = new AuthResource(this.http);
|
|
1070
1092
|
this.boards = new BoardsResource(this.http);
|
|
@@ -1105,6 +1127,30 @@ var Promptly = class {
|
|
|
1105
1127
|
getToken() {
|
|
1106
1128
|
return this.auth.getToken();
|
|
1107
1129
|
}
|
|
1130
|
+
/**
|
|
1131
|
+
* Set API key for server-to-server authentication
|
|
1132
|
+
* Alternative to user token authentication
|
|
1133
|
+
*
|
|
1134
|
+
* @example
|
|
1135
|
+
* ```typescript
|
|
1136
|
+
* const client = new Promptly({
|
|
1137
|
+
* tenantId: 'my-site',
|
|
1138
|
+
* apiKey: 'pky_your_api_key_here',
|
|
1139
|
+
* });
|
|
1140
|
+
*
|
|
1141
|
+
* // Or set later
|
|
1142
|
+
* client.setApiKey('pky_your_api_key_here');
|
|
1143
|
+
* ```
|
|
1144
|
+
*/
|
|
1145
|
+
setApiKey(apiKey) {
|
|
1146
|
+
this.http.setApiKey(apiKey);
|
|
1147
|
+
}
|
|
1148
|
+
/**
|
|
1149
|
+
* Get current API key
|
|
1150
|
+
*/
|
|
1151
|
+
getApiKey() {
|
|
1152
|
+
return this.http.getApiKey();
|
|
1153
|
+
}
|
|
1108
1154
|
};
|
|
1109
1155
|
var index_default = Promptly;
|
|
1110
1156
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.mjs
CHANGED
|
@@ -42,9 +42,11 @@ var PromptlyError = class extends Error {
|
|
|
42
42
|
var HttpClient = class {
|
|
43
43
|
constructor(config) {
|
|
44
44
|
this.token = null;
|
|
45
|
+
this.apiKey = null;
|
|
45
46
|
this.tenantId = config.tenantId;
|
|
46
47
|
this.baseUrl = (config.baseUrl || "https://promptly.webbyon.com").replace(/\/$/, "");
|
|
47
48
|
this.timeout = config.timeout || 3e4;
|
|
49
|
+
this.apiKey = config.apiKey || null;
|
|
48
50
|
}
|
|
49
51
|
/**
|
|
50
52
|
* Set authentication token
|
|
@@ -62,7 +64,19 @@ var HttpClient = class {
|
|
|
62
64
|
* Check if authenticated
|
|
63
65
|
*/
|
|
64
66
|
isAuthenticated() {
|
|
65
|
-
return this.token !== null;
|
|
67
|
+
return this.token !== null || this.apiKey !== null;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Set API key for server-to-server authentication
|
|
71
|
+
*/
|
|
72
|
+
setApiKey(apiKey) {
|
|
73
|
+
this.apiKey = apiKey;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Get current API key
|
|
77
|
+
*/
|
|
78
|
+
getApiKey() {
|
|
79
|
+
return this.apiKey;
|
|
66
80
|
}
|
|
67
81
|
/**
|
|
68
82
|
* Build full URL with query params
|
|
@@ -80,6 +94,7 @@ var HttpClient = class {
|
|
|
80
94
|
}
|
|
81
95
|
/**
|
|
82
96
|
* Build request headers
|
|
97
|
+
* API key takes precedence over bearer token for server-to-server auth
|
|
83
98
|
*/
|
|
84
99
|
buildHeaders(customHeaders) {
|
|
85
100
|
const headers = {
|
|
@@ -87,7 +102,9 @@ var HttpClient = class {
|
|
|
87
102
|
"Accept": "application/json",
|
|
88
103
|
...customHeaders
|
|
89
104
|
};
|
|
90
|
-
if (this.
|
|
105
|
+
if (this.apiKey) {
|
|
106
|
+
headers["X-API-Key"] = this.apiKey;
|
|
107
|
+
} else if (this.token) {
|
|
91
108
|
headers["Authorization"] = `Bearer ${this.token}`;
|
|
92
109
|
}
|
|
93
110
|
return headers;
|
|
@@ -180,7 +197,9 @@ var HttpClient = class {
|
|
|
180
197
|
const headers = {
|
|
181
198
|
"Accept": "application/json"
|
|
182
199
|
};
|
|
183
|
-
if (this.
|
|
200
|
+
if (this.apiKey) {
|
|
201
|
+
headers["X-API-Key"] = this.apiKey;
|
|
202
|
+
} else if (this.token) {
|
|
184
203
|
headers["Authorization"] = `Bearer ${this.token}`;
|
|
185
204
|
}
|
|
186
205
|
const controller = new AbortController();
|
|
@@ -943,14 +962,14 @@ var ReservationResource = class {
|
|
|
943
962
|
* @returns Reservation settings for the tenant
|
|
944
963
|
*/
|
|
945
964
|
async getSettings() {
|
|
946
|
-
return this.http.get("/public/
|
|
965
|
+
return this.http.get("/public/reservation/settings");
|
|
947
966
|
}
|
|
948
967
|
/**
|
|
949
968
|
* List available services
|
|
950
969
|
* @returns Array of services (always an array)
|
|
951
970
|
*/
|
|
952
971
|
async listServices() {
|
|
953
|
-
const response = await this.http.getList("/public/
|
|
972
|
+
const response = await this.http.getList("/public/reservation/services");
|
|
954
973
|
return response.data;
|
|
955
974
|
}
|
|
956
975
|
/**
|
|
@@ -960,7 +979,7 @@ var ReservationResource = class {
|
|
|
960
979
|
*/
|
|
961
980
|
async listStaff(serviceId) {
|
|
962
981
|
const params = serviceId ? { service_id: serviceId } : void 0;
|
|
963
|
-
const response = await this.http.getList("/public/
|
|
982
|
+
const response = await this.http.getList("/public/reservation/staffs", params);
|
|
964
983
|
return response.data;
|
|
965
984
|
}
|
|
966
985
|
/**
|
|
@@ -968,7 +987,7 @@ var ReservationResource = class {
|
|
|
968
987
|
* @returns Array of available date strings (YYYY-MM-DD)
|
|
969
988
|
*/
|
|
970
989
|
async getAvailableDates(params) {
|
|
971
|
-
const response = await this.http.get("/public/
|
|
990
|
+
const response = await this.http.get("/public/reservation/available-dates", params);
|
|
972
991
|
return Array.isArray(response) ? response : response?.data ?? [];
|
|
973
992
|
}
|
|
974
993
|
/**
|
|
@@ -976,7 +995,7 @@ var ReservationResource = class {
|
|
|
976
995
|
* @returns Array of available slots (always an array)
|
|
977
996
|
*/
|
|
978
997
|
async getAvailableSlots(params) {
|
|
979
|
-
const response = await this.http.get("/public/
|
|
998
|
+
const response = await this.http.get("/public/reservation/available-slots", params);
|
|
980
999
|
return Array.isArray(response) ? response : response?.data ?? [];
|
|
981
1000
|
}
|
|
982
1001
|
// ============================================
|
|
@@ -1037,6 +1056,9 @@ var ReservationResource = class {
|
|
|
1037
1056
|
// src/index.ts
|
|
1038
1057
|
var Promptly = class {
|
|
1039
1058
|
constructor(config) {
|
|
1059
|
+
if (!config.apiKey) {
|
|
1060
|
+
throw new Error("API key is required. Get your API key from Dashboard > Settings > API Tokens");
|
|
1061
|
+
}
|
|
1040
1062
|
this.http = new HttpClient(config);
|
|
1041
1063
|
this.auth = new AuthResource(this.http);
|
|
1042
1064
|
this.boards = new BoardsResource(this.http);
|
|
@@ -1077,6 +1099,30 @@ var Promptly = class {
|
|
|
1077
1099
|
getToken() {
|
|
1078
1100
|
return this.auth.getToken();
|
|
1079
1101
|
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Set API key for server-to-server authentication
|
|
1104
|
+
* Alternative to user token authentication
|
|
1105
|
+
*
|
|
1106
|
+
* @example
|
|
1107
|
+
* ```typescript
|
|
1108
|
+
* const client = new Promptly({
|
|
1109
|
+
* tenantId: 'my-site',
|
|
1110
|
+
* apiKey: 'pky_your_api_key_here',
|
|
1111
|
+
* });
|
|
1112
|
+
*
|
|
1113
|
+
* // Or set later
|
|
1114
|
+
* client.setApiKey('pky_your_api_key_here');
|
|
1115
|
+
* ```
|
|
1116
|
+
*/
|
|
1117
|
+
setApiKey(apiKey) {
|
|
1118
|
+
this.http.setApiKey(apiKey);
|
|
1119
|
+
}
|
|
1120
|
+
/**
|
|
1121
|
+
* Get current API key
|
|
1122
|
+
*/
|
|
1123
|
+
getApiKey() {
|
|
1124
|
+
return this.http.getApiKey();
|
|
1125
|
+
}
|
|
1080
1126
|
};
|
|
1081
1127
|
var index_default = Promptly;
|
|
1082
1128
|
export {
|