@embed-ai/sdk 0.1.4 → 0.2.1
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 +1 -1
- package/package.json +3 -3
- package/src/client.js +12 -7
- package/src/feed/feed.js +2 -2
- package/src/feed/namespace.d.ts +1 -1
package/README.md
CHANGED
|
@@ -330,7 +330,7 @@ await client.feed.byWalletAddress(walletAddress: string, options?: FeedOptions)
|
|
|
330
330
|
// Feed management to create new feeds and manage these custom feeds e.g. as custom feed per user in your app, which can be built on top of base feeds
|
|
331
331
|
await client.feed.createConfig(options: CreateFeedOptions)
|
|
332
332
|
await client.feed.getConfig(configId: string)
|
|
333
|
-
await client.feed.listConfigs(visibility?: "private" | "public")
|
|
333
|
+
await client.feed.listConfigs(visibility?: "private" | "template" | "public")
|
|
334
334
|
await client.feed.updateConfig(options: UpdateFeedOptions)
|
|
335
335
|
```
|
|
336
336
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embed-ai/sdk",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"main": "src/index.js",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"description": "The typescript sdk package for embed AI APIs.",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/ZKAI-Network/embed-sdk
|
|
9
|
+
"url": "git+https://github.com/ZKAI-Network/embed-sdk.git",
|
|
10
10
|
"directory": "packages/sdk"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"coverage": "vitest --coverage"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@embed-ai/types": "^0.1.
|
|
38
|
+
"@embed-ai/types": "^0.1.4"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@effect/vitest": "latest",
|
package/src/client.js
CHANGED
|
@@ -63,7 +63,7 @@ class HttpClient {
|
|
|
63
63
|
constructor(config) {
|
|
64
64
|
this.config = {
|
|
65
65
|
baseUrl: config.baseUrl ?? DEFAULT_CONFIG.baseUrl,
|
|
66
|
-
title: config.title ??
|
|
66
|
+
title: config.title ?? "",
|
|
67
67
|
referer: config.referer ?? "",
|
|
68
68
|
token: config.token,
|
|
69
69
|
retry: {
|
|
@@ -105,14 +105,19 @@ class HttpClient {
|
|
|
105
105
|
const url = this.buildUrl(endpoint, baseUrl, queryParams);
|
|
106
106
|
return Effect.tryPromise({
|
|
107
107
|
try: async () => {
|
|
108
|
+
const headers = {
|
|
109
|
+
"Authorization": useBasicAuth ? `Basic ${this.config.token}` : `Bearer ${this.config.token}`,
|
|
110
|
+
"Accept": "application/json"
|
|
111
|
+
};
|
|
112
|
+
if (this.config.referer) {
|
|
113
|
+
headers["HTTP-Referer"] = this.config.referer;
|
|
114
|
+
}
|
|
115
|
+
if (this.config.title) {
|
|
116
|
+
headers["X-Title"] = this.config.title;
|
|
117
|
+
}
|
|
108
118
|
const requestOptions = {
|
|
109
119
|
method,
|
|
110
|
-
headers
|
|
111
|
-
"Authorization": useBasicAuth ? `Basic ${this.config.token}` : `Bearer ${this.config.token}`,
|
|
112
|
-
"Accept": "application/json",
|
|
113
|
-
"HTTP-Referer": this.config.referer,
|
|
114
|
-
"X-Title": this.config.title
|
|
115
|
-
}
|
|
120
|
+
headers
|
|
116
121
|
};
|
|
117
122
|
// Add Content-Type and body for POST/PATCH requests
|
|
118
123
|
if (method !== "GET" && body) {
|
package/src/feed/feed.js
CHANGED
|
@@ -16,7 +16,7 @@ async function byUserId(httpClient, userId, feedId, options) {
|
|
|
16
16
|
feed_id: feedId,
|
|
17
17
|
...options
|
|
18
18
|
};
|
|
19
|
-
const response = await httpClient.post("/
|
|
19
|
+
const response = await httpClient.post("/v3/for-you", params);
|
|
20
20
|
return [...response.body];
|
|
21
21
|
}
|
|
22
22
|
async function byWalletAddress(httpClient, walletAddress, feedId, options) {
|
|
@@ -30,7 +30,7 @@ async function byWalletAddress(httpClient, walletAddress, feedId, options) {
|
|
|
30
30
|
feed_id: feedId,
|
|
31
31
|
...options
|
|
32
32
|
};
|
|
33
|
-
const response = await httpClient.post("/
|
|
33
|
+
const response = await httpClient.post("/v3/for-you", params);
|
|
34
34
|
return [...response.body];
|
|
35
35
|
}
|
|
36
36
|
//# sourceMappingURL=feed.js.map
|
package/src/feed/namespace.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export declare class FeedNamespace {
|
|
|
40
40
|
* console.log(feed[0].metadata?.author.username) // Access author username
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
|
-
byUserId(userId: string, feedId
|
|
43
|
+
byUserId(userId: string, feedId: string, options?: FeedOptions): Promise<ForYouResponse>;
|
|
44
44
|
/**
|
|
45
45
|
* Get personalized "For You" feed by wallet address
|
|
46
46
|
*
|