Skip to content

Commit

Permalink
feat: Regenerate fern clients
Browse files Browse the repository at this point in the history
Signed-off-by: Diwank Singh Tomer <[email protected]>
  • Loading branch information
creatorrr committed Feb 27, 2024
1 parent f41f374 commit 10c0d98
Show file tree
Hide file tree
Showing 26 changed files with 630 additions and 4 deletions.
9 changes: 8 additions & 1 deletion sdks/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
"name": "@julep/sdk",
"version": "0.2.2",
"description": "Julep is a platform for creating agents with long-term memory",
"keywords": ["julep-ai", "julep", "agents", "llms", "memory", "ai"],
"keywords": [
"julep-ai",
"julep",
"agents",
"llms",
"memory",
"ai"
],
"author": {
"name": "Julep",
"email": "[email protected]"
Expand Down
10 changes: 10 additions & 0 deletions sdks/js/src/api/Client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,5 +370,15 @@ export declare class JulepApiClient {
toolId: string,
requestOptions?: JulepApiClient.RequestOptions,
): Promise<void>;
/**
*
*
* @example
* await julepApi.getJobStatus("job_id")
*/
getJobStatus(
jobId: string,
requestOptions?: JulepApiClient.RequestOptions,
): Promise<JulepApi.JobStatus>;
protected _getAuthorizationHeader(): Promise<string>;
}
65 changes: 65 additions & 0 deletions sdks/js/src/api/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -2227,6 +2227,71 @@ class JulepApiClient {
}
});
}
/**
*
*
* @example
* await julepApi.getJobStatus("job_id")
*/
getJobStatus(jobId, requestOptions) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const _response = yield core.fetcher({
url: (0, url_join_1.default)(
(_a = yield core.Supplier.get(this._options.environment)) !== null &&
_a !== void 0
? _a
: environments.JulepApiEnvironment.Default,
`jobs/${jobId}`,
),
method: "GET",
headers: {
Authorization: yield this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
contentType: "application/json",
timeoutMs:
(requestOptions === null || requestOptions === void 0
? void 0
: requestOptions.timeoutInSeconds) != null
? requestOptions.timeoutInSeconds * 1000
: 300000,
maxRetries:
requestOptions === null || requestOptions === void 0
? void 0
: requestOptions.maxRetries,
});
if (_response.ok) {
return yield serializers.JobStatus.parseOrThrow(_response.body, {
unrecognizedObjectKeys: "passthrough",
allowUnrecognizedUnionMembers: true,
allowUnrecognizedEnumValues: true,
breadcrumbsPrefix: ["response"],
});
}
if (_response.error.reason === "status-code") {
throw new errors.JulepApiError({
statusCode: _response.error.statusCode,
body: _response.error.body,
});
}
switch (_response.error.reason) {
case "non-json":
throw new errors.JulepApiError({
statusCode: _response.error.statusCode,
body: _response.error.rawBody,
});
case "timeout":
throw new errors.JulepApiTimeoutError();
case "unknown":
throw new errors.JulepApiError({
message: _response.error.errorMessage,
});
}
});
}
_getAuthorizationHeader() {
return __awaiter(this, void 0, void 0, function* () {
const value = yield core.Supplier.get(this._options.apiKey);
Expand Down
2 changes: 2 additions & 0 deletions sdks/js/src/api/api/types/Doc.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ export interface Doc {
content: string;
/** ID of doc */
id: string;
/** Doc created at */
createdAt: Date;
}
22 changes: 22 additions & 0 deletions sdks/js/src/api/api/types/JobStatus.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
import * as JulepApi from "..";
export interface JobStatus {
/** Name of the job */
name: string;
/** Reason for current state */
reason?: string;
/** Job created at (RFC-3339 format) */
createdAt: Date;
/** Job updated at (RFC-3339 format) */
updatedAt?: Date;
/** Job id (UUID) */
id: string;
/** Whether this Job supports progress updates */
hasProgress?: boolean;
/** Progress percentage */
progress?: number;
/** Current state (one of: pending, in_progress, retrying, succeeded, aborted, failed) */
state: JulepApi.JobStatusState;
}
5 changes: 5 additions & 0 deletions sdks/js/src/api/api/types/JobStatus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";
/**
* This file was auto-generated by Fern from our API Definition.
*/
Object.defineProperty(exports, "__esModule", { value: true });
21 changes: 21 additions & 0 deletions sdks/js/src/api/api/types/JobStatusState.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
/**
* Current state (one of: pending, in_progress, retrying, succeeded, aborted, failed)
*/
export declare type JobStatusState =
| "pending"
| "in_progress"
| "retrying"
| "succeeded"
| "aborted"
| "failed";
export declare const JobStatusState: {
readonly Pending: "pending";
readonly InProgress: "in_progress";
readonly Retrying: "retrying";
readonly Succeeded: "succeeded";
readonly Aborted: "aborted";
readonly Failed: "failed";
};
14 changes: 14 additions & 0 deletions sdks/js/src/api/api/types/JobStatusState.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"use strict";
/**
* This file was auto-generated by Fern from our API Definition.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.JobStatusState = void 0;
exports.JobStatusState = {
Pending: "pending",
InProgress: "in_progress",
Retrying: "retrying",
Succeeded: "succeeded",
Aborted: "aborted",
Failed: "failed",
};
2 changes: 2 additions & 0 deletions sdks/js/src/api/api/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ export * from "./CreateToolRequest";
export * from "./ResourceCreatedResponse";
export * from "./ResourceUpdatedResponse";
export * from "./ResourceDeletedResponse";
export * from "./JobStatusState";
export * from "./JobStatus";
2 changes: 2 additions & 0 deletions sdks/js/src/api/api/types/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,5 @@ __exportStar(require("./CreateToolRequest"), exports);
__exportStar(require("./ResourceCreatedResponse"), exports);
__exportStar(require("./ResourceUpdatedResponse"), exports);
__exportStar(require("./ResourceDeletedResponse"), exports);
__exportStar(require("./JobStatusState"), exports);
__exportStar(require("./JobStatus"), exports);
1 change: 1 addition & 0 deletions sdks/js/src/api/serialization/types/Doc.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ export declare namespace Doc {
title: string;
content: string;
id: string;
created_at: string;
}
}
4 changes: 4 additions & 0 deletions sdks/js/src/api/serialization/types/Doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,8 @@ exports.Doc = core.serialization.object({
title: core.serialization.string(),
content: core.serialization.string(),
id: core.serialization.string(),
createdAt: core.serialization.property(
"created_at",
core.serialization.date(),
),
});
22 changes: 22 additions & 0 deletions sdks/js/src/api/serialization/types/JobStatus.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
import * as serializers from "..";
import * as JulepApi from "../../api";
import * as core from "../../core";
export declare const JobStatus: core.serialization.ObjectSchema<
serializers.JobStatus.Raw,
JulepApi.JobStatus
>;
export declare namespace JobStatus {
interface Raw {
name: string;
reason?: string | null;
created_at: string;
updated_at?: string | null;
id: string;
has_progress?: boolean | null;
progress?: number | null;
state: serializers.JobStatusState.Raw;
}
}
108 changes: 108 additions & 0 deletions sdks/js/src/api/serialization/types/JobStatus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
"use strict";
/**
* This file was auto-generated by Fern from our API Definition.
*/
var __createBinding =
(this && this.__createBinding) ||
(Object.create
? function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (
!desc ||
("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
) {
desc = {
enumerable: true,
get: function () {
return m[k];
},
};
}
Object.defineProperty(o, k2, desc);
}
: function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
var __setModuleDefault =
(this && this.__setModuleDefault) ||
(Object.create
? function (o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}
: function (o, v) {
o["default"] = v;
});
var __importStar =
(this && this.__importStar) ||
function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null)
for (var k in mod)
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
__createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter =
(this && this.__awaiter) ||
function (thisArg, _arguments, P, generator) {
function adopt(value) {
return value instanceof P
? value
: new P(function (resolve) {
resolve(value);
});
}
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator["throw"](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done
? resolve(result.value)
: adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.JobStatus = void 0;
const core = __importStar(require("../../core"));
exports.JobStatus = core.serialization.object({
name: core.serialization.string(),
reason: core.serialization.string().optional(),
createdAt: core.serialization.property(
"created_at",
core.serialization.date(),
),
updatedAt: core.serialization.property(
"updated_at",
core.serialization.date().optional(),
),
id: core.serialization.string(),
hasProgress: core.serialization.property(
"has_progress",
core.serialization.boolean().optional(),
),
progress: core.serialization.number().optional(),
state: core.serialization.lazy(() =>
__awaiter(void 0, void 0, void 0, function* () {
return (yield Promise.resolve().then(() => __importStar(require(".."))))
.JobStatusState;
}),
),
});
19 changes: 19 additions & 0 deletions sdks/js/src/api/serialization/types/JobStatusState.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
import * as serializers from "..";
import * as JulepApi from "../../api";
import * as core from "../../core";
export declare const JobStatusState: core.serialization.Schema<
serializers.JobStatusState.Raw,
JulepApi.JobStatusState
>;
export declare namespace JobStatusState {
type Raw =
| "pending"
| "in_progress"
| "retrying"
| "succeeded"
| "aborted"
| "failed";
}
Loading

0 comments on commit 10c0d98

Please sign in to comment.