This repository has been archived on 2026-03-06. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
openclaw-extensions/wecom/node_modules/@mistralai/mistralai/docs/sdks/accesses

Accesses

(beta.libraries.accesses)

Overview

(beta) Libraries API - manage access to a library.

Available Operations

  • list - List all of the access to this library.
  • updateOrCreate - Create or update an access level.
  • delete - Delete an access level.

list

Given a library, list all of the Entity that have access and to what level.

Example Usage

import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: process.env["MISTRAL_API_KEY"] ?? "",
});

async function run() {
  const result = await mistral.beta.libraries.accesses.list({
    libraryId: "d2169833-d8e2-416e-a372-76518d3d99c2",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MistralCore } from "@mistralai/mistralai/core.js";
import { betaLibrariesAccessesList } from "@mistralai/mistralai/funcs/betaLibrariesAccessesList.js";

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

async function run() {
  const res = await betaLibrariesAccessesList(mistral, {
    libraryId: "d2169833-d8e2-416e-a372-76518d3d99c2",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("betaLibrariesAccessesList failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.LibrariesShareListV1Request ✔️ 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.ListSharingOut>

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

updateOrCreate

Given a library id, you can create or update the access level of an entity. You have to be owner of the library to share a library. An owner cannot change their own role. A library cannot be shared outside of the organization.

Example Usage

import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: process.env["MISTRAL_API_KEY"] ?? "",
});

async function run() {
  const result = await mistral.beta.libraries.accesses.updateOrCreate({
    libraryId: "36de3a24-5b1c-4c8f-9d84-d5642205a976",
    sharingIn: {
      orgId: "aadd9ae1-f285-4437-884a-091c77efa6fd",
      level: "Viewer",
      shareWithUuid: "0ae92ecb-21ed-47c5-9f7e-0b2cbe325a20",
      shareWithType: "User",
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MistralCore } from "@mistralai/mistralai/core.js";
import { betaLibrariesAccessesUpdateOrCreate } from "@mistralai/mistralai/funcs/betaLibrariesAccessesUpdateOrCreate.js";

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

async function run() {
  const res = await betaLibrariesAccessesUpdateOrCreate(mistral, {
    libraryId: "36de3a24-5b1c-4c8f-9d84-d5642205a976",
    sharingIn: {
      orgId: "aadd9ae1-f285-4437-884a-091c77efa6fd",
      level: "Viewer",
      shareWithUuid: "0ae92ecb-21ed-47c5-9f7e-0b2cbe325a20",
      shareWithType: "User",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("betaLibrariesAccessesUpdateOrCreate failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.LibrariesShareCreateV1Request ✔️ 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.SharingOut>

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

delete

Given a library id, you can delete the access level of an entity. An owner cannot delete it's own access. You have to be the owner of the library to delete an acces other than yours.

Example Usage

import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: process.env["MISTRAL_API_KEY"] ?? "",
});

async function run() {
  const result = await mistral.beta.libraries.accesses.delete({
    libraryId: "709e3cad-9fb2-4f4e-bf88-143cf1808107",
    sharingDelete: {
      orgId: "0814a235-c2d0-4814-875a-4b85f93d3dc7",
      shareWithUuid: "b843cc47-ce8f-4354-8cfc-5fcd7fb2865b",
      shareWithType: "User",
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { MistralCore } from "@mistralai/mistralai/core.js";
import { betaLibrariesAccessesDelete } from "@mistralai/mistralai/funcs/betaLibrariesAccessesDelete.js";

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

async function run() {
  const res = await betaLibrariesAccessesDelete(mistral, {
    libraryId: "709e3cad-9fb2-4f4e-bf88-143cf1808107",
    sharingDelete: {
      orgId: "0814a235-c2d0-4814-875a-4b85f93d3dc7",
      shareWithUuid: "b843cc47-ce8f-4354-8cfc-5fcd7fb2865b",
      shareWithType: "User",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("betaLibrariesAccessesDelete failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.LibrariesShareDeleteV1Request ✔️ 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.SharingOut>

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*