@kookee/sdk 0.0.31 → 0.0.32
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/dist/index.cjs +2 -2
- package/dist/index.d.cts +224 -210
- package/dist/index.d.ts +224 -210
- package/dist/index.global.js +2 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var k="https://api.kookee.dev",
|
|
2
|
-
`);
|
|
1
|
+
'use strict';var k="https://api.kookee.dev",x="Kookee-API-Key",I="Kookee-Project-Id",i=class r extends Error{constructor(t,s,o){super(s);this.code=t;this.status=o;this.name="KookeeApiError",Object.setPrototypeOf(this,r.prototype);}},C=class{baseUrl;apiKey;projectId;constructor(e){this.apiKey=e.apiKey,this.projectId=e.projectId,this.baseUrl=e.baseUrl??k;}getHeaders(){let e={"Content-Type":"application/json"};return this.apiKey&&(e[x]=this.apiKey),this.projectId&&(e[I]=this.projectId),e}async get(e,t){let s=new URL(`${this.baseUrl}${e}`);if(t){for(let[h,n]of Object.entries(t))if(n!=null)if(Array.isArray(n))for(let a of n)s.searchParams.append(h,String(a));else s.searchParams.set(h,String(n));}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 delete(e,t){let s=await fetch(`${this.baseUrl}${e}`,{method:"DELETE",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(s)}async*streamPost(e,t){let s=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:{...this.getHeaders(),Accept:"text/event-stream"},body:t?JSON.stringify(t):void 0});if(!s.ok){let a=null;try{a=await s.json();}catch{}throw new i(a?.code??"UNKNOWN_ERROR",a?.message??`Request failed with status ${s.status}`,s.status)}if(!s.body)return;let o=s.body.getReader(),h=new TextDecoder,n="";try{for(;;){let{done:a,value:b}=await o.read();if(a)break;n+=h.decode(b,{stream:!0});let f=n.split(`
|
|
2
|
+
`);n=f.pop()??"";for(let B of f){let u=B.trim();if(!(!u||u.startsWith(":"))&&u.startsWith("data: ")){let R=u.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 m=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"announcement",...e})}async getById(e,t){return this.entries.getById(e,t)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getComments(e,t){return this.entries.getComments(e,t)}};var p=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"blog",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"blog",...t})}async getById(e,t){return this.entries.getById(e,t)}async getTags(){return this.entries.getTags("blog")}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}async react(e,t){return this.entries.react(e,t)}};var c=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"changelog",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"changelog",...t})}async getById(e,t){return this.entries.getById(e,t)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}async react(e,t){return this.entries.react(e,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 l=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/entries",e)}async getById(e,t){return this.http.get(`/v1/entries/by-id/${encodeURIComponent(e)}`,t)}async getBySlug(e,t){return this.http.get(`/v1/entries/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/entries/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/entries/${encodeURIComponent(e)}/translations`)}async getComments(e,t){return this.http.get(`/v1/entries/${encodeURIComponent(e)}/comments`,t)}async react(e,t){return this.http.post(`/v1/entries/${encodeURIComponent(e)}/reactions`,t)}async getTags(e){return this.http.get("/v1/tags",{type:e})}async getCategories(e,t){return this.http.get("/v1/categories",{type:e,...t})}};var y=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/feedback",e)}async getById(e){return this.http.get(`/v1/feedback/by-id/${encodeURIComponent(e)}`)}async vote(e,t){return this.http.post(`/v1/feedback/${encodeURIComponent(e)}/vote`,t)}async getTopContributors(e){return this.http.get("/v1/feedback/top-contributors",e)}async createPost(e){return this.http.post("/v1/feedback",e)}async createComment(e,t){return this.http.post(`/v1/feedback/${encodeURIComponent(e)}/comments`,t)}async listMyPosts(e){return this.http.get("/v1/feedback/mine",e)}async deletePost(e,t){return this.http.delete(`/v1/feedback/${encodeURIComponent(e)}`,t)}async deleteComment(e,t){return this.http.delete(`/v1/feedback/comments/${encodeURIComponent(e)}`,t)}};var P=class{http;entries;constructor(e,t){this.http=e,this.entries=t;}async categories(e){return this.entries.getCategories("help_article",e)}async list(e){return this.entries.list({type:"help_article",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"help_article",...t})}async getById(e,t){return this.entries.getById(e,t)}async search(e){return this.http.get("/v1/help/search",e)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}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 d=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"page",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"page",...t})}async getById(e,t){return this.entries.getById(e,t)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}};var E=class{http;entries;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 C({apiKey:e.apiKey,projectId:e.projectId,baseUrl:e.baseUrl}),this.entries=new l(this.http),this.announcements=new m(this.entries),this.blog=new p(this.entries),this.changelog=new c(this.entries),this.config=new g(this.http),this.feedback=new y(this.http),this.help=new P(this.http,this.entries),this.pages=new d(this.entries);}async health(){return this.http.get("/v1/health")}};exports.AnnouncementModule=m;exports.BlogModule=p;exports.ChangelogModule=c;exports.ConfigModule=g;exports.EntriesModule=l;exports.FeedbackModule=y;exports.HelpModule=P;exports.Kookee=E;exports.KookeeApiError=i;exports.PagesModule=d;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
declare class KookeeApiError extends Error {
|
|
2
|
-
readonly code: string;
|
|
3
|
-
readonly status: number;
|
|
4
|
-
constructor(code: string, message: string, status: number);
|
|
5
|
-
}
|
|
6
|
-
declare class HttpClient {
|
|
7
|
-
private readonly baseUrl;
|
|
8
|
-
private readonly apiKey?;
|
|
9
|
-
private readonly projectId?;
|
|
10
|
-
constructor(options: {
|
|
11
|
-
apiKey?: string;
|
|
12
|
-
projectId?: string;
|
|
13
|
-
baseUrl?: string;
|
|
14
|
-
});
|
|
15
|
-
private getHeaders;
|
|
16
|
-
get<T>(path: string, params?: object): Promise<T>;
|
|
17
|
-
post<T>(path: string, body?: unknown): Promise<T>;
|
|
18
|
-
delete<T>(path: string, body?: unknown): Promise<T>;
|
|
19
|
-
streamPost<T>(path: string, body?: unknown): AsyncIterable<T>;
|
|
20
|
-
private handleResponse;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
1
|
interface KookeeConfig {
|
|
24
2
|
apiKey?: string;
|
|
25
3
|
projectId?: string;
|
|
@@ -41,156 +19,10 @@ interface PaginatedResponse<T> {
|
|
|
41
19
|
page: number;
|
|
42
20
|
totalPages: number;
|
|
43
21
|
}
|
|
44
|
-
interface BlogTag {
|
|
45
|
-
name: string;
|
|
46
|
-
slug: string;
|
|
47
|
-
}
|
|
48
|
-
interface BlogTagWithCount extends BlogTag {
|
|
49
|
-
count: number;
|
|
50
|
-
}
|
|
51
|
-
interface BlogPostAuthor {
|
|
52
|
-
name: string;
|
|
53
|
-
}
|
|
54
|
-
type BlogPostStatus = 'draft' | 'published' | 'archived';
|
|
55
|
-
interface BlogPostListItem {
|
|
56
|
-
id: string;
|
|
57
|
-
slug: string;
|
|
58
|
-
title: string;
|
|
59
|
-
excerptHtml: string | null;
|
|
60
|
-
coverImageUrl: string | null;
|
|
61
|
-
status: BlogPostStatus;
|
|
62
|
-
publishedAt: string | null;
|
|
63
|
-
metadata: Record<string, NonNullable<unknown>> | null;
|
|
64
|
-
createdAt: string;
|
|
65
|
-
views: number;
|
|
66
|
-
author: BlogPostAuthor;
|
|
67
|
-
tags: BlogTag[];
|
|
68
|
-
locale: string;
|
|
69
|
-
translationGroupId: string;
|
|
70
|
-
reactions: Record<string, number>;
|
|
71
|
-
}
|
|
72
|
-
interface BlogPost extends BlogPostListItem {
|
|
73
|
-
contentHtml: string;
|
|
74
|
-
metaTitle: string | null;
|
|
75
|
-
metaDescription: string | null;
|
|
76
|
-
updatedAt: string;
|
|
77
|
-
}
|
|
78
22
|
interface ApiError {
|
|
79
23
|
code: string;
|
|
80
24
|
message: string;
|
|
81
25
|
}
|
|
82
|
-
interface PageListItem {
|
|
83
|
-
id: string;
|
|
84
|
-
slug: string;
|
|
85
|
-
title: string;
|
|
86
|
-
views: number;
|
|
87
|
-
createdAt: string;
|
|
88
|
-
updatedAt: string;
|
|
89
|
-
locale: string;
|
|
90
|
-
translationGroupId: string;
|
|
91
|
-
}
|
|
92
|
-
interface Page extends PageListItem {
|
|
93
|
-
contentHtml: string;
|
|
94
|
-
metaTitle: string | null;
|
|
95
|
-
metaDescription: string | null;
|
|
96
|
-
}
|
|
97
|
-
interface HelpCategory {
|
|
98
|
-
slug: string;
|
|
99
|
-
name: string;
|
|
100
|
-
description: string | null;
|
|
101
|
-
icon: string | null;
|
|
102
|
-
articleCount: number;
|
|
103
|
-
}
|
|
104
|
-
interface HelpArticleAuthor {
|
|
105
|
-
name: string;
|
|
106
|
-
}
|
|
107
|
-
interface HelpArticleListItem {
|
|
108
|
-
id: string;
|
|
109
|
-
slug: string;
|
|
110
|
-
title: string;
|
|
111
|
-
excerptHtml: string | null;
|
|
112
|
-
status: string;
|
|
113
|
-
position: number;
|
|
114
|
-
metadata: Record<string, NonNullable<unknown>>;
|
|
115
|
-
category: {
|
|
116
|
-
name: string;
|
|
117
|
-
slug: string;
|
|
118
|
-
};
|
|
119
|
-
author: HelpArticleAuthor;
|
|
120
|
-
createdAt: string;
|
|
121
|
-
views: number;
|
|
122
|
-
locale: string;
|
|
123
|
-
translationGroupId: string;
|
|
124
|
-
usefulYesCount: number;
|
|
125
|
-
usefulNoCount: number;
|
|
126
|
-
}
|
|
127
|
-
interface HelpArticle extends HelpArticleListItem {
|
|
128
|
-
contentHtml: string;
|
|
129
|
-
metaTitle: string | null;
|
|
130
|
-
metaDescription: string | null;
|
|
131
|
-
updatedAt: string;
|
|
132
|
-
}
|
|
133
|
-
interface HelpSearchResult {
|
|
134
|
-
id: string;
|
|
135
|
-
slug: string;
|
|
136
|
-
title: string;
|
|
137
|
-
excerptHtml: string | null;
|
|
138
|
-
category: {
|
|
139
|
-
name: string;
|
|
140
|
-
slug: string;
|
|
141
|
-
};
|
|
142
|
-
locale: string;
|
|
143
|
-
matchedChunk?: string;
|
|
144
|
-
usefulYesCount: number;
|
|
145
|
-
usefulNoCount: number;
|
|
146
|
-
}
|
|
147
|
-
type ChangelogType = 'feature' | 'fix' | 'improvement' | 'breaking' | 'security' | 'deprecated' | 'other';
|
|
148
|
-
type ChangelogOrderBy = 'createdAt' | 'publishedAt' | 'version';
|
|
149
|
-
type OrderDirection = 'asc' | 'desc';
|
|
150
|
-
interface ChangelogAuthor {
|
|
151
|
-
name: string;
|
|
152
|
-
}
|
|
153
|
-
interface ChangelogEntryListItem {
|
|
154
|
-
id: string;
|
|
155
|
-
slug: string;
|
|
156
|
-
title: string;
|
|
157
|
-
contentHtml: string;
|
|
158
|
-
type: ChangelogType;
|
|
159
|
-
version: string | null;
|
|
160
|
-
publishedAt: string | null;
|
|
161
|
-
createdAt: string;
|
|
162
|
-
locale: string;
|
|
163
|
-
translationGroupId: string;
|
|
164
|
-
metadata: Record<string, NonNullable<unknown>> | null;
|
|
165
|
-
author: ChangelogAuthor;
|
|
166
|
-
reactions: Record<string, number>;
|
|
167
|
-
}
|
|
168
|
-
interface ChangelogEntry extends ChangelogEntryListItem {
|
|
169
|
-
contentHtml: string;
|
|
170
|
-
link: string | null;
|
|
171
|
-
updatedAt: string;
|
|
172
|
-
}
|
|
173
|
-
type AnnouncementType = 'info' | 'warning' | 'critical' | 'promotion' | 'maintenance' | 'newFeature';
|
|
174
|
-
type AnnouncementOrderBy = 'createdAt' | 'publishedAt';
|
|
175
|
-
interface AnnouncementAuthor {
|
|
176
|
-
name: string;
|
|
177
|
-
}
|
|
178
|
-
interface AnnouncementListItem {
|
|
179
|
-
id: string;
|
|
180
|
-
title: string;
|
|
181
|
-
contentHtml: string;
|
|
182
|
-
type: AnnouncementType;
|
|
183
|
-
publishedAt: string | null;
|
|
184
|
-
unpublishAt: string | null;
|
|
185
|
-
createdAt: string;
|
|
186
|
-
locale: string;
|
|
187
|
-
translationGroupId: string;
|
|
188
|
-
metadata: Record<string, NonNullable<unknown>> | null;
|
|
189
|
-
author: AnnouncementAuthor;
|
|
190
|
-
}
|
|
191
|
-
interface Announcement extends AnnouncementListItem {
|
|
192
|
-
updatedAt: string;
|
|
193
|
-
}
|
|
194
26
|
interface PublicConfig {
|
|
195
27
|
key: string;
|
|
196
28
|
value: unknown;
|
|
@@ -200,10 +32,6 @@ interface HealthCheckResponse {
|
|
|
200
32
|
projectId: string;
|
|
201
33
|
timestamp: string;
|
|
202
34
|
}
|
|
203
|
-
interface VoteUsefulnessResponse {
|
|
204
|
-
usefulYesCount: number;
|
|
205
|
-
usefulNoCount: number;
|
|
206
|
-
}
|
|
207
35
|
type ReactionType = 'fire' | 'heart' | 'rocket' | 'eyes' | 'mindblown';
|
|
208
36
|
interface ReactParams {
|
|
209
37
|
reactionType: ReactionType;
|
|
@@ -212,6 +40,11 @@ interface ReactParams {
|
|
|
212
40
|
interface ReactResponse {
|
|
213
41
|
reactions: Record<string, number>;
|
|
214
42
|
}
|
|
43
|
+
interface VoteUsefulnessResponse {
|
|
44
|
+
usefulYesCount: number;
|
|
45
|
+
usefulNoCount: number;
|
|
46
|
+
}
|
|
47
|
+
type OrderDirection = 'asc' | 'desc';
|
|
215
48
|
interface HelpChatMessage {
|
|
216
49
|
role: 'user' | 'assistant';
|
|
217
50
|
content: string;
|
|
@@ -250,6 +83,20 @@ type HelpChatStreamChunk = {
|
|
|
250
83
|
type: 'error';
|
|
251
84
|
message: string;
|
|
252
85
|
};
|
|
86
|
+
interface HelpSearchResult {
|
|
87
|
+
id: string;
|
|
88
|
+
slug: string;
|
|
89
|
+
title: string;
|
|
90
|
+
excerptHtml: string | null;
|
|
91
|
+
category: {
|
|
92
|
+
name: string;
|
|
93
|
+
slug: string;
|
|
94
|
+
};
|
|
95
|
+
locale: string;
|
|
96
|
+
matchedChunk?: string;
|
|
97
|
+
usefulYesCount: number;
|
|
98
|
+
usefulNoCount: number;
|
|
99
|
+
}
|
|
253
100
|
type FeedbackPostStatus = 'open' | 'under_review' | 'planned' | 'in_progress' | 'completed' | 'declined';
|
|
254
101
|
type FeedbackPostCategory = 'feature' | 'improvement' | 'bug' | 'other';
|
|
255
102
|
type FeedbackSortOption = 'newest' | 'top' | 'trending';
|
|
@@ -355,21 +202,177 @@ interface DeleteFeedbackCommentParams {
|
|
|
355
202
|
interface DeleteFeedbackCommentResponse {
|
|
356
203
|
success: boolean;
|
|
357
204
|
}
|
|
205
|
+
type EntryType = 'blog' | 'page' | 'help_article' | 'changelog' | 'announcement';
|
|
206
|
+
type EntryStatus = 'draft' | 'published' | 'archived';
|
|
207
|
+
type ChangelogType = 'feature' | 'fix' | 'improvement' | 'breaking' | 'security' | 'deprecated' | 'other';
|
|
208
|
+
type AnnouncementType = 'info' | 'warning' | 'critical' | 'promotion' | 'maintenance' | 'newFeature';
|
|
209
|
+
interface EntryAuthor {
|
|
210
|
+
name: string;
|
|
211
|
+
}
|
|
212
|
+
interface EntryTag {
|
|
213
|
+
name: string;
|
|
214
|
+
slug: string;
|
|
215
|
+
}
|
|
216
|
+
interface EntryTagWithCount extends EntryTag {
|
|
217
|
+
count: number;
|
|
218
|
+
}
|
|
219
|
+
interface EntryCategory {
|
|
220
|
+
id: string;
|
|
221
|
+
slug: string;
|
|
222
|
+
name: string;
|
|
223
|
+
description: string | null;
|
|
224
|
+
icon: string | null;
|
|
225
|
+
articleCount: number;
|
|
226
|
+
}
|
|
227
|
+
interface EntryComment {
|
|
228
|
+
id: string;
|
|
229
|
+
content: string;
|
|
230
|
+
createdAt: string;
|
|
231
|
+
updatedAt: string;
|
|
232
|
+
author: EntryAuthor;
|
|
233
|
+
}
|
|
234
|
+
interface BaseEntry {
|
|
235
|
+
id: string;
|
|
236
|
+
type: string;
|
|
237
|
+
slug: string | null;
|
|
238
|
+
title: string;
|
|
239
|
+
excerptHtml: string | null;
|
|
240
|
+
contentHtml: string;
|
|
241
|
+
status: EntryStatus;
|
|
242
|
+
publishedAt: string | null;
|
|
243
|
+
locale: string;
|
|
244
|
+
translationGroupId: string;
|
|
245
|
+
categoryId: string | null;
|
|
246
|
+
coverImageUrl: string | null;
|
|
247
|
+
position: number;
|
|
248
|
+
views: number;
|
|
249
|
+
metaTitle: string | null;
|
|
250
|
+
metaDescription: string | null;
|
|
251
|
+
metadata: Record<string, NonNullable<unknown>> | null;
|
|
252
|
+
createdAt: string;
|
|
253
|
+
updatedAt: string;
|
|
254
|
+
author: EntryAuthor;
|
|
255
|
+
tags: EntryTag[];
|
|
256
|
+
reactions: Record<string, number>;
|
|
257
|
+
category: {
|
|
258
|
+
name: string;
|
|
259
|
+
slug: string;
|
|
260
|
+
} | null;
|
|
261
|
+
}
|
|
262
|
+
interface BlogTypeSpecific {
|
|
263
|
+
_type: 'blog';
|
|
264
|
+
}
|
|
265
|
+
interface PageTypeSpecific {
|
|
266
|
+
_type: 'page';
|
|
267
|
+
}
|
|
268
|
+
interface HelpArticleTypeSpecific {
|
|
269
|
+
_type: 'help_article';
|
|
270
|
+
visibility: HelpArticleVisibility;
|
|
271
|
+
usefulYesCount: number;
|
|
272
|
+
usefulNoCount: number;
|
|
273
|
+
}
|
|
274
|
+
interface ChangelogTypeSpecific {
|
|
275
|
+
_type: 'changelog';
|
|
276
|
+
changelogType: ChangelogType;
|
|
277
|
+
version: string | null;
|
|
278
|
+
link: string | null;
|
|
279
|
+
}
|
|
280
|
+
interface AnnouncementTypeSpecific {
|
|
281
|
+
_type: 'announcement';
|
|
282
|
+
announcementType: AnnouncementType;
|
|
283
|
+
unpublishAt: string | null;
|
|
284
|
+
}
|
|
285
|
+
type TypeSpecific = BlogTypeSpecific | PageTypeSpecific | HelpArticleTypeSpecific | ChangelogTypeSpecific | AnnouncementTypeSpecific;
|
|
286
|
+
interface GenericEntry extends BaseEntry {
|
|
287
|
+
typeSpecific: unknown;
|
|
288
|
+
}
|
|
289
|
+
interface BlogEntry extends BaseEntry {
|
|
290
|
+
type: 'blog';
|
|
291
|
+
typeSpecific: BlogTypeSpecific;
|
|
292
|
+
}
|
|
293
|
+
interface PageEntry extends BaseEntry {
|
|
294
|
+
type: 'page';
|
|
295
|
+
typeSpecific: PageTypeSpecific;
|
|
296
|
+
}
|
|
297
|
+
interface HelpArticleEntry extends BaseEntry {
|
|
298
|
+
type: 'help_article';
|
|
299
|
+
typeSpecific: HelpArticleTypeSpecific;
|
|
300
|
+
}
|
|
301
|
+
interface ChangelogEntry extends BaseEntry {
|
|
302
|
+
type: 'changelog';
|
|
303
|
+
typeSpecific: ChangelogTypeSpecific;
|
|
304
|
+
}
|
|
305
|
+
interface AnnouncementEntry extends BaseEntry {
|
|
306
|
+
type: 'announcement';
|
|
307
|
+
typeSpecific: AnnouncementTypeSpecific;
|
|
308
|
+
}
|
|
309
|
+
type TypedEntry = BlogEntry | PageEntry | HelpArticleEntry | ChangelogEntry | AnnouncementEntry;
|
|
310
|
+
type AnyEntry = TypedEntry | GenericEntry;
|
|
311
|
+
|
|
312
|
+
declare class KookeeApiError extends Error {
|
|
313
|
+
readonly code: string;
|
|
314
|
+
readonly status: number;
|
|
315
|
+
constructor(code: string, message: string, status: number);
|
|
316
|
+
}
|
|
317
|
+
declare class HttpClient {
|
|
318
|
+
private readonly baseUrl;
|
|
319
|
+
private readonly apiKey?;
|
|
320
|
+
private readonly projectId?;
|
|
321
|
+
constructor(options: {
|
|
322
|
+
apiKey?: string;
|
|
323
|
+
projectId?: string;
|
|
324
|
+
baseUrl?: string;
|
|
325
|
+
});
|
|
326
|
+
private getHeaders;
|
|
327
|
+
get<T>(path: string, params?: object): Promise<T>;
|
|
328
|
+
post<T>(path: string, body?: unknown): Promise<T>;
|
|
329
|
+
delete<T>(path: string, body?: unknown): Promise<T>;
|
|
330
|
+
streamPost<T>(path: string, body?: unknown): AsyncIterable<T>;
|
|
331
|
+
private handleResponse;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
interface EntriesListParams extends PaginationParams, LocaleOptions {
|
|
335
|
+
type: string;
|
|
336
|
+
tags?: string[];
|
|
337
|
+
category?: string;
|
|
338
|
+
search?: string;
|
|
339
|
+
}
|
|
340
|
+
interface EntriesGetByIdParams extends LocaleOptions {
|
|
341
|
+
}
|
|
342
|
+
interface EntriesGetBySlugParams extends LocaleOptions {
|
|
343
|
+
type: string;
|
|
344
|
+
}
|
|
345
|
+
interface EntriesGetCommentsParams extends PaginationParams {
|
|
346
|
+
}
|
|
347
|
+
interface EntriesGetCategoriesParams extends LocaleOptions {
|
|
348
|
+
}
|
|
349
|
+
declare class EntriesModule {
|
|
350
|
+
private readonly http;
|
|
351
|
+
constructor(http: HttpClient);
|
|
352
|
+
list(params: EntriesListParams): Promise<PaginatedResponse<GenericEntry>>;
|
|
353
|
+
getById(id: string, params?: EntriesGetByIdParams): Promise<GenericEntry>;
|
|
354
|
+
getBySlug(slug: string, params: EntriesGetBySlugParams): Promise<GenericEntry>;
|
|
355
|
+
getTranslationsById(id: string): Promise<Record<string, GenericEntry>>;
|
|
356
|
+
getTranslationsBySlug(slug: string): Promise<Record<string, GenericEntry>>;
|
|
357
|
+
getComments(entryId: string, params?: EntriesGetCommentsParams): Promise<PaginatedResponse<EntryComment>>;
|
|
358
|
+
react(entryId: string, params: ReactParams): Promise<ReactResponse>;
|
|
359
|
+
getTags(type: string): Promise<EntryTagWithCount[]>;
|
|
360
|
+
getCategories(type: string, params?: EntriesGetCategoriesParams): Promise<EntryCategory[]>;
|
|
361
|
+
}
|
|
358
362
|
|
|
359
363
|
interface AnnouncementListParams extends PaginationParams, LocaleOptions {
|
|
360
|
-
type?: AnnouncementType;
|
|
361
|
-
excludeIds?: string[];
|
|
362
|
-
orderBy?: AnnouncementOrderBy;
|
|
363
|
-
order?: OrderDirection;
|
|
364
364
|
}
|
|
365
365
|
interface AnnouncementGetByIdParams extends LocaleOptions {
|
|
366
366
|
}
|
|
367
|
+
interface AnnouncementGetCommentsParams extends PaginationParams {
|
|
368
|
+
}
|
|
367
369
|
declare class AnnouncementModule {
|
|
368
|
-
private readonly
|
|
369
|
-
constructor(
|
|
370
|
-
list(params?: AnnouncementListParams): Promise<PaginatedResponse<
|
|
371
|
-
getById(id: string, params?: AnnouncementGetByIdParams): Promise<
|
|
372
|
-
getTranslationsById(id: string): Promise<Record<string,
|
|
370
|
+
private readonly entries;
|
|
371
|
+
constructor(entries: EntriesModule);
|
|
372
|
+
list(params?: AnnouncementListParams): Promise<PaginatedResponse<AnnouncementEntry>>;
|
|
373
|
+
getById(id: string, params?: AnnouncementGetByIdParams): Promise<AnnouncementEntry>;
|
|
374
|
+
getTranslationsById(id: string): Promise<Record<string, AnnouncementEntry>>;
|
|
375
|
+
getComments(entryId: string, params?: AnnouncementGetCommentsParams): Promise<PaginatedResponse<EntryComment>>;
|
|
373
376
|
}
|
|
374
377
|
|
|
375
378
|
interface BlogListParams extends PaginationParams, LocaleOptions {
|
|
@@ -380,36 +383,39 @@ interface BlogGetBySlugParams extends LocaleOptions {
|
|
|
380
383
|
}
|
|
381
384
|
interface BlogGetByIdParams extends LocaleOptions {
|
|
382
385
|
}
|
|
386
|
+
interface BlogGetCommentsParams extends PaginationParams {
|
|
387
|
+
}
|
|
383
388
|
declare class BlogModule {
|
|
384
|
-
private readonly
|
|
385
|
-
constructor(
|
|
386
|
-
list(params?: BlogListParams): Promise<PaginatedResponse<
|
|
387
|
-
getBySlug(slug: string, params?: BlogGetBySlugParams): Promise<
|
|
388
|
-
getById(id: string, params?: BlogGetByIdParams): Promise<
|
|
389
|
-
getTags(): Promise<
|
|
390
|
-
getTranslationsById(postId: string): Promise<Record<string,
|
|
391
|
-
getTranslationsBySlug(slug: string): Promise<Record<string,
|
|
389
|
+
private readonly entries;
|
|
390
|
+
constructor(entries: EntriesModule);
|
|
391
|
+
list(params?: BlogListParams): Promise<PaginatedResponse<BlogEntry>>;
|
|
392
|
+
getBySlug(slug: string, params?: BlogGetBySlugParams): Promise<BlogEntry>;
|
|
393
|
+
getById(id: string, params?: BlogGetByIdParams): Promise<BlogEntry>;
|
|
394
|
+
getTags(): Promise<EntryTagWithCount[]>;
|
|
395
|
+
getTranslationsById(postId: string): Promise<Record<string, BlogEntry>>;
|
|
396
|
+
getTranslationsBySlug(slug: string): Promise<Record<string, BlogEntry>>;
|
|
397
|
+
getComments(entryId: string, params?: BlogGetCommentsParams): Promise<PaginatedResponse<EntryComment>>;
|
|
392
398
|
react(postId: string, params: ReactParams): Promise<ReactResponse>;
|
|
393
399
|
}
|
|
394
400
|
|
|
395
401
|
interface ChangelogListParams extends PaginationParams, LocaleOptions {
|
|
396
|
-
type?: string;
|
|
397
402
|
search?: string;
|
|
398
|
-
orderBy?: ChangelogOrderBy;
|
|
399
|
-
order?: OrderDirection;
|
|
400
403
|
}
|
|
401
404
|
interface ChangelogGetBySlugParams extends LocaleOptions {
|
|
402
405
|
}
|
|
403
406
|
interface ChangelogGetByIdParams extends LocaleOptions {
|
|
404
407
|
}
|
|
408
|
+
interface ChangelogGetCommentsParams extends PaginationParams {
|
|
409
|
+
}
|
|
405
410
|
declare class ChangelogModule {
|
|
406
|
-
private readonly
|
|
407
|
-
constructor(
|
|
408
|
-
list(params?: ChangelogListParams): Promise<PaginatedResponse<
|
|
411
|
+
private readonly entries;
|
|
412
|
+
constructor(entries: EntriesModule);
|
|
413
|
+
list(params?: ChangelogListParams): Promise<PaginatedResponse<ChangelogEntry>>;
|
|
409
414
|
getBySlug(slug: string, params?: ChangelogGetBySlugParams): Promise<ChangelogEntry>;
|
|
410
415
|
getById(id: string, params?: ChangelogGetByIdParams): Promise<ChangelogEntry>;
|
|
411
416
|
getTranslationsById(id: string): Promise<Record<string, ChangelogEntry>>;
|
|
412
417
|
getTranslationsBySlug(slug: string): Promise<Record<string, ChangelogEntry>>;
|
|
418
|
+
getComments(entryId: string, params?: ChangelogGetCommentsParams): Promise<PaginatedResponse<EntryComment>>;
|
|
413
419
|
react(changelogId: string, params: ReactParams): Promise<ReactResponse>;
|
|
414
420
|
}
|
|
415
421
|
|
|
@@ -463,16 +469,20 @@ interface HelpGetBySlugParams extends LocaleOptions {
|
|
|
463
469
|
}
|
|
464
470
|
interface HelpGetByIdParams extends LocaleOptions {
|
|
465
471
|
}
|
|
472
|
+
interface HelpGetCommentsParams extends PaginationParams {
|
|
473
|
+
}
|
|
466
474
|
declare class HelpModule {
|
|
467
475
|
private readonly http;
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
476
|
+
private readonly entries;
|
|
477
|
+
constructor(http: HttpClient, entries: EntriesModule);
|
|
478
|
+
categories(params?: HelpCategoriesParams): Promise<EntryCategory[]>;
|
|
479
|
+
list(params?: HelpListParams): Promise<PaginatedResponse<HelpArticleEntry>>;
|
|
480
|
+
getBySlug(slug: string, params?: HelpGetBySlugParams): Promise<HelpArticleEntry>;
|
|
481
|
+
getById(id: string, params?: HelpGetByIdParams): Promise<HelpArticleEntry>;
|
|
473
482
|
search(params: HelpSearchParams): Promise<HelpSearchResult[]>;
|
|
474
|
-
getTranslationsById(articleId: string): Promise<Record<string,
|
|
475
|
-
getTranslationsBySlug(slug: string): Promise<Record<string,
|
|
483
|
+
getTranslationsById(articleId: string): Promise<Record<string, HelpArticleEntry>>;
|
|
484
|
+
getTranslationsBySlug(slug: string): Promise<Record<string, HelpArticleEntry>>;
|
|
485
|
+
getComments(entryId: string, params?: HelpGetCommentsParams): Promise<PaginatedResponse<EntryComment>>;
|
|
476
486
|
chat(params: HelpChatParams): Promise<HelpChatResponse>;
|
|
477
487
|
chatStream(params: HelpChatParams): AsyncIterable<HelpChatStreamChunk>;
|
|
478
488
|
voteUsefulness(articleId: string, vote: 'yes' | 'no' | null, previousVote?: 'yes' | 'no' | null): Promise<VoteUsefulnessResponse>;
|
|
@@ -485,18 +495,22 @@ interface PagesGetBySlugParams extends LocaleOptions {
|
|
|
485
495
|
}
|
|
486
496
|
interface PagesGetByIdParams extends LocaleOptions {
|
|
487
497
|
}
|
|
498
|
+
interface PagesGetCommentsParams extends PaginationParams {
|
|
499
|
+
}
|
|
488
500
|
declare class PagesModule {
|
|
489
|
-
private readonly
|
|
490
|
-
constructor(
|
|
491
|
-
list(params?: PagesListParams): Promise<PaginatedResponse<
|
|
492
|
-
getBySlug(slug: string, params?: PagesGetBySlugParams): Promise<
|
|
493
|
-
getById(id: string, params?: PagesGetByIdParams): Promise<
|
|
494
|
-
getTranslationsById(pageId: string): Promise<Record<string,
|
|
495
|
-
getTranslationsBySlug(slug: string): Promise<Record<string,
|
|
501
|
+
private readonly entries;
|
|
502
|
+
constructor(entries: EntriesModule);
|
|
503
|
+
list(params?: PagesListParams): Promise<PaginatedResponse<PageEntry>>;
|
|
504
|
+
getBySlug(slug: string, params?: PagesGetBySlugParams): Promise<PageEntry>;
|
|
505
|
+
getById(id: string, params?: PagesGetByIdParams): Promise<PageEntry>;
|
|
506
|
+
getTranslationsById(pageId: string): Promise<Record<string, PageEntry>>;
|
|
507
|
+
getTranslationsBySlug(slug: string): Promise<Record<string, PageEntry>>;
|
|
508
|
+
getComments(entryId: string, params?: PagesGetCommentsParams): Promise<PaginatedResponse<EntryComment>>;
|
|
496
509
|
}
|
|
497
510
|
|
|
498
511
|
declare class Kookee {
|
|
499
512
|
private readonly http;
|
|
513
|
+
readonly entries: EntriesModule;
|
|
500
514
|
readonly announcements: AnnouncementModule;
|
|
501
515
|
readonly blog: BlogModule;
|
|
502
516
|
readonly changelog: ChangelogModule;
|
|
@@ -508,4 +522,4 @@ declare class Kookee {
|
|
|
508
522
|
health(): Promise<HealthCheckResponse>;
|
|
509
523
|
}
|
|
510
524
|
|
|
511
|
-
export { type
|
|
525
|
+
export { type AnnouncementEntry, type AnnouncementGetByIdParams, type AnnouncementGetCommentsParams, type AnnouncementListParams, AnnouncementModule, type AnnouncementType, type AnnouncementTypeSpecific, type AnyEntry, type ApiError, type BaseEntry, type BlogEntry, type BlogGetByIdParams, type BlogGetBySlugParams, type BlogGetCommentsParams, type BlogListParams, BlogModule, type BlogTypeSpecific, type ChangelogEntry, type ChangelogGetByIdParams, type ChangelogGetBySlugParams, type ChangelogGetCommentsParams, type ChangelogListParams, ChangelogModule, type ChangelogType, type ChangelogTypeSpecific, type ConfigListParams, ConfigModule, type CreateFeedbackCommentParams, type CreateFeedbackPostParams, type CreatedFeedbackComment, type CreatedFeedbackPost, type DeleteFeedbackCommentParams, type DeleteFeedbackCommentResponse, type DeleteFeedbackPostParams, type DeleteFeedbackPostResponse, type EntriesGetByIdParams, type EntriesGetBySlugParams, type EntriesGetCategoriesParams, type EntriesGetCommentsParams, type EntriesListParams, EntriesModule, type EntryAuthor, type EntryCategory, type EntryComment, type EntryStatus, type EntryTag, type EntryTagWithCount, type EntryType, type ExternalUser, type FeedbackAssignee, type FeedbackAuthor, type FeedbackComment, type FeedbackListParams, FeedbackModule, type FeedbackPost, type FeedbackPostCategory, type FeedbackPostListItem, type FeedbackPostStatus, type FeedbackSortOption, type FeedbackTopContributor, type FeedbackTopContributorsParams, type FeedbackVoteParams, type FeedbackVoteResponse, type GenericEntry, type HealthCheckResponse, type HelpArticleEntry, type HelpArticleTypeSpecific, type HelpArticleVisibility, type HelpCategoriesParams, type HelpChatMessage, type HelpChatParams, type HelpChatResponse, type HelpChatSource, type HelpChatSourceCategory, type HelpChatStreamChunk, type HelpGetByIdParams, type HelpGetBySlugParams, type HelpGetCommentsParams, type HelpListParams, HelpModule, type HelpSearchParams, type HelpSearchResult, Kookee, KookeeApiError, type KookeeConfig, type ListMyFeedbackPostsParams, type LocaleOptions, type OrderDirection, type PageEntry, type PageTypeSpecific, type PagesGetByIdParams, type PagesGetBySlugParams, type PagesGetCommentsParams, type PagesListParams, PagesModule, type PaginatedResponse, type PaginationParams, type PublicConfig, type ReactParams, type ReactResponse, type ReactionType, type TypeSpecific, type TypedEntry, type VoteUsefulnessResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
declare class KookeeApiError extends Error {
|
|
2
|
-
readonly code: string;
|
|
3
|
-
readonly status: number;
|
|
4
|
-
constructor(code: string, message: string, status: number);
|
|
5
|
-
}
|
|
6
|
-
declare class HttpClient {
|
|
7
|
-
private readonly baseUrl;
|
|
8
|
-
private readonly apiKey?;
|
|
9
|
-
private readonly projectId?;
|
|
10
|
-
constructor(options: {
|
|
11
|
-
apiKey?: string;
|
|
12
|
-
projectId?: string;
|
|
13
|
-
baseUrl?: string;
|
|
14
|
-
});
|
|
15
|
-
private getHeaders;
|
|
16
|
-
get<T>(path: string, params?: object): Promise<T>;
|
|
17
|
-
post<T>(path: string, body?: unknown): Promise<T>;
|
|
18
|
-
delete<T>(path: string, body?: unknown): Promise<T>;
|
|
19
|
-
streamPost<T>(path: string, body?: unknown): AsyncIterable<T>;
|
|
20
|
-
private handleResponse;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
1
|
interface KookeeConfig {
|
|
24
2
|
apiKey?: string;
|
|
25
3
|
projectId?: string;
|
|
@@ -41,156 +19,10 @@ interface PaginatedResponse<T> {
|
|
|
41
19
|
page: number;
|
|
42
20
|
totalPages: number;
|
|
43
21
|
}
|
|
44
|
-
interface BlogTag {
|
|
45
|
-
name: string;
|
|
46
|
-
slug: string;
|
|
47
|
-
}
|
|
48
|
-
interface BlogTagWithCount extends BlogTag {
|
|
49
|
-
count: number;
|
|
50
|
-
}
|
|
51
|
-
interface BlogPostAuthor {
|
|
52
|
-
name: string;
|
|
53
|
-
}
|
|
54
|
-
type BlogPostStatus = 'draft' | 'published' | 'archived';
|
|
55
|
-
interface BlogPostListItem {
|
|
56
|
-
id: string;
|
|
57
|
-
slug: string;
|
|
58
|
-
title: string;
|
|
59
|
-
excerptHtml: string | null;
|
|
60
|
-
coverImageUrl: string | null;
|
|
61
|
-
status: BlogPostStatus;
|
|
62
|
-
publishedAt: string | null;
|
|
63
|
-
metadata: Record<string, NonNullable<unknown>> | null;
|
|
64
|
-
createdAt: string;
|
|
65
|
-
views: number;
|
|
66
|
-
author: BlogPostAuthor;
|
|
67
|
-
tags: BlogTag[];
|
|
68
|
-
locale: string;
|
|
69
|
-
translationGroupId: string;
|
|
70
|
-
reactions: Record<string, number>;
|
|
71
|
-
}
|
|
72
|
-
interface BlogPost extends BlogPostListItem {
|
|
73
|
-
contentHtml: string;
|
|
74
|
-
metaTitle: string | null;
|
|
75
|
-
metaDescription: string | null;
|
|
76
|
-
updatedAt: string;
|
|
77
|
-
}
|
|
78
22
|
interface ApiError {
|
|
79
23
|
code: string;
|
|
80
24
|
message: string;
|
|
81
25
|
}
|
|
82
|
-
interface PageListItem {
|
|
83
|
-
id: string;
|
|
84
|
-
slug: string;
|
|
85
|
-
title: string;
|
|
86
|
-
views: number;
|
|
87
|
-
createdAt: string;
|
|
88
|
-
updatedAt: string;
|
|
89
|
-
locale: string;
|
|
90
|
-
translationGroupId: string;
|
|
91
|
-
}
|
|
92
|
-
interface Page extends PageListItem {
|
|
93
|
-
contentHtml: string;
|
|
94
|
-
metaTitle: string | null;
|
|
95
|
-
metaDescription: string | null;
|
|
96
|
-
}
|
|
97
|
-
interface HelpCategory {
|
|
98
|
-
slug: string;
|
|
99
|
-
name: string;
|
|
100
|
-
description: string | null;
|
|
101
|
-
icon: string | null;
|
|
102
|
-
articleCount: number;
|
|
103
|
-
}
|
|
104
|
-
interface HelpArticleAuthor {
|
|
105
|
-
name: string;
|
|
106
|
-
}
|
|
107
|
-
interface HelpArticleListItem {
|
|
108
|
-
id: string;
|
|
109
|
-
slug: string;
|
|
110
|
-
title: string;
|
|
111
|
-
excerptHtml: string | null;
|
|
112
|
-
status: string;
|
|
113
|
-
position: number;
|
|
114
|
-
metadata: Record<string, NonNullable<unknown>>;
|
|
115
|
-
category: {
|
|
116
|
-
name: string;
|
|
117
|
-
slug: string;
|
|
118
|
-
};
|
|
119
|
-
author: HelpArticleAuthor;
|
|
120
|
-
createdAt: string;
|
|
121
|
-
views: number;
|
|
122
|
-
locale: string;
|
|
123
|
-
translationGroupId: string;
|
|
124
|
-
usefulYesCount: number;
|
|
125
|
-
usefulNoCount: number;
|
|
126
|
-
}
|
|
127
|
-
interface HelpArticle extends HelpArticleListItem {
|
|
128
|
-
contentHtml: string;
|
|
129
|
-
metaTitle: string | null;
|
|
130
|
-
metaDescription: string | null;
|
|
131
|
-
updatedAt: string;
|
|
132
|
-
}
|
|
133
|
-
interface HelpSearchResult {
|
|
134
|
-
id: string;
|
|
135
|
-
slug: string;
|
|
136
|
-
title: string;
|
|
137
|
-
excerptHtml: string | null;
|
|
138
|
-
category: {
|
|
139
|
-
name: string;
|
|
140
|
-
slug: string;
|
|
141
|
-
};
|
|
142
|
-
locale: string;
|
|
143
|
-
matchedChunk?: string;
|
|
144
|
-
usefulYesCount: number;
|
|
145
|
-
usefulNoCount: number;
|
|
146
|
-
}
|
|
147
|
-
type ChangelogType = 'feature' | 'fix' | 'improvement' | 'breaking' | 'security' | 'deprecated' | 'other';
|
|
148
|
-
type ChangelogOrderBy = 'createdAt' | 'publishedAt' | 'version';
|
|
149
|
-
type OrderDirection = 'asc' | 'desc';
|
|
150
|
-
interface ChangelogAuthor {
|
|
151
|
-
name: string;
|
|
152
|
-
}
|
|
153
|
-
interface ChangelogEntryListItem {
|
|
154
|
-
id: string;
|
|
155
|
-
slug: string;
|
|
156
|
-
title: string;
|
|
157
|
-
contentHtml: string;
|
|
158
|
-
type: ChangelogType;
|
|
159
|
-
version: string | null;
|
|
160
|
-
publishedAt: string | null;
|
|
161
|
-
createdAt: string;
|
|
162
|
-
locale: string;
|
|
163
|
-
translationGroupId: string;
|
|
164
|
-
metadata: Record<string, NonNullable<unknown>> | null;
|
|
165
|
-
author: ChangelogAuthor;
|
|
166
|
-
reactions: Record<string, number>;
|
|
167
|
-
}
|
|
168
|
-
interface ChangelogEntry extends ChangelogEntryListItem {
|
|
169
|
-
contentHtml: string;
|
|
170
|
-
link: string | null;
|
|
171
|
-
updatedAt: string;
|
|
172
|
-
}
|
|
173
|
-
type AnnouncementType = 'info' | 'warning' | 'critical' | 'promotion' | 'maintenance' | 'newFeature';
|
|
174
|
-
type AnnouncementOrderBy = 'createdAt' | 'publishedAt';
|
|
175
|
-
interface AnnouncementAuthor {
|
|
176
|
-
name: string;
|
|
177
|
-
}
|
|
178
|
-
interface AnnouncementListItem {
|
|
179
|
-
id: string;
|
|
180
|
-
title: string;
|
|
181
|
-
contentHtml: string;
|
|
182
|
-
type: AnnouncementType;
|
|
183
|
-
publishedAt: string | null;
|
|
184
|
-
unpublishAt: string | null;
|
|
185
|
-
createdAt: string;
|
|
186
|
-
locale: string;
|
|
187
|
-
translationGroupId: string;
|
|
188
|
-
metadata: Record<string, NonNullable<unknown>> | null;
|
|
189
|
-
author: AnnouncementAuthor;
|
|
190
|
-
}
|
|
191
|
-
interface Announcement extends AnnouncementListItem {
|
|
192
|
-
updatedAt: string;
|
|
193
|
-
}
|
|
194
26
|
interface PublicConfig {
|
|
195
27
|
key: string;
|
|
196
28
|
value: unknown;
|
|
@@ -200,10 +32,6 @@ interface HealthCheckResponse {
|
|
|
200
32
|
projectId: string;
|
|
201
33
|
timestamp: string;
|
|
202
34
|
}
|
|
203
|
-
interface VoteUsefulnessResponse {
|
|
204
|
-
usefulYesCount: number;
|
|
205
|
-
usefulNoCount: number;
|
|
206
|
-
}
|
|
207
35
|
type ReactionType = 'fire' | 'heart' | 'rocket' | 'eyes' | 'mindblown';
|
|
208
36
|
interface ReactParams {
|
|
209
37
|
reactionType: ReactionType;
|
|
@@ -212,6 +40,11 @@ interface ReactParams {
|
|
|
212
40
|
interface ReactResponse {
|
|
213
41
|
reactions: Record<string, number>;
|
|
214
42
|
}
|
|
43
|
+
interface VoteUsefulnessResponse {
|
|
44
|
+
usefulYesCount: number;
|
|
45
|
+
usefulNoCount: number;
|
|
46
|
+
}
|
|
47
|
+
type OrderDirection = 'asc' | 'desc';
|
|
215
48
|
interface HelpChatMessage {
|
|
216
49
|
role: 'user' | 'assistant';
|
|
217
50
|
content: string;
|
|
@@ -250,6 +83,20 @@ type HelpChatStreamChunk = {
|
|
|
250
83
|
type: 'error';
|
|
251
84
|
message: string;
|
|
252
85
|
};
|
|
86
|
+
interface HelpSearchResult {
|
|
87
|
+
id: string;
|
|
88
|
+
slug: string;
|
|
89
|
+
title: string;
|
|
90
|
+
excerptHtml: string | null;
|
|
91
|
+
category: {
|
|
92
|
+
name: string;
|
|
93
|
+
slug: string;
|
|
94
|
+
};
|
|
95
|
+
locale: string;
|
|
96
|
+
matchedChunk?: string;
|
|
97
|
+
usefulYesCount: number;
|
|
98
|
+
usefulNoCount: number;
|
|
99
|
+
}
|
|
253
100
|
type FeedbackPostStatus = 'open' | 'under_review' | 'planned' | 'in_progress' | 'completed' | 'declined';
|
|
254
101
|
type FeedbackPostCategory = 'feature' | 'improvement' | 'bug' | 'other';
|
|
255
102
|
type FeedbackSortOption = 'newest' | 'top' | 'trending';
|
|
@@ -355,21 +202,177 @@ interface DeleteFeedbackCommentParams {
|
|
|
355
202
|
interface DeleteFeedbackCommentResponse {
|
|
356
203
|
success: boolean;
|
|
357
204
|
}
|
|
205
|
+
type EntryType = 'blog' | 'page' | 'help_article' | 'changelog' | 'announcement';
|
|
206
|
+
type EntryStatus = 'draft' | 'published' | 'archived';
|
|
207
|
+
type ChangelogType = 'feature' | 'fix' | 'improvement' | 'breaking' | 'security' | 'deprecated' | 'other';
|
|
208
|
+
type AnnouncementType = 'info' | 'warning' | 'critical' | 'promotion' | 'maintenance' | 'newFeature';
|
|
209
|
+
interface EntryAuthor {
|
|
210
|
+
name: string;
|
|
211
|
+
}
|
|
212
|
+
interface EntryTag {
|
|
213
|
+
name: string;
|
|
214
|
+
slug: string;
|
|
215
|
+
}
|
|
216
|
+
interface EntryTagWithCount extends EntryTag {
|
|
217
|
+
count: number;
|
|
218
|
+
}
|
|
219
|
+
interface EntryCategory {
|
|
220
|
+
id: string;
|
|
221
|
+
slug: string;
|
|
222
|
+
name: string;
|
|
223
|
+
description: string | null;
|
|
224
|
+
icon: string | null;
|
|
225
|
+
articleCount: number;
|
|
226
|
+
}
|
|
227
|
+
interface EntryComment {
|
|
228
|
+
id: string;
|
|
229
|
+
content: string;
|
|
230
|
+
createdAt: string;
|
|
231
|
+
updatedAt: string;
|
|
232
|
+
author: EntryAuthor;
|
|
233
|
+
}
|
|
234
|
+
interface BaseEntry {
|
|
235
|
+
id: string;
|
|
236
|
+
type: string;
|
|
237
|
+
slug: string | null;
|
|
238
|
+
title: string;
|
|
239
|
+
excerptHtml: string | null;
|
|
240
|
+
contentHtml: string;
|
|
241
|
+
status: EntryStatus;
|
|
242
|
+
publishedAt: string | null;
|
|
243
|
+
locale: string;
|
|
244
|
+
translationGroupId: string;
|
|
245
|
+
categoryId: string | null;
|
|
246
|
+
coverImageUrl: string | null;
|
|
247
|
+
position: number;
|
|
248
|
+
views: number;
|
|
249
|
+
metaTitle: string | null;
|
|
250
|
+
metaDescription: string | null;
|
|
251
|
+
metadata: Record<string, NonNullable<unknown>> | null;
|
|
252
|
+
createdAt: string;
|
|
253
|
+
updatedAt: string;
|
|
254
|
+
author: EntryAuthor;
|
|
255
|
+
tags: EntryTag[];
|
|
256
|
+
reactions: Record<string, number>;
|
|
257
|
+
category: {
|
|
258
|
+
name: string;
|
|
259
|
+
slug: string;
|
|
260
|
+
} | null;
|
|
261
|
+
}
|
|
262
|
+
interface BlogTypeSpecific {
|
|
263
|
+
_type: 'blog';
|
|
264
|
+
}
|
|
265
|
+
interface PageTypeSpecific {
|
|
266
|
+
_type: 'page';
|
|
267
|
+
}
|
|
268
|
+
interface HelpArticleTypeSpecific {
|
|
269
|
+
_type: 'help_article';
|
|
270
|
+
visibility: HelpArticleVisibility;
|
|
271
|
+
usefulYesCount: number;
|
|
272
|
+
usefulNoCount: number;
|
|
273
|
+
}
|
|
274
|
+
interface ChangelogTypeSpecific {
|
|
275
|
+
_type: 'changelog';
|
|
276
|
+
changelogType: ChangelogType;
|
|
277
|
+
version: string | null;
|
|
278
|
+
link: string | null;
|
|
279
|
+
}
|
|
280
|
+
interface AnnouncementTypeSpecific {
|
|
281
|
+
_type: 'announcement';
|
|
282
|
+
announcementType: AnnouncementType;
|
|
283
|
+
unpublishAt: string | null;
|
|
284
|
+
}
|
|
285
|
+
type TypeSpecific = BlogTypeSpecific | PageTypeSpecific | HelpArticleTypeSpecific | ChangelogTypeSpecific | AnnouncementTypeSpecific;
|
|
286
|
+
interface GenericEntry extends BaseEntry {
|
|
287
|
+
typeSpecific: unknown;
|
|
288
|
+
}
|
|
289
|
+
interface BlogEntry extends BaseEntry {
|
|
290
|
+
type: 'blog';
|
|
291
|
+
typeSpecific: BlogTypeSpecific;
|
|
292
|
+
}
|
|
293
|
+
interface PageEntry extends BaseEntry {
|
|
294
|
+
type: 'page';
|
|
295
|
+
typeSpecific: PageTypeSpecific;
|
|
296
|
+
}
|
|
297
|
+
interface HelpArticleEntry extends BaseEntry {
|
|
298
|
+
type: 'help_article';
|
|
299
|
+
typeSpecific: HelpArticleTypeSpecific;
|
|
300
|
+
}
|
|
301
|
+
interface ChangelogEntry extends BaseEntry {
|
|
302
|
+
type: 'changelog';
|
|
303
|
+
typeSpecific: ChangelogTypeSpecific;
|
|
304
|
+
}
|
|
305
|
+
interface AnnouncementEntry extends BaseEntry {
|
|
306
|
+
type: 'announcement';
|
|
307
|
+
typeSpecific: AnnouncementTypeSpecific;
|
|
308
|
+
}
|
|
309
|
+
type TypedEntry = BlogEntry | PageEntry | HelpArticleEntry | ChangelogEntry | AnnouncementEntry;
|
|
310
|
+
type AnyEntry = TypedEntry | GenericEntry;
|
|
311
|
+
|
|
312
|
+
declare class KookeeApiError extends Error {
|
|
313
|
+
readonly code: string;
|
|
314
|
+
readonly status: number;
|
|
315
|
+
constructor(code: string, message: string, status: number);
|
|
316
|
+
}
|
|
317
|
+
declare class HttpClient {
|
|
318
|
+
private readonly baseUrl;
|
|
319
|
+
private readonly apiKey?;
|
|
320
|
+
private readonly projectId?;
|
|
321
|
+
constructor(options: {
|
|
322
|
+
apiKey?: string;
|
|
323
|
+
projectId?: string;
|
|
324
|
+
baseUrl?: string;
|
|
325
|
+
});
|
|
326
|
+
private getHeaders;
|
|
327
|
+
get<T>(path: string, params?: object): Promise<T>;
|
|
328
|
+
post<T>(path: string, body?: unknown): Promise<T>;
|
|
329
|
+
delete<T>(path: string, body?: unknown): Promise<T>;
|
|
330
|
+
streamPost<T>(path: string, body?: unknown): AsyncIterable<T>;
|
|
331
|
+
private handleResponse;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
interface EntriesListParams extends PaginationParams, LocaleOptions {
|
|
335
|
+
type: string;
|
|
336
|
+
tags?: string[];
|
|
337
|
+
category?: string;
|
|
338
|
+
search?: string;
|
|
339
|
+
}
|
|
340
|
+
interface EntriesGetByIdParams extends LocaleOptions {
|
|
341
|
+
}
|
|
342
|
+
interface EntriesGetBySlugParams extends LocaleOptions {
|
|
343
|
+
type: string;
|
|
344
|
+
}
|
|
345
|
+
interface EntriesGetCommentsParams extends PaginationParams {
|
|
346
|
+
}
|
|
347
|
+
interface EntriesGetCategoriesParams extends LocaleOptions {
|
|
348
|
+
}
|
|
349
|
+
declare class EntriesModule {
|
|
350
|
+
private readonly http;
|
|
351
|
+
constructor(http: HttpClient);
|
|
352
|
+
list(params: EntriesListParams): Promise<PaginatedResponse<GenericEntry>>;
|
|
353
|
+
getById(id: string, params?: EntriesGetByIdParams): Promise<GenericEntry>;
|
|
354
|
+
getBySlug(slug: string, params: EntriesGetBySlugParams): Promise<GenericEntry>;
|
|
355
|
+
getTranslationsById(id: string): Promise<Record<string, GenericEntry>>;
|
|
356
|
+
getTranslationsBySlug(slug: string): Promise<Record<string, GenericEntry>>;
|
|
357
|
+
getComments(entryId: string, params?: EntriesGetCommentsParams): Promise<PaginatedResponse<EntryComment>>;
|
|
358
|
+
react(entryId: string, params: ReactParams): Promise<ReactResponse>;
|
|
359
|
+
getTags(type: string): Promise<EntryTagWithCount[]>;
|
|
360
|
+
getCategories(type: string, params?: EntriesGetCategoriesParams): Promise<EntryCategory[]>;
|
|
361
|
+
}
|
|
358
362
|
|
|
359
363
|
interface AnnouncementListParams extends PaginationParams, LocaleOptions {
|
|
360
|
-
type?: AnnouncementType;
|
|
361
|
-
excludeIds?: string[];
|
|
362
|
-
orderBy?: AnnouncementOrderBy;
|
|
363
|
-
order?: OrderDirection;
|
|
364
364
|
}
|
|
365
365
|
interface AnnouncementGetByIdParams extends LocaleOptions {
|
|
366
366
|
}
|
|
367
|
+
interface AnnouncementGetCommentsParams extends PaginationParams {
|
|
368
|
+
}
|
|
367
369
|
declare class AnnouncementModule {
|
|
368
|
-
private readonly
|
|
369
|
-
constructor(
|
|
370
|
-
list(params?: AnnouncementListParams): Promise<PaginatedResponse<
|
|
371
|
-
getById(id: string, params?: AnnouncementGetByIdParams): Promise<
|
|
372
|
-
getTranslationsById(id: string): Promise<Record<string,
|
|
370
|
+
private readonly entries;
|
|
371
|
+
constructor(entries: EntriesModule);
|
|
372
|
+
list(params?: AnnouncementListParams): Promise<PaginatedResponse<AnnouncementEntry>>;
|
|
373
|
+
getById(id: string, params?: AnnouncementGetByIdParams): Promise<AnnouncementEntry>;
|
|
374
|
+
getTranslationsById(id: string): Promise<Record<string, AnnouncementEntry>>;
|
|
375
|
+
getComments(entryId: string, params?: AnnouncementGetCommentsParams): Promise<PaginatedResponse<EntryComment>>;
|
|
373
376
|
}
|
|
374
377
|
|
|
375
378
|
interface BlogListParams extends PaginationParams, LocaleOptions {
|
|
@@ -380,36 +383,39 @@ interface BlogGetBySlugParams extends LocaleOptions {
|
|
|
380
383
|
}
|
|
381
384
|
interface BlogGetByIdParams extends LocaleOptions {
|
|
382
385
|
}
|
|
386
|
+
interface BlogGetCommentsParams extends PaginationParams {
|
|
387
|
+
}
|
|
383
388
|
declare class BlogModule {
|
|
384
|
-
private readonly
|
|
385
|
-
constructor(
|
|
386
|
-
list(params?: BlogListParams): Promise<PaginatedResponse<
|
|
387
|
-
getBySlug(slug: string, params?: BlogGetBySlugParams): Promise<
|
|
388
|
-
getById(id: string, params?: BlogGetByIdParams): Promise<
|
|
389
|
-
getTags(): Promise<
|
|
390
|
-
getTranslationsById(postId: string): Promise<Record<string,
|
|
391
|
-
getTranslationsBySlug(slug: string): Promise<Record<string,
|
|
389
|
+
private readonly entries;
|
|
390
|
+
constructor(entries: EntriesModule);
|
|
391
|
+
list(params?: BlogListParams): Promise<PaginatedResponse<BlogEntry>>;
|
|
392
|
+
getBySlug(slug: string, params?: BlogGetBySlugParams): Promise<BlogEntry>;
|
|
393
|
+
getById(id: string, params?: BlogGetByIdParams): Promise<BlogEntry>;
|
|
394
|
+
getTags(): Promise<EntryTagWithCount[]>;
|
|
395
|
+
getTranslationsById(postId: string): Promise<Record<string, BlogEntry>>;
|
|
396
|
+
getTranslationsBySlug(slug: string): Promise<Record<string, BlogEntry>>;
|
|
397
|
+
getComments(entryId: string, params?: BlogGetCommentsParams): Promise<PaginatedResponse<EntryComment>>;
|
|
392
398
|
react(postId: string, params: ReactParams): Promise<ReactResponse>;
|
|
393
399
|
}
|
|
394
400
|
|
|
395
401
|
interface ChangelogListParams extends PaginationParams, LocaleOptions {
|
|
396
|
-
type?: string;
|
|
397
402
|
search?: string;
|
|
398
|
-
orderBy?: ChangelogOrderBy;
|
|
399
|
-
order?: OrderDirection;
|
|
400
403
|
}
|
|
401
404
|
interface ChangelogGetBySlugParams extends LocaleOptions {
|
|
402
405
|
}
|
|
403
406
|
interface ChangelogGetByIdParams extends LocaleOptions {
|
|
404
407
|
}
|
|
408
|
+
interface ChangelogGetCommentsParams extends PaginationParams {
|
|
409
|
+
}
|
|
405
410
|
declare class ChangelogModule {
|
|
406
|
-
private readonly
|
|
407
|
-
constructor(
|
|
408
|
-
list(params?: ChangelogListParams): Promise<PaginatedResponse<
|
|
411
|
+
private readonly entries;
|
|
412
|
+
constructor(entries: EntriesModule);
|
|
413
|
+
list(params?: ChangelogListParams): Promise<PaginatedResponse<ChangelogEntry>>;
|
|
409
414
|
getBySlug(slug: string, params?: ChangelogGetBySlugParams): Promise<ChangelogEntry>;
|
|
410
415
|
getById(id: string, params?: ChangelogGetByIdParams): Promise<ChangelogEntry>;
|
|
411
416
|
getTranslationsById(id: string): Promise<Record<string, ChangelogEntry>>;
|
|
412
417
|
getTranslationsBySlug(slug: string): Promise<Record<string, ChangelogEntry>>;
|
|
418
|
+
getComments(entryId: string, params?: ChangelogGetCommentsParams): Promise<PaginatedResponse<EntryComment>>;
|
|
413
419
|
react(changelogId: string, params: ReactParams): Promise<ReactResponse>;
|
|
414
420
|
}
|
|
415
421
|
|
|
@@ -463,16 +469,20 @@ interface HelpGetBySlugParams extends LocaleOptions {
|
|
|
463
469
|
}
|
|
464
470
|
interface HelpGetByIdParams extends LocaleOptions {
|
|
465
471
|
}
|
|
472
|
+
interface HelpGetCommentsParams extends PaginationParams {
|
|
473
|
+
}
|
|
466
474
|
declare class HelpModule {
|
|
467
475
|
private readonly http;
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
476
|
+
private readonly entries;
|
|
477
|
+
constructor(http: HttpClient, entries: EntriesModule);
|
|
478
|
+
categories(params?: HelpCategoriesParams): Promise<EntryCategory[]>;
|
|
479
|
+
list(params?: HelpListParams): Promise<PaginatedResponse<HelpArticleEntry>>;
|
|
480
|
+
getBySlug(slug: string, params?: HelpGetBySlugParams): Promise<HelpArticleEntry>;
|
|
481
|
+
getById(id: string, params?: HelpGetByIdParams): Promise<HelpArticleEntry>;
|
|
473
482
|
search(params: HelpSearchParams): Promise<HelpSearchResult[]>;
|
|
474
|
-
getTranslationsById(articleId: string): Promise<Record<string,
|
|
475
|
-
getTranslationsBySlug(slug: string): Promise<Record<string,
|
|
483
|
+
getTranslationsById(articleId: string): Promise<Record<string, HelpArticleEntry>>;
|
|
484
|
+
getTranslationsBySlug(slug: string): Promise<Record<string, HelpArticleEntry>>;
|
|
485
|
+
getComments(entryId: string, params?: HelpGetCommentsParams): Promise<PaginatedResponse<EntryComment>>;
|
|
476
486
|
chat(params: HelpChatParams): Promise<HelpChatResponse>;
|
|
477
487
|
chatStream(params: HelpChatParams): AsyncIterable<HelpChatStreamChunk>;
|
|
478
488
|
voteUsefulness(articleId: string, vote: 'yes' | 'no' | null, previousVote?: 'yes' | 'no' | null): Promise<VoteUsefulnessResponse>;
|
|
@@ -485,18 +495,22 @@ interface PagesGetBySlugParams extends LocaleOptions {
|
|
|
485
495
|
}
|
|
486
496
|
interface PagesGetByIdParams extends LocaleOptions {
|
|
487
497
|
}
|
|
498
|
+
interface PagesGetCommentsParams extends PaginationParams {
|
|
499
|
+
}
|
|
488
500
|
declare class PagesModule {
|
|
489
|
-
private readonly
|
|
490
|
-
constructor(
|
|
491
|
-
list(params?: PagesListParams): Promise<PaginatedResponse<
|
|
492
|
-
getBySlug(slug: string, params?: PagesGetBySlugParams): Promise<
|
|
493
|
-
getById(id: string, params?: PagesGetByIdParams): Promise<
|
|
494
|
-
getTranslationsById(pageId: string): Promise<Record<string,
|
|
495
|
-
getTranslationsBySlug(slug: string): Promise<Record<string,
|
|
501
|
+
private readonly entries;
|
|
502
|
+
constructor(entries: EntriesModule);
|
|
503
|
+
list(params?: PagesListParams): Promise<PaginatedResponse<PageEntry>>;
|
|
504
|
+
getBySlug(slug: string, params?: PagesGetBySlugParams): Promise<PageEntry>;
|
|
505
|
+
getById(id: string, params?: PagesGetByIdParams): Promise<PageEntry>;
|
|
506
|
+
getTranslationsById(pageId: string): Promise<Record<string, PageEntry>>;
|
|
507
|
+
getTranslationsBySlug(slug: string): Promise<Record<string, PageEntry>>;
|
|
508
|
+
getComments(entryId: string, params?: PagesGetCommentsParams): Promise<PaginatedResponse<EntryComment>>;
|
|
496
509
|
}
|
|
497
510
|
|
|
498
511
|
declare class Kookee {
|
|
499
512
|
private readonly http;
|
|
513
|
+
readonly entries: EntriesModule;
|
|
500
514
|
readonly announcements: AnnouncementModule;
|
|
501
515
|
readonly blog: BlogModule;
|
|
502
516
|
readonly changelog: ChangelogModule;
|
|
@@ -508,4 +522,4 @@ declare class Kookee {
|
|
|
508
522
|
health(): Promise<HealthCheckResponse>;
|
|
509
523
|
}
|
|
510
524
|
|
|
511
|
-
export { type
|
|
525
|
+
export { type AnnouncementEntry, type AnnouncementGetByIdParams, type AnnouncementGetCommentsParams, type AnnouncementListParams, AnnouncementModule, type AnnouncementType, type AnnouncementTypeSpecific, type AnyEntry, type ApiError, type BaseEntry, type BlogEntry, type BlogGetByIdParams, type BlogGetBySlugParams, type BlogGetCommentsParams, type BlogListParams, BlogModule, type BlogTypeSpecific, type ChangelogEntry, type ChangelogGetByIdParams, type ChangelogGetBySlugParams, type ChangelogGetCommentsParams, type ChangelogListParams, ChangelogModule, type ChangelogType, type ChangelogTypeSpecific, type ConfigListParams, ConfigModule, type CreateFeedbackCommentParams, type CreateFeedbackPostParams, type CreatedFeedbackComment, type CreatedFeedbackPost, type DeleteFeedbackCommentParams, type DeleteFeedbackCommentResponse, type DeleteFeedbackPostParams, type DeleteFeedbackPostResponse, type EntriesGetByIdParams, type EntriesGetBySlugParams, type EntriesGetCategoriesParams, type EntriesGetCommentsParams, type EntriesListParams, EntriesModule, type EntryAuthor, type EntryCategory, type EntryComment, type EntryStatus, type EntryTag, type EntryTagWithCount, type EntryType, type ExternalUser, type FeedbackAssignee, type FeedbackAuthor, type FeedbackComment, type FeedbackListParams, FeedbackModule, type FeedbackPost, type FeedbackPostCategory, type FeedbackPostListItem, type FeedbackPostStatus, type FeedbackSortOption, type FeedbackTopContributor, type FeedbackTopContributorsParams, type FeedbackVoteParams, type FeedbackVoteResponse, type GenericEntry, type HealthCheckResponse, type HelpArticleEntry, type HelpArticleTypeSpecific, type HelpArticleVisibility, type HelpCategoriesParams, type HelpChatMessage, type HelpChatParams, type HelpChatResponse, type HelpChatSource, type HelpChatSourceCategory, type HelpChatStreamChunk, type HelpGetByIdParams, type HelpGetBySlugParams, type HelpGetCommentsParams, type HelpListParams, HelpModule, type HelpSearchParams, type HelpSearchResult, Kookee, KookeeApiError, type KookeeConfig, type ListMyFeedbackPostsParams, type LocaleOptions, type OrderDirection, type PageEntry, type PageTypeSpecific, type PagesGetByIdParams, type PagesGetBySlugParams, type PagesGetCommentsParams, type PagesListParams, PagesModule, type PaginatedResponse, type PaginationParams, type PublicConfig, type ReactParams, type ReactResponse, type ReactionType, type TypeSpecific, type TypedEntry, type VoteUsefulnessResponse };
|
package/dist/index.global.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(exports){'use strict';var k="https://api.kookee.dev",
|
|
2
|
-
`);
|
|
1
|
+
(function(exports){'use strict';var k="https://api.kookee.dev",x="Kookee-API-Key",I="Kookee-Project-Id",i=class r extends Error{constructor(t,s,o){super(s);this.code=t;this.status=o;this.name="KookeeApiError",Object.setPrototypeOf(this,r.prototype);}},C=class{baseUrl;apiKey;projectId;constructor(e){this.apiKey=e.apiKey,this.projectId=e.projectId,this.baseUrl=e.baseUrl??k;}getHeaders(){let e={"Content-Type":"application/json"};return this.apiKey&&(e[x]=this.apiKey),this.projectId&&(e[I]=this.projectId),e}async get(e,t){let s=new URL(`${this.baseUrl}${e}`);if(t){for(let[h,n]of Object.entries(t))if(n!=null)if(Array.isArray(n))for(let a of n)s.searchParams.append(h,String(a));else s.searchParams.set(h,String(n));}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 delete(e,t){let s=await fetch(`${this.baseUrl}${e}`,{method:"DELETE",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(s)}async*streamPost(e,t){let s=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:{...this.getHeaders(),Accept:"text/event-stream"},body:t?JSON.stringify(t):void 0});if(!s.ok){let a=null;try{a=await s.json();}catch{}throw new i(a?.code??"UNKNOWN_ERROR",a?.message??`Request failed with status ${s.status}`,s.status)}if(!s.body)return;let o=s.body.getReader(),h=new TextDecoder,n="";try{for(;;){let{done:a,value:b}=await o.read();if(a)break;n+=h.decode(b,{stream:!0});let f=n.split(`
|
|
2
|
+
`);n=f.pop()??"";for(let B of f){let u=B.trim();if(!(!u||u.startsWith(":"))&&u.startsWith("data: ")){let R=u.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 m=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"announcement",...e})}async getById(e,t){return this.entries.getById(e,t)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getComments(e,t){return this.entries.getComments(e,t)}};var p=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"blog",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"blog",...t})}async getById(e,t){return this.entries.getById(e,t)}async getTags(){return this.entries.getTags("blog")}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}async react(e,t){return this.entries.react(e,t)}};var c=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"changelog",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"changelog",...t})}async getById(e,t){return this.entries.getById(e,t)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}async react(e,t){return this.entries.react(e,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 l=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/entries",e)}async getById(e,t){return this.http.get(`/v1/entries/by-id/${encodeURIComponent(e)}`,t)}async getBySlug(e,t){return this.http.get(`/v1/entries/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/entries/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/entries/${encodeURIComponent(e)}/translations`)}async getComments(e,t){return this.http.get(`/v1/entries/${encodeURIComponent(e)}/comments`,t)}async react(e,t){return this.http.post(`/v1/entries/${encodeURIComponent(e)}/reactions`,t)}async getTags(e){return this.http.get("/v1/tags",{type:e})}async getCategories(e,t){return this.http.get("/v1/categories",{type:e,...t})}};var y=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/feedback",e)}async getById(e){return this.http.get(`/v1/feedback/by-id/${encodeURIComponent(e)}`)}async vote(e,t){return this.http.post(`/v1/feedback/${encodeURIComponent(e)}/vote`,t)}async getTopContributors(e){return this.http.get("/v1/feedback/top-contributors",e)}async createPost(e){return this.http.post("/v1/feedback",e)}async createComment(e,t){return this.http.post(`/v1/feedback/${encodeURIComponent(e)}/comments`,t)}async listMyPosts(e){return this.http.get("/v1/feedback/mine",e)}async deletePost(e,t){return this.http.delete(`/v1/feedback/${encodeURIComponent(e)}`,t)}async deleteComment(e,t){return this.http.delete(`/v1/feedback/comments/${encodeURIComponent(e)}`,t)}};var P=class{http;entries;constructor(e,t){this.http=e,this.entries=t;}async categories(e){return this.entries.getCategories("help_article",e)}async list(e){return this.entries.list({type:"help_article",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"help_article",...t})}async getById(e,t){return this.entries.getById(e,t)}async search(e){return this.http.get("/v1/help/search",e)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}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 d=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"page",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"page",...t})}async getById(e,t){return this.entries.getById(e,t)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}};var E=class{http;entries;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 C({apiKey:e.apiKey,projectId:e.projectId,baseUrl:e.baseUrl}),this.entries=new l(this.http),this.announcements=new m(this.entries),this.blog=new p(this.entries),this.changelog=new c(this.entries),this.config=new g(this.http),this.feedback=new y(this.http),this.help=new P(this.http,this.entries),this.pages=new d(this.entries);}async health(){return this.http.get("/v1/health")}};exports.AnnouncementModule=m;exports.BlogModule=p;exports.ChangelogModule=c;exports.ConfigModule=g;exports.EntriesModule=l;exports.FeedbackModule=y;exports.HelpModule=P;exports.Kookee=E;exports.KookeeApiError=i;exports.PagesModule=d;return exports;})({});
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var k="https://api.kookee.dev",
|
|
2
|
-
`);
|
|
1
|
+
var k="https://api.kookee.dev",x="Kookee-API-Key",I="Kookee-Project-Id",i=class r extends Error{constructor(t,s,o){super(s);this.code=t;this.status=o;this.name="KookeeApiError",Object.setPrototypeOf(this,r.prototype);}},C=class{baseUrl;apiKey;projectId;constructor(e){this.apiKey=e.apiKey,this.projectId=e.projectId,this.baseUrl=e.baseUrl??k;}getHeaders(){let e={"Content-Type":"application/json"};return this.apiKey&&(e[x]=this.apiKey),this.projectId&&(e[I]=this.projectId),e}async get(e,t){let s=new URL(`${this.baseUrl}${e}`);if(t){for(let[h,n]of Object.entries(t))if(n!=null)if(Array.isArray(n))for(let a of n)s.searchParams.append(h,String(a));else s.searchParams.set(h,String(n));}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 delete(e,t){let s=await fetch(`${this.baseUrl}${e}`,{method:"DELETE",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(s)}async*streamPost(e,t){let s=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:{...this.getHeaders(),Accept:"text/event-stream"},body:t?JSON.stringify(t):void 0});if(!s.ok){let a=null;try{a=await s.json();}catch{}throw new i(a?.code??"UNKNOWN_ERROR",a?.message??`Request failed with status ${s.status}`,s.status)}if(!s.body)return;let o=s.body.getReader(),h=new TextDecoder,n="";try{for(;;){let{done:a,value:b}=await o.read();if(a)break;n+=h.decode(b,{stream:!0});let f=n.split(`
|
|
2
|
+
`);n=f.pop()??"";for(let B of f){let u=B.trim();if(!(!u||u.startsWith(":"))&&u.startsWith("data: ")){let R=u.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 m=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"announcement",...e})}async getById(e,t){return this.entries.getById(e,t)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getComments(e,t){return this.entries.getComments(e,t)}};var p=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"blog",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"blog",...t})}async getById(e,t){return this.entries.getById(e,t)}async getTags(){return this.entries.getTags("blog")}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}async react(e,t){return this.entries.react(e,t)}};var c=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"changelog",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"changelog",...t})}async getById(e,t){return this.entries.getById(e,t)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}async react(e,t){return this.entries.react(e,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 l=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/entries",e)}async getById(e,t){return this.http.get(`/v1/entries/by-id/${encodeURIComponent(e)}`,t)}async getBySlug(e,t){return this.http.get(`/v1/entries/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/entries/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/entries/${encodeURIComponent(e)}/translations`)}async getComments(e,t){return this.http.get(`/v1/entries/${encodeURIComponent(e)}/comments`,t)}async react(e,t){return this.http.post(`/v1/entries/${encodeURIComponent(e)}/reactions`,t)}async getTags(e){return this.http.get("/v1/tags",{type:e})}async getCategories(e,t){return this.http.get("/v1/categories",{type:e,...t})}};var y=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/feedback",e)}async getById(e){return this.http.get(`/v1/feedback/by-id/${encodeURIComponent(e)}`)}async vote(e,t){return this.http.post(`/v1/feedback/${encodeURIComponent(e)}/vote`,t)}async getTopContributors(e){return this.http.get("/v1/feedback/top-contributors",e)}async createPost(e){return this.http.post("/v1/feedback",e)}async createComment(e,t){return this.http.post(`/v1/feedback/${encodeURIComponent(e)}/comments`,t)}async listMyPosts(e){return this.http.get("/v1/feedback/mine",e)}async deletePost(e,t){return this.http.delete(`/v1/feedback/${encodeURIComponent(e)}`,t)}async deleteComment(e,t){return this.http.delete(`/v1/feedback/comments/${encodeURIComponent(e)}`,t)}};var P=class{http;entries;constructor(e,t){this.http=e,this.entries=t;}async categories(e){return this.entries.getCategories("help_article",e)}async list(e){return this.entries.list({type:"help_article",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"help_article",...t})}async getById(e,t){return this.entries.getById(e,t)}async search(e){return this.http.get("/v1/help/search",e)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}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 d=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"page",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"page",...t})}async getById(e,t){return this.entries.getById(e,t)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}};var E=class{http;entries;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 C({apiKey:e.apiKey,projectId:e.projectId,baseUrl:e.baseUrl}),this.entries=new l(this.http),this.announcements=new m(this.entries),this.blog=new p(this.entries),this.changelog=new c(this.entries),this.config=new g(this.http),this.feedback=new y(this.http),this.help=new P(this.http,this.entries),this.pages=new d(this.entries);}async health(){return this.http.get("/v1/health")}};export{m as AnnouncementModule,p as BlogModule,c as ChangelogModule,g as ConfigModule,l as EntriesModule,y as FeedbackModule,P as HelpModule,E as Kookee,i as KookeeApiError,d as PagesModule};
|