@kookee/sdk 0.0.25 → 0.0.27
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 -3
- package/dist/index.d.cts +39 -1
- package/dist/index.d.ts +39 -1
- package/dist/index.global.js +2 -0
- package/dist/index.js +2 -3
- package/package.json +1 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
'use strict';var B="https://api.kookee.dev",
|
|
2
|
-
`);
|
|
3
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
'use strict';var B="https://api.kookee.dev",k="Kookee-API-Key",H="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);}},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[k]=this.apiKey),this.projectId&&(e[H]=this.projectId),e}async get(e,t){let s=new URL(`${this.baseUrl}${e}`);if(t){for(let[y,n]of Object.entries(t))if(n!=null)if(Array.isArray(n))for(let a of n)s.searchParams.append(y,String(a));else s.searchParams.set(y,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*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,n="";try{for(;;){let{done:a,value:b}=await o.read();if(a)break;n+=y.decode(b,{stream:!0});let f=n.split(`
|
|
2
|
+
`);n=f.pop()??"";for(let I of f){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)}async createPost(e){return this.http.post("/v1/feedback",e)}async createComment(e,t){return this.http.post(`/v1/feedback/${encodeURIComponent(e)}/comments`,t)}};var d=class{constructor(e){this.http=e;}async categories(e){return this.http.get("/v1/help/categories",e)}async list(e){return this.http.get("/v1/help/articles",e)}async getBySlug(e,t){return this.http.get(`/v1/help/articles/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/help/articles/by-id/${encodeURIComponent(e)}`,t)}async search(e){return this.http.get("/v1/help/search",e)}async getTranslationsById(e){return this.http.get(`/v1/help/articles/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/help/articles/${encodeURIComponent(e)}/translations`)}async chat(e){return this.http.post("/v1/help/chat",e)}chatStream(e){return this.http.streamPost("/v1/help/chat/stream",e)}async voteUsefulness(e,t,s){return this.http.post(`/v1/help/articles/by-id/${encodeURIComponent(e)}/vote-usefulness`,{vote:t,previousVote:s})}};var h=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/pages",e)}async getBySlug(e,t){return this.http.get(`/v1/pages/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/pages/by-id/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/pages/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/pages/${encodeURIComponent(e)}/translations`)}};var C=class{http;announcements;blog;changelog;config;feedback;help;pages;constructor(e){if(!e.apiKey&&!e.projectId)throw new Error("Either apiKey or projectId is required");this.http=new u({apiKey:e.apiKey,projectId:e.projectId,baseUrl:e.baseUrl}),this.announcements=new p(this.http),this.blog=new c(this.http),this.changelog=new l(this.http),this.config=new g(this.http),this.feedback=new m(this.http),this.help=new d(this.http),this.pages=new h(this.http);}async health(){return this.http.get("/v1/health")}};exports.AnnouncementModule=p;exports.BlogModule=c;exports.ChangelogModule=l;exports.ConfigModule=g;exports.FeedbackModule=m;exports.HelpModule=d;exports.Kookee=C;exports.KookeeApiError=i;exports.PagesModule=h;
|
package/dist/index.d.cts
CHANGED
|
@@ -296,6 +296,42 @@ interface FeedbackTopContributor {
|
|
|
296
296
|
interface FeedbackVoteResponse {
|
|
297
297
|
voteCount: number;
|
|
298
298
|
}
|
|
299
|
+
interface ExternalUser {
|
|
300
|
+
externalId: string;
|
|
301
|
+
name: string;
|
|
302
|
+
email?: string;
|
|
303
|
+
avatarUrl?: string;
|
|
304
|
+
}
|
|
305
|
+
interface CreateFeedbackPostParams {
|
|
306
|
+
title: string;
|
|
307
|
+
description?: string;
|
|
308
|
+
category?: FeedbackPostCategory;
|
|
309
|
+
externalUser: ExternalUser;
|
|
310
|
+
}
|
|
311
|
+
interface CreateFeedbackCommentParams {
|
|
312
|
+
content: string;
|
|
313
|
+
externalUser: ExternalUser;
|
|
314
|
+
}
|
|
315
|
+
interface CreatedFeedbackPost {
|
|
316
|
+
id: string;
|
|
317
|
+
title: string;
|
|
318
|
+
contentHtml: string | null;
|
|
319
|
+
contentText: string | null;
|
|
320
|
+
status: FeedbackPostStatus;
|
|
321
|
+
category: FeedbackPostCategory;
|
|
322
|
+
voteCount: number;
|
|
323
|
+
commentCount: number;
|
|
324
|
+
createdAt: string;
|
|
325
|
+
updatedAt: string;
|
|
326
|
+
}
|
|
327
|
+
interface CreatedFeedbackComment {
|
|
328
|
+
id: string;
|
|
329
|
+
postId: string;
|
|
330
|
+
content: string;
|
|
331
|
+
isOfficial: boolean;
|
|
332
|
+
createdAt: string;
|
|
333
|
+
updatedAt: string;
|
|
334
|
+
}
|
|
299
335
|
|
|
300
336
|
interface AnnouncementListParams extends PaginationParams, LocaleOptions {
|
|
301
337
|
type?: AnnouncementType;
|
|
@@ -383,6 +419,8 @@ declare class FeedbackModule {
|
|
|
383
419
|
getById(id: string): Promise<FeedbackPost>;
|
|
384
420
|
vote(postId: string, params: FeedbackVoteParams): Promise<FeedbackVoteResponse>;
|
|
385
421
|
getTopContributors(params?: FeedbackTopContributorsParams): Promise<FeedbackTopContributor[]>;
|
|
422
|
+
createPost(params: CreateFeedbackPostParams): Promise<CreatedFeedbackPost>;
|
|
423
|
+
createComment(postId: string, params: CreateFeedbackCommentParams): Promise<CreatedFeedbackComment>;
|
|
386
424
|
}
|
|
387
425
|
|
|
388
426
|
interface HelpCategoriesParams extends LocaleOptions {
|
|
@@ -444,4 +482,4 @@ declare class Kookee {
|
|
|
444
482
|
health(): Promise<HealthCheckResponse>;
|
|
445
483
|
}
|
|
446
484
|
|
|
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 };
|
|
485
|
+
export { type Announcement, type AnnouncementAuthor, type AnnouncementGetByIdParams, type AnnouncementListItem, type AnnouncementListParams, AnnouncementModule, type AnnouncementOrderBy, type AnnouncementType, type ApiError, type BlogGetByIdParams, type BlogGetBySlugParams, type BlogListParams, BlogModule, type BlogPost, type BlogPostAuthor, type BlogPostListItem, type BlogPostStatus, type BlogTag, type BlogTagWithCount, type ChangelogAuthor, type ChangelogEntry, type ChangelogEntryListItem, type ChangelogGetByIdParams, type ChangelogGetBySlugParams, type ChangelogListParams, ChangelogModule, type ChangelogOrderBy, type ChangelogType, type ConfigListParams, ConfigModule, type CreateFeedbackCommentParams, type CreateFeedbackPostParams, type CreatedFeedbackComment, type CreatedFeedbackPost, type ExternalUser, type FeedbackAssignee, type FeedbackAuthor, type FeedbackComment, type FeedbackListParams, FeedbackModule, type FeedbackPost, type FeedbackPostCategory, type FeedbackPostListItem, type FeedbackPostStatus, type FeedbackSortOption, type FeedbackTopContributor, type FeedbackTopContributorsParams, type FeedbackVoteParams, type FeedbackVoteResponse, type HealthCheckResponse, type HelpArticle, type HelpArticleAuthor, type HelpArticleListItem, type HelpArticleVisibility, type HelpCategoriesParams, type HelpCategory, type HelpChatMessage, type HelpChatParams, type HelpChatResponse, type HelpChatSource, type HelpChatSourceCategory, type HelpChatStreamChunk, type HelpGetByIdParams, type HelpGetBySlugParams, type HelpListParams, HelpModule, type HelpSearchParams, type HelpSearchResult, Kookee, KookeeApiError, type KookeeConfig, type 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
|
@@ -296,6 +296,42 @@ interface FeedbackTopContributor {
|
|
|
296
296
|
interface FeedbackVoteResponse {
|
|
297
297
|
voteCount: number;
|
|
298
298
|
}
|
|
299
|
+
interface ExternalUser {
|
|
300
|
+
externalId: string;
|
|
301
|
+
name: string;
|
|
302
|
+
email?: string;
|
|
303
|
+
avatarUrl?: string;
|
|
304
|
+
}
|
|
305
|
+
interface CreateFeedbackPostParams {
|
|
306
|
+
title: string;
|
|
307
|
+
description?: string;
|
|
308
|
+
category?: FeedbackPostCategory;
|
|
309
|
+
externalUser: ExternalUser;
|
|
310
|
+
}
|
|
311
|
+
interface CreateFeedbackCommentParams {
|
|
312
|
+
content: string;
|
|
313
|
+
externalUser: ExternalUser;
|
|
314
|
+
}
|
|
315
|
+
interface CreatedFeedbackPost {
|
|
316
|
+
id: string;
|
|
317
|
+
title: string;
|
|
318
|
+
contentHtml: string | null;
|
|
319
|
+
contentText: string | null;
|
|
320
|
+
status: FeedbackPostStatus;
|
|
321
|
+
category: FeedbackPostCategory;
|
|
322
|
+
voteCount: number;
|
|
323
|
+
commentCount: number;
|
|
324
|
+
createdAt: string;
|
|
325
|
+
updatedAt: string;
|
|
326
|
+
}
|
|
327
|
+
interface CreatedFeedbackComment {
|
|
328
|
+
id: string;
|
|
329
|
+
postId: string;
|
|
330
|
+
content: string;
|
|
331
|
+
isOfficial: boolean;
|
|
332
|
+
createdAt: string;
|
|
333
|
+
updatedAt: string;
|
|
334
|
+
}
|
|
299
335
|
|
|
300
336
|
interface AnnouncementListParams extends PaginationParams, LocaleOptions {
|
|
301
337
|
type?: AnnouncementType;
|
|
@@ -383,6 +419,8 @@ declare class FeedbackModule {
|
|
|
383
419
|
getById(id: string): Promise<FeedbackPost>;
|
|
384
420
|
vote(postId: string, params: FeedbackVoteParams): Promise<FeedbackVoteResponse>;
|
|
385
421
|
getTopContributors(params?: FeedbackTopContributorsParams): Promise<FeedbackTopContributor[]>;
|
|
422
|
+
createPost(params: CreateFeedbackPostParams): Promise<CreatedFeedbackPost>;
|
|
423
|
+
createComment(postId: string, params: CreateFeedbackCommentParams): Promise<CreatedFeedbackComment>;
|
|
386
424
|
}
|
|
387
425
|
|
|
388
426
|
interface HelpCategoriesParams extends LocaleOptions {
|
|
@@ -444,4 +482,4 @@ declare class Kookee {
|
|
|
444
482
|
health(): Promise<HealthCheckResponse>;
|
|
445
483
|
}
|
|
446
484
|
|
|
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 };
|
|
485
|
+
export { type Announcement, type AnnouncementAuthor, type AnnouncementGetByIdParams, type AnnouncementListItem, type AnnouncementListParams, AnnouncementModule, type AnnouncementOrderBy, type AnnouncementType, type ApiError, type BlogGetByIdParams, type BlogGetBySlugParams, type BlogListParams, BlogModule, type BlogPost, type BlogPostAuthor, type BlogPostListItem, type BlogPostStatus, type BlogTag, type BlogTagWithCount, type ChangelogAuthor, type ChangelogEntry, type ChangelogEntryListItem, type ChangelogGetByIdParams, type ChangelogGetBySlugParams, type ChangelogListParams, ChangelogModule, type ChangelogOrderBy, type ChangelogType, type ConfigListParams, ConfigModule, type CreateFeedbackCommentParams, type CreateFeedbackPostParams, type CreatedFeedbackComment, type CreatedFeedbackPost, type ExternalUser, type FeedbackAssignee, type FeedbackAuthor, type FeedbackComment, type FeedbackListParams, FeedbackModule, type FeedbackPost, type FeedbackPostCategory, type FeedbackPostListItem, type FeedbackPostStatus, type FeedbackSortOption, type FeedbackTopContributor, type FeedbackTopContributorsParams, type FeedbackVoteParams, type FeedbackVoteResponse, type HealthCheckResponse, type HelpArticle, type HelpArticleAuthor, type HelpArticleListItem, type HelpArticleVisibility, type HelpCategoriesParams, type HelpCategory, type HelpChatMessage, type HelpChatParams, type HelpChatResponse, type HelpChatSource, type HelpChatSourceCategory, type HelpChatStreamChunk, type HelpGetByIdParams, type HelpGetBySlugParams, type HelpListParams, HelpModule, type HelpSearchParams, type HelpSearchResult, Kookee, KookeeApiError, type KookeeConfig, type 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 };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(function(exports){'use strict';var B="https://api.kookee.dev",k="Kookee-API-Key",H="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);}},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[k]=this.apiKey),this.projectId&&(e[H]=this.projectId),e}async get(e,t){let s=new URL(`${this.baseUrl}${e}`);if(t){for(let[y,n]of Object.entries(t))if(n!=null)if(Array.isArray(n))for(let a of n)s.searchParams.append(y,String(a));else s.searchParams.set(y,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*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,n="";try{for(;;){let{done:a,value:b}=await o.read();if(a)break;n+=y.decode(b,{stream:!0});let f=n.split(`
|
|
2
|
+
`);n=f.pop()??"";for(let I of f){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)}async createPost(e){return this.http.post("/v1/feedback",e)}async createComment(e,t){return this.http.post(`/v1/feedback/${encodeURIComponent(e)}/comments`,t)}};var d=class{constructor(e){this.http=e;}async categories(e){return this.http.get("/v1/help/categories",e)}async list(e){return this.http.get("/v1/help/articles",e)}async getBySlug(e,t){return this.http.get(`/v1/help/articles/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/help/articles/by-id/${encodeURIComponent(e)}`,t)}async search(e){return this.http.get("/v1/help/search",e)}async getTranslationsById(e){return this.http.get(`/v1/help/articles/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/help/articles/${encodeURIComponent(e)}/translations`)}async chat(e){return this.http.post("/v1/help/chat",e)}chatStream(e){return this.http.streamPost("/v1/help/chat/stream",e)}async voteUsefulness(e,t,s){return this.http.post(`/v1/help/articles/by-id/${encodeURIComponent(e)}/vote-usefulness`,{vote:t,previousVote:s})}};var h=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/pages",e)}async getBySlug(e,t){return this.http.get(`/v1/pages/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/pages/by-id/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/pages/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/pages/${encodeURIComponent(e)}/translations`)}};var C=class{http;announcements;blog;changelog;config;feedback;help;pages;constructor(e){if(!e.apiKey&&!e.projectId)throw new Error("Either apiKey or projectId is required");this.http=new u({apiKey:e.apiKey,projectId:e.projectId,baseUrl:e.baseUrl}),this.announcements=new p(this.http),this.blog=new c(this.http),this.changelog=new l(this.http),this.config=new g(this.http),this.feedback=new m(this.http),this.help=new d(this.http),this.pages=new h(this.http);}async health(){return this.http.get("/v1/health")}};exports.AnnouncementModule=p;exports.BlogModule=c;exports.ChangelogModule=l;exports.ConfigModule=g;exports.FeedbackModule=m;exports.HelpModule=d;exports.Kookee=C;exports.KookeeApiError=i;exports.PagesModule=h;return exports;})({});
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
var B="https://api.kookee.dev",
|
|
2
|
-
`);
|
|
3
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
var B="https://api.kookee.dev",k="Kookee-API-Key",H="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);}},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[k]=this.apiKey),this.projectId&&(e[H]=this.projectId),e}async get(e,t){let s=new URL(`${this.baseUrl}${e}`);if(t){for(let[y,n]of Object.entries(t))if(n!=null)if(Array.isArray(n))for(let a of n)s.searchParams.append(y,String(a));else s.searchParams.set(y,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*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,n="";try{for(;;){let{done:a,value:b}=await o.read();if(a)break;n+=y.decode(b,{stream:!0});let f=n.split(`
|
|
2
|
+
`);n=f.pop()??"";for(let I of f){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)}async createPost(e){return this.http.post("/v1/feedback",e)}async createComment(e,t){return this.http.post(`/v1/feedback/${encodeURIComponent(e)}/comments`,t)}};var d=class{constructor(e){this.http=e;}async categories(e){return this.http.get("/v1/help/categories",e)}async list(e){return this.http.get("/v1/help/articles",e)}async getBySlug(e,t){return this.http.get(`/v1/help/articles/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/help/articles/by-id/${encodeURIComponent(e)}`,t)}async search(e){return this.http.get("/v1/help/search",e)}async getTranslationsById(e){return this.http.get(`/v1/help/articles/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/help/articles/${encodeURIComponent(e)}/translations`)}async chat(e){return this.http.post("/v1/help/chat",e)}chatStream(e){return this.http.streamPost("/v1/help/chat/stream",e)}async voteUsefulness(e,t,s){return this.http.post(`/v1/help/articles/by-id/${encodeURIComponent(e)}/vote-usefulness`,{vote:t,previousVote:s})}};var h=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/pages",e)}async getBySlug(e,t){return this.http.get(`/v1/pages/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/pages/by-id/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/pages/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/pages/${encodeURIComponent(e)}/translations`)}};var C=class{http;announcements;blog;changelog;config;feedback;help;pages;constructor(e){if(!e.apiKey&&!e.projectId)throw new Error("Either apiKey or projectId is required");this.http=new u({apiKey:e.apiKey,projectId:e.projectId,baseUrl:e.baseUrl}),this.announcements=new p(this.http),this.blog=new c(this.http),this.changelog=new l(this.http),this.config=new g(this.http),this.feedback=new m(this.http),this.help=new d(this.http),this.pages=new h(this.http);}async health(){return this.http.get("/v1/health")}};export{p as AnnouncementModule,c as BlogModule,l as ChangelogModule,g as ConfigModule,m as FeedbackModule,d as HelpModule,C as Kookee,i as KookeeApiError,h as PagesModule};
|
package/package.json
CHANGED
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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,CAAUA,EAAQ,OAAA,EAAWT,EACpC,CAEQ,UAAA,EAAqC,CAC3C,IAAMU,CAAAA,CAAkC,CACtC,cAAA,CAAgB,kBAClB,CAAA,CACA,OAAI,IAAA,C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AA,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.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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,CAAUA,EAAQ,OAAA,EAAWT,EACpC,CAEQ,UAAA,EAAqC,CAC3C,IAAMU,CAAAA,CAAkC,CACtC,cAAA,CAAgB,kBAClB,CAAA,CACA,OAAI,IAAA,CAAK,MAAA,GACPA,EAAQT,CAAc,CAAA,CAAI,IAAA,CAAK,MAAA,CAAA,CAE7B,KAAK,SAAA,GACPS,CAAAA,CAAQR,CAAiB,CAAA,CAAI,IAAA,CAAK,SAAA,CAAA,CAE7BQ,CACT,CAEA,MAAM,GAAA,CAAOC,CAAAA,CAAcC,CAAAA,CAA6B,CACtD,IAAMC,CAAAA,CAAM,IAAI,GAAA,CAAI,CAAA,EA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,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"]}
|