ChatAndSessions¶
Overview¶
Chat and session management endpoints
Available Operations¶
- manageSession - Manage Session
- listSessions - List Chat Sessions
- getSessionInfo - Get Session Info
manageSession¶
Manage a chat session by creating it, deleting it, clearing its messages, or editing its name.
Example Usage¶
import { Fermisdk } from "fermisdk";
const fermisdk = new Fermisdk({
bearerAuth: process.env["FERMISDK_BEARER_AUTH"] ?? "",
});
async function run() {
const result = await fermisdk.chatAndSessions.manageSession({
action: "create",
});
console.log(result);
}
run();
Standalone function¶
The standalone function version of this method:
import { FermisdkCore } from "fermisdk/core.js";
import { chatAndSessionsManageSession } from "fermisdk/funcs/chatAndSessionsManageSession.js";
// Use `FermisdkCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const fermisdk = new FermisdkCore({
bearerAuth: process.env["FERMISDK_BEARER_AUTH"] ?? "",
});
async function run() {
const res = await chatAndSessionsManageSession(fermisdk, {
action: "create",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("chatAndSessionsManageSession failed:", res.error);
}
}
run();
Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
request | models.SessionActionRequest | :heavy_check_mark: | The request object to use for the request. |
options | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries | RetryConfig | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response¶
Promise\<models.SessionActionResponse>
Errors¶
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ErrorT | 400 | application/json |
| errors.ErrorT | 500 | application/json |
| errors.FermisdkDefaultError | 4XX, 5XX | */* |
listSessions¶
List chat sessions for the authenticated user.
Example Usage¶
import { Fermisdk } from "fermisdk";
const fermisdk = new Fermisdk({
bearerAuth: process.env["FERMISDK_BEARER_AUTH"] ?? "",
});
async function run() {
const result = await fermisdk.chatAndSessions.listSessions({});
console.log(result);
}
run();
Standalone function¶
The standalone function version of this method:
import { FermisdkCore } from "fermisdk/core.js";
import { chatAndSessionsListSessions } from "fermisdk/funcs/chatAndSessionsListSessions.js";
// Use `FermisdkCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const fermisdk = new FermisdkCore({
bearerAuth: process.env["FERMISDK_BEARER_AUTH"] ?? "",
});
async function run() {
const res = await chatAndSessionsListSessions(fermisdk, {});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("chatAndSessionsListSessions failed:", res.error);
}
}
run();
Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.ListSessionsRequest | :heavy_check_mark: | The request object to use for the request. |
options | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries | RetryConfig | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response¶
Promise\<models.SessionListResponse>
Errors¶
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ErrorT | 500 | application/json |
| errors.FermisdkDefaultError | 4XX, 5XX | */* |
getSessionInfo¶
Get information about a session including message count and metadata.
Example Usage¶
import { Fermisdk } from "fermisdk";
const fermisdk = new Fermisdk({
bearerAuth: process.env["FERMISDK_BEARER_AUTH"] ?? "",
});
async function run() {
const result = await fermisdk.chatAndSessions.getSessionInfo({
sessionId: "<id>",
});
console.log(result);
}
run();
Standalone function¶
The standalone function version of this method:
import { FermisdkCore } from "fermisdk/core.js";
import { chatAndSessionsGetSessionInfo } from "fermisdk/funcs/chatAndSessionsGetSessionInfo.js";
// Use `FermisdkCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const fermisdk = new FermisdkCore({
bearerAuth: process.env["FERMISDK_BEARER_AUTH"] ?? "",
});
async function run() {
const res = await chatAndSessionsGetSessionInfo(fermisdk, {
sessionId: "<id>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("chatAndSessionsGetSessionInfo failed:", res.error);
}
}
run();
Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.GetSessionInfoRequest | :heavy_check_mark: | The request object to use for the request. |
options | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries | RetryConfig | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response¶
Promise\<models.SessionInfo>
Errors¶
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ErrorT | 404 | application/json |
| errors.ErrorT | 500 | application/json |
| errors.FermisdkDefaultError | 4XX, 5XX | */* |