Skip to content

Commit e6657bd

Browse files
SDK regeneration
1 parent 804283a commit e6657bd

28 files changed

+435
-6
lines changed

reference.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,6 +1169,71 @@ await client.project.get();
11691169
</dl>
11701170
</details>
11711171

1172+
## Task
1173+
1174+
<details><summary><code>client.task.<a href="/src/api/resources/task/client/Client.ts">get</a>(taskId) -> Zep.ApidataGetTaskResponse</code></summary>
1175+
<dl>
1176+
<dd>
1177+
1178+
#### 📝 Description
1179+
1180+
<dl>
1181+
<dd>
1182+
1183+
<dl>
1184+
<dd>
1185+
1186+
Gets a task by its ID
1187+
1188+
</dd>
1189+
</dl>
1190+
</dd>
1191+
</dl>
1192+
1193+
#### 🔌 Usage
1194+
1195+
<dl>
1196+
<dd>
1197+
1198+
<dl>
1199+
<dd>
1200+
1201+
```typescript
1202+
await client.task.get("task_id");
1203+
```
1204+
1205+
</dd>
1206+
</dl>
1207+
</dd>
1208+
</dl>
1209+
1210+
#### ⚙️ Parameters
1211+
1212+
<dl>
1213+
<dd>
1214+
1215+
<dl>
1216+
<dd>
1217+
1218+
**taskId:** `string` — Task ID
1219+
1220+
</dd>
1221+
</dl>
1222+
1223+
<dl>
1224+
<dd>
1225+
1226+
**requestOptions:** `Task.RequestOptions`
1227+
1228+
</dd>
1229+
</dl>
1230+
</dd>
1231+
</dl>
1232+
1233+
</dd>
1234+
</dl>
1235+
</details>
1236+
11721237
## Thread
11731238

11741239
<details><summary><code>client.thread.<a href="/src/api/resources/thread/client/Client.ts">listAll</a>({ ...params }) -> Zep.ThreadListResponse</code></summary>

src/Client.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { mergeHeaders } from "./core/headers.js";
88
import { Context } from "./api/resources/context/client/Client.js";
99
import { Graph } from "./api/resources/graph/client/Client.js";
1010
import { Project } from "./api/resources/project/client/Client.js";
11+
import { Task } from "./api/resources/task/client/Client.js";
1112
import { Thread } from "./api/resources/thread/client/Client.js";
1213
import { User } from "./api/resources/user/client/Client.js";
1314

