@back23/promptly-sdk 2.0.0 → 2.0.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 +56 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,10 +15,40 @@ import { Promptly } from '@back23/promptly-sdk';
|
|
|
15
15
|
|
|
16
16
|
const client = new Promptly({
|
|
17
17
|
tenantId: 'demo',
|
|
18
|
-
|
|
18
|
+
apiKey: 'pky_your_api_key_here', // Required - Get from Dashboard > Settings > API Tokens
|
|
19
|
+
baseUrl: 'https://promptly.webbyon.com', // Optional
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// All API calls require API key
|
|
23
|
+
const { data: posts } = await client.blog.list();
|
|
24
|
+
const products = await client.shop.listProducts();
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## v2.0.0 Breaking Changes
|
|
28
|
+
|
|
29
|
+
### API Key Required
|
|
30
|
+
|
|
31
|
+
**All API requests now require an API key.** There are no public APIs - this ensures security and proper tenant isolation.
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
// ❌ v1.x - apiKey was optional
|
|
35
|
+
const client = new Promptly({
|
|
36
|
+
tenantId: 'demo',
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// ✅ v2.0 - apiKey is REQUIRED
|
|
40
|
+
const client = new Promptly({
|
|
41
|
+
tenantId: 'demo',
|
|
42
|
+
apiKey: 'pky_xxxxxxxxxxxxxxxxxxxxxxxx',
|
|
19
43
|
});
|
|
20
44
|
```
|
|
21
45
|
|
|
46
|
+
Get your API key from: **Dashboard > Settings > API Tokens**
|
|
47
|
+
|
|
48
|
+
The SDK automatically includes the `X-API-Key` header in all requests.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
22
52
|
## v1.3.0 Changes
|
|
23
53
|
|
|
24
54
|
### Unified Response Structure
|
|
@@ -53,10 +83,11 @@ data.map(post => ...); // data is always an array
|
|
|
53
83
|
|
|
54
84
|
## API Overview
|
|
55
85
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
|
59
|
-
|
|
86
|
+
> **Note:** All APIs require API key (v2.0+). "Auth Required" means additional member login token is needed.
|
|
87
|
+
|
|
88
|
+
| Resource | Read Operations | Write Operations (Auth Required) |
|
|
89
|
+
|----------|-----------------|----------------------------------|
|
|
90
|
+
| **Boards** | list, get, listPosts, getPost, listComments | createPost, updatePost, deletePost |
|
|
60
91
|
| **Comments** | listComments | createComment, updateComment, deleteComment |
|
|
61
92
|
| **Blog** | list, get, featured, byCategory, byTag | - |
|
|
62
93
|
| **Shop** | listProducts, getProduct, listCategories | getCart, addToCart, listOrders, createOrder |
|
|
@@ -68,7 +99,7 @@ data.map(post => ...); // data is always an array
|
|
|
68
99
|
|
|
69
100
|
## API Reference
|
|
70
101
|
|
|
71
|
-
### Boards (게시판)
|
|
102
|
+
### Boards (게시판)
|
|
72
103
|
|
|
73
104
|
```typescript
|
|
74
105
|
// 게시판 목록
|
|
@@ -134,7 +165,7 @@ await client.boards.updateComment(commentId, {
|
|
|
134
165
|
await client.boards.deleteComment(commentId);
|
|
135
166
|
```
|
|
136
167
|
|
|
137
|
-
### Blog (블로그)
|
|
168
|
+
### Blog (블로그)
|
|
138
169
|
|
|
139
170
|
```typescript
|
|
140
171
|
// 블로그 글 목록
|
|
@@ -400,7 +431,7 @@ const response = await client.auth.socialCallback('google', code);
|
|
|
400
431
|
// Returns: { member: Member, token: string }
|
|
401
432
|
```
|
|
402
433
|
|
|
403
|
-
### Forms (폼)
|
|
434
|
+
### Forms (폼)
|
|
404
435
|
|
|
405
436
|
```typescript
|
|
406
437
|
// 폼 목록
|
|
@@ -529,7 +560,7 @@ await customers.create({
|
|
|
529
560
|
});
|
|
530
561
|
```
|
|
531
562
|
|
|
532
|
-
### Site Settings
|
|
563
|
+
### Site Settings
|
|
533
564
|
|
|
534
565
|
```typescript
|
|
535
566
|
// 테마 설정
|
|
@@ -543,6 +574,21 @@ const settings = await client.getSettings();
|
|
|
543
574
|
|
|
544
575
|
## Types
|
|
545
576
|
|
|
577
|
+
### Configuration
|
|
578
|
+
|
|
579
|
+
```typescript
|
|
580
|
+
interface PromptlyConfig {
|
|
581
|
+
/** Tenant ID (subdomain) */
|
|
582
|
+
tenantId: string;
|
|
583
|
+
/** API key (required) - Get from Dashboard > Settings > API Tokens */
|
|
584
|
+
apiKey: string;
|
|
585
|
+
/** Base URL of Promptly API (optional) */
|
|
586
|
+
baseUrl?: string;
|
|
587
|
+
/** Request timeout in milliseconds (optional) */
|
|
588
|
+
timeout?: number;
|
|
589
|
+
}
|
|
590
|
+
```
|
|
591
|
+
|
|
546
592
|
### Common Types
|
|
547
593
|
|
|
548
594
|
```typescript
|
|
@@ -720,6 +766,7 @@ import { Promptly } from '@back23/promptly-sdk';
|
|
|
720
766
|
|
|
721
767
|
const client = new Promptly({
|
|
722
768
|
tenantId: 'demo',
|
|
769
|
+
apiKey: process.env.NEXT_PUBLIC_PROMPTLY_API_KEY!, // Required
|
|
723
770
|
baseUrl: 'https://promptly.webbyon.com',
|
|
724
771
|
});
|
|
725
772
|
|