@kookee/sdk 0.0.19 → 0.0.21

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 CHANGED
@@ -1,3 +1,3 @@
1
- 'use strict';var u="https://api.kookee.dev",f="Kookee-API-Key",m=class extends Error{constructor(t,n,c){super(n);this.code=t;this.status=c;this.name="KookeeApiError";}},y=class{baseUrl;apiKey;constructor(e,t){this.apiKey=e,this.baseUrl=t??u;}getHeaders(){return {"Content-Type":"application/json",[f]:this.apiKey}}async get(e,t){let n=new URL(`${this.baseUrl}${e}`);if(t){for(let[d,r]of Object.entries(t))if(r!=null)if(Array.isArray(r))for(let P of r)n.searchParams.append(d,String(P));else n.searchParams.set(d,String(r));}let c=await fetch(n.toString(),{method:"GET",headers:this.getHeaders()});return this.handleResponse(c)}async post(e,t){let n=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(n)}async handleResponse(e){if(!e.ok){let t=null;try{t=await e.json();}catch{}throw new m(t?.code??"UNKNOWN_ERROR",t?.message??`Request failed with status ${e.status}`,e.status)}return e.json()}};var o=class{constructor(e){this.http=e;}async list(e){let{excludeIds:t,...n}=e??{},c=t?.length?{...n,excludeIds:t.join(",")}:n;return this.http.get("/v1/announcements",c)}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 a=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`)}};var i=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`)}};var p=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 g=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 voteUsefulness(e,t,n){return this.http.post(`/v1/help/articles/by-id/${encodeURIComponent(e)}/vote-usefulness`,{vote:t,previousVote:n})}};var l=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 h=class{http;announcements;blog;changelog;config;help;pages;constructor(e){if(!e.apiKey)throw new Error("apiKey is required");this.http=new y(e.apiKey,e.baseUrl),this.announcements=new o(this.http),this.blog=new a(this.http),this.changelog=new i(this.http),this.config=new p(this.http),this.help=new g(this.http),this.pages=new l(this.http);}async health(){return this.http.get("/v1/health")}};
2
- exports.AnnouncementModule=o;exports.BlogModule=a;exports.ChangelogModule=i;exports.ConfigModule=p;exports.HelpModule=g;exports.Kookee=h;exports.KookeeApiError=m;exports.PagesModule=l;//# sourceMappingURL=index.cjs.map
1
+ 'use strict';var u="https://api.kookee.dev",R="Kookee-API-Key",m=class extends Error{constructor(t,n,c){super(n);this.code=t;this.status=c;this.name="KookeeApiError";}},h=class{baseUrl;apiKey;constructor(e,t){this.apiKey=e,this.baseUrl=t??u;}getHeaders(){return {"Content-Type":"application/json",[R]:this.apiKey}}async get(e,t){let n=new URL(`${this.baseUrl}${e}`);if(t){for(let[d,r]of Object.entries(t))if(r!=null)if(Array.isArray(r))for(let P of r)n.searchParams.append(d,String(P));else n.searchParams.set(d,String(r));}let c=await fetch(n.toString(),{method:"GET",headers:this.getHeaders()});return this.handleResponse(c)}async post(e,t){let n=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(n)}async handleResponse(e){if(!e.ok){let t=null;try{t=await e.json();}catch{}throw new m(t?.code??"UNKNOWN_ERROR",t?.message??`Request failed with status ${e.status}`,e.status)}return e.json()}};var o=class{constructor(e){this.http=e;}async list(e){let{excludeIds:t,...n}=e??{},c=t?.length?{...n,excludeIds:t.join(",")}:n;return this.http.get("/v1/announcements",c)}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 a=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 i=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 p=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 g=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 voteUsefulness(e,t,n){return this.http.post(`/v1/help/articles/by-id/${encodeURIComponent(e)}/vote-usefulness`,{vote:t,previousVote:n})}};var l=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 y=class{http;announcements;blog;changelog;config;help;pages;constructor(e){if(!e.apiKey)throw new Error("apiKey is required");this.http=new h(e.apiKey,e.baseUrl),this.announcements=new o(this.http),this.blog=new a(this.http),this.changelog=new i(this.http),this.config=new p(this.http),this.help=new g(this.http),this.pages=new l(this.http);}async health(){return this.http.get("/v1/health")}};
2
+ exports.AnnouncementModule=o;exports.BlogModule=a;exports.ChangelogModule=i;exports.ConfigModule=p;exports.HelpModule=g;exports.Kookee=y;exports.KookeeApiError=m;exports.PagesModule=l;//# sourceMappingURL=index.cjs.map
3
3
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/lib/http-client.ts","../src/lib/modules/announcement.ts","../src/lib/modules/blog.ts","../src/lib/modules/changelog.ts","../src/lib/modules/config.ts","../src/lib/modules/help.ts","../src/lib/modules/pages.ts","../src/lib/client.ts"],"names":["DEFAULT_BASE_URL","API_KEY_HEADER","KookeeApiError","code","message","status","HttpClient","apiKey","baseUrl","path","params","url","key","value","item","response","body","errorData","AnnouncementModule","http","excludeIds","rest","queryParams","id","BlogModule","slug","postId","ChangelogModule","ConfigModule","HelpModule","articleId","vote","previousVote","PagesModule","pageId","Kookee","config"],"mappings":"aAEA,IAAMA,CAAAA,CAAmB,yBACnBC,CAAAA,CAAiB,gBAAA,CAEVC,EAAN,cAA6B,KAAM,CACxC,WAAA,CACkBC,CAAAA,CAChBC,EACgBC,CAAAA,CAChB,CACA,MAAMD,CAAO,CAAA,CAJG,UAAAD,CAAAA,CAEA,IAAA,CAAA,MAAA,CAAAE,CAAAA,CAGhB,IAAA,CAAK,IAAA,CAAO,iBACd,CACF,CAAA,CAEaC,CAAAA,CAAN,KAAiB,CACL,OAAA,CACA,OAEjB,WAAA,CAAYC,CAAAA,CAAgBC,CAAAA,CAAkB,CAC5C,IAAA,CAAK,MAAA,CAASD,EACd,IAAA,CAAK,OAAA,CA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ACxD,CACF","file":"index.cjs","sourcesContent":["import type { ApiError } from './types';\n\nconst DEFAULT_BASE_URL = 'https://api.kookee.dev';\nconst API_KEY_HEADER = 'Kookee-API-Key';\n\nexport class KookeeApiError extends Error {\n constructor(\n public readonly code: string,\n message: string,\n public readonly status: number\n ) {\n super(message);\n this.name = 'KookeeApiError';\n }\n}\n\nexport class HttpClient {\n private readonly baseUrl: string;\n private readonly apiKey: string;\n\n constructor(apiKey: string, baseUrl?: string) {\n this.apiKey = apiKey;\n this.baseUrl = baseUrl ?? DEFAULT_BASE_URL;\n }\n\n private getHeaders(): Record<string, string> {\n return {\n 'Content-Type': 'application/json',\n [API_KEY_HEADER]: this.apiKey,\n };\n }\n\n async get<T>(path: string, params?: object): Promise<T> {\n const url = new URL(`${this.baseUrl}${path}`);\n\n if (params) {\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined && value !== null) {\n if (Array.isArray(value)) {\n for (const item of value) {\n url.searchParams.append(key, String(item));\n }\n } else {\n url.searchParams.set(key, String(value));\n }\n }\n }\n }\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: this.getHeaders(),\n });\n\n return this.handleResponse<T>(response);\n }\n\n async post<T>(path: string, body?: unknown): Promise<T> {\n const response = await fetch(`${this.baseUrl}${path}`, {\n method: 'POST',\n headers: this.getHeaders(),\n body: body ? JSON.stringify(body) : undefined,\n });\n\n return this.handleResponse<T>(response);\n }\n\n private async handleResponse<T>(response: Response): Promise<T> {\n if (!response.ok) {\n let errorData: ApiError | null = null;\n\n try {\n errorData = (await response.json()) as ApiError;\n } catch {\n // Response body is not JSON\n }\n\n throw new KookeeApiError(\n errorData?.code ?? 'UNKNOWN_ERROR',\n errorData?.message ?? `Request failed with status ${response.status}`,\n response.status\n );\n }\n\n return response.json() as Promise<T>;\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n Announcement,\n AnnouncementListItem,\n AnnouncementOrderBy,\n AnnouncementType,\n LocaleOptions,\n OrderDirection,\n PaginatedResponse,\n PaginationParams,\n} from '../types';\n\nexport interface AnnouncementListParams extends PaginationParams, LocaleOptions {\n type?: AnnouncementType;\n excludeIds?: string[];\n orderBy?: AnnouncementOrderBy;\n order?: OrderDirection;\n}\n\nexport interface AnnouncementGetByIdParams extends LocaleOptions {}\n\nexport class AnnouncementModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: AnnouncementListParams): Promise<PaginatedResponse<AnnouncementListItem>> {\n const { excludeIds, ...rest } = params ?? {};\n const queryParams = excludeIds?.length ? { ...rest, excludeIds: excludeIds.join(',') } : rest;\n return this.http.get<PaginatedResponse<AnnouncementListItem>>('/v1/announcements', queryParams);\n }\n\n async getById(id: string, params?: AnnouncementGetByIdParams): Promise<Announcement> {\n return this.http.get<Announcement>(`/v1/announcements/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(id: string): Promise<Record<string, Announcement>> {\n return this.http.get<Record<string, Announcement>>(\n `/v1/announcements/${encodeURIComponent(id)}/translations`\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n BlogPost,\n BlogPostListItem,\n BlogTagWithCount,\n LocaleOptions,\n PaginatedResponse,\n PaginationParams,\n} 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","import type { HttpClient } from '../http-client';\nimport type {\n ChangelogEntry,\n ChangelogEntryListItem,\n ChangelogOrderBy,\n LocaleOptions,\n OrderDirection,\n PaginatedResponse,\n PaginationParams,\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","import type { HttpClient } from '../http-client';\nimport type { PublicConfig } from '../types';\n\nexport interface ConfigListParams {\n keys?: string[];\n}\n\nexport class ConfigModule {\n constructor(private readonly http: HttpClient) {}\n\n async getByKey(key: string): Promise<PublicConfig> {\n return this.http.get<PublicConfig>(`/v1/config/${encodeURIComponent(key)}`);\n }\n\n async list(params?: ConfigListParams): Promise<PublicConfig[]> {\n return this.http.get<PublicConfig[]>('/v1/config', params);\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n HelpArticle,\n HelpArticleListItem,\n HelpCategory,\n 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 voteUsefulness(\n articleId: string,\n vote: 'yes' | 'no' | null,\n previousVote?: 'yes' | 'no' | null,\n ): Promise<VoteUsefulnessResponse> {\n return this.http.post<VoteUsefulnessResponse>(\n `/v1/help/articles/by-id/${encodeURIComponent(articleId)}/vote-usefulness`,\n { vote, previousVote }\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type { LocaleOptions, Page, PageListItem, PaginatedResponse, PaginationParams } from '../types';\n\nexport interface PagesListParams extends PaginationParams, LocaleOptions {\n search?: string;\n}\n\nexport interface PagesGetBySlugParams extends LocaleOptions {}\n\nexport interface PagesGetByIdParams extends LocaleOptions {}\n\nexport class PagesModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: PagesListParams): Promise<PaginatedResponse<PageListItem>> {\n return this.http.get<PaginatedResponse<PageListItem>>('/v1/pages', params);\n }\n\n async getBySlug(slug: string, params?: PagesGetBySlugParams): Promise<Page> {\n return this.http.get<Page>(`/v1/pages/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: PagesGetByIdParams): Promise<Page> {\n return this.http.get<Page>(`/v1/pages/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(pageId: string): Promise<Record<string, Page>> {\n return this.http.get<Record<string, Page>>(\n `/v1/pages/by-id/${encodeURIComponent(pageId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, Page>> {\n return this.http.get<Record<string, Page>>(\n `/v1/pages/${encodeURIComponent(slug)}/translations`\n );\n }\n}\n","import { HttpClient } from './http-client';\nimport { AnnouncementModule } from './modules/announcement';\nimport { BlogModule } from './modules/blog';\nimport { ChangelogModule } from './modules/changelog';\nimport { ConfigModule } from './modules/config';\nimport { HelpModule } from './modules/help';\nimport { PagesModule } from './modules/pages';\nimport type { KookeeConfig, HealthCheckResponse } from './types';\n\nexport class Kookee {\n private readonly http: HttpClient;\n\n public readonly announcements: AnnouncementModule;\n public readonly blog: BlogModule;\n public readonly changelog: ChangelogModule;\n public readonly config: ConfigModule;\n public readonly help: HelpModule;\n public readonly pages: PagesModule;\n\n constructor(config: KookeeConfig) {\n if (!config.apiKey) {\n throw new Error('apiKey is required');\n }\n\n this.http = new HttpClient(config.apiKey, config.baseUrl);\n\n this.announcements = new AnnouncementModule(this.http);\n this.blog = new BlogModule(this.http);\n this.changelog = new ChangelogModule(this.http);\n this.config = new ConfigModule(this.http);\n this.help = new HelpModule(this.http);\n this.pages = new PagesModule(this.http);\n }\n\n async health(): Promise<HealthCheckResponse> {\n return this.http.get<HealthCheckResponse>('/v1/health');\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/lib/http-client.ts","../src/lib/modules/announcement.ts","../src/lib/modules/blog.ts","../src/lib/modules/changelog.ts","../src/lib/modules/config.ts","../src/lib/modules/help.ts","../src/lib/modules/pages.ts","../src/lib/client.ts"],"names":["DEFAULT_BASE_URL","API_KEY_HEADER","KookeeApiError","code","message","status","HttpClient","apiKey","baseUrl","path","params","url","key","value","item","response","body","errorData","AnnouncementModule","http","excludeIds","rest","queryParams","id","BlogModule","slug","postId","ChangelogModule","changelogId","ConfigModule","HelpModule","articleId","vote","previousVote","PagesModule","pageId","Kookee","config"],"mappings":"aAEA,IAAMA,CAAAA,CAAmB,yBACnBC,CAAAA,CAAiB,gBAAA,CAEVC,EAAN,cAA6B,KAAM,CACxC,WAAA,CACkBC,CAAAA,CAChBC,CAAAA,CACgBC,EAChB,CACA,KAAA,CAAMD,CAAO,CAAA,CAJG,IAAA,CAAA,IAAA,CAAAD,EAEA,IAAA,CAAA,MAAA,CAAAE,CAAAA,CAGhB,IAAA,CAAK,IAAA,CAAO,iBACd,CACF,EAEaC,CAAAA,CAAN,KAAiB,CACL,OAAA,CACA,M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A,CAAW+B,CAAAA,CAAO,MAAA,CAAQA,CAAAA,CAAO,OAAO,CAAA,CAExD,KAAK,aAAA,CAAgB,IAAInB,EAAmB,IAAA,CAAK,IAAI,EACrD,IAAA,CAAK,IAAA,CAAO,IAAIM,CAAAA,CAAW,IAAA,CAAK,IAAI,EACpC,IAAA,CAAK,SAAA,CAAY,IAAIG,CAAAA,CAAgB,IAAA,CAAK,IAAI,EAC9C,IAAA,CAAK,MAAA,CAAS,IAAIE,CAAAA,CAAa,IAAA,CAAK,IAAI,EACxC,IAAA,CAAK,IAAA,CAAO,IAAIC,CAAAA,CAAW,IAAA,CAAK,IAAI,CAAA,CACpC,IAAA,CAAK,KAAA,CAAQ,IAAII,CAAAA,CAAY,IAAA,CAAK,IAAI,EACxC,CAEA,MAAM,MAAA,EAAuC,CAC3C,OAAO,KAAK,IAAA,CAAK,GAAA,CAAyB,YAAY,CACxD,CACF","file":"index.cjs","sourcesContent":["import type { ApiError } from './types';\n\nconst DEFAULT_BASE_URL = 'https://api.kookee.dev';\nconst API_KEY_HEADER = 'Kookee-API-Key';\n\nexport class KookeeApiError extends Error {\n constructor(\n public readonly code: string,\n message: string,\n public readonly status: number\n ) {\n super(message);\n this.name = 'KookeeApiError';\n }\n}\n\nexport class HttpClient {\n private readonly baseUrl: string;\n private readonly apiKey: string;\n\n constructor(apiKey: string, baseUrl?: string) {\n this.apiKey = apiKey;\n this.baseUrl = baseUrl ?? DEFAULT_BASE_URL;\n }\n\n private getHeaders(): Record<string, string> {\n return {\n 'Content-Type': 'application/json',\n [API_KEY_HEADER]: this.apiKey,\n };\n }\n\n async get<T>(path: string, params?: object): Promise<T> {\n const url = new URL(`${this.baseUrl}${path}`);\n\n if (params) {\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined && value !== null) {\n if (Array.isArray(value)) {\n for (const item of value) {\n url.searchParams.append(key, String(item));\n }\n } else {\n url.searchParams.set(key, String(value));\n }\n }\n }\n }\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: this.getHeaders(),\n });\n\n return this.handleResponse<T>(response);\n }\n\n async post<T>(path: string, body?: unknown): Promise<T> {\n const response = await fetch(`${this.baseUrl}${path}`, {\n method: 'POST',\n headers: this.getHeaders(),\n body: body ? JSON.stringify(body) : undefined,\n });\n\n return this.handleResponse<T>(response);\n }\n\n private async handleResponse<T>(response: Response): Promise<T> {\n if (!response.ok) {\n let errorData: ApiError | null = null;\n\n try {\n errorData = (await response.json()) as ApiError;\n } catch {\n // Response body is not JSON\n }\n\n throw new KookeeApiError(\n errorData?.code ?? 'UNKNOWN_ERROR',\n errorData?.message ?? `Request failed with status ${response.status}`,\n response.status\n );\n }\n\n return response.json() as Promise<T>;\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n Announcement,\n AnnouncementListItem,\n AnnouncementOrderBy,\n AnnouncementType,\n LocaleOptions,\n OrderDirection,\n PaginatedResponse,\n PaginationParams,\n} from '../types';\n\nexport interface AnnouncementListParams extends PaginationParams, LocaleOptions {\n type?: AnnouncementType;\n excludeIds?: string[];\n orderBy?: AnnouncementOrderBy;\n order?: OrderDirection;\n}\n\nexport interface AnnouncementGetByIdParams extends LocaleOptions {}\n\nexport class AnnouncementModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: AnnouncementListParams): Promise<PaginatedResponse<AnnouncementListItem>> {\n const { excludeIds, ...rest } = params ?? {};\n const queryParams = excludeIds?.length ? { ...rest, excludeIds: excludeIds.join(',') } : rest;\n return this.http.get<PaginatedResponse<AnnouncementListItem>>('/v1/announcements', queryParams);\n }\n\n async getById(id: string, params?: AnnouncementGetByIdParams): Promise<Announcement> {\n return this.http.get<Announcement>(`/v1/announcements/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(id: string): Promise<Record<string, Announcement>> {\n return this.http.get<Record<string, Announcement>>(\n `/v1/announcements/${encodeURIComponent(id)}/translations`\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n BlogPost,\n BlogPostListItem,\n BlogTagWithCount,\n LocaleOptions,\n PaginatedResponse,\n PaginationParams,\n ReactParams,\n ReactResponse,\n} from '../types';\n\nexport interface BlogListParams extends PaginationParams, LocaleOptions {\n tags?: string[];\n search?: string;\n}\n\nexport interface BlogGetBySlugParams extends LocaleOptions {}\n\nexport interface BlogGetByIdParams extends LocaleOptions {}\n\nexport class BlogModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: BlogListParams): Promise<PaginatedResponse<BlogPostListItem>> {\n return this.http.get<PaginatedResponse<BlogPostListItem>>('/v1/blog/posts', params);\n }\n\n async getBySlug(slug: string, params?: BlogGetBySlugParams): Promise<BlogPost> {\n return this.http.get<BlogPost>(`/v1/blog/posts/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: BlogGetByIdParams): Promise<BlogPost> {\n return this.http.get<BlogPost>(`/v1/blog/posts/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTags(): Promise<BlogTagWithCount[]> {\n return this.http.get<BlogTagWithCount[]>('/v1/blog/tags');\n }\n\n async getTranslationsById(postId: string): Promise<Record<string, BlogPost>> {\n return this.http.get<Record<string, BlogPost>>(\n `/v1/blog/posts/by-id/${encodeURIComponent(postId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, BlogPost>> {\n return this.http.get<Record<string, BlogPost>>(\n `/v1/blog/posts/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async react(postId: string, params: ReactParams): Promise<ReactResponse> {\n return this.http.post<ReactResponse>(\n `/v1/blog/posts/${encodeURIComponent(postId)}/reactions`,\n params\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n ChangelogEntry,\n ChangelogEntryListItem,\n ChangelogOrderBy,\n LocaleOptions,\n OrderDirection,\n PaginatedResponse,\n PaginationParams,\n ReactParams,\n ReactResponse,\n} from '../types';\n\nexport interface ChangelogListParams extends PaginationParams, LocaleOptions {\n type?: string;\n search?: string;\n orderBy?: ChangelogOrderBy;\n order?: OrderDirection;\n}\n\nexport interface ChangelogGetBySlugParams extends LocaleOptions {}\n\nexport interface ChangelogGetByIdParams extends LocaleOptions {}\n\nexport class ChangelogModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: ChangelogListParams): Promise<PaginatedResponse<ChangelogEntryListItem>> {\n return this.http.get<PaginatedResponse<ChangelogEntryListItem>>('/v1/changelog', params);\n }\n\n async getBySlug(slug: string, params?: ChangelogGetBySlugParams): Promise<ChangelogEntry> {\n return this.http.get<ChangelogEntry>(`/v1/changelog/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: ChangelogGetByIdParams): Promise<ChangelogEntry> {\n return this.http.get<ChangelogEntry>(`/v1/changelog/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(id: string): Promise<Record<string, ChangelogEntry>> {\n return this.http.get<Record<string, ChangelogEntry>>(\n `/v1/changelog/by-id/${encodeURIComponent(id)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, ChangelogEntry>> {\n return this.http.get<Record<string, ChangelogEntry>>(\n `/v1/changelog/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async react(changelogId: string, params: ReactParams): Promise<ReactResponse> {\n return this.http.post<ReactResponse>(\n `/v1/changelog/${encodeURIComponent(changelogId)}/reactions`,\n params\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type { PublicConfig } from '../types';\n\nexport interface ConfigListParams {\n keys?: string[];\n}\n\nexport class ConfigModule {\n constructor(private readonly http: HttpClient) {}\n\n async getByKey(key: string): Promise<PublicConfig> {\n return this.http.get<PublicConfig>(`/v1/config/${encodeURIComponent(key)}`);\n }\n\n async list(params?: ConfigListParams): Promise<PublicConfig[]> {\n return this.http.get<PublicConfig[]>('/v1/config', params);\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n HelpArticle,\n HelpArticleListItem,\n HelpCategory,\n 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 voteUsefulness(\n articleId: string,\n vote: 'yes' | 'no' | null,\n previousVote?: 'yes' | 'no' | null,\n ): Promise<VoteUsefulnessResponse> {\n return this.http.post<VoteUsefulnessResponse>(\n `/v1/help/articles/by-id/${encodeURIComponent(articleId)}/vote-usefulness`,\n { vote, previousVote }\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type { LocaleOptions, Page, PageListItem, PaginatedResponse, PaginationParams } from '../types';\n\nexport interface PagesListParams extends PaginationParams, LocaleOptions {\n search?: string;\n}\n\nexport interface PagesGetBySlugParams extends LocaleOptions {}\n\nexport interface PagesGetByIdParams extends LocaleOptions {}\n\nexport class PagesModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: PagesListParams): Promise<PaginatedResponse<PageListItem>> {\n return this.http.get<PaginatedResponse<PageListItem>>('/v1/pages', params);\n }\n\n async getBySlug(slug: string, params?: PagesGetBySlugParams): Promise<Page> {\n return this.http.get<Page>(`/v1/pages/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: PagesGetByIdParams): Promise<Page> {\n return this.http.get<Page>(`/v1/pages/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(pageId: string): Promise<Record<string, Page>> {\n return this.http.get<Record<string, Page>>(\n `/v1/pages/by-id/${encodeURIComponent(pageId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, Page>> {\n return this.http.get<Record<string, Page>>(\n `/v1/pages/${encodeURIComponent(slug)}/translations`\n );\n }\n}\n","import { HttpClient } from './http-client';\nimport { AnnouncementModule } from './modules/announcement';\nimport { BlogModule } from './modules/blog';\nimport { ChangelogModule } from './modules/changelog';\nimport { ConfigModule } from './modules/config';\nimport { HelpModule } from './modules/help';\nimport { PagesModule } from './modules/pages';\nimport type { KookeeConfig, HealthCheckResponse } from './types';\n\nexport class Kookee {\n private readonly http: HttpClient;\n\n public readonly announcements: AnnouncementModule;\n public readonly blog: BlogModule;\n public readonly changelog: ChangelogModule;\n public readonly config: ConfigModule;\n public readonly help: HelpModule;\n public readonly pages: PagesModule;\n\n constructor(config: KookeeConfig) {\n if (!config.apiKey) {\n throw new Error('apiKey is required');\n }\n\n this.http = new HttpClient(config.apiKey, config.baseUrl);\n\n this.announcements = new AnnouncementModule(this.http);\n this.blog = new BlogModule(this.http);\n this.changelog = new ChangelogModule(this.http);\n this.config = new ConfigModule(this.http);\n this.help = new HelpModule(this.http);\n this.pages = new PagesModule(this.http);\n }\n\n async health(): Promise<HealthCheckResponse> {\n return this.http.get<HealthCheckResponse>('/v1/health');\n }\n}\n"]}
package/dist/index.d.cts CHANGED
@@ -58,6 +58,7 @@ interface BlogPostListItem {
58
58
  tags: BlogTag[];
59
59
  locale: string;
60
60
  translationGroupId: string;
61
+ reactions: Record<string, number>;
61
62
  }
62
63
  interface BlogPost extends BlogPostListItem {
63
64
  contentHtml: string;
@@ -137,6 +138,7 @@ interface ChangelogEntryListItem {
137
138
  id: string;
138
139
  slug: string;
139
140
  title: string;
141
+ contentHtml: string;
140
142
  type: ChangelogType;
141
143
  version: string | null;
142
144
  publishedAt: string | null;
@@ -145,6 +147,7 @@ interface ChangelogEntryListItem {
145
147
  translationGroupId: string;
146
148
  metadata: Record<string, NonNullable<unknown>> | null;
147
149
  author: ChangelogAuthor;
150
+ reactions: Record<string, number>;
148
151
  }
149
152
  interface ChangelogEntry extends ChangelogEntryListItem {
150
153
  contentHtml: string;
@@ -185,6 +188,14 @@ interface VoteUsefulnessResponse {
185
188
  usefulYesCount: number;
186
189
  usefulNoCount: number;
187
190
  }
191
+ type ReactionType = 'fire' | 'heart' | 'rocket' | 'eyes' | 'mindblown';
192
+ interface ReactParams {
193
+ reactionType: ReactionType;
194
+ action: 'add' | 'remove';
195
+ }
196
+ interface ReactResponse {
197
+ reactions: Record<string, number>;
198
+ }
188
199
 
189
200
  interface AnnouncementListParams extends PaginationParams, LocaleOptions {
190
201
  type?: AnnouncementType;
@@ -219,6 +230,7 @@ declare class BlogModule {
219
230
  getTags(): Promise<BlogTagWithCount[]>;
220
231
  getTranslationsById(postId: string): Promise<Record<string, BlogPost>>;
221
232
  getTranslationsBySlug(slug: string): Promise<Record<string, BlogPost>>;
233
+ react(postId: string, params: ReactParams): Promise<ReactResponse>;
222
234
  }
223
235
 
224
236
  interface ChangelogListParams extends PaginationParams, LocaleOptions {
@@ -239,6 +251,7 @@ declare class ChangelogModule {
239
251
  getById(id: string, params?: ChangelogGetByIdParams): Promise<ChangelogEntry>;
240
252
  getTranslationsById(id: string): Promise<Record<string, ChangelogEntry>>;
241
253
  getTranslationsBySlug(slug: string): Promise<Record<string, ChangelogEntry>>;
254
+ react(changelogId: string, params: ReactParams): Promise<ReactResponse>;
242
255
  }
243
256
 
244
257
  interface ConfigListParams {
@@ -307,4 +320,4 @@ declare class Kookee {
307
320
  health(): Promise<HealthCheckResponse>;
308
321
  }
309
322
 
310
- export { type Announcement, type AnnouncementAuthor, type AnnouncementGetByIdParams, type AnnouncementListItem, type AnnouncementListParams, AnnouncementModule, type AnnouncementOrderBy, type AnnouncementType, type ApiError, type BlogGetByIdParams, type BlogGetBySlugParams, type BlogListParams, BlogModule, type BlogPost, type BlogPostAuthor, type BlogPostListItem, type BlogTag, type BlogTagWithCount, type ChangelogAuthor, type ChangelogEntry, type ChangelogEntryListItem, type ChangelogGetByIdParams, type ChangelogGetBySlugParams, type ChangelogListParams, ChangelogModule, type ChangelogOrderBy, type ChangelogType, type ConfigListParams, ConfigModule, type HealthCheckResponse, type HelpArticle, type HelpArticleListItem, type HelpCategoriesParams, type HelpCategory, type 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 VoteUsefulnessResponse };
323
+ export { type Announcement, type AnnouncementAuthor, type AnnouncementGetByIdParams, type AnnouncementListItem, type AnnouncementListParams, AnnouncementModule, type AnnouncementOrderBy, type AnnouncementType, type ApiError, type BlogGetByIdParams, type BlogGetBySlugParams, type BlogListParams, BlogModule, type BlogPost, type BlogPostAuthor, type BlogPostListItem, type BlogTag, type BlogTagWithCount, type ChangelogAuthor, type ChangelogEntry, type ChangelogEntryListItem, type ChangelogGetByIdParams, type ChangelogGetBySlugParams, type ChangelogListParams, ChangelogModule, type ChangelogOrderBy, type ChangelogType, type ConfigListParams, ConfigModule, type HealthCheckResponse, type HelpArticle, type HelpArticleListItem, type HelpCategoriesParams, type HelpCategory, type 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
@@ -58,6 +58,7 @@ interface BlogPostListItem {
58
58
  tags: BlogTag[];
59
59
  locale: string;
60
60
  translationGroupId: string;
61
+ reactions: Record<string, number>;
61
62
  }
62
63
  interface BlogPost extends BlogPostListItem {
63
64
  contentHtml: string;
@@ -137,6 +138,7 @@ interface ChangelogEntryListItem {
137
138
  id: string;
138
139
  slug: string;
139
140
  title: string;
141
+ contentHtml: string;
140
142
  type: ChangelogType;
141
143
  version: string | null;
142
144
  publishedAt: string | null;
@@ -145,6 +147,7 @@ interface ChangelogEntryListItem {
145
147
  translationGroupId: string;
146
148
  metadata: Record<string, NonNullable<unknown>> | null;
147
149
  author: ChangelogAuthor;
150
+ reactions: Record<string, number>;
148
151
  }
149
152
  interface ChangelogEntry extends ChangelogEntryListItem {
150
153
  contentHtml: string;
@@ -185,6 +188,14 @@ interface VoteUsefulnessResponse {
185
188
  usefulYesCount: number;
186
189
  usefulNoCount: number;
187
190
  }
191
+ type ReactionType = 'fire' | 'heart' | 'rocket' | 'eyes' | 'mindblown';
192
+ interface ReactParams {
193
+ reactionType: ReactionType;
194
+ action: 'add' | 'remove';
195
+ }
196
+ interface ReactResponse {
197
+ reactions: Record<string, number>;
198
+ }
188
199
 
189
200
  interface AnnouncementListParams extends PaginationParams, LocaleOptions {
190
201
  type?: AnnouncementType;
@@ -219,6 +230,7 @@ declare class BlogModule {
219
230
  getTags(): Promise<BlogTagWithCount[]>;
220
231
  getTranslationsById(postId: string): Promise<Record<string, BlogPost>>;
221
232
  getTranslationsBySlug(slug: string): Promise<Record<string, BlogPost>>;
233
+ react(postId: string, params: ReactParams): Promise<ReactResponse>;
222
234
  }
223
235
 
224
236
  interface ChangelogListParams extends PaginationParams, LocaleOptions {
@@ -239,6 +251,7 @@ declare class ChangelogModule {
239
251
  getById(id: string, params?: ChangelogGetByIdParams): Promise<ChangelogEntry>;
240
252
  getTranslationsById(id: string): Promise<Record<string, ChangelogEntry>>;
241
253
  getTranslationsBySlug(slug: string): Promise<Record<string, ChangelogEntry>>;
254
+ react(changelogId: string, params: ReactParams): Promise<ReactResponse>;
242
255
  }
243
256
 
244
257
  interface ConfigListParams {
@@ -307,4 +320,4 @@ declare class Kookee {
307
320
  health(): Promise<HealthCheckResponse>;
308
321
  }
309
322
 
310
- export { type Announcement, type AnnouncementAuthor, type AnnouncementGetByIdParams, type AnnouncementListItem, type AnnouncementListParams, AnnouncementModule, type AnnouncementOrderBy, type AnnouncementType, type ApiError, type BlogGetByIdParams, type BlogGetBySlugParams, type BlogListParams, BlogModule, type BlogPost, type BlogPostAuthor, type BlogPostListItem, type BlogTag, type BlogTagWithCount, type ChangelogAuthor, type ChangelogEntry, type ChangelogEntryListItem, type ChangelogGetByIdParams, type ChangelogGetBySlugParams, type ChangelogListParams, ChangelogModule, type ChangelogOrderBy, type ChangelogType, type ConfigListParams, ConfigModule, type HealthCheckResponse, type HelpArticle, type HelpArticleListItem, type HelpCategoriesParams, type HelpCategory, type 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 VoteUsefulnessResponse };
323
+ export { type Announcement, type AnnouncementAuthor, type AnnouncementGetByIdParams, type AnnouncementListItem, type AnnouncementListParams, AnnouncementModule, type AnnouncementOrderBy, type AnnouncementType, type ApiError, type BlogGetByIdParams, type BlogGetBySlugParams, type BlogListParams, BlogModule, type BlogPost, type BlogPostAuthor, type BlogPostListItem, type BlogTag, type BlogTagWithCount, type ChangelogAuthor, type ChangelogEntry, type ChangelogEntryListItem, type ChangelogGetByIdParams, type ChangelogGetBySlugParams, type ChangelogListParams, ChangelogModule, type ChangelogOrderBy, type ChangelogType, type ConfigListParams, ConfigModule, type HealthCheckResponse, type HelpArticle, type HelpArticleListItem, type HelpCategoriesParams, type HelpCategory, type HelpGetByIdParams, type HelpGetBySlugParams, type HelpListParams, HelpModule, type HelpSearchParams, type HelpSearchResult, Kookee, KookeeApiError, type KookeeConfig, type LocaleOptions, type OrderDirection, type Page, type PageListItem, type PagesGetByIdParams, type PagesGetBySlugParams, type PagesListParams, PagesModule, type PaginatedResponse, type PaginationParams, type PublicConfig, type ReactParams, type ReactResponse, type ReactionType, type VoteUsefulnessResponse };
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- var u="https://api.kookee.dev",f="Kookee-API-Key",m=class extends Error{constructor(t,n,c){super(n);this.code=t;this.status=c;this.name="KookeeApiError";}},y=class{baseUrl;apiKey;constructor(e,t){this.apiKey=e,this.baseUrl=t??u;}getHeaders(){return {"Content-Type":"application/json",[f]:this.apiKey}}async get(e,t){let n=new URL(`${this.baseUrl}${e}`);if(t){for(let[d,r]of Object.entries(t))if(r!=null)if(Array.isArray(r))for(let P of r)n.searchParams.append(d,String(P));else n.searchParams.set(d,String(r));}let c=await fetch(n.toString(),{method:"GET",headers:this.getHeaders()});return this.handleResponse(c)}async post(e,t){let n=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(n)}async handleResponse(e){if(!e.ok){let t=null;try{t=await e.json();}catch{}throw new m(t?.code??"UNKNOWN_ERROR",t?.message??`Request failed with status ${e.status}`,e.status)}return e.json()}};var o=class{constructor(e){this.http=e;}async list(e){let{excludeIds:t,...n}=e??{},c=t?.length?{...n,excludeIds:t.join(",")}:n;return this.http.get("/v1/announcements",c)}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 a=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`)}};var i=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`)}};var p=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 g=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 voteUsefulness(e,t,n){return this.http.post(`/v1/help/articles/by-id/${encodeURIComponent(e)}/vote-usefulness`,{vote:t,previousVote:n})}};var l=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 h=class{http;announcements;blog;changelog;config;help;pages;constructor(e){if(!e.apiKey)throw new Error("apiKey is required");this.http=new y(e.apiKey,e.baseUrl),this.announcements=new o(this.http),this.blog=new a(this.http),this.changelog=new i(this.http),this.config=new p(this.http),this.help=new g(this.http),this.pages=new l(this.http);}async health(){return this.http.get("/v1/health")}};
2
- export{o as AnnouncementModule,a as BlogModule,i as ChangelogModule,p as ConfigModule,g as HelpModule,h as Kookee,m as KookeeApiError,l as PagesModule};//# sourceMappingURL=index.js.map
1
+ var u="https://api.kookee.dev",R="Kookee-API-Key",m=class extends Error{constructor(t,n,c){super(n);this.code=t;this.status=c;this.name="KookeeApiError";}},h=class{baseUrl;apiKey;constructor(e,t){this.apiKey=e,this.baseUrl=t??u;}getHeaders(){return {"Content-Type":"application/json",[R]:this.apiKey}}async get(e,t){let n=new URL(`${this.baseUrl}${e}`);if(t){for(let[d,r]of Object.entries(t))if(r!=null)if(Array.isArray(r))for(let P of r)n.searchParams.append(d,String(P));else n.searchParams.set(d,String(r));}let c=await fetch(n.toString(),{method:"GET",headers:this.getHeaders()});return this.handleResponse(c)}async post(e,t){let n=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(n)}async handleResponse(e){if(!e.ok){let t=null;try{t=await e.json();}catch{}throw new m(t?.code??"UNKNOWN_ERROR",t?.message??`Request failed with status ${e.status}`,e.status)}return e.json()}};var o=class{constructor(e){this.http=e;}async list(e){let{excludeIds:t,...n}=e??{},c=t?.length?{...n,excludeIds:t.join(",")}:n;return this.http.get("/v1/announcements",c)}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 a=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 i=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 p=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 g=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 voteUsefulness(e,t,n){return this.http.post(`/v1/help/articles/by-id/${encodeURIComponent(e)}/vote-usefulness`,{vote:t,previousVote:n})}};var l=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 y=class{http;announcements;blog;changelog;config;help;pages;constructor(e){if(!e.apiKey)throw new Error("apiKey is required");this.http=new h(e.apiKey,e.baseUrl),this.announcements=new o(this.http),this.blog=new a(this.http),this.changelog=new i(this.http),this.config=new p(this.http),this.help=new g(this.http),this.pages=new l(this.http);}async health(){return this.http.get("/v1/health")}};
2
+ export{o as AnnouncementModule,a as BlogModule,i as ChangelogModule,p as ConfigModule,g as HelpModule,y as Kookee,m as KookeeApiError,l as PagesModule};//# sourceMappingURL=index.js.map
3
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/lib/http-client.ts","../src/lib/modules/announcement.ts","../src/lib/modules/blog.ts","../src/lib/modules/changelog.ts","../src/lib/modules/config.ts","../src/lib/modules/help.ts","../src/lib/modules/pages.ts","../src/lib/client.ts"],"names":["DEFAULT_BASE_URL","API_KEY_HEADER","KookeeApiError","code","message","status","HttpClient","apiKey","baseUrl","path","params","url","key","value","item","response","body","errorData","AnnouncementModule","http","excludeIds","rest","queryParams","id","BlogModule","slug","postId","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,CAAA,CAExD,IAAA,CAAK,aAAA,CAAgB,IAAIlB,CAAAA,CAAmB,IAAA,CAAK,IAAI,CAAA,CACrD,IAAA,CAAK,KAAO,IAAIM,CAAAA,CAAW,IAAA,CAAK,IAAI,CAAA,CACpC,IAAA,CAAK,UAAY,IAAIG,CAAAA,CAAgB,KAAK,IAAI,CAAA,CAC9C,KAAK,MAAA,CAAS,IAAIC,CAAAA,CAAa,IAAA,CAAK,IAAI,CAAA,CACxC,KAAK,IAAA,CAAO,IAAIC,EAAW,IAAA,CAAK,IAAI,EACpC,IAAA,CAAK,KAAA,CAAQ,IAAII,CAAAA,CAAY,IAAA,CAAK,IAAI,EACxC,CAEA,MAAM,QAAuC,CAC3C,OAAO,KAAK,IAAA,CAAK,GAAA,CAAyB,YAAY,CACxD,CACF","file":"index.js","sourcesContent":["import type { ApiError } from './types';\n\nconst DEFAULT_BASE_URL = 'https://api.kookee.dev';\nconst API_KEY_HEADER = 'Kookee-API-Key';\n\nexport class KookeeApiError extends Error {\n constructor(\n public readonly code: string,\n message: string,\n public readonly status: number\n ) {\n super(message);\n this.name = 'KookeeApiError';\n }\n}\n\nexport class HttpClient {\n private readonly baseUrl: string;\n private readonly apiKey: string;\n\n constructor(apiKey: string, baseUrl?: string) {\n this.apiKey = apiKey;\n this.baseUrl = baseUrl ?? DEFAULT_BASE_URL;\n }\n\n private getHeaders(): Record<string, string> {\n return {\n 'Content-Type': 'application/json',\n [API_KEY_HEADER]: this.apiKey,\n };\n }\n\n async get<T>(path: string, params?: object): Promise<T> {\n const url = new URL(`${this.baseUrl}${path}`);\n\n if (params) {\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined && value !== null) {\n if (Array.isArray(value)) {\n for (const item of value) {\n url.searchParams.append(key, String(item));\n }\n } else {\n url.searchParams.set(key, String(value));\n }\n }\n }\n }\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: this.getHeaders(),\n });\n\n return this.handleResponse<T>(response);\n }\n\n async post<T>(path: string, body?: unknown): Promise<T> {\n const response = await fetch(`${this.baseUrl}${path}`, {\n method: 'POST',\n headers: this.getHeaders(),\n body: body ? JSON.stringify(body) : undefined,\n });\n\n return this.handleResponse<T>(response);\n }\n\n private async handleResponse<T>(response: Response): Promise<T> {\n if (!response.ok) {\n let errorData: ApiError | null = null;\n\n try {\n errorData = (await response.json()) as ApiError;\n } catch {\n // Response body is not JSON\n }\n\n throw new KookeeApiError(\n errorData?.code ?? 'UNKNOWN_ERROR',\n errorData?.message ?? `Request failed with status ${response.status}`,\n response.status\n );\n }\n\n return response.json() as Promise<T>;\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n Announcement,\n AnnouncementListItem,\n AnnouncementOrderBy,\n AnnouncementType,\n LocaleOptions,\n OrderDirection,\n PaginatedResponse,\n PaginationParams,\n} from '../types';\n\nexport interface AnnouncementListParams extends PaginationParams, LocaleOptions {\n type?: AnnouncementType;\n excludeIds?: string[];\n orderBy?: AnnouncementOrderBy;\n order?: OrderDirection;\n}\n\nexport interface AnnouncementGetByIdParams extends LocaleOptions {}\n\nexport class AnnouncementModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: AnnouncementListParams): Promise<PaginatedResponse<AnnouncementListItem>> {\n const { excludeIds, ...rest } = params ?? {};\n const queryParams = excludeIds?.length ? { ...rest, excludeIds: excludeIds.join(',') } : rest;\n return this.http.get<PaginatedResponse<AnnouncementListItem>>('/v1/announcements', queryParams);\n }\n\n async getById(id: string, params?: AnnouncementGetByIdParams): Promise<Announcement> {\n return this.http.get<Announcement>(`/v1/announcements/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(id: string): Promise<Record<string, Announcement>> {\n return this.http.get<Record<string, Announcement>>(\n `/v1/announcements/${encodeURIComponent(id)}/translations`\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n BlogPost,\n BlogPostListItem,\n BlogTagWithCount,\n LocaleOptions,\n PaginatedResponse,\n PaginationParams,\n} 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","import type { HttpClient } from '../http-client';\nimport type {\n ChangelogEntry,\n ChangelogEntryListItem,\n ChangelogOrderBy,\n LocaleOptions,\n OrderDirection,\n PaginatedResponse,\n PaginationParams,\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","import type { HttpClient } from '../http-client';\nimport type { PublicConfig } from '../types';\n\nexport interface ConfigListParams {\n keys?: string[];\n}\n\nexport class ConfigModule {\n constructor(private readonly http: HttpClient) {}\n\n async getByKey(key: string): Promise<PublicConfig> {\n return this.http.get<PublicConfig>(`/v1/config/${encodeURIComponent(key)}`);\n }\n\n async list(params?: ConfigListParams): Promise<PublicConfig[]> {\n return this.http.get<PublicConfig[]>('/v1/config', params);\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n HelpArticle,\n HelpArticleListItem,\n HelpCategory,\n 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 voteUsefulness(\n articleId: string,\n vote: 'yes' | 'no' | null,\n previousVote?: 'yes' | 'no' | null,\n ): Promise<VoteUsefulnessResponse> {\n return this.http.post<VoteUsefulnessResponse>(\n `/v1/help/articles/by-id/${encodeURIComponent(articleId)}/vote-usefulness`,\n { vote, previousVote }\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type { LocaleOptions, Page, PageListItem, PaginatedResponse, PaginationParams } from '../types';\n\nexport interface PagesListParams extends PaginationParams, LocaleOptions {\n search?: string;\n}\n\nexport interface PagesGetBySlugParams extends LocaleOptions {}\n\nexport interface PagesGetByIdParams extends LocaleOptions {}\n\nexport class PagesModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: PagesListParams): Promise<PaginatedResponse<PageListItem>> {\n return this.http.get<PaginatedResponse<PageListItem>>('/v1/pages', params);\n }\n\n async getBySlug(slug: string, params?: PagesGetBySlugParams): Promise<Page> {\n return this.http.get<Page>(`/v1/pages/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: PagesGetByIdParams): Promise<Page> {\n return this.http.get<Page>(`/v1/pages/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(pageId: string): Promise<Record<string, Page>> {\n return this.http.get<Record<string, Page>>(\n `/v1/pages/by-id/${encodeURIComponent(pageId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, Page>> {\n return this.http.get<Record<string, Page>>(\n `/v1/pages/${encodeURIComponent(slug)}/translations`\n );\n }\n}\n","import { HttpClient } from './http-client';\nimport { AnnouncementModule } from './modules/announcement';\nimport { BlogModule } from './modules/blog';\nimport { ChangelogModule } from './modules/changelog';\nimport { ConfigModule } from './modules/config';\nimport { HelpModule } from './modules/help';\nimport { PagesModule } from './modules/pages';\nimport type { KookeeConfig, HealthCheckResponse } from './types';\n\nexport class Kookee {\n private readonly http: HttpClient;\n\n public readonly announcements: AnnouncementModule;\n public readonly blog: BlogModule;\n public readonly changelog: ChangelogModule;\n public readonly config: ConfigModule;\n public readonly help: HelpModule;\n public readonly pages: PagesModule;\n\n constructor(config: KookeeConfig) {\n if (!config.apiKey) {\n throw new Error('apiKey is required');\n }\n\n this.http = new HttpClient(config.apiKey, config.baseUrl);\n\n this.announcements = new AnnouncementModule(this.http);\n this.blog = new BlogModule(this.http);\n this.changelog = new ChangelogModule(this.http);\n this.config = new ConfigModule(this.http);\n this.help = new HelpModule(this.http);\n this.pages = new PagesModule(this.http);\n }\n\n async health(): Promise<HealthCheckResponse> {\n return this.http.get<HealthCheckResponse>('/v1/health');\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/lib/http-client.ts","../src/lib/modules/announcement.ts","../src/lib/modules/blog.ts","../src/lib/modules/changelog.ts","../src/lib/modules/config.ts","../src/lib/modules/help.ts","../src/lib/modules/pages.ts","../src/lib/client.ts"],"names":["DEFAULT_BASE_URL","API_KEY_HEADER","KookeeApiError","code","message","status","HttpClient","apiKey","baseUrl","path","params","url","key","value","item","response","body","errorData","AnnouncementModule","http","excludeIds","rest","queryParams","id","BlogModule","slug","postId","ChangelogModule","changelogId","ConfigModule","HelpModule","articleId","vote","previousVote","PagesModule","pageId","Kookee","config"],"mappings":"AAEA,IAAMA,CAAAA,CAAmB,yBACnBC,CAAAA,CAAiB,gBAAA,CAEVC,EAAN,cAA6B,KAAM,CACxC,WAAA,CACkBC,CAAAA,CAChBC,CAAAA,CACgBC,EAChB,CACA,KAAA,CAAMD,CAAO,CAAA,CAJG,IAAA,CAAA,IAAA,CAAAD,EAEA,IAAA,CAAA,MAAA,CAAAE,CAAAA,CAGhB,IAAA,CAAK,IAAA,CAAO,iBACd,CACF,EAEaC,CAAAA,CAAN,KAAiB,CACL,OAAA,CACA,MAAA,CAEjB,YAAYC,CAAAA,CAAgBC,CAAAA,CAAkB,CAC5C,IAAA,CAAK,MAAA,CAASD,CAAAA,CACd,KAAK,OAAA,CAAUC,CAAAA,EAAWR,EAC5B,CAEQ,UAAA,EAAqC,CAC3C,OAAO,CACL,cAAA,CAAgB,kBAAA,CAChB,CAACC,CAAc,EAAG,KAAK,MACzB,CACF,CAEA,MAAM,GAAA,CAAOQ,EAAcC,CAAAA,CAA6B,CACtD,IAAMC,CAAAA,CAAM,IAAI,GAAA,CAAI,GAAG,IAAA,CAAK,OAAO,GAAGF,CAAI,CAAA,CAAE,EAE5C,GAAIC,CAAAA,CAAAA,CACF,IAAA,GAAW,CAACE,CAAAA,CAAKC,CAAK,IAAK,MAAA,CAAO,OAAA,CAAQH,CAAM,CAAA,CAC9C,GAA2BG,GAAU,IAAA,CACnC,GAAI,KAAA,CAAM,OAAA,CAAQA,CAAK,CAAA,CACrB,QAAWC,CAAAA,IAAQD,CAAAA,CACjBF,CAAAA,CAAI,YAAA,CAAa,MAAA,CAAOC,CAAAA,CAAK,OAAOE,CAAI,CAAC,CAAA,CAAA,KAG3CH,CAAAA,CAAI,YAAA,CAAa,GAAA,CAAIC,EAAK,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,CAAK,GAAA,CACf,CAAA,gBAAA,EAAmB,kBAAA,CAAmBA,CAAM,CAAC,CAAA,aAAA,CAC/C,CACF,CAEA,MAAM,sBAAsBV,CAAAA,CAA6C,CACvE,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CACf,aAAa,kBAAA,CAAmBA,CAAI,CAAC,CAAA,aAAA,CACvC,CACF,CACF,EC5BO,IAAMW,CAAAA,CAAN,KAAa,CACD,IAAA,CAED,cACA,IAAA,CACA,SAAA,CACA,OACA,IAAA,CACA,KAAA,CAEhB,YAAYC,CAAAA,CAAsB,CAChC,GAAI,CAACA,CAAAA,CAAO,MAAA,CACV,MAAM,IAAI,KAAA,CAAM,oBAAoB,CAAA,CAGtC,IAAA,CAAK,IAAA,CAAO,IAAI/B,CAAAA,CAAW+B,CAAAA,CAAO,MAAA,CAAQA,CAAAA,CAAO,OAAO,CAAA,CAExD,KAAK,aAAA,CAAgB,IAAInB,EAAmB,IAAA,CAAK,IAAI,EACrD,IAAA,CAAK,IAAA,CAAO,IAAIM,CAAAA,CAAW,IAAA,CAAK,IAAI,EACpC,IAAA,CAAK,SAAA,CAAY,IAAIG,CAAAA,CAAgB,IAAA,CAAK,IAAI,EAC9C,IAAA,CAAK,MAAA,CAAS,IAAIE,CAAAA,CAAa,IAAA,CAAK,IAAI,EACxC,IAAA,CAAK,IAAA,CAAO,IAAIC,CAAAA,CAAW,IAAA,CAAK,IAAI,CAAA,CACpC,IAAA,CAAK,KAAA,CAAQ,IAAII,CAAAA,CAAY,IAAA,CAAK,IAAI,EACxC,CAEA,MAAM,MAAA,EAAuC,CAC3C,OAAO,KAAK,IAAA,CAAK,GAAA,CAAyB,YAAY,CACxD,CACF","file":"index.js","sourcesContent":["import type { ApiError } from './types';\n\nconst DEFAULT_BASE_URL = 'https://api.kookee.dev';\nconst API_KEY_HEADER = 'Kookee-API-Key';\n\nexport class KookeeApiError extends Error {\n constructor(\n public readonly code: string,\n message: string,\n public readonly status: number\n ) {\n super(message);\n this.name = 'KookeeApiError';\n }\n}\n\nexport class HttpClient {\n private readonly baseUrl: string;\n private readonly apiKey: string;\n\n constructor(apiKey: string, baseUrl?: string) {\n this.apiKey = apiKey;\n this.baseUrl = baseUrl ?? DEFAULT_BASE_URL;\n }\n\n private getHeaders(): Record<string, string> {\n return {\n 'Content-Type': 'application/json',\n [API_KEY_HEADER]: this.apiKey,\n };\n }\n\n async get<T>(path: string, params?: object): Promise<T> {\n const url = new URL(`${this.baseUrl}${path}`);\n\n if (params) {\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined && value !== null) {\n if (Array.isArray(value)) {\n for (const item of value) {\n url.searchParams.append(key, String(item));\n }\n } else {\n url.searchParams.set(key, String(value));\n }\n }\n }\n }\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: this.getHeaders(),\n });\n\n return this.handleResponse<T>(response);\n }\n\n async post<T>(path: string, body?: unknown): Promise<T> {\n const response = await fetch(`${this.baseUrl}${path}`, {\n method: 'POST',\n headers: this.getHeaders(),\n body: body ? JSON.stringify(body) : undefined,\n });\n\n return this.handleResponse<T>(response);\n }\n\n private async handleResponse<T>(response: Response): Promise<T> {\n if (!response.ok) {\n let errorData: ApiError | null = null;\n\n try {\n errorData = (await response.json()) as ApiError;\n } catch {\n // Response body is not JSON\n }\n\n throw new KookeeApiError(\n errorData?.code ?? 'UNKNOWN_ERROR',\n errorData?.message ?? `Request failed with status ${response.status}`,\n response.status\n );\n }\n\n return response.json() as Promise<T>;\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n Announcement,\n AnnouncementListItem,\n AnnouncementOrderBy,\n AnnouncementType,\n LocaleOptions,\n OrderDirection,\n PaginatedResponse,\n PaginationParams,\n} from '../types';\n\nexport interface AnnouncementListParams extends PaginationParams, LocaleOptions {\n type?: AnnouncementType;\n excludeIds?: string[];\n orderBy?: AnnouncementOrderBy;\n order?: OrderDirection;\n}\n\nexport interface AnnouncementGetByIdParams extends LocaleOptions {}\n\nexport class AnnouncementModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: AnnouncementListParams): Promise<PaginatedResponse<AnnouncementListItem>> {\n const { excludeIds, ...rest } = params ?? {};\n const queryParams = excludeIds?.length ? { ...rest, excludeIds: excludeIds.join(',') } : rest;\n return this.http.get<PaginatedResponse<AnnouncementListItem>>('/v1/announcements', queryParams);\n }\n\n async getById(id: string, params?: AnnouncementGetByIdParams): Promise<Announcement> {\n return this.http.get<Announcement>(`/v1/announcements/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(id: string): Promise<Record<string, Announcement>> {\n return this.http.get<Record<string, Announcement>>(\n `/v1/announcements/${encodeURIComponent(id)}/translations`\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n BlogPost,\n BlogPostListItem,\n BlogTagWithCount,\n LocaleOptions,\n PaginatedResponse,\n PaginationParams,\n ReactParams,\n ReactResponse,\n} from '../types';\n\nexport interface BlogListParams extends PaginationParams, LocaleOptions {\n tags?: string[];\n search?: string;\n}\n\nexport interface BlogGetBySlugParams extends LocaleOptions {}\n\nexport interface BlogGetByIdParams extends LocaleOptions {}\n\nexport class BlogModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: BlogListParams): Promise<PaginatedResponse<BlogPostListItem>> {\n return this.http.get<PaginatedResponse<BlogPostListItem>>('/v1/blog/posts', params);\n }\n\n async getBySlug(slug: string, params?: BlogGetBySlugParams): Promise<BlogPost> {\n return this.http.get<BlogPost>(`/v1/blog/posts/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: BlogGetByIdParams): Promise<BlogPost> {\n return this.http.get<BlogPost>(`/v1/blog/posts/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTags(): Promise<BlogTagWithCount[]> {\n return this.http.get<BlogTagWithCount[]>('/v1/blog/tags');\n }\n\n async getTranslationsById(postId: string): Promise<Record<string, BlogPost>> {\n return this.http.get<Record<string, BlogPost>>(\n `/v1/blog/posts/by-id/${encodeURIComponent(postId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, BlogPost>> {\n return this.http.get<Record<string, BlogPost>>(\n `/v1/blog/posts/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async react(postId: string, params: ReactParams): Promise<ReactResponse> {\n return this.http.post<ReactResponse>(\n `/v1/blog/posts/${encodeURIComponent(postId)}/reactions`,\n params\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n ChangelogEntry,\n ChangelogEntryListItem,\n ChangelogOrderBy,\n LocaleOptions,\n OrderDirection,\n PaginatedResponse,\n PaginationParams,\n ReactParams,\n ReactResponse,\n} from '../types';\n\nexport interface ChangelogListParams extends PaginationParams, LocaleOptions {\n type?: string;\n search?: string;\n orderBy?: ChangelogOrderBy;\n order?: OrderDirection;\n}\n\nexport interface ChangelogGetBySlugParams extends LocaleOptions {}\n\nexport interface ChangelogGetByIdParams extends LocaleOptions {}\n\nexport class ChangelogModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: ChangelogListParams): Promise<PaginatedResponse<ChangelogEntryListItem>> {\n return this.http.get<PaginatedResponse<ChangelogEntryListItem>>('/v1/changelog', params);\n }\n\n async getBySlug(slug: string, params?: ChangelogGetBySlugParams): Promise<ChangelogEntry> {\n return this.http.get<ChangelogEntry>(`/v1/changelog/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: ChangelogGetByIdParams): Promise<ChangelogEntry> {\n return this.http.get<ChangelogEntry>(`/v1/changelog/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(id: string): Promise<Record<string, ChangelogEntry>> {\n return this.http.get<Record<string, ChangelogEntry>>(\n `/v1/changelog/by-id/${encodeURIComponent(id)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, ChangelogEntry>> {\n return this.http.get<Record<string, ChangelogEntry>>(\n `/v1/changelog/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async react(changelogId: string, params: ReactParams): Promise<ReactResponse> {\n return this.http.post<ReactResponse>(\n `/v1/changelog/${encodeURIComponent(changelogId)}/reactions`,\n params\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type { PublicConfig } from '../types';\n\nexport interface ConfigListParams {\n keys?: string[];\n}\n\nexport class ConfigModule {\n constructor(private readonly http: HttpClient) {}\n\n async getByKey(key: string): Promise<PublicConfig> {\n return this.http.get<PublicConfig>(`/v1/config/${encodeURIComponent(key)}`);\n }\n\n async list(params?: ConfigListParams): Promise<PublicConfig[]> {\n return this.http.get<PublicConfig[]>('/v1/config', params);\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n HelpArticle,\n HelpArticleListItem,\n HelpCategory,\n 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 voteUsefulness(\n articleId: string,\n vote: 'yes' | 'no' | null,\n previousVote?: 'yes' | 'no' | null,\n ): Promise<VoteUsefulnessResponse> {\n return this.http.post<VoteUsefulnessResponse>(\n `/v1/help/articles/by-id/${encodeURIComponent(articleId)}/vote-usefulness`,\n { vote, previousVote }\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type { LocaleOptions, Page, PageListItem, PaginatedResponse, PaginationParams } from '../types';\n\nexport interface PagesListParams extends PaginationParams, LocaleOptions {\n search?: string;\n}\n\nexport interface PagesGetBySlugParams extends LocaleOptions {}\n\nexport interface PagesGetByIdParams extends LocaleOptions {}\n\nexport class PagesModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: PagesListParams): Promise<PaginatedResponse<PageListItem>> {\n return this.http.get<PaginatedResponse<PageListItem>>('/v1/pages', params);\n }\n\n async getBySlug(slug: string, params?: PagesGetBySlugParams): Promise<Page> {\n return this.http.get<Page>(`/v1/pages/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: PagesGetByIdParams): Promise<Page> {\n return this.http.get<Page>(`/v1/pages/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(pageId: string): Promise<Record<string, Page>> {\n return this.http.get<Record<string, Page>>(\n `/v1/pages/by-id/${encodeURIComponent(pageId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, Page>> {\n return this.http.get<Record<string, Page>>(\n `/v1/pages/${encodeURIComponent(slug)}/translations`\n );\n }\n}\n","import { HttpClient } from './http-client';\nimport { AnnouncementModule } from './modules/announcement';\nimport { BlogModule } from './modules/blog';\nimport { ChangelogModule } from './modules/changelog';\nimport { ConfigModule } from './modules/config';\nimport { HelpModule } from './modules/help';\nimport { PagesModule } from './modules/pages';\nimport type { KookeeConfig, HealthCheckResponse } from './types';\n\nexport class Kookee {\n private readonly http: HttpClient;\n\n public readonly announcements: AnnouncementModule;\n public readonly blog: BlogModule;\n public readonly changelog: ChangelogModule;\n public readonly config: ConfigModule;\n public readonly help: HelpModule;\n public readonly pages: PagesModule;\n\n constructor(config: KookeeConfig) {\n if (!config.apiKey) {\n throw new Error('apiKey is required');\n }\n\n this.http = new HttpClient(config.apiKey, config.baseUrl);\n\n this.announcements = new AnnouncementModule(this.http);\n this.blog = new BlogModule(this.http);\n this.changelog = new ChangelogModule(this.http);\n this.config = new ConfigModule(this.http);\n this.help = new HelpModule(this.http);\n this.pages = new PagesModule(this.http);\n }\n\n async health(): Promise<HealthCheckResponse> {\n return this.http.get<HealthCheckResponse>('/v1/health');\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kookee/sdk",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "description": "Official Kookee SDK - Access your blog, changelog, help center, and more",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",