@back23/promptly-sdk 2.2.1 → 2.3.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 +138 -2
- package/dist/index.d.mts +84 -3
- package/dist/index.d.ts +84 -3
- package/dist/index.js +67 -3
- package/dist/index.mjs +67 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,6 +24,66 @@ const { data: posts } = await client.blog.list();
|
|
|
24
24
|
const products = await client.shop.listProducts();
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
+
## v2.3.1 Changes (Bug Fix)
|
|
28
|
+
|
|
29
|
+
### Dual Authentication Support Fixed
|
|
30
|
+
|
|
31
|
+
API Key와 Bearer Token이 동시에 전송되도록 수정되었습니다. 이전 버전에서는 API Key가 설정되어 있으면 Authorization 헤더가 무시되어 로그인 후 멤버 전용 API 호출이 실패하는 문제가 있었습니다.
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
// 이제 API Key + Bearer Token 동시 사용 가능
|
|
35
|
+
const client = new Promptly({
|
|
36
|
+
tenantId: 'demo',
|
|
37
|
+
apiKey: 'pky_xxx', // X-API-Key 헤더
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// 로그인 후 토큰 설정
|
|
41
|
+
await client.auth.login({ email, password });
|
|
42
|
+
|
|
43
|
+
// 멤버 전용 API 정상 동작 (Authorization: Bearer xxx 헤더 포함)
|
|
44
|
+
const profile = await client.members.getProfile();
|
|
45
|
+
const orders = await client.orders.list();
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## v2.3.0 Changes
|
|
51
|
+
|
|
52
|
+
### Polymorphic Comments API
|
|
53
|
+
|
|
54
|
+
댓글 시스템이 재설계되어 게시판, 블로그, 방명록(독립 페이지) 등 다양한 곳에서 사용할 수 있습니다.
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
// 게시판 글 댓글
|
|
58
|
+
const boardComments = await client.comments.boardPost(postId);
|
|
59
|
+
await client.comments.createBoardPost(postId, {
|
|
60
|
+
author_name: '홍길동',
|
|
61
|
+
content: '댓글 내용',
|
|
62
|
+
password: '1234', // 비회원 댓글용
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// 블로그 글 댓글
|
|
66
|
+
const blogComments = await client.comments.blogPost('post-slug');
|
|
67
|
+
await client.comments.createBlogPost('post-slug', {
|
|
68
|
+
author_name: 'Jane',
|
|
69
|
+
content: 'Great post!',
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
// 방명록 (독립 페이지)
|
|
73
|
+
const guestbook = await client.comments.standalone('guestbook');
|
|
74
|
+
await client.comments.createStandalone('guestbook', {
|
|
75
|
+
author_name: '방문자',
|
|
76
|
+
content: '안녕하세요!',
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// 공통 기능
|
|
80
|
+
await client.comments.update(commentId, { content: '수정된 댓글' });
|
|
81
|
+
await client.comments.delete(commentId, { password: '1234' });
|
|
82
|
+
await client.comments.like(commentId);
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
27
87
|
## v2.2.0 Changes
|
|
28
88
|
|
|
29
89
|
### Entity Definition CRUD
|
|
@@ -136,9 +196,9 @@ data.map(post => ...); // data is always an array
|
|
|
136
196
|
|
|
137
197
|
| Resource | Read Operations | Write Operations (Auth Required) |
|
|
138
198
|
|----------|-----------------|----------------------------------|
|
|
139
|
-
| **Boards** | list, get, listPosts, getPost
|
|
140
|
-
| **Comments** | listComments | createComment, updateComment, deleteComment |
|
|
199
|
+
| **Boards** | list, get, listPosts, getPost | createPost, updatePost, deletePost |
|
|
141
200
|
| **Blog** | list, get, featured, byCategory, byTag | - |
|
|
201
|
+
| **Comments** | boardPost, blogPost, standalone | createBoardPost, createBlogPost, createStandalone, update, delete, like |
|
|
142
202
|
| **Shop** | listProducts, getProduct, listCategories | getCart, addToCart, listOrders, createOrder |
|
|
143
203
|
| **Forms** | list, get, submit | mySubmissions |
|
|
144
204
|
| **Auth** | login, register | logout, me, updateProfile |
|
|
@@ -250,6 +310,67 @@ const tags = await client.blog.tags();
|
|
|
250
310
|
// Returns: string[] (always an array)
|
|
251
311
|
```
|
|
252
312
|
|
|
313
|
+
### Comments (댓글)
|
|
314
|
+
|
|
315
|
+
3가지 댓글 유형을 지원합니다:
|
|
316
|
+
- **게시판 댓글** (`board_post`)
|
|
317
|
+
- **블로그 댓글** (`blog_post`)
|
|
318
|
+
- **방명록/독립 댓글** (`page`)
|
|
319
|
+
|
|
320
|
+
```typescript
|
|
321
|
+
// 게시판 글 댓글 조회
|
|
322
|
+
const { data: comments, meta } = await client.comments.boardPost(postId, {
|
|
323
|
+
page: 1,
|
|
324
|
+
per_page: 20,
|
|
325
|
+
});
|
|
326
|
+
// Returns: ListResponse<Comment>
|
|
327
|
+
|
|
328
|
+
// 게시판 글 댓글 작성
|
|
329
|
+
await client.comments.createBoardPost(postId, {
|
|
330
|
+
author_name: '홍길동',
|
|
331
|
+
author_email: 'user@example.com',
|
|
332
|
+
content: '댓글 내용',
|
|
333
|
+
password: '1234', // 비회원용
|
|
334
|
+
parent_id: null, // 대댓글이면 부모 댓글 ID
|
|
335
|
+
is_secret: false, // 비밀 댓글 여부
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
// 블로그 글 댓글 조회
|
|
339
|
+
const { data: blogComments } = await client.comments.blogPost('post-slug');
|
|
340
|
+
// Returns: ListResponse<Comment>
|
|
341
|
+
|
|
342
|
+
// 블로그 글 댓글 작성
|
|
343
|
+
await client.comments.createBlogPost('post-slug', {
|
|
344
|
+
author_name: 'Jane',
|
|
345
|
+
content: 'Great post!',
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
// 방명록 댓글 조회 (page_slug로 구분)
|
|
349
|
+
const { data: guestbook } = await client.comments.standalone('guestbook');
|
|
350
|
+
// Returns: ListResponse<Comment>
|
|
351
|
+
|
|
352
|
+
// 방명록 댓글 작성
|
|
353
|
+
await client.comments.createStandalone('guestbook', {
|
|
354
|
+
author_name: '방문자',
|
|
355
|
+
content: '안녕하세요!',
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
// 댓글 수정
|
|
359
|
+
await client.comments.update(commentId, {
|
|
360
|
+
content: '수정된 댓글',
|
|
361
|
+
password: '1234', // 비회원이 작성한 댓글인 경우
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
// 댓글 삭제
|
|
365
|
+
await client.comments.delete(commentId, {
|
|
366
|
+
password: '1234', // 비회원이 작성한 댓글인 경우
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
// 댓글 좋아요
|
|
370
|
+
const result = await client.comments.like(commentId);
|
|
371
|
+
// Returns: { data: { likes: number } }
|
|
372
|
+
```
|
|
373
|
+
|
|
253
374
|
### Shop (쇼핑)
|
|
254
375
|
|
|
255
376
|
#### Public (로그인 불필요)
|
|
@@ -724,6 +845,21 @@ interface BlogPost {
|
|
|
724
845
|
created_at: string;
|
|
725
846
|
}
|
|
726
847
|
|
|
848
|
+
interface Comment {
|
|
849
|
+
id: number;
|
|
850
|
+
type: 'board_post' | 'blog_post' | 'page';
|
|
851
|
+
author_name: string;
|
|
852
|
+
author_avatar: string | null;
|
|
853
|
+
content: string;
|
|
854
|
+
is_approved: boolean;
|
|
855
|
+
is_pinned: boolean;
|
|
856
|
+
is_secret: boolean;
|
|
857
|
+
likes: number;
|
|
858
|
+
depth: number;
|
|
859
|
+
created_at: string;
|
|
860
|
+
replies: Comment[];
|
|
861
|
+
}
|
|
862
|
+
|
|
727
863
|
interface Product {
|
|
728
864
|
id: number;
|
|
729
865
|
slug: string;
|
package/dist/index.d.mts
CHANGED
|
@@ -237,6 +237,42 @@ interface BlogListParams extends ListParams {
|
|
|
237
237
|
search?: string;
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
+
type CommentType = 'board_post' | 'blog_post' | 'page';
|
|
241
|
+
interface Comment {
|
|
242
|
+
id: number;
|
|
243
|
+
type: CommentType;
|
|
244
|
+
author_name: string;
|
|
245
|
+
author_avatar: string | null;
|
|
246
|
+
content: string;
|
|
247
|
+
is_approved: boolean;
|
|
248
|
+
is_pinned: boolean;
|
|
249
|
+
is_secret: boolean;
|
|
250
|
+
likes: number;
|
|
251
|
+
depth: number;
|
|
252
|
+
created_at: string;
|
|
253
|
+
replies: Comment[];
|
|
254
|
+
}
|
|
255
|
+
interface CommentListResponse extends ListResponse<Comment> {
|
|
256
|
+
}
|
|
257
|
+
interface CommentListParams extends ListParams {
|
|
258
|
+
include_unapproved?: boolean;
|
|
259
|
+
}
|
|
260
|
+
interface CommentCreateData {
|
|
261
|
+
author_name?: string;
|
|
262
|
+
author_email?: string;
|
|
263
|
+
content: string;
|
|
264
|
+
password?: string;
|
|
265
|
+
parent_id?: number | null;
|
|
266
|
+
is_secret?: boolean;
|
|
267
|
+
}
|
|
268
|
+
interface CommentUpdateData {
|
|
269
|
+
content: string;
|
|
270
|
+
password?: string;
|
|
271
|
+
}
|
|
272
|
+
interface CommentDeleteData {
|
|
273
|
+
password?: string;
|
|
274
|
+
}
|
|
275
|
+
|
|
240
276
|
/**
|
|
241
277
|
* Form types for Promptly SDK
|
|
242
278
|
*/
|
|
@@ -793,7 +829,7 @@ declare class HttpClient {
|
|
|
793
829
|
private buildUrl;
|
|
794
830
|
/**
|
|
795
831
|
* Build request headers
|
|
796
|
-
* API key
|
|
832
|
+
* Both API key and bearer token can be sent together
|
|
797
833
|
*/
|
|
798
834
|
private buildHeaders;
|
|
799
835
|
/**
|
|
@@ -1004,6 +1040,49 @@ declare class BlogResource {
|
|
|
1004
1040
|
tags(): Promise<string[]>;
|
|
1005
1041
|
}
|
|
1006
1042
|
|
|
1043
|
+
declare class CommentsResource {
|
|
1044
|
+
private http;
|
|
1045
|
+
constructor(http: HttpClient);
|
|
1046
|
+
/**
|
|
1047
|
+
* Get comments for a board post
|
|
1048
|
+
*/
|
|
1049
|
+
boardPost(postId: number, params?: CommentListParams): Promise<CommentListResponse>;
|
|
1050
|
+
/**
|
|
1051
|
+
* Create a comment on a board post
|
|
1052
|
+
*/
|
|
1053
|
+
createBoardPost(postId: number, data: CommentCreateData): Promise<ApiResponse<Comment>>;
|
|
1054
|
+
/**
|
|
1055
|
+
* Get comments for a blog post
|
|
1056
|
+
*/
|
|
1057
|
+
blogPost(slug: string, params?: CommentListParams): Promise<CommentListResponse>;
|
|
1058
|
+
/**
|
|
1059
|
+
* Create a comment on a blog post
|
|
1060
|
+
*/
|
|
1061
|
+
createBlogPost(slug: string, data: CommentCreateData): Promise<ApiResponse<Comment>>;
|
|
1062
|
+
/**
|
|
1063
|
+
* Get standalone comments (guestbook, feedback, etc.)
|
|
1064
|
+
*/
|
|
1065
|
+
standalone(pageSlug: string, params?: CommentListParams): Promise<CommentListResponse>;
|
|
1066
|
+
/**
|
|
1067
|
+
* Create a standalone comment
|
|
1068
|
+
*/
|
|
1069
|
+
createStandalone(pageSlug: string, data: CommentCreateData): Promise<ApiResponse<Comment>>;
|
|
1070
|
+
/**
|
|
1071
|
+
* Update a comment
|
|
1072
|
+
*/
|
|
1073
|
+
update(commentId: number, data: CommentUpdateData): Promise<ApiResponse<Comment>>;
|
|
1074
|
+
/**
|
|
1075
|
+
* Delete a comment
|
|
1076
|
+
*/
|
|
1077
|
+
delete(commentId: number, data?: CommentDeleteData): Promise<ApiResponse<void>>;
|
|
1078
|
+
/**
|
|
1079
|
+
* Like a comment
|
|
1080
|
+
*/
|
|
1081
|
+
like(commentId: number): Promise<ApiResponse<{
|
|
1082
|
+
likes: number;
|
|
1083
|
+
}>>;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1007
1086
|
/**
|
|
1008
1087
|
* Form Resource for Promptly SDK
|
|
1009
1088
|
*/
|
|
@@ -1461,10 +1540,12 @@ declare class Promptly {
|
|
|
1461
1540
|
private http;
|
|
1462
1541
|
/** Authentication & user management */
|
|
1463
1542
|
readonly auth: AuthResource;
|
|
1464
|
-
/** Board posts
|
|
1543
|
+
/** Board posts */
|
|
1465
1544
|
readonly boards: BoardsResource;
|
|
1466
1545
|
/** Blog posts */
|
|
1467
1546
|
readonly blog: BlogResource;
|
|
1547
|
+
/** Comments for boards, blogs, and standalone pages */
|
|
1548
|
+
readonly comments: CommentsResource;
|
|
1468
1549
|
/** Forms and submissions */
|
|
1469
1550
|
readonly forms: FormsResource;
|
|
1470
1551
|
/** E-commerce: products, cart, orders, payments */
|
|
@@ -1522,4 +1603,4 @@ declare class Promptly {
|
|
|
1522
1603
|
getApiKey(): string | null;
|
|
1523
1604
|
}
|
|
1524
1605
|
|
|
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 };
|
|
1606
|
+
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 Comment, type CommentCreateData, type CommentDeleteData, type CommentListParams, type CommentListResponse, type CommentType, type CommentUpdateData, 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
|
@@ -237,6 +237,42 @@ interface BlogListParams extends ListParams {
|
|
|
237
237
|
search?: string;
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
+
type CommentType = 'board_post' | 'blog_post' | 'page';
|
|
241
|
+
interface Comment {
|
|
242
|
+
id: number;
|
|
243
|
+
type: CommentType;
|
|
244
|
+
author_name: string;
|
|
245
|
+
author_avatar: string | null;
|
|
246
|
+
content: string;
|
|
247
|
+
is_approved: boolean;
|
|
248
|
+
is_pinned: boolean;
|
|
249
|
+
is_secret: boolean;
|
|
250
|
+
likes: number;
|
|
251
|
+
depth: number;
|
|
252
|
+
created_at: string;
|
|
253
|
+
replies: Comment[];
|
|
254
|
+
}
|
|
255
|
+
interface CommentListResponse extends ListResponse<Comment> {
|
|
256
|
+
}
|
|
257
|
+
interface CommentListParams extends ListParams {
|
|
258
|
+
include_unapproved?: boolean;
|
|
259
|
+
}
|
|
260
|
+
interface CommentCreateData {
|
|
261
|
+
author_name?: string;
|
|
262
|
+
author_email?: string;
|
|
263
|
+
content: string;
|
|
264
|
+
password?: string;
|
|
265
|
+
parent_id?: number | null;
|
|
266
|
+
is_secret?: boolean;
|
|
267
|
+
}
|
|
268
|
+
interface CommentUpdateData {
|
|
269
|
+
content: string;
|
|
270
|
+
password?: string;
|
|
271
|
+
}
|
|
272
|
+
interface CommentDeleteData {
|
|
273
|
+
password?: string;
|
|
274
|
+
}
|
|
275
|
+
|
|
240
276
|
/**
|
|
241
277
|
* Form types for Promptly SDK
|
|
242
278
|
*/
|
|
@@ -793,7 +829,7 @@ declare class HttpClient {
|
|
|
793
829
|
private buildUrl;
|
|
794
830
|
/**
|
|
795
831
|
* Build request headers
|
|
796
|
-
* API key
|
|
832
|
+
* Both API key and bearer token can be sent together
|
|
797
833
|
*/
|
|
798
834
|
private buildHeaders;
|
|
799
835
|
/**
|
|
@@ -1004,6 +1040,49 @@ declare class BlogResource {
|
|
|
1004
1040
|
tags(): Promise<string[]>;
|
|
1005
1041
|
}
|
|
1006
1042
|
|
|
1043
|
+
declare class CommentsResource {
|
|
1044
|
+
private http;
|
|
1045
|
+
constructor(http: HttpClient);
|
|
1046
|
+
/**
|
|
1047
|
+
* Get comments for a board post
|
|
1048
|
+
*/
|
|
1049
|
+
boardPost(postId: number, params?: CommentListParams): Promise<CommentListResponse>;
|
|
1050
|
+
/**
|
|
1051
|
+
* Create a comment on a board post
|
|
1052
|
+
*/
|
|
1053
|
+
createBoardPost(postId: number, data: CommentCreateData): Promise<ApiResponse<Comment>>;
|
|
1054
|
+
/**
|
|
1055
|
+
* Get comments for a blog post
|
|
1056
|
+
*/
|
|
1057
|
+
blogPost(slug: string, params?: CommentListParams): Promise<CommentListResponse>;
|
|
1058
|
+
/**
|
|
1059
|
+
* Create a comment on a blog post
|
|
1060
|
+
*/
|
|
1061
|
+
createBlogPost(slug: string, data: CommentCreateData): Promise<ApiResponse<Comment>>;
|
|
1062
|
+
/**
|
|
1063
|
+
* Get standalone comments (guestbook, feedback, etc.)
|
|
1064
|
+
*/
|
|
1065
|
+
standalone(pageSlug: string, params?: CommentListParams): Promise<CommentListResponse>;
|
|
1066
|
+
/**
|
|
1067
|
+
* Create a standalone comment
|
|
1068
|
+
*/
|
|
1069
|
+
createStandalone(pageSlug: string, data: CommentCreateData): Promise<ApiResponse<Comment>>;
|
|
1070
|
+
/**
|
|
1071
|
+
* Update a comment
|
|
1072
|
+
*/
|
|
1073
|
+
update(commentId: number, data: CommentUpdateData): Promise<ApiResponse<Comment>>;
|
|
1074
|
+
/**
|
|
1075
|
+
* Delete a comment
|
|
1076
|
+
*/
|
|
1077
|
+
delete(commentId: number, data?: CommentDeleteData): Promise<ApiResponse<void>>;
|
|
1078
|
+
/**
|
|
1079
|
+
* Like a comment
|
|
1080
|
+
*/
|
|
1081
|
+
like(commentId: number): Promise<ApiResponse<{
|
|
1082
|
+
likes: number;
|
|
1083
|
+
}>>;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1007
1086
|
/**
|
|
1008
1087
|
* Form Resource for Promptly SDK
|
|
1009
1088
|
*/
|
|
@@ -1461,10 +1540,12 @@ declare class Promptly {
|
|
|
1461
1540
|
private http;
|
|
1462
1541
|
/** Authentication & user management */
|
|
1463
1542
|
readonly auth: AuthResource;
|
|
1464
|
-
/** Board posts
|
|
1543
|
+
/** Board posts */
|
|
1465
1544
|
readonly boards: BoardsResource;
|
|
1466
1545
|
/** Blog posts */
|
|
1467
1546
|
readonly blog: BlogResource;
|
|
1547
|
+
/** Comments for boards, blogs, and standalone pages */
|
|
1548
|
+
readonly comments: CommentsResource;
|
|
1468
1549
|
/** Forms and submissions */
|
|
1469
1550
|
readonly forms: FormsResource;
|
|
1470
1551
|
/** E-commerce: products, cart, orders, payments */
|
|
@@ -1522,4 +1603,4 @@ declare class Promptly {
|
|
|
1522
1603
|
getApiKey(): string | null;
|
|
1523
1604
|
}
|
|
1524
1605
|
|
|
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 };
|
|
1606
|
+
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 Comment, type CommentCreateData, type CommentDeleteData, type CommentListParams, type CommentListResponse, type CommentType, type CommentUpdateData, 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.js
CHANGED
|
@@ -122,7 +122,7 @@ var HttpClient = class {
|
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
124
124
|
* Build request headers
|
|
125
|
-
* API key
|
|
125
|
+
* Both API key and bearer token can be sent together
|
|
126
126
|
*/
|
|
127
127
|
buildHeaders(customHeaders) {
|
|
128
128
|
const headers = {
|
|
@@ -132,7 +132,8 @@ var HttpClient = class {
|
|
|
132
132
|
};
|
|
133
133
|
if (this.apiKey) {
|
|
134
134
|
headers["X-API-Key"] = this.apiKey;
|
|
135
|
-
}
|
|
135
|
+
}
|
|
136
|
+
if (this.token) {
|
|
136
137
|
headers["Authorization"] = `Bearer ${this.token}`;
|
|
137
138
|
}
|
|
138
139
|
return headers;
|
|
@@ -227,7 +228,8 @@ var HttpClient = class {
|
|
|
227
228
|
};
|
|
228
229
|
if (this.apiKey) {
|
|
229
230
|
headers["X-API-Key"] = this.apiKey;
|
|
230
|
-
}
|
|
231
|
+
}
|
|
232
|
+
if (this.token) {
|
|
231
233
|
headers["Authorization"] = `Bearer ${this.token}`;
|
|
232
234
|
}
|
|
233
235
|
const controller = new AbortController();
|
|
@@ -538,6 +540,67 @@ var BlogResource = class {
|
|
|
538
540
|
}
|
|
539
541
|
};
|
|
540
542
|
|
|
543
|
+
// src/resources/comments.ts
|
|
544
|
+
var CommentsResource = class {
|
|
545
|
+
constructor(http) {
|
|
546
|
+
this.http = http;
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* Get comments for a board post
|
|
550
|
+
*/
|
|
551
|
+
async boardPost(postId, params) {
|
|
552
|
+
return this.http.get(`/posts/${postId}/comments`, params);
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* Create a comment on a board post
|
|
556
|
+
*/
|
|
557
|
+
async createBoardPost(postId, data) {
|
|
558
|
+
return this.http.post(`/posts/${postId}/comments`, data);
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* Get comments for a blog post
|
|
562
|
+
*/
|
|
563
|
+
async blogPost(slug, params) {
|
|
564
|
+
return this.http.get(`/blog/${slug}/comments`, params);
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Create a comment on a blog post
|
|
568
|
+
*/
|
|
569
|
+
async createBlogPost(slug, data) {
|
|
570
|
+
return this.http.post(`/blog/${slug}/comments`, data);
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* Get standalone comments (guestbook, feedback, etc.)
|
|
574
|
+
*/
|
|
575
|
+
async standalone(pageSlug, params) {
|
|
576
|
+
return this.http.get(`/comments/${pageSlug}`, params);
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* Create a standalone comment
|
|
580
|
+
*/
|
|
581
|
+
async createStandalone(pageSlug, data) {
|
|
582
|
+
return this.http.post(`/comments/${pageSlug}`, data);
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Update a comment
|
|
586
|
+
*/
|
|
587
|
+
async update(commentId, data) {
|
|
588
|
+
return this.http.put(`/comments/${commentId}`, data);
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* Delete a comment
|
|
592
|
+
*/
|
|
593
|
+
async delete(commentId, data) {
|
|
594
|
+
return this.http.delete(`/comments/${commentId}`, data);
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Like a comment
|
|
598
|
+
*/
|
|
599
|
+
async like(commentId) {
|
|
600
|
+
return this.http.post(`/comments/${commentId}/like`);
|
|
601
|
+
}
|
|
602
|
+
};
|
|
603
|
+
|
|
541
604
|
// src/resources/forms.ts
|
|
542
605
|
var FormsResource = class {
|
|
543
606
|
constructor(http) {
|
|
@@ -1153,6 +1216,7 @@ var Promptly = class {
|
|
|
1153
1216
|
this.auth = new AuthResource(this.http);
|
|
1154
1217
|
this.boards = new BoardsResource(this.http);
|
|
1155
1218
|
this.blog = new BlogResource(this.http);
|
|
1219
|
+
this.comments = new CommentsResource(this.http);
|
|
1156
1220
|
this.forms = new FormsResource(this.http);
|
|
1157
1221
|
this.shop = new ShopResource(this.http);
|
|
1158
1222
|
this.media = new MediaResource(this.http);
|
package/dist/index.mjs
CHANGED
|
@@ -94,7 +94,7 @@ var HttpClient = class {
|
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
96
|
* Build request headers
|
|
97
|
-
* API key
|
|
97
|
+
* Both API key and bearer token can be sent together
|
|
98
98
|
*/
|
|
99
99
|
buildHeaders(customHeaders) {
|
|
100
100
|
const headers = {
|
|
@@ -104,7 +104,8 @@ var HttpClient = class {
|
|
|
104
104
|
};
|
|
105
105
|
if (this.apiKey) {
|
|
106
106
|
headers["X-API-Key"] = this.apiKey;
|
|
107
|
-
}
|
|
107
|
+
}
|
|
108
|
+
if (this.token) {
|
|
108
109
|
headers["Authorization"] = `Bearer ${this.token}`;
|
|
109
110
|
}
|
|
110
111
|
return headers;
|
|
@@ -199,7 +200,8 @@ var HttpClient = class {
|
|
|
199
200
|
};
|
|
200
201
|
if (this.apiKey) {
|
|
201
202
|
headers["X-API-Key"] = this.apiKey;
|
|
202
|
-
}
|
|
203
|
+
}
|
|
204
|
+
if (this.token) {
|
|
203
205
|
headers["Authorization"] = `Bearer ${this.token}`;
|
|
204
206
|
}
|
|
205
207
|
const controller = new AbortController();
|
|
@@ -510,6 +512,67 @@ var BlogResource = class {
|
|
|
510
512
|
}
|
|
511
513
|
};
|
|
512
514
|
|
|
515
|
+
// src/resources/comments.ts
|
|
516
|
+
var CommentsResource = class {
|
|
517
|
+
constructor(http) {
|
|
518
|
+
this.http = http;
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Get comments for a board post
|
|
522
|
+
*/
|
|
523
|
+
async boardPost(postId, params) {
|
|
524
|
+
return this.http.get(`/posts/${postId}/comments`, params);
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Create a comment on a board post
|
|
528
|
+
*/
|
|
529
|
+
async createBoardPost(postId, data) {
|
|
530
|
+
return this.http.post(`/posts/${postId}/comments`, data);
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* Get comments for a blog post
|
|
534
|
+
*/
|
|
535
|
+
async blogPost(slug, params) {
|
|
536
|
+
return this.http.get(`/blog/${slug}/comments`, params);
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Create a comment on a blog post
|
|
540
|
+
*/
|
|
541
|
+
async createBlogPost(slug, data) {
|
|
542
|
+
return this.http.post(`/blog/${slug}/comments`, data);
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Get standalone comments (guestbook, feedback, etc.)
|
|
546
|
+
*/
|
|
547
|
+
async standalone(pageSlug, params) {
|
|
548
|
+
return this.http.get(`/comments/${pageSlug}`, params);
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Create a standalone comment
|
|
552
|
+
*/
|
|
553
|
+
async createStandalone(pageSlug, data) {
|
|
554
|
+
return this.http.post(`/comments/${pageSlug}`, data);
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Update a comment
|
|
558
|
+
*/
|
|
559
|
+
async update(commentId, data) {
|
|
560
|
+
return this.http.put(`/comments/${commentId}`, data);
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Delete a comment
|
|
564
|
+
*/
|
|
565
|
+
async delete(commentId, data) {
|
|
566
|
+
return this.http.delete(`/comments/${commentId}`, data);
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Like a comment
|
|
570
|
+
*/
|
|
571
|
+
async like(commentId) {
|
|
572
|
+
return this.http.post(`/comments/${commentId}/like`);
|
|
573
|
+
}
|
|
574
|
+
};
|
|
575
|
+
|
|
513
576
|
// src/resources/forms.ts
|
|
514
577
|
var FormsResource = class {
|
|
515
578
|
constructor(http) {
|
|
@@ -1125,6 +1188,7 @@ var Promptly = class {
|
|
|
1125
1188
|
this.auth = new AuthResource(this.http);
|
|
1126
1189
|
this.boards = new BoardsResource(this.http);
|
|
1127
1190
|
this.blog = new BlogResource(this.http);
|
|
1191
|
+
this.comments = new CommentsResource(this.http);
|
|
1128
1192
|
this.forms = new FormsResource(this.http);
|
|
1129
1193
|
this.shop = new ShopResource(this.http);
|
|
1130
1194
|
this.media = new MediaResource(this.http);
|