@back23/promptly-sdk 2.0.1 → 2.2.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/README.md +0 -0
- package/dist/index.d.mts +108 -34
- package/dist/index.d.ts +108 -34
- package/dist/index.js +138 -76
- package/dist/index.mjs +138 -76
- package/package.json +1 -1
package/README.md
CHANGED
|
File without changes
|
package/dist/index.d.mts
CHANGED
|
@@ -621,6 +621,25 @@ interface UpdateEntityRecordData {
|
|
|
621
621
|
data?: Record<string, any>;
|
|
622
622
|
status?: 'active' | 'archived' | 'draft';
|
|
623
623
|
}
|
|
624
|
+
interface CreateEntityData {
|
|
625
|
+
name: string;
|
|
626
|
+
slug?: string;
|
|
627
|
+
description?: string;
|
|
628
|
+
schema: EntitySchema;
|
|
629
|
+
settings?: Record<string, any>;
|
|
630
|
+
icon?: string;
|
|
631
|
+
is_active?: boolean;
|
|
632
|
+
}
|
|
633
|
+
interface UpdateEntityData {
|
|
634
|
+
name?: string;
|
|
635
|
+
slug?: string;
|
|
636
|
+
description?: string;
|
|
637
|
+
schema?: EntitySchema;
|
|
638
|
+
settings?: Record<string, any>;
|
|
639
|
+
icon?: string;
|
|
640
|
+
is_active?: boolean;
|
|
641
|
+
sort_order?: number;
|
|
642
|
+
}
|
|
624
643
|
|
|
625
644
|
/**
|
|
626
645
|
* Reservation types for Promptly SDK
|
|
@@ -805,7 +824,7 @@ declare class HttpClient {
|
|
|
805
824
|
/**
|
|
806
825
|
* DELETE request
|
|
807
826
|
*/
|
|
808
|
-
delete<T>(endpoint: string): Promise<T>;
|
|
827
|
+
delete<T>(endpoint: string, params?: Record<string, any>): Promise<T>;
|
|
809
828
|
/**
|
|
810
829
|
* Upload file
|
|
811
830
|
*/
|
|
@@ -1159,25 +1178,80 @@ declare class EntitiesResource {
|
|
|
1159
1178
|
private http;
|
|
1160
1179
|
constructor(http: HttpClient);
|
|
1161
1180
|
/**
|
|
1162
|
-
* List all
|
|
1163
|
-
* @returns Array of entities
|
|
1181
|
+
* List all custom entities
|
|
1182
|
+
* @returns Array of entities
|
|
1164
1183
|
*
|
|
1165
1184
|
* @example
|
|
1166
1185
|
* ```typescript
|
|
1167
1186
|
* const entities = await client.entities.list();
|
|
1168
|
-
* // [{ id: 1, name: 'Customer', slug: 'customer', ... }]
|
|
1187
|
+
* // [{ id: 1, name: 'Customer', slug: 'customer', records_count: 150, ... }]
|
|
1169
1188
|
* ```
|
|
1170
1189
|
*/
|
|
1171
1190
|
list(): Promise<CustomEntity[]>;
|
|
1172
1191
|
/**
|
|
1173
|
-
*
|
|
1192
|
+
* Create a new entity definition
|
|
1174
1193
|
*
|
|
1175
1194
|
* @example
|
|
1176
1195
|
* ```typescript
|
|
1177
|
-
* const
|
|
1178
|
-
*
|
|
1196
|
+
* const entity = await client.entities.create({
|
|
1197
|
+
* name: '고객',
|
|
1198
|
+
* slug: 'customers', // optional, auto-generated from name
|
|
1199
|
+
* description: '고객 관리',
|
|
1200
|
+
* schema: {
|
|
1201
|
+
* fields: [
|
|
1202
|
+
* { name: 'company', label: '회사명', type: 'text', required: true },
|
|
1203
|
+
* { name: 'email', label: '이메일', type: 'email', required: true },
|
|
1204
|
+
* { name: 'status', label: '상태', type: 'select', options: [
|
|
1205
|
+
* { value: 'active', label: '활성' },
|
|
1206
|
+
* { value: 'inactive', label: '비활성' }
|
|
1207
|
+
* ]}
|
|
1208
|
+
* ]
|
|
1209
|
+
* },
|
|
1210
|
+
* icon: 'users'
|
|
1211
|
+
* });
|
|
1179
1212
|
* ```
|
|
1180
1213
|
*/
|
|
1214
|
+
create(data: CreateEntityData): Promise<CustomEntity>;
|
|
1215
|
+
/**
|
|
1216
|
+
* Get entity definition by slug (includes schema)
|
|
1217
|
+
*
|
|
1218
|
+
* @example
|
|
1219
|
+
* ```typescript
|
|
1220
|
+
* const entity = await client.entities.get('customers');
|
|
1221
|
+
* console.log(entity.schema.fields);
|
|
1222
|
+
* ```
|
|
1223
|
+
*/
|
|
1224
|
+
get(slug: string): Promise<CustomEntity>;
|
|
1225
|
+
/**
|
|
1226
|
+
* Update an entity definition
|
|
1227
|
+
*
|
|
1228
|
+
* @example
|
|
1229
|
+
* ```typescript
|
|
1230
|
+
* const updated = await client.entities.update('customers', {
|
|
1231
|
+
* name: '고객사',
|
|
1232
|
+
* description: '고객사 관리'
|
|
1233
|
+
* });
|
|
1234
|
+
* ```
|
|
1235
|
+
*/
|
|
1236
|
+
update(slug: string, data: UpdateEntityData): Promise<CustomEntity>;
|
|
1237
|
+
/**
|
|
1238
|
+
* Delete an entity definition
|
|
1239
|
+
* If entity has records, use force=true to delete anyway
|
|
1240
|
+
*
|
|
1241
|
+
* @example
|
|
1242
|
+
* ```typescript
|
|
1243
|
+
* // Will fail if entity has records
|
|
1244
|
+
* await client.entities.delete('customers');
|
|
1245
|
+
*
|
|
1246
|
+
* // Force delete with all records
|
|
1247
|
+
* await client.entities.delete('customers', true);
|
|
1248
|
+
* ```
|
|
1249
|
+
*/
|
|
1250
|
+
delete(slug: string, force?: boolean): Promise<void>;
|
|
1251
|
+
/**
|
|
1252
|
+
* Get entity schema (convenience method)
|
|
1253
|
+
* @deprecated Use get(slug) instead - it includes schema
|
|
1254
|
+
*/
|
|
1181
1255
|
getSchema(slug: string): Promise<EntitySchema>;
|
|
1182
1256
|
/**
|
|
1183
1257
|
* List records for an entity
|
|
@@ -1186,18 +1260,20 @@ declare class EntitiesResource {
|
|
|
1186
1260
|
* @example
|
|
1187
1261
|
* ```typescript
|
|
1188
1262
|
* // Basic listing
|
|
1189
|
-
* const customers = await client.entities.listRecords('
|
|
1263
|
+
* const customers = await client.entities.listRecords('customers');
|
|
1190
1264
|
*
|
|
1191
|
-
* // With pagination
|
|
1192
|
-
* const customers = await client.entities.listRecords('
|
|
1265
|
+
* // With pagination and search
|
|
1266
|
+
* const customers = await client.entities.listRecords('customers', {
|
|
1193
1267
|
* page: 1,
|
|
1194
1268
|
* per_page: 20,
|
|
1195
|
-
*
|
|
1269
|
+
* search: 'ACME',
|
|
1270
|
+
* sort: 'company',
|
|
1271
|
+
* dir: 'asc'
|
|
1196
1272
|
* });
|
|
1197
1273
|
*
|
|
1198
|
-
* // With filtering
|
|
1199
|
-
* const vipCustomers = await client.entities.listRecords('
|
|
1200
|
-
*
|
|
1274
|
+
* // With filtering
|
|
1275
|
+
* const vipCustomers = await client.entities.listRecords('customers', {
|
|
1276
|
+
* filters: JSON.stringify({ tier: 'vip' })
|
|
1201
1277
|
* });
|
|
1202
1278
|
* ```
|
|
1203
1279
|
*/
|
|
@@ -1207,46 +1283,44 @@ declare class EntitiesResource {
|
|
|
1207
1283
|
*
|
|
1208
1284
|
* @example
|
|
1209
1285
|
* ```typescript
|
|
1210
|
-
* const customer = await client.entities.getRecord('
|
|
1286
|
+
* const customer = await client.entities.getRecord('customers', 1);
|
|
1211
1287
|
* console.log(customer.data.company); // 'ABC Corp'
|
|
1212
1288
|
* ```
|
|
1213
1289
|
*/
|
|
1214
1290
|
getRecord(slug: string, id: number): Promise<EntityRecord>;
|
|
1215
1291
|
/**
|
|
1216
1292
|
* Create a new record
|
|
1293
|
+
* Request body fields are defined by entity schema
|
|
1217
1294
|
*
|
|
1218
1295
|
* @example
|
|
1219
1296
|
* ```typescript
|
|
1220
|
-
* const newCustomer = await client.entities.createRecord('
|
|
1221
|
-
*
|
|
1222
|
-
*
|
|
1223
|
-
*
|
|
1224
|
-
* tier: 'standard',
|
|
1225
|
-
* },
|
|
1226
|
-
* status: 'active',
|
|
1297
|
+
* const newCustomer = await client.entities.createRecord('customers', {
|
|
1298
|
+
* company: 'ABC Corp',
|
|
1299
|
+
* email: 'contact@abc.com',
|
|
1300
|
+
* tier: 'standard',
|
|
1227
1301
|
* });
|
|
1228
1302
|
* ```
|
|
1229
1303
|
*/
|
|
1230
|
-
createRecord(slug: string, data:
|
|
1304
|
+
createRecord(slug: string, data: Record<string, any>): Promise<EntityRecord>;
|
|
1231
1305
|
/**
|
|
1232
1306
|
* Update a record
|
|
1307
|
+
* Only provided fields will be updated, existing data is preserved
|
|
1233
1308
|
*
|
|
1234
1309
|
* @example
|
|
1235
1310
|
* ```typescript
|
|
1236
|
-
* const updated = await client.entities.updateRecord('
|
|
1237
|
-
*
|
|
1238
|
-
*
|
|
1239
|
-
* },
|
|
1311
|
+
* const updated = await client.entities.updateRecord('customers', 1, {
|
|
1312
|
+
* tier: 'vip',
|
|
1313
|
+
* email: 'new@abc.com'
|
|
1240
1314
|
* });
|
|
1241
1315
|
* ```
|
|
1242
1316
|
*/
|
|
1243
|
-
updateRecord(slug: string, id: number, data:
|
|
1317
|
+
updateRecord(slug: string, id: number, data: Record<string, any>): Promise<EntityRecord>;
|
|
1244
1318
|
/**
|
|
1245
1319
|
* Delete a record
|
|
1246
1320
|
*
|
|
1247
1321
|
* @example
|
|
1248
1322
|
* ```typescript
|
|
1249
|
-
* await client.entities.deleteRecord('
|
|
1323
|
+
* await client.entities.deleteRecord('customers', 1);
|
|
1250
1324
|
* ```
|
|
1251
1325
|
*/
|
|
1252
1326
|
deleteRecord(slug: string, id: number): Promise<void>;
|
|
@@ -1255,7 +1329,7 @@ declare class EntitiesResource {
|
|
|
1255
1329
|
*
|
|
1256
1330
|
* @example
|
|
1257
1331
|
* ```typescript
|
|
1258
|
-
* const record = await client.entities.getRecord('
|
|
1332
|
+
* const record = await client.entities.getRecord('customers', 1);
|
|
1259
1333
|
* const company = client.entities.getValue(record, 'company');
|
|
1260
1334
|
* ```
|
|
1261
1335
|
*/
|
|
@@ -1271,7 +1345,7 @@ declare class EntitiesResource {
|
|
|
1271
1345
|
* tier: 'standard' | 'vip';
|
|
1272
1346
|
* }
|
|
1273
1347
|
*
|
|
1274
|
-
* const customers = client.entities.typed<Customer>('
|
|
1348
|
+
* const customers = client.entities.typed<Customer>('customers');
|
|
1275
1349
|
* const list = await customers.list(); // Typed records
|
|
1276
1350
|
* const record = await customers.get(1);
|
|
1277
1351
|
* console.log(record.data.company); // TypeScript knows this is string
|
|
@@ -1287,10 +1361,10 @@ declare class EntitiesResource {
|
|
|
1287
1361
|
get: (id: number) => Promise<Omit<EntityRecord, "data"> & {
|
|
1288
1362
|
data: T;
|
|
1289
1363
|
}>;
|
|
1290
|
-
create: (data: T
|
|
1364
|
+
create: (data: T) => Promise<Omit<EntityRecord, "data"> & {
|
|
1291
1365
|
data: T;
|
|
1292
1366
|
}>;
|
|
1293
|
-
update: (id: number, data: Partial<T
|
|
1367
|
+
update: (id: number, data: Partial<T>) => Promise<Omit<EntityRecord, "data"> & {
|
|
1294
1368
|
data: T;
|
|
1295
1369
|
}>;
|
|
1296
1370
|
delete: (id: number) => Promise<void>;
|
|
@@ -1448,4 +1522,4 @@ declare class Promptly {
|
|
|
1448
1522
|
getApiKey(): string | null;
|
|
1449
1523
|
}
|
|
1450
1524
|
|
|
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 };
|
|
1525
|
+
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 CreateEntityData, 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 UpdateEntityData, type UpdateEntityRecordData, type UpdatePostData, type UpdateProfileData, Promptly as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -621,6 +621,25 @@ interface UpdateEntityRecordData {
|
|
|
621
621
|
data?: Record<string, any>;
|
|
622
622
|
status?: 'active' | 'archived' | 'draft';
|
|
623
623
|
}
|
|
624
|
+
interface CreateEntityData {
|
|
625
|
+
name: string;
|
|
626
|
+
slug?: string;
|
|
627
|
+
description?: string;
|
|
628
|
+
schema: EntitySchema;
|
|
629
|
+
settings?: Record<string, any>;
|
|
630
|
+
icon?: string;
|
|
631
|
+
is_active?: boolean;
|
|
632
|
+
}
|
|
633
|
+
interface UpdateEntityData {
|
|
634
|
+
name?: string;
|
|
635
|
+
slug?: string;
|
|
636
|
+
description?: string;
|
|
637
|
+
schema?: EntitySchema;
|
|
638
|
+
settings?: Record<string, any>;
|
|
639
|
+
icon?: string;
|
|
640
|
+
is_active?: boolean;
|
|
641
|
+
sort_order?: number;
|
|
642
|
+
}
|
|
624
643
|
|
|
625
644
|
/**
|
|
626
645
|
* Reservation types for Promptly SDK
|
|
@@ -805,7 +824,7 @@ declare class HttpClient {
|
|
|
805
824
|
/**
|
|
806
825
|
* DELETE request
|
|
807
826
|
*/
|
|
808
|
-
delete<T>(endpoint: string): Promise<T>;
|
|
827
|
+
delete<T>(endpoint: string, params?: Record<string, any>): Promise<T>;
|
|
809
828
|
/**
|
|
810
829
|
* Upload file
|
|
811
830
|
*/
|
|
@@ -1159,25 +1178,80 @@ declare class EntitiesResource {
|
|
|
1159
1178
|
private http;
|
|
1160
1179
|
constructor(http: HttpClient);
|
|
1161
1180
|
/**
|
|
1162
|
-
* List all
|
|
1163
|
-
* @returns Array of entities
|
|
1181
|
+
* List all custom entities
|
|
1182
|
+
* @returns Array of entities
|
|
1164
1183
|
*
|
|
1165
1184
|
* @example
|
|
1166
1185
|
* ```typescript
|
|
1167
1186
|
* const entities = await client.entities.list();
|
|
1168
|
-
* // [{ id: 1, name: 'Customer', slug: 'customer', ... }]
|
|
1187
|
+
* // [{ id: 1, name: 'Customer', slug: 'customer', records_count: 150, ... }]
|
|
1169
1188
|
* ```
|
|
1170
1189
|
*/
|
|
1171
1190
|
list(): Promise<CustomEntity[]>;
|
|
1172
1191
|
/**
|
|
1173
|
-
*
|
|
1192
|
+
* Create a new entity definition
|
|
1174
1193
|
*
|
|
1175
1194
|
* @example
|
|
1176
1195
|
* ```typescript
|
|
1177
|
-
* const
|
|
1178
|
-
*
|
|
1196
|
+
* const entity = await client.entities.create({
|
|
1197
|
+
* name: '고객',
|
|
1198
|
+
* slug: 'customers', // optional, auto-generated from name
|
|
1199
|
+
* description: '고객 관리',
|
|
1200
|
+
* schema: {
|
|
1201
|
+
* fields: [
|
|
1202
|
+
* { name: 'company', label: '회사명', type: 'text', required: true },
|
|
1203
|
+
* { name: 'email', label: '이메일', type: 'email', required: true },
|
|
1204
|
+
* { name: 'status', label: '상태', type: 'select', options: [
|
|
1205
|
+
* { value: 'active', label: '활성' },
|
|
1206
|
+
* { value: 'inactive', label: '비활성' }
|
|
1207
|
+
* ]}
|
|
1208
|
+
* ]
|
|
1209
|
+
* },
|
|
1210
|
+
* icon: 'users'
|
|
1211
|
+
* });
|
|
1179
1212
|
* ```
|
|
1180
1213
|
*/
|
|
1214
|
+
create(data: CreateEntityData): Promise<CustomEntity>;
|
|
1215
|
+
/**
|
|
1216
|
+
* Get entity definition by slug (includes schema)
|
|
1217
|
+
*
|
|
1218
|
+
* @example
|
|
1219
|
+
* ```typescript
|
|
1220
|
+
* const entity = await client.entities.get('customers');
|
|
1221
|
+
* console.log(entity.schema.fields);
|
|
1222
|
+
* ```
|
|
1223
|
+
*/
|
|
1224
|
+
get(slug: string): Promise<CustomEntity>;
|
|
1225
|
+
/**
|
|
1226
|
+
* Update an entity definition
|
|
1227
|
+
*
|
|
1228
|
+
* @example
|
|
1229
|
+
* ```typescript
|
|
1230
|
+
* const updated = await client.entities.update('customers', {
|
|
1231
|
+
* name: '고객사',
|
|
1232
|
+
* description: '고객사 관리'
|
|
1233
|
+
* });
|
|
1234
|
+
* ```
|
|
1235
|
+
*/
|
|
1236
|
+
update(slug: string, data: UpdateEntityData): Promise<CustomEntity>;
|
|
1237
|
+
/**
|
|
1238
|
+
* Delete an entity definition
|
|
1239
|
+
* If entity has records, use force=true to delete anyway
|
|
1240
|
+
*
|
|
1241
|
+
* @example
|
|
1242
|
+
* ```typescript
|
|
1243
|
+
* // Will fail if entity has records
|
|
1244
|
+
* await client.entities.delete('customers');
|
|
1245
|
+
*
|
|
1246
|
+
* // Force delete with all records
|
|
1247
|
+
* await client.entities.delete('customers', true);
|
|
1248
|
+
* ```
|
|
1249
|
+
*/
|
|
1250
|
+
delete(slug: string, force?: boolean): Promise<void>;
|
|
1251
|
+
/**
|
|
1252
|
+
* Get entity schema (convenience method)
|
|
1253
|
+
* @deprecated Use get(slug) instead - it includes schema
|
|
1254
|
+
*/
|
|
1181
1255
|
getSchema(slug: string): Promise<EntitySchema>;
|
|
1182
1256
|
/**
|
|
1183
1257
|
* List records for an entity
|
|
@@ -1186,18 +1260,20 @@ declare class EntitiesResource {
|
|
|
1186
1260
|
* @example
|
|
1187
1261
|
* ```typescript
|
|
1188
1262
|
* // Basic listing
|
|
1189
|
-
* const customers = await client.entities.listRecords('
|
|
1263
|
+
* const customers = await client.entities.listRecords('customers');
|
|
1190
1264
|
*
|
|
1191
|
-
* // With pagination
|
|
1192
|
-
* const customers = await client.entities.listRecords('
|
|
1265
|
+
* // With pagination and search
|
|
1266
|
+
* const customers = await client.entities.listRecords('customers', {
|
|
1193
1267
|
* page: 1,
|
|
1194
1268
|
* per_page: 20,
|
|
1195
|
-
*
|
|
1269
|
+
* search: 'ACME',
|
|
1270
|
+
* sort: 'company',
|
|
1271
|
+
* dir: 'asc'
|
|
1196
1272
|
* });
|
|
1197
1273
|
*
|
|
1198
|
-
* // With filtering
|
|
1199
|
-
* const vipCustomers = await client.entities.listRecords('
|
|
1200
|
-
*
|
|
1274
|
+
* // With filtering
|
|
1275
|
+
* const vipCustomers = await client.entities.listRecords('customers', {
|
|
1276
|
+
* filters: JSON.stringify({ tier: 'vip' })
|
|
1201
1277
|
* });
|
|
1202
1278
|
* ```
|
|
1203
1279
|
*/
|
|
@@ -1207,46 +1283,44 @@ declare class EntitiesResource {
|
|
|
1207
1283
|
*
|
|
1208
1284
|
* @example
|
|
1209
1285
|
* ```typescript
|
|
1210
|
-
* const customer = await client.entities.getRecord('
|
|
1286
|
+
* const customer = await client.entities.getRecord('customers', 1);
|
|
1211
1287
|
* console.log(customer.data.company); // 'ABC Corp'
|
|
1212
1288
|
* ```
|
|
1213
1289
|
*/
|
|
1214
1290
|
getRecord(slug: string, id: number): Promise<EntityRecord>;
|
|
1215
1291
|
/**
|
|
1216
1292
|
* Create a new record
|
|
1293
|
+
* Request body fields are defined by entity schema
|
|
1217
1294
|
*
|
|
1218
1295
|
* @example
|
|
1219
1296
|
* ```typescript
|
|
1220
|
-
* const newCustomer = await client.entities.createRecord('
|
|
1221
|
-
*
|
|
1222
|
-
*
|
|
1223
|
-
*
|
|
1224
|
-
* tier: 'standard',
|
|
1225
|
-
* },
|
|
1226
|
-
* status: 'active',
|
|
1297
|
+
* const newCustomer = await client.entities.createRecord('customers', {
|
|
1298
|
+
* company: 'ABC Corp',
|
|
1299
|
+
* email: 'contact@abc.com',
|
|
1300
|
+
* tier: 'standard',
|
|
1227
1301
|
* });
|
|
1228
1302
|
* ```
|
|
1229
1303
|
*/
|
|
1230
|
-
createRecord(slug: string, data:
|
|
1304
|
+
createRecord(slug: string, data: Record<string, any>): Promise<EntityRecord>;
|
|
1231
1305
|
/**
|
|
1232
1306
|
* Update a record
|
|
1307
|
+
* Only provided fields will be updated, existing data is preserved
|
|
1233
1308
|
*
|
|
1234
1309
|
* @example
|
|
1235
1310
|
* ```typescript
|
|
1236
|
-
* const updated = await client.entities.updateRecord('
|
|
1237
|
-
*
|
|
1238
|
-
*
|
|
1239
|
-
* },
|
|
1311
|
+
* const updated = await client.entities.updateRecord('customers', 1, {
|
|
1312
|
+
* tier: 'vip',
|
|
1313
|
+
* email: 'new@abc.com'
|
|
1240
1314
|
* });
|
|
1241
1315
|
* ```
|
|
1242
1316
|
*/
|
|
1243
|
-
updateRecord(slug: string, id: number, data:
|
|
1317
|
+
updateRecord(slug: string, id: number, data: Record<string, any>): Promise<EntityRecord>;
|
|
1244
1318
|
/**
|
|
1245
1319
|
* Delete a record
|
|
1246
1320
|
*
|
|
1247
1321
|
* @example
|
|
1248
1322
|
* ```typescript
|
|
1249
|
-
* await client.entities.deleteRecord('
|
|
1323
|
+
* await client.entities.deleteRecord('customers', 1);
|
|
1250
1324
|
* ```
|
|
1251
1325
|
*/
|
|
1252
1326
|
deleteRecord(slug: string, id: number): Promise<void>;
|
|
@@ -1255,7 +1329,7 @@ declare class EntitiesResource {
|
|
|
1255
1329
|
*
|
|
1256
1330
|
* @example
|
|
1257
1331
|
* ```typescript
|
|
1258
|
-
* const record = await client.entities.getRecord('
|
|
1332
|
+
* const record = await client.entities.getRecord('customers', 1);
|
|
1259
1333
|
* const company = client.entities.getValue(record, 'company');
|
|
1260
1334
|
* ```
|
|
1261
1335
|
*/
|
|
@@ -1271,7 +1345,7 @@ declare class EntitiesResource {
|
|
|
1271
1345
|
* tier: 'standard' | 'vip';
|
|
1272
1346
|
* }
|
|
1273
1347
|
*
|
|
1274
|
-
* const customers = client.entities.typed<Customer>('
|
|
1348
|
+
* const customers = client.entities.typed<Customer>('customers');
|
|
1275
1349
|
* const list = await customers.list(); // Typed records
|
|
1276
1350
|
* const record = await customers.get(1);
|
|
1277
1351
|
* console.log(record.data.company); // TypeScript knows this is string
|
|
@@ -1287,10 +1361,10 @@ declare class EntitiesResource {
|
|
|
1287
1361
|
get: (id: number) => Promise<Omit<EntityRecord, "data"> & {
|
|
1288
1362
|
data: T;
|
|
1289
1363
|
}>;
|
|
1290
|
-
create: (data: T
|
|
1364
|
+
create: (data: T) => Promise<Omit<EntityRecord, "data"> & {
|
|
1291
1365
|
data: T;
|
|
1292
1366
|
}>;
|
|
1293
|
-
update: (id: number, data: Partial<T
|
|
1367
|
+
update: (id: number, data: Partial<T>) => Promise<Omit<EntityRecord, "data"> & {
|
|
1294
1368
|
data: T;
|
|
1295
1369
|
}>;
|
|
1296
1370
|
delete: (id: number) => Promise<void>;
|
|
@@ -1448,4 +1522,4 @@ declare class Promptly {
|
|
|
1448
1522
|
getApiKey(): string | null;
|
|
1449
1523
|
}
|
|
1450
1524
|
|
|
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 };
|
|
1525
|
+
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 CreateEntityData, 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 UpdateEntityData, type UpdateEntityRecordData, type UpdatePostData, type UpdateProfileData, Promptly as default };
|