@@ -39,6 +40,7 @@ export class ZepClient {
3940
protected _context: Context | undefined;
4041
protected _graph: Graph | undefined;
4142
protected _project: Project | undefined;
43+
protected _task: Task | undefined;
4244
protected _thread: Thread | undefined;
4345
protected _user: User | undefined;
4446

@@ -49,8 +51,8 @@ export class ZepClient {
4951
{
5052
"X-Fern-Language": "JavaScript",
5153
"X-Fern-SDK-Name": "zep-cloud",
52-
"X-Fern-SDK-Version": "3.12.0",
53-
"User-Agent": "zep-cloud/3.12.0",
54+
"X-Fern-SDK-Version": "3.13.0",
55+
"User-Agent": "zep-cloud/3.13.0",
5456
"X-Fern-Runtime": core.RUNTIME.type,
5557
"X-Fern-Runtime-Version": core.RUNTIME.version,
5658
},
@@ -71,6 +73,10 @@ export class ZepClient {
7173
return (this._project ??= new Project(this._options));
7274
}
7375

76+
public get task(): Task {
77+
return (this._task ??= new Task(this._options));
78+
}
79+
7480
public get thread(): Thread {
7581
return (this._thread ??= new Thread(this._options));
7682
}

src/api/resources/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export * from "./thread/types/index.js";
33
export * as context from "./context/index.js";
44
export * as graph from "./graph/index.js";
55
export * as project from "./project/index.js";
6+
export * as task from "./task/index.js";
67
export * as user from "./user/index.js";
78
export * from "./context/client/requests/index.js";
89
export * from "./graph/client/requests/index.js";
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
/**
2+
* This file was auto-generated by Fern from our API Definition.
3+
*/
4+
5+
import * as environments from "../../../../environments.js";
6+
import * as core from "../../../../core/index.js";
7+
import * as Zep from "../../../index.js";
8+
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js";
9+
import * as serializers from "../../../../serialization/index.js";
10+
import * as errors from "../../../../errors/index.js";
11+
12+
export declare namespace Task {
13+
export interface Options {
14+
environment?: core.Supplier<environments.ZepEnvironment | string>;
15+
/** Specify a custom URL to connect the client to. */
16+
baseUrl?: core.Supplier<string>;
17+
apiKey?: core.Supplier<string | undefined>;
18+
/** Additional headers to include in requests. */
19+
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
20+
fetcher?: core.FetchFunction;
21+
}
22+
23+
export interface RequestOptions {
24+
/** The maximum time to wait for a response in seconds. */
25+
timeoutInSeconds?: number;
26+
/** The number of times to retry the request. Defaults to 2. */
27+
maxRetries?: number;
28+
/** A hook to abort the request. */
29+
abortSignal?: AbortSignal;
30+
/** Additional headers to include in the request. */
31+
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
32+
}
33+
}
34+
35+
export class Task {
36+
protected readonly _options: Task.Options;
37+
38+
constructor(_options: Task.Options = {}) {
39+
this._options = _options;
40+
}
41+
42+
/**
43+
* Gets a task by its ID
44+
*
45+
* @param {string} taskId - Task ID
46+
* @param {Task.RequestOptions} requestOptions - Request-specific configuration.
47+
*
48+
* @throws {@link Zep.NotFoundError}
49+
* @throws {@link Zep.InternalServerError}
50+
*
51+
* @example
52+
* await client.task.get("task_id")
53+
*/
54+
public get(
55+
taskId: string,
56+
requestOptions?: Task.RequestOptions,
57+
): core.HttpResponsePromise<Zep.ApidataGetTaskResponse> {
58+
return core.HttpResponsePromise.fromPromise(this.__get(taskId, requestOptions));
59+
}
60+
61+
private async __get(
62+
taskId: string,
63+
requestOptions?: Task.RequestOptions,
64+
): Promise<core.WithRawResponse<Zep.ApidataGetTaskResponse>> {
65+
const _response = await (this._options.fetcher ?? core.fetcher)({
66+
url: core.url.join(
67+
(await core.Supplier.get(this._options.baseUrl)) ??
68+
(await core.Supplier.get(this._options.environment)) ??
69+
environments.ZepEnvironment.Default,
70+
`tasks/${encodeURIComponent(taskId)}`,
71+
),
72+
method: "GET",
73+
headers: mergeHeaders(
74+
this._options?.headers,
75+
mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }),
76+
requestOptions?.headers,
77+
),
78+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
79+
maxRetries: requestOptions?.maxRetries,
80+
abortSignal: requestOptions?.abortSignal,
81+
});
82+
if (_response.ok) {
83+
return {
84+
data: serializers.ApidataGetTaskResponse.parseOrThrow(_response.body, {
85+
unrecognizedObjectKeys: "passthrough",
86+
allowUnrecognizedUnionMembers: true,
87+
allowUnrecognizedEnumValues: true,
88+
skipValidation: true,
89+
breadcrumbsPrefix: ["response"],
90+
}),
91+
rawResponse: _response.rawResponse,
92+
};
93+
}
94+
95+
if (_response.error.reason === "status-code") {
96+
switch (_response.error.statusCode) {
97+
case 404:
98+
throw new Zep.NotFoundError(
99+
serializers.ApiError.parseOrThrow(_response.error.body, {
100+
unrecognizedObjectKeys: "passthrough",
101+
allowUnrecognizedUnionMembers: true,
102+
allowUnrecognizedEnumValues: true,
103+
skipValidation: true,
104+
breadcrumbsPrefix: ["response"],
105+
}),
106+
_response.rawResponse,
107+
);
108+
case 500:
109+
throw new Zep.InternalServerError(
110+
serializers.ApiError.parseOrThrow(_response.error.body, {
111+
unrecognizedObjectKeys: "passthrough",
112+
allowUnrecognizedUnionMembers: true,
113+
allowUnrecognizedEnumValues: true,
114+
skipValidation: true,
115+
breadcrumbsPrefix: ["response"],
116+
}),
117+
_response.rawResponse,
118+
);
119+
default:
120+
throw new errors.ZepError({
121+
statusCode: _response.error.statusCode,
122+
body: _response.error.body,
123+
rawResponse: _response.rawResponse,
124+
});
125+
}
126+
}
127+
128+
switch (_response.error.reason) {
129+
case "non-json":
130+
throw new errors.ZepError({
131+
statusCode: _response.error.statusCode,
132+
body: _response.error.rawBody,
133+
rawResponse: _response.rawResponse,
134+
});
135+
case "timeout":
136+
throw new errors.ZepTimeoutError("Timeout exceeded when calling GET /tasks/{task_id}.");
137+
case "unknown":
138+
throw new errors.ZepError({
139+
message: _response.error.errorMessage,
140+
rawResponse: _response.rawResponse,
141+
});
142+
}
143+
}
144+
145+
protected async _getCustomAuthorizationHeaders() {
146+
const apiKeyValue = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["ZEP_API_KEY"];
147+
return { Authorization: `Api-Key ${apiKeyValue}` };
148+
}
149+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};

src/api/resources/task/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./client/index.js";

src/api/types/AddThreadMessagesResponse.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
export interface AddThreadMessagesResponse {
66
context?: string;
77
messageUuids?: string[];
8+
taskId?: string;
89
}

src/api/types/AddTripleResponse.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ export interface AddTripleResponse {
88
edge?: Zep.EntityEdge;
99
sourceNode?: Zep.EntityNode;
1010
targetNode?: Zep.EntityNode;
11+
/** Task ID of the add triple task */
12+
taskId?: string;
1113
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* This file was auto-generated by Fern from our API Definition.
3+
*/
4+
5+
import * as Zep from "../index.js";
6+
7+
export interface ApidataGetTaskResponse {
8+
completedAt?: string;
9+
createdAt?: string;
10+
error?: Zep.ApidataTaskErrorResponse;
11+
progress?: Zep.ApidataTaskProgress;
12+
startedAt?: string;
13+
status?: string;
14+
taskId?: string;
15+
type?: string;
16+
updatedAt?: string;
17+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* This file was auto-generated by Fern from our API Definition.
3+
*/
4+
5+
export interface ApidataTaskErrorResponse {
6+
code?: string;
7+
details?: Record<string, unknown>;
8+
message?: string;
9+
}

0 commit comments

Comments
 (0)