@kookee/sdk 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -54
- package/package.json +8 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @kookee/sdk
|
|
2
2
|
|
|
3
|
-
Official SDK for Kookee - Access your blog
|
|
3
|
+
Official SDK for Kookee - Access your blog content via a simple API.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -18,7 +18,7 @@ yarn add @kookee/sdk
|
|
|
18
18
|
import { Kookee } from '@kookee/sdk';
|
|
19
19
|
|
|
20
20
|
const kookee = new Kookee({
|
|
21
|
-
|
|
21
|
+
apiKey: 'your-api-key',
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
// Fetch blog posts
|
|
@@ -28,79 +28,70 @@ const posts = await kookee.blog.list({ limit: 10 });
|
|
|
28
28
|
const post = await kookee.blog.getBySlug('hello-world');
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
##
|
|
32
|
-
|
|
33
|
-
### Blog
|
|
31
|
+
## Blog
|
|
34
32
|
|
|
35
33
|
```typescript
|
|
36
34
|
// List posts with pagination
|
|
37
|
-
const posts = await kookee.blog.list({
|
|
35
|
+
const posts = await kookee.blog.list({ page: 1, limit: 10 });
|
|
38
36
|
|
|
39
|
-
// Filter by tag
|
|
37
|
+
// Filter by tag slug
|
|
40
38
|
const taggedPosts = await kookee.blog.list({ tag: 'news' });
|
|
41
39
|
|
|
42
|
-
//
|
|
40
|
+
// Search posts
|
|
41
|
+
const searchResults = await kookee.blog.list({ search: 'tutorial' });
|
|
42
|
+
|
|
43
|
+
// Get single post by slug
|
|
43
44
|
const post = await kookee.blog.getBySlug('my-post');
|
|
44
45
|
|
|
45
|
-
// Get
|
|
46
|
+
// Get single post by ID
|
|
47
|
+
const postById = await kookee.blog.getById('post-uuid');
|
|
48
|
+
|
|
49
|
+
// Get all tags with post counts
|
|
46
50
|
const tags = await kookee.blog.getTags();
|
|
47
51
|
```
|
|
48
52
|
|
|
49
|
-
|
|
53
|
+
## Response Types
|
|
50
54
|
|
|
51
|
-
|
|
52
|
-
// List changelog entries
|
|
53
|
-
const entries = await kookee.changelog.list();
|
|
54
|
-
|
|
55
|
-
// Filter by type
|
|
56
|
-
const features = await kookee.changelog.list({ type: 'feature' });
|
|
57
|
-
|
|
58
|
-
// Get single entry
|
|
59
|
-
const entry = await kookee.changelog.getBySlug('v1.0.0');
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### Help Center
|
|
55
|
+
### BlogPostListItem (returned by `list()`)
|
|
63
56
|
|
|
64
57
|
```typescript
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
// Get single article
|
|
80
|
-
const article = await kookee.helpCenter.getArticleBySlug('installation');
|
|
58
|
+
interface BlogPostListItem {
|
|
59
|
+
id: string;
|
|
60
|
+
slug: string;
|
|
61
|
+
title: string;
|
|
62
|
+
excerptHtml: string | null;
|
|
63
|
+
coverImageUrl: string | null;
|
|
64
|
+
status: string;
|
|
65
|
+
publishedAt: string | null;
|
|
66
|
+
metadata: Record<string, unknown> | null;
|
|
67
|
+
createdAt: string;
|
|
68
|
+
author: { name: string };
|
|
69
|
+
tags: Array<{ name: string; slug: string }>;
|
|
70
|
+
}
|
|
81
71
|
```
|
|
82
72
|
|
|
83
|
-
###
|
|
73
|
+
### BlogPost (returned by `getBySlug()` and `getById()`)
|
|
84
74
|
|
|
85
75
|
```typescript
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
message: 'Hello!',
|
|
93
|
-
});
|
|
76
|
+
interface BlogPost extends BlogPostListItem {
|
|
77
|
+
contentHtml: string;
|
|
78
|
+
metaTitle: string | null;
|
|
79
|
+
metaDescription: string | null;
|
|
80
|
+
updatedAt: string;
|
|
81
|
+
}
|
|
94
82
|
```
|
|
95
83
|
|
|
96
|
-
###
|
|
84
|
+
### Paginated Response
|
|
97
85
|
|
|
98
86
|
```typescript
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
87
|
+
interface PaginatedResponse<T> {
|
|
88
|
+
data: T[];
|
|
89
|
+
total: number;
|
|
90
|
+
limit: number;
|
|
91
|
+
offset: number;
|
|
92
|
+
page: number;
|
|
93
|
+
totalPages: number;
|
|
94
|
+
}
|
|
104
95
|
```
|
|
105
96
|
|
|
106
97
|
## Error Handling
|
|
@@ -118,12 +109,21 @@ try {
|
|
|
118
109
|
}
|
|
119
110
|
```
|
|
120
111
|
|
|
112
|
+
## Configuration
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
const kookee = new Kookee({
|
|
116
|
+
apiKey: 'your-api-key',
|
|
117
|
+
baseUrl: 'https://api.kookee.dev', // optional, defaults to production API
|
|
118
|
+
});
|
|
119
|
+
```
|
|
120
|
+
|
|
121
121
|
## TypeScript
|
|
122
122
|
|
|
123
123
|
The SDK is written in TypeScript and provides full type definitions:
|
|
124
124
|
|
|
125
125
|
```typescript
|
|
126
|
-
import type { BlogPost,
|
|
126
|
+
import type { BlogPost, BlogPostListItem, BlogTag, PaginatedResponse } from '@kookee/sdk';
|
|
127
127
|
```
|
|
128
128
|
|
|
129
129
|
## License
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kookee/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
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",
|
|
@@ -29,12 +29,15 @@
|
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"repository": {
|
|
31
31
|
"type": "git",
|
|
32
|
-
"url": "https://github.com/kookee/sdk"
|
|
32
|
+
"url": "https://github.com/kookee-dot-dev/kookee-ts-sdk"
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://kookee.dev",
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@
|
|
37
|
-
"
|
|
36
|
+
"@types/node": "^22.10.2",
|
|
37
|
+
"eslint": "^9.17.0",
|
|
38
|
+
"tsup": "^8.3.5",
|
|
39
|
+
"typescript": "^5.7.2",
|
|
40
|
+
"typescript-eslint": "^8.18.2"
|
|
38
41
|
},
|
|
39
42
|
"publishConfig": {
|
|
40
43
|
"access": "public"
|
|
@@ -43,6 +46,6 @@
|
|
|
43
46
|
"scripts": {
|
|
44
47
|
"build": "tsup",
|
|
45
48
|
"dev": "tsup --watch",
|
|
46
|
-
"lint": "tsc --
|
|
49
|
+
"lint": "tsc --noEmit && eslint ."
|
|
47
50
|
}
|
|
48
51
|
}
|