Skip to content

Latest commit

 

History

History
85 lines (61 loc) · 5.88 KB

File metadata and controls

85 lines (61 loc) · 5.88 KB

Sessions

(sessions)

Overview

Operations related to sessions

Available Operations

  • sessions - Returns a list of Session objects.

sessions

Returns a list of Session objects.

Example Usage

import { OpalMcp } from "opal-mcp";

const opalMcp = new OpalMcp({
  bearerAuth: process.env["OPALMCP_BEARER_AUTH"] ?? "",
});

async function run() {
  const result = await opalMcp.sessions.sessions({
    resourceId: "1b978423-db0a-4037-a4cf-f79c60cb67b3",
    userId: "32acc112-21ff-4669-91c2-21e27683eaa1",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { OpalMcpCore } from "opal-mcp/core.js";
import { sessionsSessions } from "opal-mcp/funcs/sessionsSessions.js";

// Use `OpalMcpCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const opalMcp = new OpalMcpCore({
  bearerAuth: process.env["OPALMCP_BEARER_AUTH"] ?? "",
});

async function run() {
  const res = await sessionsSessions(opalMcp, {
    resourceId: "1b978423-db0a-4037-a4cf-f79c60cb67b3",
    userId: "32acc112-21ff-4669-91c2-21e27683eaa1",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("sessionsSessions failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.SessionsRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit 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 Enables retrying HTTP requests under certain failure conditions.

Response

Promise<components.SessionsList>

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*