@karakeep/sdk 0.23.2
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/LICENSE +661 -0
- package/README.md +64 -0
- package/dist/index.cjs +6 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +1484 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/package.json +52 -0
package/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Karakeep SDK
|
|
2
|
+
|
|
3
|
+
This package contains the official typescript SDK for the karakeep API.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
npm install @karakeep/sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { createHoarderClient } from "@karakeep/sdk";
|
|
15
|
+
|
|
16
|
+
// Create a client
|
|
17
|
+
const apiKey = "my-super-secret-key";
|
|
18
|
+
const addr = `https://karakeep.mydomain.com`;
|
|
19
|
+
const client = createHoarderClient({
|
|
20
|
+
baseUrl: `${addr}/api/v1/`,
|
|
21
|
+
headers: {
|
|
22
|
+
"Content-Type": "application/json",
|
|
23
|
+
authorization: `Bearer ${apiKey}`,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// Create a bookmark
|
|
28
|
+
const {
|
|
29
|
+
data: createdBookmark,
|
|
30
|
+
response: createResponse,
|
|
31
|
+
error: createError,
|
|
32
|
+
} = await client.POST("/bookmarks", {
|
|
33
|
+
body: {
|
|
34
|
+
type: "text",
|
|
35
|
+
title: "Search Test 1",
|
|
36
|
+
text: "This is a test bookmark for search",
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
console.log(createResponse.status, createdBookmark, createError);
|
|
41
|
+
|
|
42
|
+
// Search for bookmarks
|
|
43
|
+
const {
|
|
44
|
+
data: searchResults,
|
|
45
|
+
response: searchResponse,
|
|
46
|
+
error: searchError,
|
|
47
|
+
} = await client.GET("/bookmarks/search", {
|
|
48
|
+
params: {
|
|
49
|
+
query: {
|
|
50
|
+
q: "test bookmark",
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
console.log(searchResponse.status, searchResults, searchError);
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Docs
|
|
58
|
+
|
|
59
|
+
API docs can be found [here](https://docs.karakeep.app/api).
|
|
60
|
+
|
|
61
|
+
## Versioning
|
|
62
|
+
|
|
63
|
+
- This package follows the minor version of the karakeep server. So new APIs introduced in Karakeep version `0.21.0` will be available in this package starting from version `0.21.0`.
|
|
64
|
+
- Karakeep strives to maintain backward compatibility in its APIs, so older versions of this package should continue working with newer karakeep server versions.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const createClient = require("openapi-fetch");
|
|
4
|
+
const createHoarderClient = createClient;
|
|
5
|
+
exports.createHoarderClient = createHoarderClient;
|
|
6
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["import createClient from \"openapi-fetch\";\n\nimport type { paths } from \"./hoarder-api.d.ts\";\n\nexport const createHoarderClient = createClient<paths>;\n"],"names":[],"mappings":";;;AAIO,MAAM,sBAAsB;;"}
|