@kookee/sdk 0.0.29 → 0.0.31
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 +139 -11
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.global.js +2 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Official TypeScript SDK for [Kookee](https://kookee.dev) - the headless CMS for
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- **Lightweight** - Only ~
|
|
7
|
+
- **Lightweight** - Only ~6.41 KB KB minified (ESM), no bloat
|
|
8
8
|
- **Zero dependencies** - Uses native `fetch`, nothing else
|
|
9
9
|
- **TypeScript-first** - Full type definitions out of the box
|
|
10
10
|
- **Tree-shakeable** - Import only what you need
|
|
@@ -36,6 +36,14 @@ const posts = await kookee.blog.list({ limit: 10 });
|
|
|
36
36
|
const post = await kookee.blog.getBySlug('hello-world');
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
+
## Configuration
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
const kookee = new Kookee({
|
|
43
|
+
apiKey: 'your-api-key',
|
|
44
|
+
});
|
|
45
|
+
```
|
|
46
|
+
|
|
39
47
|
## Blog
|
|
40
48
|
|
|
41
49
|
```typescript
|
|
@@ -61,7 +69,8 @@ const tags = await kookee.blog.getTags();
|
|
|
61
69
|
await kookee.blog.react('post-id', { reactionType: 'heart', action: 'add' });
|
|
62
70
|
|
|
63
71
|
// Get translations
|
|
64
|
-
const
|
|
72
|
+
const translationsBySlug = await kookee.blog.getTranslationsBySlug('my-post');
|
|
73
|
+
const translationsById = await kookee.blog.getTranslationsById('post-uuid');
|
|
65
74
|
```
|
|
66
75
|
|
|
67
76
|
## Help Center
|
|
@@ -84,21 +93,31 @@ const article = await kookee.help.getBySlug('getting-started');
|
|
|
84
93
|
const articleById = await kookee.help.getById('article-uuid');
|
|
85
94
|
|
|
86
95
|
// Get article translations
|
|
87
|
-
const
|
|
96
|
+
const translationsBySlug = await kookee.help.getTranslationsBySlug('getting-started');
|
|
97
|
+
const translationsById = await kookee.help.getTranslationsById('article-uuid');
|
|
88
98
|
|
|
89
99
|
// AI-powered chat
|
|
90
100
|
const response = await kookee.help.chat({
|
|
91
101
|
messages: [{ role: 'user', content: 'How do I reset my password?' }],
|
|
102
|
+
sessionId: 'optional-session-id', // maintain conversation context across calls
|
|
92
103
|
});
|
|
93
104
|
|
|
94
105
|
// Streaming chat
|
|
95
106
|
for await (const chunk of kookee.help.chatStream({ messages })) {
|
|
96
107
|
if (chunk.type === 'delta') console.log(chunk.content);
|
|
97
108
|
if (chunk.type === 'sources') console.log('Sources:', chunk.sources);
|
|
109
|
+
if (chunk.type === 'done') console.log('Stream finished');
|
|
110
|
+
if (chunk.type === 'error') console.error(chunk.message);
|
|
98
111
|
}
|
|
99
112
|
|
|
100
113
|
// Vote on article usefulness
|
|
101
114
|
await kookee.help.voteUsefulness('article-id', 'yes');
|
|
115
|
+
|
|
116
|
+
// Change a previous vote
|
|
117
|
+
await kookee.help.voteUsefulness('article-id', 'no', 'yes');
|
|
118
|
+
|
|
119
|
+
// Remove a vote
|
|
120
|
+
await kookee.help.voteUsefulness('article-id', null, 'yes');
|
|
102
121
|
```
|
|
103
122
|
|
|
104
123
|
## Changelog
|
|
@@ -110,6 +129,9 @@ const entries = await kookee.changelog.list({ page: 1, limit: 10 });
|
|
|
110
129
|
// Filter by type: 'feature' | 'fix' | 'improvement' | 'breaking' | 'security' | 'deprecated' | 'other'
|
|
111
130
|
const fixes = await kookee.changelog.list({ type: 'fix' });
|
|
112
131
|
|
|
132
|
+
// Search entries
|
|
133
|
+
const results = await kookee.changelog.list({ search: 'authentication' });
|
|
134
|
+
|
|
113
135
|
// Order by version or date
|
|
114
136
|
const sorted = await kookee.changelog.list({ orderBy: 'version', order: 'desc' });
|
|
115
137
|
|
|
@@ -118,7 +140,8 @@ const entry = await kookee.changelog.getBySlug('v1-0-0');
|
|
|
118
140
|
const entryById = await kookee.changelog.getById('entry-uuid');
|
|
119
141
|
|
|
120
142
|
// Get translations
|
|
121
|
-
const
|
|
143
|
+
const translationsBySlug = await kookee.changelog.getTranslationsBySlug('v1-0-0');
|
|
144
|
+
const translationsById = await kookee.changelog.getTranslationsById('entry-uuid');
|
|
122
145
|
|
|
123
146
|
// React to an entry
|
|
124
147
|
await kookee.changelog.react('entry-id', { reactionType: 'fire', action: 'add' });
|
|
@@ -133,6 +156,9 @@ const announcements = await kookee.announcements.list({ page: 1, limit: 10 });
|
|
|
133
156
|
// Filter by type: 'info' | 'warning' | 'critical' | 'promotion' | 'maintenance' | 'newFeature'
|
|
134
157
|
const critical = await kookee.announcements.list({ type: 'critical' });
|
|
135
158
|
|
|
159
|
+
// Order announcements
|
|
160
|
+
const sorted = await kookee.announcements.list({ orderBy: 'publishedAt', order: 'desc' });
|
|
161
|
+
|
|
136
162
|
// Exclude already-seen announcements
|
|
137
163
|
const unseen = await kookee.announcements.list({ excludeIds: ['id1', 'id2'] });
|
|
138
164
|
|
|
@@ -157,11 +183,14 @@ const page = await kookee.pages.getBySlug('privacy-policy');
|
|
|
157
183
|
const pageById = await kookee.pages.getById('page-uuid');
|
|
158
184
|
|
|
159
185
|
// Get translations
|
|
160
|
-
const
|
|
186
|
+
const translationsBySlug = await kookee.pages.getTranslationsBySlug('privacy-policy');
|
|
187
|
+
const translationsById = await kookee.pages.getTranslationsById('page-uuid');
|
|
161
188
|
```
|
|
162
189
|
|
|
163
190
|
## Feedback
|
|
164
191
|
|
|
192
|
+
### Reading feedback
|
|
193
|
+
|
|
165
194
|
```typescript
|
|
166
195
|
// List feedback posts
|
|
167
196
|
const posts = await kookee.feedback.list({ page: 1, limit: 10 });
|
|
@@ -175,6 +204,9 @@ const bugs = await kookee.feedback.list({ category: 'bug' });
|
|
|
175
204
|
// Sort options: 'newest' | 'top' | 'trending'
|
|
176
205
|
const trending = await kookee.feedback.list({ sort: 'trending' });
|
|
177
206
|
|
|
207
|
+
// Search posts
|
|
208
|
+
const results = await kookee.feedback.list({ search: 'dark mode' });
|
|
209
|
+
|
|
178
210
|
// Get single post with comments
|
|
179
211
|
const post = await kookee.feedback.getById('post-uuid');
|
|
180
212
|
|
|
@@ -185,6 +217,52 @@ await kookee.feedback.vote('post-id', { action: 'upvote' });
|
|
|
185
217
|
const contributors = await kookee.feedback.getTopContributors({ limit: 10 });
|
|
186
218
|
```
|
|
187
219
|
|
|
220
|
+
### Creating and managing feedback
|
|
221
|
+
|
|
222
|
+
These operations require an `ExternalUser` to identify the author:
|
|
223
|
+
|
|
224
|
+
```typescript
|
|
225
|
+
import type { ExternalUser } from '@kookee/sdk';
|
|
226
|
+
|
|
227
|
+
const user: ExternalUser = {
|
|
228
|
+
externalId: 'user-123', // your system's user ID
|
|
229
|
+
name: 'Jane Doe',
|
|
230
|
+
email: 'jane@example.com', // optional
|
|
231
|
+
avatarUrl: 'https://...', // optional
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
// Create a feedback post
|
|
235
|
+
const newPost = await kookee.feedback.createPost({
|
|
236
|
+
title: 'Add dark mode',
|
|
237
|
+
description: 'It would be great to have a dark mode option.',
|
|
238
|
+
category: 'feature', // optional: 'feature' | 'improvement' | 'bug' | 'other'
|
|
239
|
+
externalUser: user,
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
// Add a comment to a post
|
|
243
|
+
const comment = await kookee.feedback.createComment('post-id', {
|
|
244
|
+
content: 'Great idea, I would love this too!',
|
|
245
|
+
externalUser: user,
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
// List posts created by a specific user
|
|
249
|
+
const myPosts = await kookee.feedback.listMyPosts({
|
|
250
|
+
externalId: 'user-123',
|
|
251
|
+
page: 1,
|
|
252
|
+
limit: 10,
|
|
253
|
+
status: 'open', // optional filter
|
|
254
|
+
category: 'feature', // optional filter
|
|
255
|
+
search: 'dark mode', // optional search
|
|
256
|
+
sort: 'newest', // optional sort
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
// Delete a post (only the author can delete)
|
|
260
|
+
await kookee.feedback.deletePost('post-id', { externalId: 'user-123' });
|
|
261
|
+
|
|
262
|
+
// Delete a comment (only the author can delete)
|
|
263
|
+
await kookee.feedback.deleteComment('comment-id', { externalId: 'user-123' });
|
|
264
|
+
```
|
|
265
|
+
|
|
188
266
|
## Config
|
|
189
267
|
|
|
190
268
|
```typescript
|
|
@@ -195,6 +273,13 @@ const config = await kookee.config.getByKey('feature_flags');
|
|
|
195
273
|
const configs = await kookee.config.list({ keys: ['feature_flags', 'theme'] });
|
|
196
274
|
```
|
|
197
275
|
|
|
276
|
+
## Health Check
|
|
277
|
+
|
|
278
|
+
```typescript
|
|
279
|
+
const health = await kookee.health();
|
|
280
|
+
// { status: 'ok', projectId: '...', timestamp: '...' }
|
|
281
|
+
```
|
|
282
|
+
|
|
198
283
|
## Reactions
|
|
199
284
|
|
|
200
285
|
Blog posts and changelog entries support reactions:
|
|
@@ -219,6 +304,13 @@ const posts = await kookee.blog.list({ locale: 'de' });
|
|
|
219
304
|
const post = await kookee.blog.getBySlug('hello-world', { locale: 'de', fallback: true });
|
|
220
305
|
```
|
|
221
306
|
|
|
307
|
+
Translation endpoints return a `Record<string, T>` keyed by locale code:
|
|
308
|
+
|
|
309
|
+
```typescript
|
|
310
|
+
const translations = await kookee.blog.getTranslationsBySlug('hello-world');
|
|
311
|
+
// { en: BlogPost, de: BlogPost, fr: BlogPost, ... }
|
|
312
|
+
```
|
|
313
|
+
|
|
222
314
|
## Paginated Response
|
|
223
315
|
|
|
224
316
|
All list endpoints return a paginated response:
|
|
@@ -249,21 +341,57 @@ try {
|
|
|
249
341
|
}
|
|
250
342
|
```
|
|
251
343
|
|
|
252
|
-
##
|
|
344
|
+
## Code Block Styles
|
|
345
|
+
|
|
346
|
+
The SDK ships an optional CSS file for styling code blocks in content HTML (VS Code Dark+ theme):
|
|
253
347
|
|
|
254
348
|
```typescript
|
|
255
|
-
|
|
256
|
-
apiKey: 'your-api-key',
|
|
257
|
-
baseUrl: 'https://api.kookee.dev', // optional, defaults to production API
|
|
258
|
-
});
|
|
349
|
+
import '@kookee/sdk/styles/code.css';
|
|
259
350
|
```
|
|
260
351
|
|
|
352
|
+
Or via CDN:
|
|
353
|
+
|
|
354
|
+
```html
|
|
355
|
+
<link rel="stylesheet" href="https://unpkg.com/@kookee/sdk/styles/code.css">
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
This provides:
|
|
359
|
+
- Syntax-highlighted code blocks with a dark theme
|
|
360
|
+
- Copy-to-clipboard button styling
|
|
361
|
+
- Language label display
|
|
362
|
+
- Inline code styling (red on pink background)
|
|
363
|
+
|
|
261
364
|
## TypeScript
|
|
262
365
|
|
|
263
366
|
The SDK is written in TypeScript and provides full type definitions:
|
|
264
367
|
|
|
265
368
|
```typescript
|
|
266
|
-
import type {
|
|
369
|
+
import type {
|
|
370
|
+
BlogPost,
|
|
371
|
+
BlogPostListItem,
|
|
372
|
+
BlogTag,
|
|
373
|
+
BlogTagWithCount,
|
|
374
|
+
Page,
|
|
375
|
+
PageListItem,
|
|
376
|
+
HelpArticle,
|
|
377
|
+
HelpArticleListItem,
|
|
378
|
+
HelpCategory,
|
|
379
|
+
HelpSearchResult,
|
|
380
|
+
HelpChatResponse,
|
|
381
|
+
HelpChatStreamChunk,
|
|
382
|
+
ChangelogEntry,
|
|
383
|
+
ChangelogEntryListItem,
|
|
384
|
+
Announcement,
|
|
385
|
+
AnnouncementListItem,
|
|
386
|
+
FeedbackPost,
|
|
387
|
+
FeedbackPostListItem,
|
|
388
|
+
FeedbackComment,
|
|
389
|
+
FeedbackTopContributor,
|
|
390
|
+
ExternalUser,
|
|
391
|
+
PublicConfig,
|
|
392
|
+
PaginatedResponse,
|
|
393
|
+
KookeeConfig,
|
|
394
|
+
} from '@kookee/sdk';
|
|
267
395
|
```
|
|
268
396
|
|
|
269
397
|
## License
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var k="https://api.kookee.dev",B="Kookee-API-Key",H="Kookee-Project-Id",i=class n extends Error{constructor(t,s,
|
|
2
|
-
`);
|
|
1
|
+
'use strict';var k="https://api.kookee.dev",B="Kookee-API-Key",H="Kookee-Project-Id",i=class n extends Error{constructor(t,s,r){super(s);this.code=t;this.status=r;this.name="KookeeApiError",Object.setPrototypeOf(this,n.prototype);}},u=class{baseUrl;apiKey;projectId;constructor(e){this.apiKey=e.apiKey,this.projectId=e.projectId,this.baseUrl=e.baseUrl??k;}getHeaders(){let e={"Content-Type":"application/json"};return this.apiKey&&(e[B]=this.apiKey),this.projectId&&(e[H]=this.projectId),e}async get(e,t){let s=new URL(`${this.baseUrl}${e}`);if(t){for(let[P,o]of Object.entries(t))if(o!=null)if(Array.isArray(o))for(let a of o)s.searchParams.append(P,String(a));else s.searchParams.set(P,String(o));}let r=await fetch(s.toString(),{method:"GET",headers:this.getHeaders()});return this.handleResponse(r)}async post(e,t){let s=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(s)}async delete(e,t){let s=await fetch(`${this.baseUrl}${e}`,{method:"DELETE",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(s)}async*streamPost(e,t){let s=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:{...this.getHeaders(),Accept:"text/event-stream"},body:t?JSON.stringify(t):void 0});if(!s.ok){let a=null;try{a=await s.json();}catch{}throw new i(a?.code??"UNKNOWN_ERROR",a?.message??`Request failed with status ${s.status}`,s.status)}if(!s.body)return;let r=s.body.getReader(),P=new TextDecoder,o="";try{for(;;){let{done:a,value:f}=await r.read();if(a)break;o+=P.decode(f,{stream:!0});let b=o.split(`
|
|
2
|
+
`);o=b.pop()??"";for(let I of b){let y=I.trim();if(!(!y||y.startsWith(":"))&&y.startsWith("data: ")){let R=y.slice(6);if(R==="[DONE]")return;yield JSON.parse(R);}}}}finally{r.releaseLock();}}async handleResponse(e){if(!e.ok){let t=null;try{t=await e.json();}catch{}throw new i(t?.code??"UNKNOWN_ERROR",t?.message??`Request failed with status ${e.status}`,e.status)}return e.json()}};var p=class{constructor(e){this.http=e;}async list(e){let{excludeIds:t,...s}=e??{},r=t?.length?{...s,excludeIds:t.join(",")}:s;return this.http.get("/v1/announcements",r)}async getById(e,t){return this.http.get(`/v1/announcements/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/announcements/${encodeURIComponent(e)}/translations`)}};var c=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/blog/posts",e)}async getBySlug(e,t){return this.http.get(`/v1/blog/posts/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/blog/posts/by-id/${encodeURIComponent(e)}`,t)}async getTags(){return this.http.get("/v1/blog/tags")}async getTranslationsById(e){return this.http.get(`/v1/blog/posts/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/blog/posts/${encodeURIComponent(e)}/translations`)}async react(e,t){return this.http.post(`/v1/blog/posts/${encodeURIComponent(e)}/reactions`,t)}};var l=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/changelog",e)}async getBySlug(e,t){return this.http.get(`/v1/changelog/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/changelog/by-id/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/changelog/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/changelog/${encodeURIComponent(e)}/translations`)}async react(e,t){return this.http.post(`/v1/changelog/${encodeURIComponent(e)}/reactions`,t)}};var g=class{constructor(e){this.http=e;}async getByKey(e){return this.http.get(`/v1/config/${encodeURIComponent(e)}`)}async list(e){return this.http.get("/v1/config",e)}};var m=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/feedback",e)}async getById(e){return this.http.get(`/v1/feedback/by-id/${encodeURIComponent(e)}`)}async vote(e,t){return this.http.post(`/v1/feedback/${encodeURIComponent(e)}/vote`,t)}async getTopContributors(e){return this.http.get("/v1/feedback/top-contributors",e)}async createPost(e){return this.http.post("/v1/feedback",e)}async createComment(e,t){return this.http.post(`/v1/feedback/${encodeURIComponent(e)}/comments`,t)}async listMyPosts(e){return this.http.get("/v1/feedback/mine",e)}async deletePost(e,t){return this.http.delete(`/v1/feedback/${encodeURIComponent(e)}`,t)}async deleteComment(e,t){return this.http.delete(`/v1/feedback/comments/${encodeURIComponent(e)}`,t)}};var d=class{constructor(e){this.http=e;}async categories(e){return this.http.get("/v1/help/categories",e)}async list(e){return this.http.get("/v1/help/articles",e)}async getBySlug(e,t){return this.http.get(`/v1/help/articles/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/help/articles/by-id/${encodeURIComponent(e)}`,t)}async search(e){return this.http.get("/v1/help/search",e)}async getTranslationsById(e){return this.http.get(`/v1/help/articles/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/help/articles/${encodeURIComponent(e)}/translations`)}async chat(e){return this.http.post("/v1/help/chat",e)}chatStream(e){return this.http.streamPost("/v1/help/chat/stream",e)}async voteUsefulness(e,t,s){return this.http.post(`/v1/help/articles/by-id/${encodeURIComponent(e)}/vote-usefulness`,{vote:t,previousVote:s})}};var h=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/pages",e)}async getBySlug(e,t){return this.http.get(`/v1/pages/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/pages/by-id/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/pages/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/pages/${encodeURIComponent(e)}/translations`)}};var C=class{http;announcements;blog;changelog;config;feedback;help;pages;constructor(e){if(!e.apiKey&&!e.projectId)throw new Error("Either apiKey or projectId is required");this.http=new u({apiKey:e.apiKey,projectId:e.projectId,baseUrl:e.baseUrl}),this.announcements=new p(this.http),this.blog=new c(this.http),this.changelog=new l(this.http),this.config=new g(this.http),this.feedback=new m(this.http),this.help=new d(this.http),this.pages=new h(this.http);}async health(){return this.http.get("/v1/health")}};exports.AnnouncementModule=p;exports.BlogModule=c;exports.ChangelogModule=l;exports.ConfigModule=g;exports.FeedbackModule=m;exports.HelpModule=d;exports.Kookee=C;exports.KookeeApiError=i;exports.PagesModule=h;
|
package/dist/index.d.cts
CHANGED
|
@@ -349,6 +349,12 @@ interface DeleteFeedbackPostParams {
|
|
|
349
349
|
interface DeleteFeedbackPostResponse {
|
|
350
350
|
success: boolean;
|
|
351
351
|
}
|
|
352
|
+
interface DeleteFeedbackCommentParams {
|
|
353
|
+
externalId: string;
|
|
354
|
+
}
|
|
355
|
+
interface DeleteFeedbackCommentResponse {
|
|
356
|
+
success: boolean;
|
|
357
|
+
}
|
|
352
358
|
|
|
353
359
|
interface AnnouncementListParams extends PaginationParams, LocaleOptions {
|
|
354
360
|
type?: AnnouncementType;
|
|
@@ -440,6 +446,7 @@ declare class FeedbackModule {
|
|
|
440
446
|
createComment(postId: string, params: CreateFeedbackCommentParams): Promise<CreatedFeedbackComment>;
|
|
441
447
|
listMyPosts(params: ListMyFeedbackPostsParams): Promise<PaginatedResponse<FeedbackPostListItem>>;
|
|
442
448
|
deletePost(postId: string, params: DeleteFeedbackPostParams): Promise<DeleteFeedbackPostResponse>;
|
|
449
|
+
deleteComment(commentId: string, params: DeleteFeedbackCommentParams): Promise<DeleteFeedbackCommentResponse>;
|
|
443
450
|
}
|
|
444
451
|
|
|
445
452
|
interface HelpCategoriesParams extends LocaleOptions {
|
|
@@ -501,4 +508,4 @@ declare class Kookee {
|
|
|
501
508
|
health(): Promise<HealthCheckResponse>;
|
|
502
509
|
}
|
|
503
510
|
|
|
504
|
-
export { type Announcement, type AnnouncementAuthor, type AnnouncementGetByIdParams, type AnnouncementListItem, type AnnouncementListParams, AnnouncementModule, type AnnouncementOrderBy, type AnnouncementType, type ApiError, type BlogGetByIdParams, type BlogGetBySlugParams, type BlogListParams, BlogModule, type BlogPost, type BlogPostAuthor, type BlogPostListItem, type BlogPostStatus, type BlogTag, type BlogTagWithCount, type ChangelogAuthor, type ChangelogEntry, type ChangelogEntryListItem, type ChangelogGetByIdParams, type ChangelogGetBySlugParams, type ChangelogListParams, ChangelogModule, type ChangelogOrderBy, type ChangelogType, type ConfigListParams, ConfigModule, type CreateFeedbackCommentParams, type CreateFeedbackPostParams, type CreatedFeedbackComment, type CreatedFeedbackPost, type DeleteFeedbackPostParams, type DeleteFeedbackPostResponse, type ExternalUser, type FeedbackAssignee, type FeedbackAuthor, type FeedbackComment, type FeedbackListParams, FeedbackModule, type FeedbackPost, type FeedbackPostCategory, type FeedbackPostListItem, type FeedbackPostStatus, type FeedbackSortOption, type FeedbackTopContributor, type FeedbackTopContributorsParams, type FeedbackVoteParams, type FeedbackVoteResponse, type HealthCheckResponse, type HelpArticle, type HelpArticleAuthor, type HelpArticleListItem, type HelpArticleVisibility, type HelpCategoriesParams, type HelpCategory, type HelpChatMessage, type HelpChatParams, type HelpChatResponse, type HelpChatSource, type HelpChatSourceCategory, type HelpChatStreamChunk, type HelpGetByIdParams, type HelpGetBySlugParams, type HelpListParams, HelpModule, type HelpSearchParams, type HelpSearchResult, Kookee, KookeeApiError, type KookeeConfig, type ListMyFeedbackPostsParams, type LocaleOptions, type OrderDirection, type Page, type PageListItem, type PagesGetByIdParams, type PagesGetBySlugParams, type PagesListParams, PagesModule, type PaginatedResponse, type PaginationParams, type PublicConfig, type ReactParams, type ReactResponse, type ReactionType, type VoteUsefulnessResponse };
|
|
511
|
+
export { type Announcement, type AnnouncementAuthor, type AnnouncementGetByIdParams, type AnnouncementListItem, type AnnouncementListParams, AnnouncementModule, type AnnouncementOrderBy, type AnnouncementType, type ApiError, type BlogGetByIdParams, type BlogGetBySlugParams, type BlogListParams, BlogModule, type BlogPost, type BlogPostAuthor, type BlogPostListItem, type BlogPostStatus, type BlogTag, type BlogTagWithCount, type ChangelogAuthor, type ChangelogEntry, type ChangelogEntryListItem, type ChangelogGetByIdParams, type ChangelogGetBySlugParams, type ChangelogListParams, ChangelogModule, type ChangelogOrderBy, type ChangelogType, type ConfigListParams, ConfigModule, type CreateFeedbackCommentParams, type CreateFeedbackPostParams, type CreatedFeedbackComment, type CreatedFeedbackPost, type DeleteFeedbackCommentParams, type DeleteFeedbackCommentResponse, type DeleteFeedbackPostParams, type DeleteFeedbackPostResponse, type ExternalUser, type FeedbackAssignee, type FeedbackAuthor, type FeedbackComment, type FeedbackListParams, FeedbackModule, type FeedbackPost, type FeedbackPostCategory, type FeedbackPostListItem, type FeedbackPostStatus, type FeedbackSortOption, type FeedbackTopContributor, type FeedbackTopContributorsParams, type FeedbackVoteParams, type FeedbackVoteResponse, type HealthCheckResponse, type HelpArticle, type HelpArticleAuthor, type HelpArticleListItem, type HelpArticleVisibility, type HelpCategoriesParams, type HelpCategory, type HelpChatMessage, type HelpChatParams, type HelpChatResponse, type HelpChatSource, type HelpChatSourceCategory, type HelpChatStreamChunk, type HelpGetByIdParams, type HelpGetBySlugParams, type HelpListParams, HelpModule, type HelpSearchParams, type HelpSearchResult, Kookee, KookeeApiError, type KookeeConfig, type ListMyFeedbackPostsParams, type LocaleOptions, type OrderDirection, type Page, type PageListItem, type PagesGetByIdParams, type PagesGetBySlugParams, type PagesListParams, PagesModule, type PaginatedResponse, type PaginationParams, type PublicConfig, type ReactParams, type ReactResponse, type ReactionType, type VoteUsefulnessResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -349,6 +349,12 @@ interface DeleteFeedbackPostParams {
|
|
|
349
349
|
interface DeleteFeedbackPostResponse {
|
|
350
350
|
success: boolean;
|
|
351
351
|
}
|
|
352
|
+
interface DeleteFeedbackCommentParams {
|
|
353
|
+
externalId: string;
|
|
354
|
+
}
|
|
355
|
+
interface DeleteFeedbackCommentResponse {
|
|
356
|
+
success: boolean;
|
|
357
|
+
}
|
|
352
358
|
|
|
353
359
|
interface AnnouncementListParams extends PaginationParams, LocaleOptions {
|
|
354
360
|
type?: AnnouncementType;
|
|
@@ -440,6 +446,7 @@ declare class FeedbackModule {
|
|
|
440
446
|
createComment(postId: string, params: CreateFeedbackCommentParams): Promise<CreatedFeedbackComment>;
|
|
441
447
|
listMyPosts(params: ListMyFeedbackPostsParams): Promise<PaginatedResponse<FeedbackPostListItem>>;
|
|
442
448
|
deletePost(postId: string, params: DeleteFeedbackPostParams): Promise<DeleteFeedbackPostResponse>;
|
|
449
|
+
deleteComment(commentId: string, params: DeleteFeedbackCommentParams): Promise<DeleteFeedbackCommentResponse>;
|
|
443
450
|
}
|
|
444
451
|
|
|
445
452
|
interface HelpCategoriesParams extends LocaleOptions {
|
|
@@ -501,4 +508,4 @@ declare class Kookee {
|
|
|
501
508
|
health(): Promise<HealthCheckResponse>;
|
|
502
509
|
}
|
|
503
510
|
|
|
504
|
-
export { type Announcement, type AnnouncementAuthor, type AnnouncementGetByIdParams, type AnnouncementListItem, type AnnouncementListParams, AnnouncementModule, type AnnouncementOrderBy, type AnnouncementType, type ApiError, type BlogGetByIdParams, type BlogGetBySlugParams, type BlogListParams, BlogModule, type BlogPost, type BlogPostAuthor, type BlogPostListItem, type BlogPostStatus, type BlogTag, type BlogTagWithCount, type ChangelogAuthor, type ChangelogEntry, type ChangelogEntryListItem, type ChangelogGetByIdParams, type ChangelogGetBySlugParams, type ChangelogListParams, ChangelogModule, type ChangelogOrderBy, type ChangelogType, type ConfigListParams, ConfigModule, type CreateFeedbackCommentParams, type CreateFeedbackPostParams, type CreatedFeedbackComment, type CreatedFeedbackPost, type DeleteFeedbackPostParams, type DeleteFeedbackPostResponse, type ExternalUser, type FeedbackAssignee, type FeedbackAuthor, type FeedbackComment, type FeedbackListParams, FeedbackModule, type FeedbackPost, type FeedbackPostCategory, type FeedbackPostListItem, type FeedbackPostStatus, type FeedbackSortOption, type FeedbackTopContributor, type FeedbackTopContributorsParams, type FeedbackVoteParams, type FeedbackVoteResponse, type HealthCheckResponse, type HelpArticle, type HelpArticleAuthor, type HelpArticleListItem, type HelpArticleVisibility, type HelpCategoriesParams, type HelpCategory, type HelpChatMessage, type HelpChatParams, type HelpChatResponse, type HelpChatSource, type HelpChatSourceCategory, type HelpChatStreamChunk, type HelpGetByIdParams, type HelpGetBySlugParams, type HelpListParams, HelpModule, type HelpSearchParams, type HelpSearchResult, Kookee, KookeeApiError, type KookeeConfig, type ListMyFeedbackPostsParams, type LocaleOptions, type OrderDirection, type Page, type PageListItem, type PagesGetByIdParams, type PagesGetBySlugParams, type PagesListParams, PagesModule, type PaginatedResponse, type PaginationParams, type PublicConfig, type ReactParams, type ReactResponse, type ReactionType, type VoteUsefulnessResponse };
|
|
511
|
+
export { type Announcement, type AnnouncementAuthor, type AnnouncementGetByIdParams, type AnnouncementListItem, type AnnouncementListParams, AnnouncementModule, type AnnouncementOrderBy, type AnnouncementType, type ApiError, type BlogGetByIdParams, type BlogGetBySlugParams, type BlogListParams, BlogModule, type BlogPost, type BlogPostAuthor, type BlogPostListItem, type BlogPostStatus, type BlogTag, type BlogTagWithCount, type ChangelogAuthor, type ChangelogEntry, type ChangelogEntryListItem, type ChangelogGetByIdParams, type ChangelogGetBySlugParams, type ChangelogListParams, ChangelogModule, type ChangelogOrderBy, type ChangelogType, type ConfigListParams, ConfigModule, type CreateFeedbackCommentParams, type CreateFeedbackPostParams, type CreatedFeedbackComment, type CreatedFeedbackPost, type DeleteFeedbackCommentParams, type DeleteFeedbackCommentResponse, type DeleteFeedbackPostParams, type DeleteFeedbackPostResponse, type ExternalUser, type FeedbackAssignee, type FeedbackAuthor, type FeedbackComment, type FeedbackListParams, FeedbackModule, type FeedbackPost, type FeedbackPostCategory, type FeedbackPostListItem, type FeedbackPostStatus, type FeedbackSortOption, type FeedbackTopContributor, type FeedbackTopContributorsParams, type FeedbackVoteParams, type FeedbackVoteResponse, type HealthCheckResponse, type HelpArticle, type HelpArticleAuthor, type HelpArticleListItem, type HelpArticleVisibility, type HelpCategoriesParams, type HelpCategory, type HelpChatMessage, type HelpChatParams, type HelpChatResponse, type HelpChatSource, type HelpChatSourceCategory, type HelpChatStreamChunk, type HelpGetByIdParams, type HelpGetBySlugParams, type HelpListParams, HelpModule, type HelpSearchParams, type HelpSearchResult, Kookee, KookeeApiError, type KookeeConfig, type ListMyFeedbackPostsParams, type LocaleOptions, type OrderDirection, type Page, type PageListItem, type PagesGetByIdParams, type PagesGetBySlugParams, type PagesListParams, PagesModule, type PaginatedResponse, type PaginationParams, type PublicConfig, type ReactParams, type ReactResponse, type ReactionType, type VoteUsefulnessResponse };
|
package/dist/index.global.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(exports){'use strict';var k="https://api.kookee.dev",B="Kookee-API-Key",H="Kookee-Project-Id",i=class n extends Error{constructor(t,s,
|
|
2
|
-
`);
|
|
1
|
+
(function(exports){'use strict';var k="https://api.kookee.dev",B="Kookee-API-Key",H="Kookee-Project-Id",i=class n extends Error{constructor(t,s,r){super(s);this.code=t;this.status=r;this.name="KookeeApiError",Object.setPrototypeOf(this,n.prototype);}},u=class{baseUrl;apiKey;projectId;constructor(e){this.apiKey=e.apiKey,this.projectId=e.projectId,this.baseUrl=e.baseUrl??k;}getHeaders(){let e={"Content-Type":"application/json"};return this.apiKey&&(e[B]=this.apiKey),this.projectId&&(e[H]=this.projectId),e}async get(e,t){let s=new URL(`${this.baseUrl}${e}`);if(t){for(let[P,o]of Object.entries(t))if(o!=null)if(Array.isArray(o))for(let a of o)s.searchParams.append(P,String(a));else s.searchParams.set(P,String(o));}let r=await fetch(s.toString(),{method:"GET",headers:this.getHeaders()});return this.handleResponse(r)}async post(e,t){let s=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(s)}async delete(e,t){let s=await fetch(`${this.baseUrl}${e}`,{method:"DELETE",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(s)}async*streamPost(e,t){let s=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:{...this.getHeaders(),Accept:"text/event-stream"},body:t?JSON.stringify(t):void 0});if(!s.ok){let a=null;try{a=await s.json();}catch{}throw new i(a?.code??"UNKNOWN_ERROR",a?.message??`Request failed with status ${s.status}`,s.status)}if(!s.body)return;let r=s.body.getReader(),P=new TextDecoder,o="";try{for(;;){let{done:a,value:f}=await r.read();if(a)break;o+=P.decode(f,{stream:!0});let b=o.split(`
|
|
2
|
+
`);o=b.pop()??"";for(let I of b){let y=I.trim();if(!(!y||y.startsWith(":"))&&y.startsWith("data: ")){let R=y.slice(6);if(R==="[DONE]")return;yield JSON.parse(R);}}}}finally{r.releaseLock();}}async handleResponse(e){if(!e.ok){let t=null;try{t=await e.json();}catch{}throw new i(t?.code??"UNKNOWN_ERROR",t?.message??`Request failed with status ${e.status}`,e.status)}return e.json()}};var p=class{constructor(e){this.http=e;}async list(e){let{excludeIds:t,...s}=e??{},r=t?.length?{...s,excludeIds:t.join(",")}:s;return this.http.get("/v1/announcements",r)}async getById(e,t){return this.http.get(`/v1/announcements/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/announcements/${encodeURIComponent(e)}/translations`)}};var c=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/blog/posts",e)}async getBySlug(e,t){return this.http.get(`/v1/blog/posts/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/blog/posts/by-id/${encodeURIComponent(e)}`,t)}async getTags(){return this.http.get("/v1/blog/tags")}async getTranslationsById(e){return this.http.get(`/v1/blog/posts/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/blog/posts/${encodeURIComponent(e)}/translations`)}async react(e,t){return this.http.post(`/v1/blog/posts/${encodeURIComponent(e)}/reactions`,t)}};var l=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/changelog",e)}async getBySlug(e,t){return this.http.get(`/v1/changelog/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/changelog/by-id/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/changelog/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/changelog/${encodeURIComponent(e)}/translations`)}async react(e,t){return this.http.post(`/v1/changelog/${encodeURIComponent(e)}/reactions`,t)}};var g=class{constructor(e){this.http=e;}async getByKey(e){return this.http.get(`/v1/config/${encodeURIComponent(e)}`)}async list(e){return this.http.get("/v1/config",e)}};var m=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/feedback",e)}async getById(e){return this.http.get(`/v1/feedback/by-id/${encodeURIComponent(e)}`)}async vote(e,t){return this.http.post(`/v1/feedback/${encodeURIComponent(e)}/vote`,t)}async getTopContributors(e){return this.http.get("/v1/feedback/top-contributors",e)}async createPost(e){return this.http.post("/v1/feedback",e)}async createComment(e,t){return this.http.post(`/v1/feedback/${encodeURIComponent(e)}/comments`,t)}async listMyPosts(e){return this.http.get("/v1/feedback/mine",e)}async deletePost(e,t){return this.http.delete(`/v1/feedback/${encodeURIComponent(e)}`,t)}async deleteComment(e,t){return this.http.delete(`/v1/feedback/comments/${encodeURIComponent(e)}`,t)}};var d=class{constructor(e){this.http=e;}async categories(e){return this.http.get("/v1/help/categories",e)}async list(e){return this.http.get("/v1/help/articles",e)}async getBySlug(e,t){return this.http.get(`/v1/help/articles/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/help/articles/by-id/${encodeURIComponent(e)}`,t)}async search(e){return this.http.get("/v1/help/search",e)}async getTranslationsById(e){return this.http.get(`/v1/help/articles/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/help/articles/${encodeURIComponent(e)}/translations`)}async chat(e){return this.http.post("/v1/help/chat",e)}chatStream(e){return this.http.streamPost("/v1/help/chat/stream",e)}async voteUsefulness(e,t,s){return this.http.post(`/v1/help/articles/by-id/${encodeURIComponent(e)}/vote-usefulness`,{vote:t,previousVote:s})}};var h=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/pages",e)}async getBySlug(e,t){return this.http.get(`/v1/pages/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/pages/by-id/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/pages/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/pages/${encodeURIComponent(e)}/translations`)}};var C=class{http;announcements;blog;changelog;config;feedback;help;pages;constructor(e){if(!e.apiKey&&!e.projectId)throw new Error("Either apiKey or projectId is required");this.http=new u({apiKey:e.apiKey,projectId:e.projectId,baseUrl:e.baseUrl}),this.announcements=new p(this.http),this.blog=new c(this.http),this.changelog=new l(this.http),this.config=new g(this.http),this.feedback=new m(this.http),this.help=new d(this.http),this.pages=new h(this.http);}async health(){return this.http.get("/v1/health")}};exports.AnnouncementModule=p;exports.BlogModule=c;exports.ChangelogModule=l;exports.ConfigModule=g;exports.FeedbackModule=m;exports.HelpModule=d;exports.Kookee=C;exports.KookeeApiError=i;exports.PagesModule=h;return exports;})({});
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var k="https://api.kookee.dev",B="Kookee-API-Key",H="Kookee-Project-Id",i=class n extends Error{constructor(t,s,
|
|
2
|
-
`);
|
|
1
|
+
var k="https://api.kookee.dev",B="Kookee-API-Key",H="Kookee-Project-Id",i=class n extends Error{constructor(t,s,r){super(s);this.code=t;this.status=r;this.name="KookeeApiError",Object.setPrototypeOf(this,n.prototype);}},u=class{baseUrl;apiKey;projectId;constructor(e){this.apiKey=e.apiKey,this.projectId=e.projectId,this.baseUrl=e.baseUrl??k;}getHeaders(){let e={"Content-Type":"application/json"};return this.apiKey&&(e[B]=this.apiKey),this.projectId&&(e[H]=this.projectId),e}async get(e,t){let s=new URL(`${this.baseUrl}${e}`);if(t){for(let[P,o]of Object.entries(t))if(o!=null)if(Array.isArray(o))for(let a of o)s.searchParams.append(P,String(a));else s.searchParams.set(P,String(o));}let r=await fetch(s.toString(),{method:"GET",headers:this.getHeaders()});return this.handleResponse(r)}async post(e,t){let s=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(s)}async delete(e,t){let s=await fetch(`${this.baseUrl}${e}`,{method:"DELETE",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(s)}async*streamPost(e,t){let s=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:{...this.getHeaders(),Accept:"text/event-stream"},body:t?JSON.stringify(t):void 0});if(!s.ok){let a=null;try{a=await s.json();}catch{}throw new i(a?.code??"UNKNOWN_ERROR",a?.message??`Request failed with status ${s.status}`,s.status)}if(!s.body)return;let r=s.body.getReader(),P=new TextDecoder,o="";try{for(;;){let{done:a,value:f}=await r.read();if(a)break;o+=P.decode(f,{stream:!0});let b=o.split(`
|
|
2
|
+
`);o=b.pop()??"";for(let I of b){let y=I.trim();if(!(!y||y.startsWith(":"))&&y.startsWith("data: ")){let R=y.slice(6);if(R==="[DONE]")return;yield JSON.parse(R);}}}}finally{r.releaseLock();}}async handleResponse(e){if(!e.ok){let t=null;try{t=await e.json();}catch{}throw new i(t?.code??"UNKNOWN_ERROR",t?.message??`Request failed with status ${e.status}`,e.status)}return e.json()}};var p=class{constructor(e){this.http=e;}async list(e){let{excludeIds:t,...s}=e??{},r=t?.length?{...s,excludeIds:t.join(",")}:s;return this.http.get("/v1/announcements",r)}async getById(e,t){return this.http.get(`/v1/announcements/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/announcements/${encodeURIComponent(e)}/translations`)}};var c=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/blog/posts",e)}async getBySlug(e,t){return this.http.get(`/v1/blog/posts/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/blog/posts/by-id/${encodeURIComponent(e)}`,t)}async getTags(){return this.http.get("/v1/blog/tags")}async getTranslationsById(e){return this.http.get(`/v1/blog/posts/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/blog/posts/${encodeURIComponent(e)}/translations`)}async react(e,t){return this.http.post(`/v1/blog/posts/${encodeURIComponent(e)}/reactions`,t)}};var l=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/changelog",e)}async getBySlug(e,t){return this.http.get(`/v1/changelog/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/changelog/by-id/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/changelog/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/changelog/${encodeURIComponent(e)}/translations`)}async react(e,t){return this.http.post(`/v1/changelog/${encodeURIComponent(e)}/reactions`,t)}};var g=class{constructor(e){this.http=e;}async getByKey(e){return this.http.get(`/v1/config/${encodeURIComponent(e)}`)}async list(e){return this.http.get("/v1/config",e)}};var m=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/feedback",e)}async getById(e){return this.http.get(`/v1/feedback/by-id/${encodeURIComponent(e)}`)}async vote(e,t){return this.http.post(`/v1/feedback/${encodeURIComponent(e)}/vote`,t)}async getTopContributors(e){return this.http.get("/v1/feedback/top-contributors",e)}async createPost(e){return this.http.post("/v1/feedback",e)}async createComment(e,t){return this.http.post(`/v1/feedback/${encodeURIComponent(e)}/comments`,t)}async listMyPosts(e){return this.http.get("/v1/feedback/mine",e)}async deletePost(e,t){return this.http.delete(`/v1/feedback/${encodeURIComponent(e)}`,t)}async deleteComment(e,t){return this.http.delete(`/v1/feedback/comments/${encodeURIComponent(e)}`,t)}};var d=class{constructor(e){this.http=e;}async categories(e){return this.http.get("/v1/help/categories",e)}async list(e){return this.http.get("/v1/help/articles",e)}async getBySlug(e,t){return this.http.get(`/v1/help/articles/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/help/articles/by-id/${encodeURIComponent(e)}`,t)}async search(e){return this.http.get("/v1/help/search",e)}async getTranslationsById(e){return this.http.get(`/v1/help/articles/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/help/articles/${encodeURIComponent(e)}/translations`)}async chat(e){return this.http.post("/v1/help/chat",e)}chatStream(e){return this.http.streamPost("/v1/help/chat/stream",e)}async voteUsefulness(e,t,s){return this.http.post(`/v1/help/articles/by-id/${encodeURIComponent(e)}/vote-usefulness`,{vote:t,previousVote:s})}};var h=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/pages",e)}async getBySlug(e,t){return this.http.get(`/v1/pages/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/pages/by-id/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/pages/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/pages/${encodeURIComponent(e)}/translations`)}};var C=class{http;announcements;blog;changelog;config;feedback;help;pages;constructor(e){if(!e.apiKey&&!e.projectId)throw new Error("Either apiKey or projectId is required");this.http=new u({apiKey:e.apiKey,projectId:e.projectId,baseUrl:e.baseUrl}),this.announcements=new p(this.http),this.blog=new c(this.http),this.changelog=new l(this.http),this.config=new g(this.http),this.feedback=new m(this.http),this.help=new d(this.http),this.pages=new h(this.http);}async health(){return this.http.get("/v1/health")}};export{p as AnnouncementModule,c as BlogModule,l as ChangelogModule,g as ConfigModule,m as FeedbackModule,d as HelpModule,C as Kookee,i as KookeeApiError,h as PagesModule};
|