@kookee/sdk 0.0.22 → 0.0.24
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 +157 -25
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +118 -12
- package/dist/index.d.ts +118 -12
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -42,8 +42,8 @@ const post = await kookee.blog.getBySlug('hello-world');
|
|
|
42
42
|
// List posts with pagination
|
|
43
43
|
const posts = await kookee.blog.list({ page: 1, limit: 10 });
|
|
44
44
|
|
|
45
|
-
// Filter by tag
|
|
46
|
-
const taggedPosts = await kookee.blog.list({
|
|
45
|
+
// Filter by tag slugs
|
|
46
|
+
const taggedPosts = await kookee.blog.list({ tags: ['news'] });
|
|
47
47
|
|
|
48
48
|
// Search posts
|
|
49
49
|
const searchResults = await kookee.blog.list({ search: 'tutorial' });
|
|
@@ -56,40 +56,172 @@ const postById = await kookee.blog.getById('post-uuid');
|
|
|
56
56
|
|
|
57
57
|
// Get all tags with post counts
|
|
58
58
|
const tags = await kookee.blog.getTags();
|
|
59
|
-
```
|
|
60
59
|
|
|
61
|
-
|
|
60
|
+
// React to a post
|
|
61
|
+
await kookee.blog.react('post-id', { reactionType: 'heart', action: 'add' });
|
|
62
|
+
|
|
63
|
+
// Get translations
|
|
64
|
+
const translations = await kookee.blog.getTranslationsBySlug('my-post');
|
|
65
|
+
```
|
|
62
66
|
|
|
63
|
-
|
|
67
|
+
## Help Center
|
|
64
68
|
|
|
65
69
|
```typescript
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
70
|
+
// List categories
|
|
71
|
+
const categories = await kookee.help.categories();
|
|
72
|
+
|
|
73
|
+
// List articles with pagination
|
|
74
|
+
const articles = await kookee.help.list({ page: 1, limit: 10 });
|
|
75
|
+
|
|
76
|
+
// Filter by category slug
|
|
77
|
+
const categoryArticles = await kookee.help.list({ category: 'getting-started' });
|
|
78
|
+
|
|
79
|
+
// Semantic search
|
|
80
|
+
const results = await kookee.help.search({ query: 'how to reset password', limit: 5 });
|
|
81
|
+
|
|
82
|
+
// Get single article
|
|
83
|
+
const article = await kookee.help.getBySlug('getting-started');
|
|
84
|
+
const articleById = await kookee.help.getById('article-uuid');
|
|
85
|
+
|
|
86
|
+
// Get article translations
|
|
87
|
+
const translations = await kookee.help.getTranslationsBySlug('getting-started');
|
|
88
|
+
|
|
89
|
+
// AI-powered chat
|
|
90
|
+
const response = await kookee.help.chat({
|
|
91
|
+
messages: [{ role: 'user', content: 'How do I reset my password?' }],
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
// Streaming chat
|
|
95
|
+
for await (const chunk of kookee.help.chatStream({ messages })) {
|
|
96
|
+
if (chunk.type === 'delta') console.log(chunk.content);
|
|
97
|
+
if (chunk.type === 'sources') console.log('Sources:', chunk.sources);
|
|
78
98
|
}
|
|
99
|
+
|
|
100
|
+
// Vote on article usefulness
|
|
101
|
+
await kookee.help.voteUsefulness('article-id', 'yes');
|
|
79
102
|
```
|
|
80
103
|
|
|
81
|
-
|
|
104
|
+
## Changelog
|
|
82
105
|
|
|
83
106
|
```typescript
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
107
|
+
// List entries
|
|
108
|
+
const entries = await kookee.changelog.list({ page: 1, limit: 10 });
|
|
109
|
+
|
|
110
|
+
// Filter by type: 'feature' | 'fix' | 'improvement' | 'breaking' | 'security' | 'deprecated' | 'other'
|
|
111
|
+
const fixes = await kookee.changelog.list({ type: 'fix' });
|
|
112
|
+
|
|
113
|
+
// Order by version or date
|
|
114
|
+
const sorted = await kookee.changelog.list({ orderBy: 'version', order: 'desc' });
|
|
115
|
+
|
|
116
|
+
// Get single entry
|
|
117
|
+
const entry = await kookee.changelog.getBySlug('v1-0-0');
|
|
118
|
+
const entryById = await kookee.changelog.getById('entry-uuid');
|
|
119
|
+
|
|
120
|
+
// Get translations
|
|
121
|
+
const translations = await kookee.changelog.getTranslationsBySlug('v1-0-0');
|
|
122
|
+
|
|
123
|
+
// React to an entry
|
|
124
|
+
await kookee.changelog.react('entry-id', { reactionType: 'fire', action: 'add' });
|
|
90
125
|
```
|
|
91
126
|
|
|
92
|
-
|
|
127
|
+
## Announcements
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
// List announcements
|
|
131
|
+
const announcements = await kookee.announcements.list({ page: 1, limit: 10 });
|
|
132
|
+
|
|
133
|
+
// Filter by type: 'info' | 'warning' | 'critical' | 'promotion' | 'maintenance' | 'newFeature'
|
|
134
|
+
const critical = await kookee.announcements.list({ type: 'critical' });
|
|
135
|
+
|
|
136
|
+
// Exclude already-seen announcements
|
|
137
|
+
const unseen = await kookee.announcements.list({ excludeIds: ['id1', 'id2'] });
|
|
138
|
+
|
|
139
|
+
// Get single announcement
|
|
140
|
+
const announcement = await kookee.announcements.getById('announcement-uuid');
|
|
141
|
+
|
|
142
|
+
// Get translations
|
|
143
|
+
const translations = await kookee.announcements.getTranslationsById('announcement-uuid');
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Pages
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
// List pages
|
|
150
|
+
const pages = await kookee.pages.list({ page: 1, limit: 10 });
|
|
151
|
+
|
|
152
|
+
// Search pages
|
|
153
|
+
const results = await kookee.pages.list({ search: 'privacy' });
|
|
154
|
+
|
|
155
|
+
// Get single page
|
|
156
|
+
const page = await kookee.pages.getBySlug('privacy-policy');
|
|
157
|
+
const pageById = await kookee.pages.getById('page-uuid');
|
|
158
|
+
|
|
159
|
+
// Get translations
|
|
160
|
+
const translations = await kookee.pages.getTranslationsBySlug('privacy-policy');
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Feedback
|
|
164
|
+
|
|
165
|
+
```typescript
|
|
166
|
+
// List feedback posts
|
|
167
|
+
const posts = await kookee.feedback.list({ page: 1, limit: 10 });
|
|
168
|
+
|
|
169
|
+
// Filter by status: 'open' | 'under_review' | 'planned' | 'in_progress' | 'completed' | 'declined'
|
|
170
|
+
const planned = await kookee.feedback.list({ status: 'planned' });
|
|
171
|
+
|
|
172
|
+
// Filter by category: 'feature' | 'improvement' | 'bug' | 'other'
|
|
173
|
+
const bugs = await kookee.feedback.list({ category: 'bug' });
|
|
174
|
+
|
|
175
|
+
// Sort options: 'newest' | 'top' | 'trending'
|
|
176
|
+
const trending = await kookee.feedback.list({ sort: 'trending' });
|
|
177
|
+
|
|
178
|
+
// Get single post with comments
|
|
179
|
+
const post = await kookee.feedback.getById('post-uuid');
|
|
180
|
+
|
|
181
|
+
// Vote on a post
|
|
182
|
+
await kookee.feedback.vote('post-id', { action: 'upvote' });
|
|
183
|
+
|
|
184
|
+
// Get top contributors
|
|
185
|
+
const contributors = await kookee.feedback.getTopContributors({ limit: 10 });
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Config
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
// Get a single config value
|
|
192
|
+
const config = await kookee.config.getByKey('feature_flags');
|
|
193
|
+
|
|
194
|
+
// Get multiple config values
|
|
195
|
+
const configs = await kookee.config.list({ keys: ['feature_flags', 'theme'] });
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Reactions
|
|
199
|
+
|
|
200
|
+
Blog posts and changelog entries support reactions:
|
|
201
|
+
|
|
202
|
+
```typescript
|
|
203
|
+
// Available reaction types: 'fire' | 'heart' | 'rocket' | 'eyes' | 'mindblown'
|
|
204
|
+
await kookee.blog.react('post-id', { reactionType: 'heart', action: 'add' });
|
|
205
|
+
|
|
206
|
+
// Remove a reaction
|
|
207
|
+
await kookee.blog.react('post-id', { reactionType: 'heart', action: 'remove' });
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Localization
|
|
211
|
+
|
|
212
|
+
Most endpoints support locale options:
|
|
213
|
+
|
|
214
|
+
```typescript
|
|
215
|
+
// Specify locale
|
|
216
|
+
const posts = await kookee.blog.list({ locale: 'de' });
|
|
217
|
+
|
|
218
|
+
// With fallback to default locale if translation doesn't exist
|
|
219
|
+
const post = await kookee.blog.getBySlug('hello-world', { locale: 'de', fallback: true });
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Paginated Response
|
|
223
|
+
|
|
224
|
+
All list endpoints return a paginated response:
|
|
93
225
|
|
|
94
226
|
```typescript
|
|
95
227
|
interface PaginatedResponse<T> {
|
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var
|
|
2
|
-
exports.AnnouncementModule=
|
|
1
|
+
'use strict';var B="https://api.kookee.dev",H="Kookee-API-Key",x="Kookee-Project-Id",i=class n extends Error{constructor(t,s,o){super(s);this.code=t;this.status=o;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??B;}getHeaders(){let e={"Content-Type":"application/json"};return this.apiKey&&(e[H]=this.apiKey),this.projectId&&(e[x]=this.projectId),e}async get(e,t){let s=new URL(`${this.baseUrl}${e}`);if(t){for(let[y,r]of Object.entries(t))if(r!=null)if(Array.isArray(r))for(let a of r)s.searchParams.append(y,String(a));else s.searchParams.set(y,String(r));}let o=await fetch(s.toString(),{method:"GET",headers:this.getHeaders()});return this.handleResponse(o)}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*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 o=s.body.getReader(),y=new TextDecoder,r="";try{for(;;){let{done:a,value:b}=await o.read();if(a)break;r+=y.decode(b,{stream:!0});let C=r.split(`
|
|
2
|
+
`);r=C.pop()??"";for(let I of C){let P=I.trim();if(!(!P||P.startsWith(":"))&&P.startsWith("data: ")){let R=P.slice(6);if(R==="[DONE]")return;yield JSON.parse(R);}}}}finally{o.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??{},o=t?.length?{...s,excludeIds:t.join(",")}:s;return this.http.get("/v1/announcements",o)}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)}};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 f=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=f;exports.KookeeApiError=i;exports.PagesModule=h;//# sourceMappingURL=index.cjs.map
|
|
3
3
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/http-client.ts","../src/lib/modules/announcement.ts","../src/lib/modules/blog.ts","../src/lib/modules/changelog.ts","../src/lib/modules/config.ts","../src/lib/modules/help.ts","../src/lib/modules/pages.ts","../src/lib/client.ts"],"names":["DEFAULT_BASE_URL","API_KEY_HEADER","KookeeApiError","code","message","status","HttpClient","apiKey","baseUrl","path","params","url","key","value","item","response","body","errorData","AnnouncementModule","http","excludeIds","rest","queryParams","id","BlogModule","slug","postId","ChangelogModule","changelogId","ConfigModule","HelpModule","articleId","vote","previousVote","PagesModule","pageId","Kookee","config"],"mappings":"aAEA,IAAMA,CAAAA,CAAmB,yBACnBC,CAAAA,CAAiB,gBAAA,CAEVC,EAAN,cAA6B,KAAM,CACxC,WAAA,CACkBC,CAAAA,CAChBC,CAAAA,CACgBC,EAChB,CACA,KAAA,CAAMD,CAAO,CAAA,CAJG,IAAA,CAAA,IAAA,CAAAD,CAAAA,CAEA,YAAAE,CAAAA,CAGhB,IAAA,CAAK,IAAA,CAAO,iBACd,CACF,CAAA,CAEaC,EAAN,KAAiB,CACL,QACA,MAAA,CAEjB,WAAA,CAAYC,EAAgBC,CAAAA,CAAkB,CAC5C,IAAA,CAAK,MAAA,CAASD,CAAAA,CACd,IAAA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AAA,CAAO,OACV,MAAM,IAAI,KAAA,CAAM,oBAAoB,CAAA,CAGtC,IAAA,CAAK,KAAO,IAAI/B,CAAAA,CAAW+B,CAAAA,CAAO,MAAA,CAAQA,CAAAA,CAAO,OAAO,EAExD,IAAA,CAAK,aAAA,CAAgB,IAAInB,CAAAA,CAAmB,IAAA,CAAK,IAAI,CAAA,CACrD,IAAA,CAAK,IAAA,CAAO,IAAIM,CAAAA,CAAW,IAAA,CAAK,IAAI,CAAA,CACpC,IAAA,CAAK,SAAA,CAAY,IAAIG,CAAAA,CAAgB,IAAA,CAAK,IAAI,CAAA,CAC9C,IAAA,CAAK,MAAA,CAAS,IAAIE,CAAAA,CAAa,IAAA,CAAK,IAAI,CAAA,CACxC,IAAA,CAAK,IAAA,CAAO,IAAIC,CAAAA,CAAW,IAAA,CAAK,IAAI,CAAA,CACpC,IAAA,CAAK,KAAA,CAAQ,IAAII,CAAAA,CAAY,IAAA,CAAK,IAAI,EACxC,CAEA,MAAM,MAAA,EAAuC,CAC3C,OAAO,KAAK,IAAA,CAAK,GAAA,CAAyB,YAAY,CACxD,CACF","file":"index.cjs","sourcesContent":["import type { ApiError } from './types';\n\nconst DEFAULT_BASE_URL = 'https://api.kookee.dev';\nconst API_KEY_HEADER = 'Kookee-API-Key';\n\nexport class KookeeApiError extends Error {\n constructor(\n public readonly code: string,\n message: string,\n public readonly status: number\n ) {\n super(message);\n this.name = 'KookeeApiError';\n }\n}\n\nexport class HttpClient {\n private readonly baseUrl: string;\n private readonly apiKey: string;\n\n constructor(apiKey: string, baseUrl?: string) {\n this.apiKey = apiKey;\n this.baseUrl = baseUrl ?? DEFAULT_BASE_URL;\n }\n\n private getHeaders(): Record<string, string> {\n return {\n 'Content-Type': 'application/json',\n [API_KEY_HEADER]: this.apiKey,\n };\n }\n\n async get<T>(path: string, params?: object): Promise<T> {\n const url = new URL(`${this.baseUrl}${path}`);\n\n if (params) {\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined && value !== null) {\n if (Array.isArray(value)) {\n for (const item of value) {\n url.searchParams.append(key, String(item));\n }\n } else {\n url.searchParams.set(key, String(value));\n }\n }\n }\n }\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: this.getHeaders(),\n });\n\n return this.handleResponse<T>(response);\n }\n\n async post<T>(path: string, body?: unknown): Promise<T> {\n const response = await fetch(`${this.baseUrl}${path}`, {\n method: 'POST',\n headers: this.getHeaders(),\n body: body ? JSON.stringify(body) : undefined,\n });\n\n return this.handleResponse<T>(response);\n }\n\n private async handleResponse<T>(response: Response): Promise<T> {\n if (!response.ok) {\n let errorData: ApiError | null = null;\n\n try {\n errorData = (await response.json()) as ApiError;\n } catch {\n // Response body is not JSON\n }\n\n throw new KookeeApiError(\n errorData?.code ?? 'UNKNOWN_ERROR',\n errorData?.message ?? `Request failed with status ${response.status}`,\n response.status\n );\n }\n\n return response.json() as Promise<T>;\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n Announcement,\n AnnouncementListItem,\n AnnouncementOrderBy,\n AnnouncementType,\n LocaleOptions,\n OrderDirection,\n PaginatedResponse,\n PaginationParams,\n} from '../types';\n\nexport interface AnnouncementListParams extends PaginationParams, LocaleOptions {\n type?: AnnouncementType;\n excludeIds?: string[];\n orderBy?: AnnouncementOrderBy;\n order?: OrderDirection;\n}\n\nexport interface AnnouncementGetByIdParams extends LocaleOptions {}\n\nexport class AnnouncementModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: AnnouncementListParams): Promise<PaginatedResponse<AnnouncementListItem>> {\n const { excludeIds, ...rest } = params ?? {};\n const queryParams = excludeIds?.length ? { ...rest, excludeIds: excludeIds.join(',') } : rest;\n return this.http.get<PaginatedResponse<AnnouncementListItem>>('/v1/announcements', queryParams);\n }\n\n async getById(id: string, params?: AnnouncementGetByIdParams): Promise<Announcement> {\n return this.http.get<Announcement>(`/v1/announcements/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(id: string): Promise<Record<string, Announcement>> {\n return this.http.get<Record<string, Announcement>>(\n `/v1/announcements/${encodeURIComponent(id)}/translations`\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n BlogPost,\n BlogPostListItem,\n BlogTagWithCount,\n LocaleOptions,\n PaginatedResponse,\n PaginationParams,\n ReactParams,\n ReactResponse,\n} from '../types';\n\nexport interface BlogListParams extends PaginationParams, LocaleOptions {\n tags?: string[];\n search?: string;\n}\n\nexport interface BlogGetBySlugParams extends LocaleOptions {}\n\nexport interface BlogGetByIdParams extends LocaleOptions {}\n\nexport class BlogModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: BlogListParams): Promise<PaginatedResponse<BlogPostListItem>> {\n return this.http.get<PaginatedResponse<BlogPostListItem>>('/v1/blog/posts', params);\n }\n\n async getBySlug(slug: string, params?: BlogGetBySlugParams): Promise<BlogPost> {\n return this.http.get<BlogPost>(`/v1/blog/posts/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: BlogGetByIdParams): Promise<BlogPost> {\n return this.http.get<BlogPost>(`/v1/blog/posts/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTags(): Promise<BlogTagWithCount[]> {\n return this.http.get<BlogTagWithCount[]>('/v1/blog/tags');\n }\n\n async getTranslationsById(postId: string): Promise<Record<string, BlogPost>> {\n return this.http.get<Record<string, BlogPost>>(\n `/v1/blog/posts/by-id/${encodeURIComponent(postId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, BlogPost>> {\n return this.http.get<Record<string, BlogPost>>(\n `/v1/blog/posts/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async react(postId: string, params: ReactParams): Promise<ReactResponse> {\n return this.http.post<ReactResponse>(\n `/v1/blog/posts/${encodeURIComponent(postId)}/reactions`,\n params\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n ChangelogEntry,\n ChangelogEntryListItem,\n ChangelogOrderBy,\n LocaleOptions,\n OrderDirection,\n PaginatedResponse,\n PaginationParams,\n ReactParams,\n ReactResponse,\n} from '../types';\n\nexport interface ChangelogListParams extends PaginationParams, LocaleOptions {\n type?: string;\n search?: string;\n orderBy?: ChangelogOrderBy;\n order?: OrderDirection;\n}\n\nexport interface ChangelogGetBySlugParams extends LocaleOptions {}\n\nexport interface ChangelogGetByIdParams extends LocaleOptions {}\n\nexport class ChangelogModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: ChangelogListParams): Promise<PaginatedResponse<ChangelogEntryListItem>> {\n return this.http.get<PaginatedResponse<ChangelogEntryListItem>>('/v1/changelog', params);\n }\n\n async getBySlug(slug: string, params?: ChangelogGetBySlugParams): Promise<ChangelogEntry> {\n return this.http.get<ChangelogEntry>(`/v1/changelog/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: ChangelogGetByIdParams): Promise<ChangelogEntry> {\n return this.http.get<ChangelogEntry>(`/v1/changelog/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(id: string): Promise<Record<string, ChangelogEntry>> {\n return this.http.get<Record<string, ChangelogEntry>>(\n `/v1/changelog/by-id/${encodeURIComponent(id)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, ChangelogEntry>> {\n return this.http.get<Record<string, ChangelogEntry>>(\n `/v1/changelog/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async react(changelogId: string, params: ReactParams): Promise<ReactResponse> {\n return this.http.post<ReactResponse>(\n `/v1/changelog/${encodeURIComponent(changelogId)}/reactions`,\n params\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type { PublicConfig } from '../types';\n\nexport interface ConfigListParams {\n keys?: string[];\n}\n\nexport class ConfigModule {\n constructor(private readonly http: HttpClient) {}\n\n async getByKey(key: string): Promise<PublicConfig> {\n return this.http.get<PublicConfig>(`/v1/config/${encodeURIComponent(key)}`);\n }\n\n async list(params?: ConfigListParams): Promise<PublicConfig[]> {\n return this.http.get<PublicConfig[]>('/v1/config', params);\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n HelpArticle,\n HelpArticleListItem,\n HelpCategory,\n HelpChatParams,\n HelpChatResponse,\n HelpSearchResult,\n LocaleOptions,\n PaginatedResponse,\n PaginationParams,\n VoteUsefulnessResponse,\n} from '../types';\n\nexport interface HelpCategoriesParams extends LocaleOptions {}\n\nexport interface HelpListParams extends PaginationParams, LocaleOptions {\n category?: string;\n search?: string;\n}\n\nexport interface HelpSearchParams extends LocaleOptions {\n query: string;\n limit?: number;\n}\n\nexport interface HelpGetBySlugParams extends LocaleOptions {}\n\nexport interface HelpGetByIdParams extends LocaleOptions {}\n\nexport class HelpModule {\n constructor(private readonly http: HttpClient) {}\n\n async categories(params?: HelpCategoriesParams): Promise<HelpCategory[]> {\n return this.http.get<HelpCategory[]>('/v1/help/categories', params);\n }\n\n async list(params?: HelpListParams): Promise<PaginatedResponse<HelpArticleListItem>> {\n return this.http.get<PaginatedResponse<HelpArticleListItem>>('/v1/help/articles', params);\n }\n\n async getBySlug(slug: string, params?: HelpGetBySlugParams): Promise<HelpArticle> {\n return this.http.get<HelpArticle>(`/v1/help/articles/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: HelpGetByIdParams): Promise<HelpArticle> {\n return this.http.get<HelpArticle>(`/v1/help/articles/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async search(params: HelpSearchParams): Promise<HelpSearchResult[]> {\n return this.http.get<HelpSearchResult[]>('/v1/help/search', params);\n }\n\n async getTranslationsById(articleId: string): Promise<Record<string, HelpArticle>> {\n return this.http.get<Record<string, HelpArticle>>(\n `/v1/help/articles/by-id/${encodeURIComponent(articleId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, HelpArticle>> {\n return this.http.get<Record<string, HelpArticle>>(\n `/v1/help/articles/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async chat(params: HelpChatParams): Promise<HelpChatResponse> {\n return this.http.post<HelpChatResponse>('/v1/help/chat', params);\n }\n\n async voteUsefulness(\n articleId: string,\n vote: 'yes' | 'no' | null,\n previousVote?: 'yes' | 'no' | null,\n ): Promise<VoteUsefulnessResponse> {\n return this.http.post<VoteUsefulnessResponse>(\n `/v1/help/articles/by-id/${encodeURIComponent(articleId)}/vote-usefulness`,\n { vote, previousVote }\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type { LocaleOptions, Page, PageListItem, PaginatedResponse, PaginationParams } from '../types';\n\nexport interface PagesListParams extends PaginationParams, LocaleOptions {\n search?: string;\n}\n\nexport interface PagesGetBySlugParams extends LocaleOptions {}\n\nexport interface PagesGetByIdParams extends LocaleOptions {}\n\nexport class PagesModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: PagesListParams): Promise<PaginatedResponse<PageListItem>> {\n return this.http.get<PaginatedResponse<PageListItem>>('/v1/pages', params);\n }\n\n async getBySlug(slug: string, params?: PagesGetBySlugParams): Promise<Page> {\n return this.http.get<Page>(`/v1/pages/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: PagesGetByIdParams): Promise<Page> {\n return this.http.get<Page>(`/v1/pages/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(pageId: string): Promise<Record<string, Page>> {\n return this.http.get<Record<string, Page>>(\n `/v1/pages/by-id/${encodeURIComponent(pageId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, Page>> {\n return this.http.get<Record<string, Page>>(\n `/v1/pages/${encodeURIComponent(slug)}/translations`\n );\n }\n}\n","import { HttpClient } from './http-client';\nimport { AnnouncementModule } from './modules/announcement';\nimport { BlogModule } from './modules/blog';\nimport { ChangelogModule } from './modules/changelog';\nimport { ConfigModule } from './modules/config';\nimport { HelpModule } from './modules/help';\nimport { PagesModule } from './modules/pages';\nimport type { KookeeConfig, HealthCheckResponse } from './types';\n\nexport class Kookee {\n private readonly http: HttpClient;\n\n public readonly announcements: AnnouncementModule;\n public readonly blog: BlogModule;\n public readonly changelog: ChangelogModule;\n public readonly config: ConfigModule;\n public readonly help: HelpModule;\n public readonly pages: PagesModule;\n\n constructor(config: KookeeConfig) {\n if (!config.apiKey) {\n throw new Error('apiKey is required');\n }\n\n this.http = new HttpClient(config.apiKey, config.baseUrl);\n\n this.announcements = new AnnouncementModule(this.http);\n this.blog = new BlogModule(this.http);\n this.changelog = new ChangelogModule(this.http);\n this.config = new ConfigModule(this.http);\n this.help = new HelpModule(this.http);\n this.pages = new PagesModule(this.http);\n }\n\n async health(): Promise<HealthCheckResponse> {\n return this.http.get<HealthCheckResponse>('/v1/health');\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/lib/http-client.ts","../src/lib/modules/announcement.ts","../src/lib/modules/blog.ts","../src/lib/modules/changelog.ts","../src/lib/modules/config.ts","../src/lib/modules/feedback.ts","../src/lib/modules/help.ts","../src/lib/modules/pages.ts","../src/lib/client.ts"],"names":["DEFAULT_BASE_URL","API_KEY_HEADER","PROJECT_ID_HEADER","KookeeApiError","_KookeeApiError","code","message","status","HttpClient","options","headers","path","params","url","key","value","item","response","body","errorData","reader","decoder","buffer","done","lines","line","trimmed","data","AnnouncementModule","http","excludeIds","rest","queryParams","id","BlogModule","slug","postId","ChangelogModule","changelogId","ConfigModule","FeedbackModule","HelpModule","articleId","vote","previousVote","PagesModule","pageId","Kookee","config"],"mappings":"aAEA,IAAMA,CAAAA,CAAmB,wBAAA,CACnBC,CAAAA,CAAiB,gBAAA,CACjBC,EAAoB,mBAAA,CAEbC,CAAAA,CAAN,MAAMC,CAAAA,SAAuB,KAAM,CACxC,WAAA,CACkBC,CAAAA,CAChBC,CAAAA,CACgBC,EAChB,CACA,KAAA,CAAMD,CAAO,CAAA,CAJG,UAAAD,CAAAA,CAEA,IAAA,CAAA,MAAA,CAAAE,CAAAA,CAGhB,IAAA,CAAK,KAAO,gBAAA,CACZ,MAAA,CAAO,cAAA,CAAe,IAAA,CAAMH,EAAe,SAAS,EACtD,CACF,CAAA,CAEaI,EAAN,KAAiB,CACL,OAAA,CACA,MAAA,CAC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hB,WAAA,CAAYC,CAAAA,CAAsB,CAChC,GAAI,CAACA,EAAO,MAAA,EAAU,CAACA,CAAAA,CAAO,SAAA,CAC5B,MAAM,IAAI,MAAM,wCAAwC,CAAA,CAG1D,KAAK,IAAA,CAAO,IAAIxC,EAAW,CAAE,MAAA,CAAQwC,CAAAA,CAAO,MAAA,CAAQ,SAAA,CAAWA,CAAAA,CAAO,UAAW,OAAA,CAASA,CAAAA,CAAO,OAAQ,CAAC,CAAA,CAE1G,IAAA,CAAK,cAAgB,IAAIpB,CAAAA,CAAmB,IAAA,CAAK,IAAI,CAAA,CACrD,IAAA,CAAK,KAAO,IAAIM,CAAAA,CAAW,KAAK,IAAI,CAAA,CACpC,KAAK,SAAA,CAAY,IAAIG,CAAAA,CAAgB,IAAA,CAAK,IAAI,CAAA,CAC9C,KAAK,MAAA,CAAS,IAAIE,EAAa,IAAA,CAAK,IAAI,EACxC,IAAA,CAAK,QAAA,CAAW,IAAIC,CAAAA,CAAe,IAAA,CAAK,IAAI,EAC5C,IAAA,CAAK,IAAA,CAAO,IAAIC,CAAAA,CAAW,IAAA,CAAK,IAAI,CAAA,CACpC,IAAA,CAAK,KAAA,CAAQ,IAAII,CAAAA,CAAY,IAAA,CAAK,IAAI,EACxC,CAEA,MAAM,MAAA,EAAuC,CAC3C,OAAO,KAAK,IAAA,CAAK,GAAA,CAAyB,YAAY,CACxD,CACF","file":"index.cjs","sourcesContent":["import type { ApiError } from './types';\n\nconst DEFAULT_BASE_URL = 'https://api.kookee.dev';\nconst API_KEY_HEADER = 'Kookee-API-Key';\nconst PROJECT_ID_HEADER = 'Kookee-Project-Id';\n\nexport class KookeeApiError extends Error {\n constructor(\n public readonly code: string,\n message: string,\n public readonly status: number\n ) {\n super(message);\n this.name = 'KookeeApiError';\n Object.setPrototypeOf(this, KookeeApiError.prototype);\n }\n}\n\nexport class HttpClient {\n private readonly baseUrl: string;\n private readonly apiKey?: string;\n private readonly projectId?: string;\n\n constructor(options: { apiKey?: string; projectId?: string; baseUrl?: string }) {\n this.apiKey = options.apiKey;\n this.projectId = options.projectId;\n this.baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;\n }\n\n private getHeaders(): Record<string, string> {\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n };\n if (this.apiKey) {\n headers[API_KEY_HEADER] = this.apiKey;\n }\n if (this.projectId) {\n headers[PROJECT_ID_HEADER] = this.projectId;\n }\n return headers;\n }\n\n async get<T>(path: string, params?: object): Promise<T> {\n const url = new URL(`${this.baseUrl}${path}`);\n\n if (params) {\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined && value !== null) {\n if (Array.isArray(value)) {\n for (const item of value) {\n url.searchParams.append(key, String(item));\n }\n } else {\n url.searchParams.set(key, String(value));\n }\n }\n }\n }\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: this.getHeaders(),\n });\n\n return this.handleResponse<T>(response);\n }\n\n async post<T>(path: string, body?: unknown): Promise<T> {\n const response = await fetch(`${this.baseUrl}${path}`, {\n method: 'POST',\n headers: this.getHeaders(),\n body: body ? JSON.stringify(body) : undefined,\n });\n\n return this.handleResponse<T>(response);\n }\n\n async *streamPost<T>(path: string, body?: unknown): AsyncIterable<T> {\n const response = await fetch(`${this.baseUrl}${path}`, {\n method: 'POST',\n headers: {\n ...this.getHeaders(),\n Accept: 'text/event-stream',\n },\n body: body ? JSON.stringify(body) : undefined,\n });\n\n if (!response.ok) {\n let errorData: ApiError | null = null;\n try {\n errorData = (await response.json()) as ApiError;\n } catch {\n // Response body is not JSON\n }\n throw new KookeeApiError(\n errorData?.code ?? 'UNKNOWN_ERROR',\n errorData?.message ?? `Request failed with status ${response.status}`,\n response.status\n );\n }\n\n if (!response.body) {\n return;\n }\n\n const reader = response.body.getReader();\n const decoder = new TextDecoder();\n let buffer = '';\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n buffer = lines.pop() ?? '';\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed || trimmed.startsWith(':')) continue;\n if (trimmed.startsWith('data: ')) {\n const data = trimmed.slice(6);\n if (data === '[DONE]') return;\n yield JSON.parse(data) as T;\n }\n }\n }\n } finally {\n reader.releaseLock();\n }\n }\n\n private async handleResponse<T>(response: Response): Promise<T> {\n if (!response.ok) {\n let errorData: ApiError | null = null;\n\n try {\n errorData = (await response.json()) as ApiError;\n } catch {\n // Response body is not JSON\n }\n\n throw new KookeeApiError(\n errorData?.code ?? 'UNKNOWN_ERROR',\n errorData?.message ?? `Request failed with status ${response.status}`,\n response.status\n );\n }\n\n return response.json() as Promise<T>;\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n Announcement,\n AnnouncementListItem,\n AnnouncementOrderBy,\n AnnouncementType,\n LocaleOptions,\n OrderDirection,\n PaginatedResponse,\n PaginationParams,\n} from '../types';\n\nexport interface AnnouncementListParams extends PaginationParams, LocaleOptions {\n type?: AnnouncementType;\n excludeIds?: string[];\n orderBy?: AnnouncementOrderBy;\n order?: OrderDirection;\n}\n\nexport interface AnnouncementGetByIdParams extends LocaleOptions {}\n\nexport class AnnouncementModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: AnnouncementListParams): Promise<PaginatedResponse<AnnouncementListItem>> {\n const { excludeIds, ...rest } = params ?? {};\n const queryParams = excludeIds?.length ? { ...rest, excludeIds: excludeIds.join(',') } : rest;\n return this.http.get<PaginatedResponse<AnnouncementListItem>>('/v1/announcements', queryParams);\n }\n\n async getById(id: string, params?: AnnouncementGetByIdParams): Promise<Announcement> {\n return this.http.get<Announcement>(`/v1/announcements/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(id: string): Promise<Record<string, Announcement>> {\n return this.http.get<Record<string, Announcement>>(\n `/v1/announcements/${encodeURIComponent(id)}/translations`\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n BlogPost,\n BlogPostListItem,\n BlogTagWithCount,\n LocaleOptions,\n PaginatedResponse,\n PaginationParams,\n ReactParams,\n ReactResponse,\n} from '../types';\n\nexport interface BlogListParams extends PaginationParams, LocaleOptions {\n tags?: string[];\n search?: string;\n}\n\nexport interface BlogGetBySlugParams extends LocaleOptions {}\n\nexport interface BlogGetByIdParams extends LocaleOptions {}\n\nexport class BlogModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: BlogListParams): Promise<PaginatedResponse<BlogPostListItem>> {\n return this.http.get<PaginatedResponse<BlogPostListItem>>('/v1/blog/posts', params);\n }\n\n async getBySlug(slug: string, params?: BlogGetBySlugParams): Promise<BlogPost> {\n return this.http.get<BlogPost>(`/v1/blog/posts/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: BlogGetByIdParams): Promise<BlogPost> {\n return this.http.get<BlogPost>(`/v1/blog/posts/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTags(): Promise<BlogTagWithCount[]> {\n return this.http.get<BlogTagWithCount[]>('/v1/blog/tags');\n }\n\n async getTranslationsById(postId: string): Promise<Record<string, BlogPost>> {\n return this.http.get<Record<string, BlogPost>>(\n `/v1/blog/posts/by-id/${encodeURIComponent(postId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, BlogPost>> {\n return this.http.get<Record<string, BlogPost>>(\n `/v1/blog/posts/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async react(postId: string, params: ReactParams): Promise<ReactResponse> {\n return this.http.post<ReactResponse>(\n `/v1/blog/posts/${encodeURIComponent(postId)}/reactions`,\n params\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n ChangelogEntry,\n ChangelogEntryListItem,\n ChangelogOrderBy,\n LocaleOptions,\n OrderDirection,\n PaginatedResponse,\n PaginationParams,\n ReactParams,\n ReactResponse,\n} from '../types';\n\nexport interface ChangelogListParams extends PaginationParams, LocaleOptions {\n type?: string;\n search?: string;\n orderBy?: ChangelogOrderBy;\n order?: OrderDirection;\n}\n\nexport interface ChangelogGetBySlugParams extends LocaleOptions {}\n\nexport interface ChangelogGetByIdParams extends LocaleOptions {}\n\nexport class ChangelogModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: ChangelogListParams): Promise<PaginatedResponse<ChangelogEntryListItem>> {\n return this.http.get<PaginatedResponse<ChangelogEntryListItem>>('/v1/changelog', params);\n }\n\n async getBySlug(slug: string, params?: ChangelogGetBySlugParams): Promise<ChangelogEntry> {\n return this.http.get<ChangelogEntry>(`/v1/changelog/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: ChangelogGetByIdParams): Promise<ChangelogEntry> {\n return this.http.get<ChangelogEntry>(`/v1/changelog/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(id: string): Promise<Record<string, ChangelogEntry>> {\n return this.http.get<Record<string, ChangelogEntry>>(\n `/v1/changelog/by-id/${encodeURIComponent(id)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, ChangelogEntry>> {\n return this.http.get<Record<string, ChangelogEntry>>(\n `/v1/changelog/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async react(changelogId: string, params: ReactParams): Promise<ReactResponse> {\n return this.http.post<ReactResponse>(\n `/v1/changelog/${encodeURIComponent(changelogId)}/reactions`,\n params\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type { PublicConfig } from '../types';\n\nexport interface ConfigListParams {\n keys?: string[];\n}\n\nexport class ConfigModule {\n constructor(private readonly http: HttpClient) {}\n\n async getByKey(key: string): Promise<PublicConfig> {\n return this.http.get<PublicConfig>(`/v1/config/${encodeURIComponent(key)}`);\n }\n\n async list(params?: ConfigListParams): Promise<PublicConfig[]> {\n return this.http.get<PublicConfig[]>('/v1/config', params);\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n FeedbackPost,\n FeedbackPostCategory,\n FeedbackPostListItem,\n FeedbackPostStatus,\n FeedbackSortOption,\n FeedbackTopContributor,\n FeedbackVoteResponse,\n PaginatedResponse,\n PaginationParams,\n} from '../types';\n\nexport interface FeedbackListParams extends PaginationParams {\n status?: FeedbackPostStatus;\n category?: FeedbackPostCategory;\n search?: string;\n sort?: FeedbackSortOption;\n}\n\nexport interface FeedbackVoteParams {\n action: 'upvote' | 'downvote';\n}\n\nexport interface FeedbackTopContributorsParams {\n limit?: number;\n}\n\nexport class FeedbackModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: FeedbackListParams): Promise<PaginatedResponse<FeedbackPostListItem>> {\n return this.http.get<PaginatedResponse<FeedbackPostListItem>>('/v1/feedback', params);\n }\n\n async getById(id: string): Promise<FeedbackPost> {\n return this.http.get<FeedbackPost>(`/v1/feedback/by-id/${encodeURIComponent(id)}`);\n }\n\n async vote(postId: string, params: FeedbackVoteParams): Promise<FeedbackVoteResponse> {\n return this.http.post<FeedbackVoteResponse>(\n `/v1/feedback/${encodeURIComponent(postId)}/vote`,\n params\n );\n }\n\n async getTopContributors(params?: FeedbackTopContributorsParams): Promise<FeedbackTopContributor[]> {\n return this.http.get<FeedbackTopContributor[]>('/v1/feedback/top-contributors', params);\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n HelpArticle,\n HelpArticleListItem,\n HelpCategory,\n HelpChatParams,\n HelpChatResponse,\n HelpChatStreamChunk,\n HelpSearchResult,\n LocaleOptions,\n PaginatedResponse,\n PaginationParams,\n VoteUsefulnessResponse,\n} from '../types';\n\nexport interface HelpCategoriesParams extends LocaleOptions {}\n\nexport interface HelpListParams extends PaginationParams, LocaleOptions {\n category?: string;\n search?: string;\n}\n\nexport interface HelpSearchParams extends LocaleOptions {\n query: string;\n limit?: number;\n}\n\nexport interface HelpGetBySlugParams extends LocaleOptions {}\n\nexport interface HelpGetByIdParams extends LocaleOptions {}\n\nexport class HelpModule {\n constructor(private readonly http: HttpClient) {}\n\n async categories(params?: HelpCategoriesParams): Promise<HelpCategory[]> {\n return this.http.get<HelpCategory[]>('/v1/help/categories', params);\n }\n\n async list(params?: HelpListParams): Promise<PaginatedResponse<HelpArticleListItem>> {\n return this.http.get<PaginatedResponse<HelpArticleListItem>>('/v1/help/articles', params);\n }\n\n async getBySlug(slug: string, params?: HelpGetBySlugParams): Promise<HelpArticle> {\n return this.http.get<HelpArticle>(`/v1/help/articles/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: HelpGetByIdParams): Promise<HelpArticle> {\n return this.http.get<HelpArticle>(`/v1/help/articles/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async search(params: HelpSearchParams): Promise<HelpSearchResult[]> {\n return this.http.get<HelpSearchResult[]>('/v1/help/search', params);\n }\n\n async getTranslationsById(articleId: string): Promise<Record<string, HelpArticle>> {\n return this.http.get<Record<string, HelpArticle>>(\n `/v1/help/articles/by-id/${encodeURIComponent(articleId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, HelpArticle>> {\n return this.http.get<Record<string, HelpArticle>>(\n `/v1/help/articles/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async chat(params: HelpChatParams): Promise<HelpChatResponse> {\n return this.http.post<HelpChatResponse>('/v1/help/chat', params);\n }\n\n chatStream(params: HelpChatParams): AsyncIterable<HelpChatStreamChunk> {\n return this.http.streamPost<HelpChatStreamChunk>('/v1/help/chat/stream', params);\n }\n\n async voteUsefulness(\n articleId: string,\n vote: 'yes' | 'no' | null,\n previousVote?: 'yes' | 'no' | null,\n ): Promise<VoteUsefulnessResponse> {\n return this.http.post<VoteUsefulnessResponse>(\n `/v1/help/articles/by-id/${encodeURIComponent(articleId)}/vote-usefulness`,\n { vote, previousVote }\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type { LocaleOptions, Page, PageListItem, PaginatedResponse, PaginationParams } from '../types';\n\nexport interface PagesListParams extends PaginationParams, LocaleOptions {\n search?: string;\n}\n\nexport interface PagesGetBySlugParams extends LocaleOptions {}\n\nexport interface PagesGetByIdParams extends LocaleOptions {}\n\nexport class PagesModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: PagesListParams): Promise<PaginatedResponse<PageListItem>> {\n return this.http.get<PaginatedResponse<PageListItem>>('/v1/pages', params);\n }\n\n async getBySlug(slug: string, params?: PagesGetBySlugParams): Promise<Page> {\n return this.http.get<Page>(`/v1/pages/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: PagesGetByIdParams): Promise<Page> {\n return this.http.get<Page>(`/v1/pages/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(pageId: string): Promise<Record<string, Page>> {\n return this.http.get<Record<string, Page>>(\n `/v1/pages/by-id/${encodeURIComponent(pageId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, Page>> {\n return this.http.get<Record<string, Page>>(\n `/v1/pages/${encodeURIComponent(slug)}/translations`\n );\n }\n}\n","import { HttpClient } from './http-client';\nimport { AnnouncementModule } from './modules/announcement';\nimport { BlogModule } from './modules/blog';\nimport { ChangelogModule } from './modules/changelog';\nimport { ConfigModule } from './modules/config';\nimport { FeedbackModule } from './modules/feedback';\nimport { HelpModule } from './modules/help';\nimport { PagesModule } from './modules/pages';\nimport type { KookeeConfig, HealthCheckResponse } from './types';\n\nexport class Kookee {\n private readonly http: HttpClient;\n\n public readonly announcements: AnnouncementModule;\n public readonly blog: BlogModule;\n public readonly changelog: ChangelogModule;\n public readonly config: ConfigModule;\n public readonly feedback: FeedbackModule;\n public readonly help: HelpModule;\n public readonly pages: PagesModule;\n\n constructor(config: KookeeConfig) {\n if (!config.apiKey && !config.projectId) {\n throw new Error('Either apiKey or projectId is required');\n }\n\n this.http = new HttpClient({ apiKey: config.apiKey, projectId: config.projectId, baseUrl: config.baseUrl });\n\n this.announcements = new AnnouncementModule(this.http);\n this.blog = new BlogModule(this.http);\n this.changelog = new ChangelogModule(this.http);\n this.config = new ConfigModule(this.http);\n this.feedback = new FeedbackModule(this.http);\n this.help = new HelpModule(this.http);\n this.pages = new PagesModule(this.http);\n }\n\n async health(): Promise<HealthCheckResponse> {\n return this.http.get<HealthCheckResponse>('/v1/health');\n }\n}\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -5,16 +5,23 @@ declare class KookeeApiError extends Error {
|
|
|
5
5
|
}
|
|
6
6
|
declare class HttpClient {
|
|
7
7
|
private readonly baseUrl;
|
|
8
|
-
private readonly apiKey
|
|
9
|
-
|
|
8
|
+
private readonly apiKey?;
|
|
9
|
+
private readonly projectId?;
|
|
10
|
+
constructor(options: {
|
|
11
|
+
apiKey?: string;
|
|
12
|
+
projectId?: string;
|
|
13
|
+
baseUrl?: string;
|
|
14
|
+
});
|
|
10
15
|
private getHeaders;
|
|
11
16
|
get<T>(path: string, params?: object): Promise<T>;
|
|
12
17
|
post<T>(path: string, body?: unknown): Promise<T>;
|
|
18
|
+
streamPost<T>(path: string, body?: unknown): AsyncIterable<T>;
|
|
13
19
|
private handleResponse;
|
|
14
20
|
}
|
|
15
21
|
|
|
16
22
|
interface KookeeConfig {
|
|
17
|
-
apiKey
|
|
23
|
+
apiKey?: string;
|
|
24
|
+
projectId?: string;
|
|
18
25
|
baseUrl?: string;
|
|
19
26
|
}
|
|
20
27
|
interface PaginationParams {
|
|
@@ -43,13 +50,14 @@ interface BlogTagWithCount extends BlogTag {
|
|
|
43
50
|
interface BlogPostAuthor {
|
|
44
51
|
name: string;
|
|
45
52
|
}
|
|
53
|
+
type BlogPostStatus = 'draft' | 'published' | 'archived';
|
|
46
54
|
interface BlogPostListItem {
|
|
47
55
|
id: string;
|
|
48
56
|
slug: string;
|
|
49
57
|
title: string;
|
|
50
58
|
excerptHtml: string | null;
|
|
51
59
|
coverImageUrl: string | null;
|
|
52
|
-
status:
|
|
60
|
+
status: BlogPostStatus;
|
|
53
61
|
publishedAt: string | null;
|
|
54
62
|
metadata: Record<string, NonNullable<unknown>> | null;
|
|
55
63
|
createdAt: string;
|
|
@@ -74,6 +82,7 @@ interface PageListItem {
|
|
|
74
82
|
id: string;
|
|
75
83
|
slug: string;
|
|
76
84
|
title: string;
|
|
85
|
+
views: number;
|
|
77
86
|
createdAt: string;
|
|
78
87
|
updatedAt: string;
|
|
79
88
|
locale: string;
|
|
@@ -83,7 +92,6 @@ interface Page extends PageListItem {
|
|
|
83
92
|
contentHtml: string;
|
|
84
93
|
metaTitle: string | null;
|
|
85
94
|
metaDescription: string | null;
|
|
86
|
-
views: number;
|
|
87
95
|
}
|
|
88
96
|
interface HelpCategory {
|
|
89
97
|
slug: string;
|
|
@@ -92,15 +100,22 @@ interface HelpCategory {
|
|
|
92
100
|
icon: string | null;
|
|
93
101
|
articleCount: number;
|
|
94
102
|
}
|
|
103
|
+
interface HelpArticleAuthor {
|
|
104
|
+
name: string;
|
|
105
|
+
}
|
|
95
106
|
interface HelpArticleListItem {
|
|
96
107
|
id: string;
|
|
97
108
|
slug: string;
|
|
98
109
|
title: string;
|
|
99
110
|
excerptHtml: string | null;
|
|
111
|
+
status: string;
|
|
112
|
+
position: number;
|
|
113
|
+
metadata: Record<string, unknown>;
|
|
100
114
|
category: {
|
|
101
115
|
name: string;
|
|
102
116
|
slug: string;
|
|
103
117
|
};
|
|
118
|
+
author: HelpArticleAuthor;
|
|
104
119
|
createdAt: string;
|
|
105
120
|
views: number;
|
|
106
121
|
locale: string;
|
|
@@ -162,6 +177,7 @@ interface AnnouncementAuthor {
|
|
|
162
177
|
interface AnnouncementListItem {
|
|
163
178
|
id: string;
|
|
164
179
|
title: string;
|
|
180
|
+
contentHtml: string;
|
|
165
181
|
type: AnnouncementType;
|
|
166
182
|
publishedAt: string | null;
|
|
167
183
|
unpublishAt: string | null;
|
|
@@ -172,7 +188,6 @@ interface AnnouncementListItem {
|
|
|
172
188
|
author: AnnouncementAuthor;
|
|
173
189
|
}
|
|
174
190
|
interface Announcement extends AnnouncementListItem {
|
|
175
|
-
contentHtml: string;
|
|
176
191
|
updatedAt: string;
|
|
177
192
|
}
|
|
178
193
|
interface PublicConfig {
|
|
@@ -207,11 +222,79 @@ interface HelpChatParams {
|
|
|
207
222
|
}
|
|
208
223
|
interface HelpChatResponse {
|
|
209
224
|
message: string;
|
|
210
|
-
sources:
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
225
|
+
sources: HelpChatSource[];
|
|
226
|
+
}
|
|
227
|
+
type HelpArticleVisibility = 'public' | 'chatbot_only';
|
|
228
|
+
interface HelpChatSourceCategory {
|
|
229
|
+
slug: string;
|
|
230
|
+
name: string;
|
|
231
|
+
}
|
|
232
|
+
interface HelpChatSource {
|
|
233
|
+
id: string;
|
|
234
|
+
slug: string;
|
|
235
|
+
title: string;
|
|
236
|
+
visibility: HelpArticleVisibility;
|
|
237
|
+
metadata: Record<string, unknown> | null;
|
|
238
|
+
category: HelpChatSourceCategory;
|
|
239
|
+
}
|
|
240
|
+
type HelpChatStreamChunk = {
|
|
241
|
+
type: 'delta';
|
|
242
|
+
content: string;
|
|
243
|
+
} | {
|
|
244
|
+
type: 'sources';
|
|
245
|
+
sources: HelpChatSource[];
|
|
246
|
+
} | {
|
|
247
|
+
type: 'done';
|
|
248
|
+
} | {
|
|
249
|
+
type: 'error';
|
|
250
|
+
message: string;
|
|
251
|
+
};
|
|
252
|
+
type FeedbackPostStatus = 'open' | 'under_review' | 'planned' | 'in_progress' | 'completed' | 'declined';
|
|
253
|
+
type FeedbackPostCategory = 'feature' | 'improvement' | 'bug' | 'other';
|
|
254
|
+
type FeedbackSortOption = 'newest' | 'top' | 'trending';
|
|
255
|
+
interface FeedbackAuthor {
|
|
256
|
+
id: string;
|
|
257
|
+
name: string;
|
|
258
|
+
image: string | null;
|
|
259
|
+
isTeamMember?: boolean;
|
|
260
|
+
}
|
|
261
|
+
interface FeedbackAssignee {
|
|
262
|
+
id: string;
|
|
263
|
+
name: string | null;
|
|
264
|
+
image: string | null;
|
|
265
|
+
}
|
|
266
|
+
interface FeedbackComment {
|
|
267
|
+
id: string;
|
|
268
|
+
content: string;
|
|
269
|
+
createdAt: string;
|
|
270
|
+
updatedAt: string;
|
|
271
|
+
isOfficial: boolean;
|
|
272
|
+
author: FeedbackAuthor;
|
|
273
|
+
}
|
|
274
|
+
interface FeedbackPostListItem {
|
|
275
|
+
id: string;
|
|
276
|
+
title: string;
|
|
277
|
+
contentText: string | null;
|
|
278
|
+
status: FeedbackPostStatus;
|
|
279
|
+
category: FeedbackPostCategory;
|
|
280
|
+
voteCount: number;
|
|
281
|
+
commentCount: number;
|
|
282
|
+
createdAt: string;
|
|
283
|
+
author: FeedbackAuthor;
|
|
284
|
+
assignee: FeedbackAssignee | null;
|
|
285
|
+
}
|
|
286
|
+
interface FeedbackPost extends FeedbackPostListItem {
|
|
287
|
+
contentHtml: string | null;
|
|
288
|
+
comments: FeedbackComment[];
|
|
289
|
+
}
|
|
290
|
+
interface FeedbackTopContributor {
|
|
291
|
+
id: string;
|
|
292
|
+
name: string;
|
|
293
|
+
image: string | null;
|
|
294
|
+
totalVotes: number;
|
|
295
|
+
}
|
|
296
|
+
interface FeedbackVoteResponse {
|
|
297
|
+
voteCount: number;
|
|
215
298
|
}
|
|
216
299
|
|
|
217
300
|
interface AnnouncementListParams extends PaginationParams, LocaleOptions {
|
|
@@ -281,6 +364,27 @@ declare class ConfigModule {
|
|
|
281
364
|
list(params?: ConfigListParams): Promise<PublicConfig[]>;
|
|
282
365
|
}
|
|
283
366
|
|
|
367
|
+
interface FeedbackListParams extends PaginationParams {
|
|
368
|
+
status?: FeedbackPostStatus;
|
|
369
|
+
category?: FeedbackPostCategory;
|
|
370
|
+
search?: string;
|
|
371
|
+
sort?: FeedbackSortOption;
|
|
372
|
+
}
|
|
373
|
+
interface FeedbackVoteParams {
|
|
374
|
+
action: 'upvote' | 'downvote';
|
|
375
|
+
}
|
|
376
|
+
interface FeedbackTopContributorsParams {
|
|
377
|
+
limit?: number;
|
|
378
|
+
}
|
|
379
|
+
declare class FeedbackModule {
|
|
380
|
+
private readonly http;
|
|
381
|
+
constructor(http: HttpClient);
|
|
382
|
+
list(params?: FeedbackListParams): Promise<PaginatedResponse<FeedbackPostListItem>>;
|
|
383
|
+
getById(id: string): Promise<FeedbackPost>;
|
|
384
|
+
vote(postId: string, params: FeedbackVoteParams): Promise<FeedbackVoteResponse>;
|
|
385
|
+
getTopContributors(params?: FeedbackTopContributorsParams): Promise<FeedbackTopContributor[]>;
|
|
386
|
+
}
|
|
387
|
+
|
|
284
388
|
interface HelpCategoriesParams extends LocaleOptions {
|
|
285
389
|
}
|
|
286
390
|
interface HelpListParams extends PaginationParams, LocaleOptions {
|
|
@@ -306,6 +410,7 @@ declare class HelpModule {
|
|
|
306
410
|
getTranslationsById(articleId: string): Promise<Record<string, HelpArticle>>;
|
|
307
411
|
getTranslationsBySlug(slug: string): Promise<Record<string, HelpArticle>>;
|
|
308
412
|
chat(params: HelpChatParams): Promise<HelpChatResponse>;
|
|
413
|
+
chatStream(params: HelpChatParams): AsyncIterable<HelpChatStreamChunk>;
|
|
309
414
|
voteUsefulness(articleId: string, vote: 'yes' | 'no' | null, previousVote?: 'yes' | 'no' | null): Promise<VoteUsefulnessResponse>;
|
|
310
415
|
}
|
|
311
416
|
|
|
@@ -332,10 +437,11 @@ declare class Kookee {
|
|
|
332
437
|
readonly blog: BlogModule;
|
|
333
438
|
readonly changelog: ChangelogModule;
|
|
334
439
|
readonly config: ConfigModule;
|
|
440
|
+
readonly feedback: FeedbackModule;
|
|
335
441
|
readonly help: HelpModule;
|
|
336
442
|
readonly pages: PagesModule;
|
|
337
443
|
constructor(config: KookeeConfig);
|
|
338
444
|
health(): Promise<HealthCheckResponse>;
|
|
339
445
|
}
|
|
340
446
|
|
|
341
|
-
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 BlogTag, type BlogTagWithCount, type ChangelogAuthor, type ChangelogEntry, type ChangelogEntryListItem, type ChangelogGetByIdParams, type ChangelogGetBySlugParams, type ChangelogListParams, ChangelogModule, type ChangelogOrderBy, type ChangelogType, type ConfigListParams, ConfigModule, type HealthCheckResponse, type HelpArticle, type HelpArticleListItem, type HelpCategoriesParams, type HelpCategory, type HelpChatMessage, type HelpChatParams, type HelpChatResponse, type HelpGetByIdParams, type HelpGetBySlugParams, type HelpListParams, HelpModule, type HelpSearchParams, type HelpSearchResult, Kookee, KookeeApiError, type KookeeConfig, 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 };
|
|
447
|
+
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 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 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
|
@@ -5,16 +5,23 @@ declare class KookeeApiError extends Error {
|
|
|
5
5
|
}
|
|
6
6
|
declare class HttpClient {
|
|
7
7
|
private readonly baseUrl;
|
|
8
|
-
private readonly apiKey
|
|
9
|
-
|
|
8
|
+
private readonly apiKey?;
|
|
9
|
+
private readonly projectId?;
|
|
10
|
+
constructor(options: {
|
|
11
|
+
apiKey?: string;
|
|
12
|
+
projectId?: string;
|
|
13
|
+
baseUrl?: string;
|
|
14
|
+
});
|
|
10
15
|
private getHeaders;
|
|
11
16
|
get<T>(path: string, params?: object): Promise<T>;
|
|
12
17
|
post<T>(path: string, body?: unknown): Promise<T>;
|
|
18
|
+
streamPost<T>(path: string, body?: unknown): AsyncIterable<T>;
|
|
13
19
|
private handleResponse;
|
|
14
20
|
}
|
|
15
21
|
|
|
16
22
|
interface KookeeConfig {
|
|
17
|
-
apiKey
|
|
23
|
+
apiKey?: string;
|
|
24
|
+
projectId?: string;
|
|
18
25
|
baseUrl?: string;
|
|
19
26
|
}
|
|
20
27
|
interface PaginationParams {
|
|
@@ -43,13 +50,14 @@ interface BlogTagWithCount extends BlogTag {
|
|
|
43
50
|
interface BlogPostAuthor {
|
|
44
51
|
name: string;
|
|
45
52
|
}
|
|
53
|
+
type BlogPostStatus = 'draft' | 'published' | 'archived';
|
|
46
54
|
interface BlogPostListItem {
|
|
47
55
|
id: string;
|
|
48
56
|
slug: string;
|
|
49
57
|
title: string;
|
|
50
58
|
excerptHtml: string | null;
|
|
51
59
|
coverImageUrl: string | null;
|
|
52
|
-
status:
|
|
60
|
+
status: BlogPostStatus;
|
|
53
61
|
publishedAt: string | null;
|
|
54
62
|
metadata: Record<string, NonNullable<unknown>> | null;
|
|
55
63
|
createdAt: string;
|
|
@@ -74,6 +82,7 @@ interface PageListItem {
|
|
|
74
82
|
id: string;
|
|
75
83
|
slug: string;
|
|
76
84
|
title: string;
|
|
85
|
+
views: number;
|
|
77
86
|
createdAt: string;
|
|
78
87
|
updatedAt: string;
|
|
79
88
|
locale: string;
|
|
@@ -83,7 +92,6 @@ interface Page extends PageListItem {
|
|
|
83
92
|
contentHtml: string;
|
|
84
93
|
metaTitle: string | null;
|
|
85
94
|
metaDescription: string | null;
|
|
86
|
-
views: number;
|
|
87
95
|
}
|
|
88
96
|
interface HelpCategory {
|
|
89
97
|
slug: string;
|
|
@@ -92,15 +100,22 @@ interface HelpCategory {
|
|
|
92
100
|
icon: string | null;
|
|
93
101
|
articleCount: number;
|
|
94
102
|
}
|
|
103
|
+
interface HelpArticleAuthor {
|
|
104
|
+
name: string;
|
|
105
|
+
}
|
|
95
106
|
interface HelpArticleListItem {
|
|
96
107
|
id: string;
|
|
97
108
|
slug: string;
|
|
98
109
|
title: string;
|
|
99
110
|
excerptHtml: string | null;
|
|
111
|
+
status: string;
|
|
112
|
+
position: number;
|
|
113
|
+
metadata: Record<string, unknown>;
|
|
100
114
|
category: {
|
|
101
115
|
name: string;
|
|
102
116
|
slug: string;
|
|
103
117
|
};
|
|
118
|
+
author: HelpArticleAuthor;
|
|
104
119
|
createdAt: string;
|
|
105
120
|
views: number;
|
|
106
121
|
locale: string;
|
|
@@ -162,6 +177,7 @@ interface AnnouncementAuthor {
|
|
|
162
177
|
interface AnnouncementListItem {
|
|
163
178
|
id: string;
|
|
164
179
|
title: string;
|
|
180
|
+
contentHtml: string;
|
|
165
181
|
type: AnnouncementType;
|
|
166
182
|
publishedAt: string | null;
|
|
167
183
|
unpublishAt: string | null;
|
|
@@ -172,7 +188,6 @@ interface AnnouncementListItem {
|
|
|
172
188
|
author: AnnouncementAuthor;
|
|
173
189
|
}
|
|
174
190
|
interface Announcement extends AnnouncementListItem {
|
|
175
|
-
contentHtml: string;
|
|
176
191
|
updatedAt: string;
|
|
177
192
|
}
|
|
178
193
|
interface PublicConfig {
|
|
@@ -207,11 +222,79 @@ interface HelpChatParams {
|
|
|
207
222
|
}
|
|
208
223
|
interface HelpChatResponse {
|
|
209
224
|
message: string;
|
|
210
|
-
sources:
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
225
|
+
sources: HelpChatSource[];
|
|
226
|
+
}
|
|
227
|
+
type HelpArticleVisibility = 'public' | 'chatbot_only';
|
|
228
|
+
interface HelpChatSourceCategory {
|
|
229
|
+
slug: string;
|
|
230
|
+
name: string;
|
|
231
|
+
}
|
|
232
|
+
interface HelpChatSource {
|
|
233
|
+
id: string;
|
|
234
|
+
slug: string;
|
|
235
|
+
title: string;
|
|
236
|
+
visibility: HelpArticleVisibility;
|
|
237
|
+
metadata: Record<string, unknown> | null;
|
|
238
|
+
category: HelpChatSourceCategory;
|
|
239
|
+
}
|
|
240
|
+
type HelpChatStreamChunk = {
|
|
241
|
+
type: 'delta';
|
|
242
|
+
content: string;
|
|
243
|
+
} | {
|
|
244
|
+
type: 'sources';
|
|
245
|
+
sources: HelpChatSource[];
|
|
246
|
+
} | {
|
|
247
|
+
type: 'done';
|
|
248
|
+
} | {
|
|
249
|
+
type: 'error';
|
|
250
|
+
message: string;
|
|
251
|
+
};
|
|
252
|
+
type FeedbackPostStatus = 'open' | 'under_review' | 'planned' | 'in_progress' | 'completed' | 'declined';
|
|
253
|
+
type FeedbackPostCategory = 'feature' | 'improvement' | 'bug' | 'other';
|
|
254
|
+
type FeedbackSortOption = 'newest' | 'top' | 'trending';
|
|
255
|
+
interface FeedbackAuthor {
|
|
256
|
+
id: string;
|
|
257
|
+
name: string;
|
|
258
|
+
image: string | null;
|
|
259
|
+
isTeamMember?: boolean;
|
|
260
|
+
}
|
|
261
|
+
interface FeedbackAssignee {
|
|
262
|
+
id: string;
|
|
263
|
+
name: string | null;
|
|
264
|
+
image: string | null;
|
|
265
|
+
}
|
|
266
|
+
interface FeedbackComment {
|
|
267
|
+
id: string;
|
|
268
|
+
content: string;
|
|
269
|
+
createdAt: string;
|
|
270
|
+
updatedAt: string;
|
|
271
|
+
isOfficial: boolean;
|
|
272
|
+
author: FeedbackAuthor;
|
|
273
|
+
}
|
|
274
|
+
interface FeedbackPostListItem {
|
|
275
|
+
id: string;
|
|
276
|
+
title: string;
|
|
277
|
+
contentText: string | null;
|
|
278
|
+
status: FeedbackPostStatus;
|
|
279
|
+
category: FeedbackPostCategory;
|
|
280
|
+
voteCount: number;
|
|
281
|
+
commentCount: number;
|
|
282
|
+
createdAt: string;
|
|
283
|
+
author: FeedbackAuthor;
|
|
284
|
+
assignee: FeedbackAssignee | null;
|
|
285
|
+
}
|
|
286
|
+
interface FeedbackPost extends FeedbackPostListItem {
|
|
287
|
+
contentHtml: string | null;
|
|
288
|
+
comments: FeedbackComment[];
|
|
289
|
+
}
|
|
290
|
+
interface FeedbackTopContributor {
|
|
291
|
+
id: string;
|
|
292
|
+
name: string;
|
|
293
|
+
image: string | null;
|
|
294
|
+
totalVotes: number;
|
|
295
|
+
}
|
|
296
|
+
interface FeedbackVoteResponse {
|
|
297
|
+
voteCount: number;
|
|
215
298
|
}
|
|
216
299
|
|
|
217
300
|
interface AnnouncementListParams extends PaginationParams, LocaleOptions {
|
|
@@ -281,6 +364,27 @@ declare class ConfigModule {
|
|
|
281
364
|
list(params?: ConfigListParams): Promise<PublicConfig[]>;
|
|
282
365
|
}
|
|
283
366
|
|
|
367
|
+
interface FeedbackListParams extends PaginationParams {
|
|
368
|
+
status?: FeedbackPostStatus;
|
|
369
|
+
category?: FeedbackPostCategory;
|
|
370
|
+
search?: string;
|
|
371
|
+
sort?: FeedbackSortOption;
|
|
372
|
+
}
|
|
373
|
+
interface FeedbackVoteParams {
|
|
374
|
+
action: 'upvote' | 'downvote';
|
|
375
|
+
}
|
|
376
|
+
interface FeedbackTopContributorsParams {
|
|
377
|
+
limit?: number;
|
|
378
|
+
}
|
|
379
|
+
declare class FeedbackModule {
|
|
380
|
+
private readonly http;
|
|
381
|
+
constructor(http: HttpClient);
|
|
382
|
+
list(params?: FeedbackListParams): Promise<PaginatedResponse<FeedbackPostListItem>>;
|
|
383
|
+
getById(id: string): Promise<FeedbackPost>;
|
|
384
|
+
vote(postId: string, params: FeedbackVoteParams): Promise<FeedbackVoteResponse>;
|
|
385
|
+
getTopContributors(params?: FeedbackTopContributorsParams): Promise<FeedbackTopContributor[]>;
|
|
386
|
+
}
|
|
387
|
+
|
|
284
388
|
interface HelpCategoriesParams extends LocaleOptions {
|
|
285
389
|
}
|
|
286
390
|
interface HelpListParams extends PaginationParams, LocaleOptions {
|
|
@@ -306,6 +410,7 @@ declare class HelpModule {
|
|
|
306
410
|
getTranslationsById(articleId: string): Promise<Record<string, HelpArticle>>;
|
|
307
411
|
getTranslationsBySlug(slug: string): Promise<Record<string, HelpArticle>>;
|
|
308
412
|
chat(params: HelpChatParams): Promise<HelpChatResponse>;
|
|
413
|
+
chatStream(params: HelpChatParams): AsyncIterable<HelpChatStreamChunk>;
|
|
309
414
|
voteUsefulness(articleId: string, vote: 'yes' | 'no' | null, previousVote?: 'yes' | 'no' | null): Promise<VoteUsefulnessResponse>;
|
|
310
415
|
}
|
|
311
416
|
|
|
@@ -332,10 +437,11 @@ declare class Kookee {
|
|
|
332
437
|
readonly blog: BlogModule;
|
|
333
438
|
readonly changelog: ChangelogModule;
|
|
334
439
|
readonly config: ConfigModule;
|
|
440
|
+
readonly feedback: FeedbackModule;
|
|
335
441
|
readonly help: HelpModule;
|
|
336
442
|
readonly pages: PagesModule;
|
|
337
443
|
constructor(config: KookeeConfig);
|
|
338
444
|
health(): Promise<HealthCheckResponse>;
|
|
339
445
|
}
|
|
340
446
|
|
|
341
|
-
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 BlogTag, type BlogTagWithCount, type ChangelogAuthor, type ChangelogEntry, type ChangelogEntryListItem, type ChangelogGetByIdParams, type ChangelogGetBySlugParams, type ChangelogListParams, ChangelogModule, type ChangelogOrderBy, type ChangelogType, type ConfigListParams, ConfigModule, type HealthCheckResponse, type HelpArticle, type HelpArticleListItem, type HelpCategoriesParams, type HelpCategory, type HelpChatMessage, type HelpChatParams, type HelpChatResponse, type HelpGetByIdParams, type HelpGetBySlugParams, type HelpListParams, HelpModule, type HelpSearchParams, type HelpSearchResult, Kookee, KookeeApiError, type KookeeConfig, 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 };
|
|
447
|
+
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 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 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.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
1
|
+
var B="https://api.kookee.dev",H="Kookee-API-Key",x="Kookee-Project-Id",i=class n extends Error{constructor(t,s,o){super(s);this.code=t;this.status=o;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??B;}getHeaders(){let e={"Content-Type":"application/json"};return this.apiKey&&(e[H]=this.apiKey),this.projectId&&(e[x]=this.projectId),e}async get(e,t){let s=new URL(`${this.baseUrl}${e}`);if(t){for(let[y,r]of Object.entries(t))if(r!=null)if(Array.isArray(r))for(let a of r)s.searchParams.append(y,String(a));else s.searchParams.set(y,String(r));}let o=await fetch(s.toString(),{method:"GET",headers:this.getHeaders()});return this.handleResponse(o)}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*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 o=s.body.getReader(),y=new TextDecoder,r="";try{for(;;){let{done:a,value:b}=await o.read();if(a)break;r+=y.decode(b,{stream:!0});let C=r.split(`
|
|
2
|
+
`);r=C.pop()??"";for(let I of C){let P=I.trim();if(!(!P||P.startsWith(":"))&&P.startsWith("data: ")){let R=P.slice(6);if(R==="[DONE]")return;yield JSON.parse(R);}}}}finally{o.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??{},o=t?.length?{...s,excludeIds:t.join(",")}:s;return this.http.get("/v1/announcements",o)}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)}};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 f=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,f as Kookee,i as KookeeApiError,h as PagesModule};//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/http-client.ts","../src/lib/modules/announcement.ts","../src/lib/modules/blog.ts","../src/lib/modules/changelog.ts","../src/lib/modules/config.ts","../src/lib/modules/help.ts","../src/lib/modules/pages.ts","../src/lib/client.ts"],"names":["DEFAULT_BASE_URL","API_KEY_HEADER","KookeeApiError","code","message","status","HttpClient","apiKey","baseUrl","path","params","url","key","value","item","response","body","errorData","AnnouncementModule","http","excludeIds","rest","queryParams","id","BlogModule","slug","postId","ChangelogModule","changelogId","ConfigModule","HelpModule","articleId","vote","previousVote","PagesModule","pageId","Kookee","config"],"mappings":"AAEA,IAAMA,CAAAA,CAAmB,yBACnBC,CAAAA,CAAiB,gBAAA,CAEVC,EAAN,cAA6B,KAAM,CACxC,WAAA,CACkBC,CAAAA,CAChBC,CAAAA,CACgBC,EAChB,CACA,KAAA,CAAMD,CAAO,CAAA,CAJG,IAAA,CAAA,IAAA,CAAAD,CAAAA,CAEA,YAAAE,CAAAA,CAGhB,IAAA,CAAK,IAAA,CAAO,iBACd,CACF,CAAA,CAEaC,EAAN,KAAiB,CACL,QACA,MAAA,CAEjB,WAAA,CAAYC,EAAgBC,CAAAA,CAAkB,CAC5C,IAAA,CAAK,MAAA,CAASD,CAAAA,CACd,IAAA,CAAK,QAAUC,CAAAA,EAAWR,EAC5B,CAEQ,UAAA,EAAqC,CAC3C,OAAO,CACL,cAAA,CAAgB,kBAAA,CAChB,CAACC,CAAc,EAAG,IAAA,CAAK,MACzB,CACF,CAEA,MAAM,GAA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AA,CAAK,aAAA,CAAgB,IAAInB,CAAAA,CAAmB,IAAA,CAAK,IAAI,CAAA,CACrD,IAAA,CAAK,IAAA,CAAO,IAAIM,CAAAA,CAAW,IAAA,CAAK,IAAI,CAAA,CACpC,IAAA,CAAK,SAAA,CAAY,IAAIG,CAAAA,CAAgB,IAAA,CAAK,IAAI,CAAA,CAC9C,IAAA,CAAK,MAAA,CAAS,IAAIE,CAAAA,CAAa,IAAA,CAAK,IAAI,CAAA,CACxC,IAAA,CAAK,IAAA,CAAO,IAAIC,CAAAA,CAAW,IAAA,CAAK,IAAI,CAAA,CACpC,IAAA,CAAK,KAAA,CAAQ,IAAII,CAAAA,CAAY,IAAA,CAAK,IAAI,EACxC,CAEA,MAAM,MAAA,EAAuC,CAC3C,OAAO,KAAK,IAAA,CAAK,GAAA,CAAyB,YAAY,CACxD,CACF","file":"index.js","sourcesContent":["import type { ApiError } from './types';\n\nconst DEFAULT_BASE_URL = 'https://api.kookee.dev';\nconst API_KEY_HEADER = 'Kookee-API-Key';\n\nexport class KookeeApiError extends Error {\n constructor(\n public readonly code: string,\n message: string,\n public readonly status: number\n ) {\n super(message);\n this.name = 'KookeeApiError';\n }\n}\n\nexport class HttpClient {\n private readonly baseUrl: string;\n private readonly apiKey: string;\n\n constructor(apiKey: string, baseUrl?: string) {\n this.apiKey = apiKey;\n this.baseUrl = baseUrl ?? DEFAULT_BASE_URL;\n }\n\n private getHeaders(): Record<string, string> {\n return {\n 'Content-Type': 'application/json',\n [API_KEY_HEADER]: this.apiKey,\n };\n }\n\n async get<T>(path: string, params?: object): Promise<T> {\n const url = new URL(`${this.baseUrl}${path}`);\n\n if (params) {\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined && value !== null) {\n if (Array.isArray(value)) {\n for (const item of value) {\n url.searchParams.append(key, String(item));\n }\n } else {\n url.searchParams.set(key, String(value));\n }\n }\n }\n }\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: this.getHeaders(),\n });\n\n return this.handleResponse<T>(response);\n }\n\n async post<T>(path: string, body?: unknown): Promise<T> {\n const response = await fetch(`${this.baseUrl}${path}`, {\n method: 'POST',\n headers: this.getHeaders(),\n body: body ? JSON.stringify(body) : undefined,\n });\n\n return this.handleResponse<T>(response);\n }\n\n private async handleResponse<T>(response: Response): Promise<T> {\n if (!response.ok) {\n let errorData: ApiError | null = null;\n\n try {\n errorData = (await response.json()) as ApiError;\n } catch {\n // Response body is not JSON\n }\n\n throw new KookeeApiError(\n errorData?.code ?? 'UNKNOWN_ERROR',\n errorData?.message ?? `Request failed with status ${response.status}`,\n response.status\n );\n }\n\n return response.json() as Promise<T>;\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n Announcement,\n AnnouncementListItem,\n AnnouncementOrderBy,\n AnnouncementType,\n LocaleOptions,\n OrderDirection,\n PaginatedResponse,\n PaginationParams,\n} from '../types';\n\nexport interface AnnouncementListParams extends PaginationParams, LocaleOptions {\n type?: AnnouncementType;\n excludeIds?: string[];\n orderBy?: AnnouncementOrderBy;\n order?: OrderDirection;\n}\n\nexport interface AnnouncementGetByIdParams extends LocaleOptions {}\n\nexport class AnnouncementModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: AnnouncementListParams): Promise<PaginatedResponse<AnnouncementListItem>> {\n const { excludeIds, ...rest } = params ?? {};\n const queryParams = excludeIds?.length ? { ...rest, excludeIds: excludeIds.join(',') } : rest;\n return this.http.get<PaginatedResponse<AnnouncementListItem>>('/v1/announcements', queryParams);\n }\n\n async getById(id: string, params?: AnnouncementGetByIdParams): Promise<Announcement> {\n return this.http.get<Announcement>(`/v1/announcements/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(id: string): Promise<Record<string, Announcement>> {\n return this.http.get<Record<string, Announcement>>(\n `/v1/announcements/${encodeURIComponent(id)}/translations`\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n BlogPost,\n BlogPostListItem,\n BlogTagWithCount,\n LocaleOptions,\n PaginatedResponse,\n PaginationParams,\n ReactParams,\n ReactResponse,\n} from '../types';\n\nexport interface BlogListParams extends PaginationParams, LocaleOptions {\n tags?: string[];\n search?: string;\n}\n\nexport interface BlogGetBySlugParams extends LocaleOptions {}\n\nexport interface BlogGetByIdParams extends LocaleOptions {}\n\nexport class BlogModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: BlogListParams): Promise<PaginatedResponse<BlogPostListItem>> {\n return this.http.get<PaginatedResponse<BlogPostListItem>>('/v1/blog/posts', params);\n }\n\n async getBySlug(slug: string, params?: BlogGetBySlugParams): Promise<BlogPost> {\n return this.http.get<BlogPost>(`/v1/blog/posts/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: BlogGetByIdParams): Promise<BlogPost> {\n return this.http.get<BlogPost>(`/v1/blog/posts/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTags(): Promise<BlogTagWithCount[]> {\n return this.http.get<BlogTagWithCount[]>('/v1/blog/tags');\n }\n\n async getTranslationsById(postId: string): Promise<Record<string, BlogPost>> {\n return this.http.get<Record<string, BlogPost>>(\n `/v1/blog/posts/by-id/${encodeURIComponent(postId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, BlogPost>> {\n return this.http.get<Record<string, BlogPost>>(\n `/v1/blog/posts/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async react(postId: string, params: ReactParams): Promise<ReactResponse> {\n return this.http.post<ReactResponse>(\n `/v1/blog/posts/${encodeURIComponent(postId)}/reactions`,\n params\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n ChangelogEntry,\n ChangelogEntryListItem,\n ChangelogOrderBy,\n LocaleOptions,\n OrderDirection,\n PaginatedResponse,\n PaginationParams,\n ReactParams,\n ReactResponse,\n} from '../types';\n\nexport interface ChangelogListParams extends PaginationParams, LocaleOptions {\n type?: string;\n search?: string;\n orderBy?: ChangelogOrderBy;\n order?: OrderDirection;\n}\n\nexport interface ChangelogGetBySlugParams extends LocaleOptions {}\n\nexport interface ChangelogGetByIdParams extends LocaleOptions {}\n\nexport class ChangelogModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: ChangelogListParams): Promise<PaginatedResponse<ChangelogEntryListItem>> {\n return this.http.get<PaginatedResponse<ChangelogEntryListItem>>('/v1/changelog', params);\n }\n\n async getBySlug(slug: string, params?: ChangelogGetBySlugParams): Promise<ChangelogEntry> {\n return this.http.get<ChangelogEntry>(`/v1/changelog/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: ChangelogGetByIdParams): Promise<ChangelogEntry> {\n return this.http.get<ChangelogEntry>(`/v1/changelog/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(id: string): Promise<Record<string, ChangelogEntry>> {\n return this.http.get<Record<string, ChangelogEntry>>(\n `/v1/changelog/by-id/${encodeURIComponent(id)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, ChangelogEntry>> {\n return this.http.get<Record<string, ChangelogEntry>>(\n `/v1/changelog/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async react(changelogId: string, params: ReactParams): Promise<ReactResponse> {\n return this.http.post<ReactResponse>(\n `/v1/changelog/${encodeURIComponent(changelogId)}/reactions`,\n params\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type { PublicConfig } from '../types';\n\nexport interface ConfigListParams {\n keys?: string[];\n}\n\nexport class ConfigModule {\n constructor(private readonly http: HttpClient) {}\n\n async getByKey(key: string): Promise<PublicConfig> {\n return this.http.get<PublicConfig>(`/v1/config/${encodeURIComponent(key)}`);\n }\n\n async list(params?: ConfigListParams): Promise<PublicConfig[]> {\n return this.http.get<PublicConfig[]>('/v1/config', params);\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n HelpArticle,\n HelpArticleListItem,\n HelpCategory,\n HelpChatParams,\n HelpChatResponse,\n HelpSearchResult,\n LocaleOptions,\n PaginatedResponse,\n PaginationParams,\n VoteUsefulnessResponse,\n} from '../types';\n\nexport interface HelpCategoriesParams extends LocaleOptions {}\n\nexport interface HelpListParams extends PaginationParams, LocaleOptions {\n category?: string;\n search?: string;\n}\n\nexport interface HelpSearchParams extends LocaleOptions {\n query: string;\n limit?: number;\n}\n\nexport interface HelpGetBySlugParams extends LocaleOptions {}\n\nexport interface HelpGetByIdParams extends LocaleOptions {}\n\nexport class HelpModule {\n constructor(private readonly http: HttpClient) {}\n\n async categories(params?: HelpCategoriesParams): Promise<HelpCategory[]> {\n return this.http.get<HelpCategory[]>('/v1/help/categories', params);\n }\n\n async list(params?: HelpListParams): Promise<PaginatedResponse<HelpArticleListItem>> {\n return this.http.get<PaginatedResponse<HelpArticleListItem>>('/v1/help/articles', params);\n }\n\n async getBySlug(slug: string, params?: HelpGetBySlugParams): Promise<HelpArticle> {\n return this.http.get<HelpArticle>(`/v1/help/articles/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: HelpGetByIdParams): Promise<HelpArticle> {\n return this.http.get<HelpArticle>(`/v1/help/articles/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async search(params: HelpSearchParams): Promise<HelpSearchResult[]> {\n return this.http.get<HelpSearchResult[]>('/v1/help/search', params);\n }\n\n async getTranslationsById(articleId: string): Promise<Record<string, HelpArticle>> {\n return this.http.get<Record<string, HelpArticle>>(\n `/v1/help/articles/by-id/${encodeURIComponent(articleId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, HelpArticle>> {\n return this.http.get<Record<string, HelpArticle>>(\n `/v1/help/articles/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async chat(params: HelpChatParams): Promise<HelpChatResponse> {\n return this.http.post<HelpChatResponse>('/v1/help/chat', params);\n }\n\n async voteUsefulness(\n articleId: string,\n vote: 'yes' | 'no' | null,\n previousVote?: 'yes' | 'no' | null,\n ): Promise<VoteUsefulnessResponse> {\n return this.http.post<VoteUsefulnessResponse>(\n `/v1/help/articles/by-id/${encodeURIComponent(articleId)}/vote-usefulness`,\n { vote, previousVote }\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type { LocaleOptions, Page, PageListItem, PaginatedResponse, PaginationParams } from '../types';\n\nexport interface PagesListParams extends PaginationParams, LocaleOptions {\n search?: string;\n}\n\nexport interface PagesGetBySlugParams extends LocaleOptions {}\n\nexport interface PagesGetByIdParams extends LocaleOptions {}\n\nexport class PagesModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: PagesListParams): Promise<PaginatedResponse<PageListItem>> {\n return this.http.get<PaginatedResponse<PageListItem>>('/v1/pages', params);\n }\n\n async getBySlug(slug: string, params?: PagesGetBySlugParams): Promise<Page> {\n return this.http.get<Page>(`/v1/pages/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: PagesGetByIdParams): Promise<Page> {\n return this.http.get<Page>(`/v1/pages/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(pageId: string): Promise<Record<string, Page>> {\n return this.http.get<Record<string, Page>>(\n `/v1/pages/by-id/${encodeURIComponent(pageId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, Page>> {\n return this.http.get<Record<string, Page>>(\n `/v1/pages/${encodeURIComponent(slug)}/translations`\n );\n }\n}\n","import { HttpClient } from './http-client';\nimport { AnnouncementModule } from './modules/announcement';\nimport { BlogModule } from './modules/blog';\nimport { ChangelogModule } from './modules/changelog';\nimport { ConfigModule } from './modules/config';\nimport { HelpModule } from './modules/help';\nimport { PagesModule } from './modules/pages';\nimport type { KookeeConfig, HealthCheckResponse } from './types';\n\nexport class Kookee {\n private readonly http: HttpClient;\n\n public readonly announcements: AnnouncementModule;\n public readonly blog: BlogModule;\n public readonly changelog: ChangelogModule;\n public readonly config: ConfigModule;\n public readonly help: HelpModule;\n public readonly pages: PagesModule;\n\n constructor(config: KookeeConfig) {\n if (!config.apiKey) {\n throw new Error('apiKey is required');\n }\n\n this.http = new HttpClient(config.apiKey, config.baseUrl);\n\n this.announcements = new AnnouncementModule(this.http);\n this.blog = new BlogModule(this.http);\n this.changelog = new ChangelogModule(this.http);\n this.config = new ConfigModule(this.http);\n this.help = new HelpModule(this.http);\n this.pages = new PagesModule(this.http);\n }\n\n async health(): Promise<HealthCheckResponse> {\n return this.http.get<HealthCheckResponse>('/v1/health');\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/lib/http-client.ts","../src/lib/modules/announcement.ts","../src/lib/modules/blog.ts","../src/lib/modules/changelog.ts","../src/lib/modules/config.ts","../src/lib/modules/feedback.ts","../src/lib/modules/help.ts","../src/lib/modules/pages.ts","../src/lib/client.ts"],"names":["DEFAULT_BASE_URL","API_KEY_HEADER","PROJECT_ID_HEADER","KookeeApiError","_KookeeApiError","code","message","status","HttpClient","options","headers","path","params","url","key","value","item","response","body","errorData","reader","decoder","buffer","done","lines","line","trimmed","data","AnnouncementModule","http","excludeIds","rest","queryParams","id","BlogModule","slug","postId","ChangelogModule","changelogId","ConfigModule","FeedbackModule","HelpModule","articleId","vote","previousVote","PagesModule","pageId","Kookee","config"],"mappings":"AAEA,IAAMA,CAAAA,CAAmB,wBAAA,CACnBC,CAAAA,CAAiB,gBAAA,CACjBC,EAAoB,mBAAA,CAEbC,CAAAA,CAAN,MAAMC,CAAAA,SAAuB,KAAM,CACxC,WAAA,CACkBC,CAAAA,CAChBC,CAAAA,CACgBC,EAChB,CACA,KAAA,CAAMD,CAAO,CAAA,CAJG,UAAAD,CAAAA,CAEA,IAAA,CAAA,MAAA,CAAAE,CAAAA,CAGhB,IAAA,CAAK,KAAO,gBAAA,CACZ,MAAA,CAAO,cAAA,CAAe,IAAA,CAAMH,EAAe,SAAS,EACtD,CACF,CAAA,CAEaI,EAAN,KAAiB,CACL,OAAA,CACA,MAAA,CACA,SAAA,CAEjB,WAAA,CAAYC,CAAAA,CAAoE,CAC9E,KAAK,MAAA,CAASA,CAAAA,CAAQ,MAAA,CACtB,IAAA,CAAK,UAAYA,CAAAA,CAAQ,SAAA,CACzB,IAAA,CAAK,OAAA,C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AIxC,EAAW,CAAE,MAAA,CAAQwC,CAAAA,CAAO,MAAA,CAAQ,SAAA,CAAWA,CAAAA,CAAO,UAAW,OAAA,CAASA,CAAAA,CAAO,OAAQ,CAAC,CAAA,CAE1G,IAAA,CAAK,cAAgB,IAAIpB,CAAAA,CAAmB,IAAA,CAAK,IAAI,CAAA,CACrD,IAAA,CAAK,KAAO,IAAIM,CAAAA,CAAW,KAAK,IAAI,CAAA,CACpC,KAAK,SAAA,CAAY,IAAIG,CAAAA,CAAgB,IAAA,CAAK,IAAI,CAAA,CAC9C,KAAK,MAAA,CAAS,IAAIE,EAAa,IAAA,CAAK,IAAI,EACxC,IAAA,CAAK,QAAA,CAAW,IAAIC,CAAAA,CAAe,IAAA,CAAK,IAAI,EAC5C,IAAA,CAAK,IAAA,CAAO,IAAIC,CAAAA,CAAW,IAAA,CAAK,IAAI,CAAA,CACpC,IAAA,CAAK,KAAA,CAAQ,IAAII,CAAAA,CAAY,IAAA,CAAK,IAAI,EACxC,CAEA,MAAM,MAAA,EAAuC,CAC3C,OAAO,KAAK,IAAA,CAAK,GAAA,CAAyB,YAAY,CACxD,CACF","file":"index.js","sourcesContent":["import type { ApiError } from './types';\n\nconst DEFAULT_BASE_URL = 'https://api.kookee.dev';\nconst API_KEY_HEADER = 'Kookee-API-Key';\nconst PROJECT_ID_HEADER = 'Kookee-Project-Id';\n\nexport class KookeeApiError extends Error {\n constructor(\n public readonly code: string,\n message: string,\n public readonly status: number\n ) {\n super(message);\n this.name = 'KookeeApiError';\n Object.setPrototypeOf(this, KookeeApiError.prototype);\n }\n}\n\nexport class HttpClient {\n private readonly baseUrl: string;\n private readonly apiKey?: string;\n private readonly projectId?: string;\n\n constructor(options: { apiKey?: string; projectId?: string; baseUrl?: string }) {\n this.apiKey = options.apiKey;\n this.projectId = options.projectId;\n this.baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;\n }\n\n private getHeaders(): Record<string, string> {\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n };\n if (this.apiKey) {\n headers[API_KEY_HEADER] = this.apiKey;\n }\n if (this.projectId) {\n headers[PROJECT_ID_HEADER] = this.projectId;\n }\n return headers;\n }\n\n async get<T>(path: string, params?: object): Promise<T> {\n const url = new URL(`${this.baseUrl}${path}`);\n\n if (params) {\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined && value !== null) {\n if (Array.isArray(value)) {\n for (const item of value) {\n url.searchParams.append(key, String(item));\n }\n } else {\n url.searchParams.set(key, String(value));\n }\n }\n }\n }\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: this.getHeaders(),\n });\n\n return this.handleResponse<T>(response);\n }\n\n async post<T>(path: string, body?: unknown): Promise<T> {\n const response = await fetch(`${this.baseUrl}${path}`, {\n method: 'POST',\n headers: this.getHeaders(),\n body: body ? JSON.stringify(body) : undefined,\n });\n\n return this.handleResponse<T>(response);\n }\n\n async *streamPost<T>(path: string, body?: unknown): AsyncIterable<T> {\n const response = await fetch(`${this.baseUrl}${path}`, {\n method: 'POST',\n headers: {\n ...this.getHeaders(),\n Accept: 'text/event-stream',\n },\n body: body ? JSON.stringify(body) : undefined,\n });\n\n if (!response.ok) {\n let errorData: ApiError | null = null;\n try {\n errorData = (await response.json()) as ApiError;\n } catch {\n // Response body is not JSON\n }\n throw new KookeeApiError(\n errorData?.code ?? 'UNKNOWN_ERROR',\n errorData?.message ?? `Request failed with status ${response.status}`,\n response.status\n );\n }\n\n if (!response.body) {\n return;\n }\n\n const reader = response.body.getReader();\n const decoder = new TextDecoder();\n let buffer = '';\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n buffer = lines.pop() ?? '';\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed || trimmed.startsWith(':')) continue;\n if (trimmed.startsWith('data: ')) {\n const data = trimmed.slice(6);\n if (data === '[DONE]') return;\n yield JSON.parse(data) as T;\n }\n }\n }\n } finally {\n reader.releaseLock();\n }\n }\n\n private async handleResponse<T>(response: Response): Promise<T> {\n if (!response.ok) {\n let errorData: ApiError | null = null;\n\n try {\n errorData = (await response.json()) as ApiError;\n } catch {\n // Response body is not JSON\n }\n\n throw new KookeeApiError(\n errorData?.code ?? 'UNKNOWN_ERROR',\n errorData?.message ?? `Request failed with status ${response.status}`,\n response.status\n );\n }\n\n return response.json() as Promise<T>;\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n Announcement,\n AnnouncementListItem,\n AnnouncementOrderBy,\n AnnouncementType,\n LocaleOptions,\n OrderDirection,\n PaginatedResponse,\n PaginationParams,\n} from '../types';\n\nexport interface AnnouncementListParams extends PaginationParams, LocaleOptions {\n type?: AnnouncementType;\n excludeIds?: string[];\n orderBy?: AnnouncementOrderBy;\n order?: OrderDirection;\n}\n\nexport interface AnnouncementGetByIdParams extends LocaleOptions {}\n\nexport class AnnouncementModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: AnnouncementListParams): Promise<PaginatedResponse<AnnouncementListItem>> {\n const { excludeIds, ...rest } = params ?? {};\n const queryParams = excludeIds?.length ? { ...rest, excludeIds: excludeIds.join(',') } : rest;\n return this.http.get<PaginatedResponse<AnnouncementListItem>>('/v1/announcements', queryParams);\n }\n\n async getById(id: string, params?: AnnouncementGetByIdParams): Promise<Announcement> {\n return this.http.get<Announcement>(`/v1/announcements/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(id: string): Promise<Record<string, Announcement>> {\n return this.http.get<Record<string, Announcement>>(\n `/v1/announcements/${encodeURIComponent(id)}/translations`\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n BlogPost,\n BlogPostListItem,\n BlogTagWithCount,\n LocaleOptions,\n PaginatedResponse,\n PaginationParams,\n ReactParams,\n ReactResponse,\n} from '../types';\n\nexport interface BlogListParams extends PaginationParams, LocaleOptions {\n tags?: string[];\n search?: string;\n}\n\nexport interface BlogGetBySlugParams extends LocaleOptions {}\n\nexport interface BlogGetByIdParams extends LocaleOptions {}\n\nexport class BlogModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: BlogListParams): Promise<PaginatedResponse<BlogPostListItem>> {\n return this.http.get<PaginatedResponse<BlogPostListItem>>('/v1/blog/posts', params);\n }\n\n async getBySlug(slug: string, params?: BlogGetBySlugParams): Promise<BlogPost> {\n return this.http.get<BlogPost>(`/v1/blog/posts/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: BlogGetByIdParams): Promise<BlogPost> {\n return this.http.get<BlogPost>(`/v1/blog/posts/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTags(): Promise<BlogTagWithCount[]> {\n return this.http.get<BlogTagWithCount[]>('/v1/blog/tags');\n }\n\n async getTranslationsById(postId: string): Promise<Record<string, BlogPost>> {\n return this.http.get<Record<string, BlogPost>>(\n `/v1/blog/posts/by-id/${encodeURIComponent(postId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, BlogPost>> {\n return this.http.get<Record<string, BlogPost>>(\n `/v1/blog/posts/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async react(postId: string, params: ReactParams): Promise<ReactResponse> {\n return this.http.post<ReactResponse>(\n `/v1/blog/posts/${encodeURIComponent(postId)}/reactions`,\n params\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n ChangelogEntry,\n ChangelogEntryListItem,\n ChangelogOrderBy,\n LocaleOptions,\n OrderDirection,\n PaginatedResponse,\n PaginationParams,\n ReactParams,\n ReactResponse,\n} from '../types';\n\nexport interface ChangelogListParams extends PaginationParams, LocaleOptions {\n type?: string;\n search?: string;\n orderBy?: ChangelogOrderBy;\n order?: OrderDirection;\n}\n\nexport interface ChangelogGetBySlugParams extends LocaleOptions {}\n\nexport interface ChangelogGetByIdParams extends LocaleOptions {}\n\nexport class ChangelogModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: ChangelogListParams): Promise<PaginatedResponse<ChangelogEntryListItem>> {\n return this.http.get<PaginatedResponse<ChangelogEntryListItem>>('/v1/changelog', params);\n }\n\n async getBySlug(slug: string, params?: ChangelogGetBySlugParams): Promise<ChangelogEntry> {\n return this.http.get<ChangelogEntry>(`/v1/changelog/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: ChangelogGetByIdParams): Promise<ChangelogEntry> {\n return this.http.get<ChangelogEntry>(`/v1/changelog/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(id: string): Promise<Record<string, ChangelogEntry>> {\n return this.http.get<Record<string, ChangelogEntry>>(\n `/v1/changelog/by-id/${encodeURIComponent(id)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, ChangelogEntry>> {\n return this.http.get<Record<string, ChangelogEntry>>(\n `/v1/changelog/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async react(changelogId: string, params: ReactParams): Promise<ReactResponse> {\n return this.http.post<ReactResponse>(\n `/v1/changelog/${encodeURIComponent(changelogId)}/reactions`,\n params\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type { PublicConfig } from '../types';\n\nexport interface ConfigListParams {\n keys?: string[];\n}\n\nexport class ConfigModule {\n constructor(private readonly http: HttpClient) {}\n\n async getByKey(key: string): Promise<PublicConfig> {\n return this.http.get<PublicConfig>(`/v1/config/${encodeURIComponent(key)}`);\n }\n\n async list(params?: ConfigListParams): Promise<PublicConfig[]> {\n return this.http.get<PublicConfig[]>('/v1/config', params);\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n FeedbackPost,\n FeedbackPostCategory,\n FeedbackPostListItem,\n FeedbackPostStatus,\n FeedbackSortOption,\n FeedbackTopContributor,\n FeedbackVoteResponse,\n PaginatedResponse,\n PaginationParams,\n} from '../types';\n\nexport interface FeedbackListParams extends PaginationParams {\n status?: FeedbackPostStatus;\n category?: FeedbackPostCategory;\n search?: string;\n sort?: FeedbackSortOption;\n}\n\nexport interface FeedbackVoteParams {\n action: 'upvote' | 'downvote';\n}\n\nexport interface FeedbackTopContributorsParams {\n limit?: number;\n}\n\nexport class FeedbackModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: FeedbackListParams): Promise<PaginatedResponse<FeedbackPostListItem>> {\n return this.http.get<PaginatedResponse<FeedbackPostListItem>>('/v1/feedback', params);\n }\n\n async getById(id: string): Promise<FeedbackPost> {\n return this.http.get<FeedbackPost>(`/v1/feedback/by-id/${encodeURIComponent(id)}`);\n }\n\n async vote(postId: string, params: FeedbackVoteParams): Promise<FeedbackVoteResponse> {\n return this.http.post<FeedbackVoteResponse>(\n `/v1/feedback/${encodeURIComponent(postId)}/vote`,\n params\n );\n }\n\n async getTopContributors(params?: FeedbackTopContributorsParams): Promise<FeedbackTopContributor[]> {\n return this.http.get<FeedbackTopContributor[]>('/v1/feedback/top-contributors', params);\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n HelpArticle,\n HelpArticleListItem,\n HelpCategory,\n HelpChatParams,\n HelpChatResponse,\n HelpChatStreamChunk,\n HelpSearchResult,\n LocaleOptions,\n PaginatedResponse,\n PaginationParams,\n VoteUsefulnessResponse,\n} from '../types';\n\nexport interface HelpCategoriesParams extends LocaleOptions {}\n\nexport interface HelpListParams extends PaginationParams, LocaleOptions {\n category?: string;\n search?: string;\n}\n\nexport interface HelpSearchParams extends LocaleOptions {\n query: string;\n limit?: number;\n}\n\nexport interface HelpGetBySlugParams extends LocaleOptions {}\n\nexport interface HelpGetByIdParams extends LocaleOptions {}\n\nexport class HelpModule {\n constructor(private readonly http: HttpClient) {}\n\n async categories(params?: HelpCategoriesParams): Promise<HelpCategory[]> {\n return this.http.get<HelpCategory[]>('/v1/help/categories', params);\n }\n\n async list(params?: HelpListParams): Promise<PaginatedResponse<HelpArticleListItem>> {\n return this.http.get<PaginatedResponse<HelpArticleListItem>>('/v1/help/articles', params);\n }\n\n async getBySlug(slug: string, params?: HelpGetBySlugParams): Promise<HelpArticle> {\n return this.http.get<HelpArticle>(`/v1/help/articles/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: HelpGetByIdParams): Promise<HelpArticle> {\n return this.http.get<HelpArticle>(`/v1/help/articles/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async search(params: HelpSearchParams): Promise<HelpSearchResult[]> {\n return this.http.get<HelpSearchResult[]>('/v1/help/search', params);\n }\n\n async getTranslationsById(articleId: string): Promise<Record<string, HelpArticle>> {\n return this.http.get<Record<string, HelpArticle>>(\n `/v1/help/articles/by-id/${encodeURIComponent(articleId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, HelpArticle>> {\n return this.http.get<Record<string, HelpArticle>>(\n `/v1/help/articles/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async chat(params: HelpChatParams): Promise<HelpChatResponse> {\n return this.http.post<HelpChatResponse>('/v1/help/chat', params);\n }\n\n chatStream(params: HelpChatParams): AsyncIterable<HelpChatStreamChunk> {\n return this.http.streamPost<HelpChatStreamChunk>('/v1/help/chat/stream', params);\n }\n\n async voteUsefulness(\n articleId: string,\n vote: 'yes' | 'no' | null,\n previousVote?: 'yes' | 'no' | null,\n ): Promise<VoteUsefulnessResponse> {\n return this.http.post<VoteUsefulnessResponse>(\n `/v1/help/articles/by-id/${encodeURIComponent(articleId)}/vote-usefulness`,\n { vote, previousVote }\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type { LocaleOptions, Page, PageListItem, PaginatedResponse, PaginationParams } from '../types';\n\nexport interface PagesListParams extends PaginationParams, LocaleOptions {\n search?: string;\n}\n\nexport interface PagesGetBySlugParams extends LocaleOptions {}\n\nexport interface PagesGetByIdParams extends LocaleOptions {}\n\nexport class PagesModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: PagesListParams): Promise<PaginatedResponse<PageListItem>> {\n return this.http.get<PaginatedResponse<PageListItem>>('/v1/pages', params);\n }\n\n async getBySlug(slug: string, params?: PagesGetBySlugParams): Promise<Page> {\n return this.http.get<Page>(`/v1/pages/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: PagesGetByIdParams): Promise<Page> {\n return this.http.get<Page>(`/v1/pages/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(pageId: string): Promise<Record<string, Page>> {\n return this.http.get<Record<string, Page>>(\n `/v1/pages/by-id/${encodeURIComponent(pageId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, Page>> {\n return this.http.get<Record<string, Page>>(\n `/v1/pages/${encodeURIComponent(slug)}/translations`\n );\n }\n}\n","import { HttpClient } from './http-client';\nimport { AnnouncementModule } from './modules/announcement';\nimport { BlogModule } from './modules/blog';\nimport { ChangelogModule } from './modules/changelog';\nimport { ConfigModule } from './modules/config';\nimport { FeedbackModule } from './modules/feedback';\nimport { HelpModule } from './modules/help';\nimport { PagesModule } from './modules/pages';\nimport type { KookeeConfig, HealthCheckResponse } from './types';\n\nexport class Kookee {\n private readonly http: HttpClient;\n\n public readonly announcements: AnnouncementModule;\n public readonly blog: BlogModule;\n public readonly changelog: ChangelogModule;\n public readonly config: ConfigModule;\n public readonly feedback: FeedbackModule;\n public readonly help: HelpModule;\n public readonly pages: PagesModule;\n\n constructor(config: KookeeConfig) {\n if (!config.apiKey && !config.projectId) {\n throw new Error('Either apiKey or projectId is required');\n }\n\n this.http = new HttpClient({ apiKey: config.apiKey, projectId: config.projectId, baseUrl: config.baseUrl });\n\n this.announcements = new AnnouncementModule(this.http);\n this.blog = new BlogModule(this.http);\n this.changelog = new ChangelogModule(this.http);\n this.config = new ConfigModule(this.http);\n this.feedback = new FeedbackModule(this.http);\n this.help = new HelpModule(this.http);\n this.pages = new PagesModule(this.http);\n }\n\n async health(): Promise<HealthCheckResponse> {\n return this.http.get<HealthCheckResponse>('/v1/health');\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kookee/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.24",
|
|
4
4
|
"description": "Official Kookee SDK - Access your blog, changelog, help center, and more",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -34,6 +34,9 @@
|
|
|
34
34
|
"url": "https://github.com/kookee-dot-dev/kookee-ts-sdk"
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://kookee.dev",
|
|
37
|
+
"sideEffects": [
|
|
38
|
+
"./styles/code.css"
|
|
39
|
+
],
|
|
37
40
|
"devDependencies": {
|
|
38
41
|
"@types/node": "^22.10.2",
|
|
39
42
|
"eslint": "^9.17.0",
|