Tree BG 1
Tree
Tree
TreeLeaves
TreeLeaves
Cat IdleGrassGrassRockRock

Accès des bibliothèques bêta

API Libraries (bêta) - gérer l'accès à une bibliothèque.

Lister tous les accès à cette bibliothèque.

GET /v1/libraries/{library_id}/share

Étant donné une bibliothèque, lister toutes les entités qui ont accès et à quel niveau.

200

Réponse réussie

Playground

Testez les endpoints en direct

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

const mistral = new Mistral({
  apiKey: "MISTRAL_API_KEY",
});

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

  console.log(result);
}

run();
from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.libraries.accesses.list(library_id="d2169833-d8e2-416e-a372-76518d3d99c2")

    # Handle response
    print(res)

curl https://api.mistral.ai/v1/libraries/{library_id}/share \
 -X GET \
 -H 'Authorization: Bearer YOUR_APIKEY_HERE'

200

{
  "data": [
    {
      "library_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
      "org_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
      "role": "user",
      "share_with_type": "User",
      "share_with_uuid": null
    }
  ]
}

Créer ou mettre à jour un niveau d'accès.

PUT /v1/libraries/{library_id}/share

Étant donné un identifiant de bibliothèque, vous pouvez créer ou mettre à jour le niveau d'accès d'une entité. Vous devez être propriétaire de la bibliothèque pour partager une bibliothèque. Un propriétaire ne peut pas modifier son propre rôle. Une bibliothèque ne peut pas être partagée en dehors de l'organisation.

200

Réponse réussie

library_id
*string
org_id
*string
role
*string
share_with_type
*string
share_with_uuid
*string|null
user_id
string|null

Playground

Testez les endpoints en direct

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

const mistral = new Mistral({
  apiKey: "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();
from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.libraries.accesses.update_or_create(library_id="36de3a24-5b1c-4c8f-9d84-d5642205a976", level="Viewer", share_with_uuid="0ae92ecb-21ed-47c5-9f7e-0b2cbe325a20", share_with_type="User")

    # Handle response
    print(res)

curl https://api.mistral.ai/v1/libraries/{library_id}/share \
 -X PUT \
 -H 'Authorization: Bearer YOUR_APIKEY_HERE' \
 -H 'Content-Type: application/json' \
 -d '{
  "level": "Viewer",
  "share_with_type": "User",
  "share_with_uuid": "019b2bd7-96e7-7219-8c0b-45a73da50088"
}'

200

{
  "library_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
  "org_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
  "role": "user",
  "share_with_type": "User",
  "share_with_uuid": null
}

Supprimer un niveau d'accès.

DELETE /v1/libraries/{library_id}/share

Étant donné un identifiant de bibliothèque, vous pouvez supprimer le niveau d'accès d'une entité. Un propriétaire ne peut pas supprimer son propre accès. Vous devez être le propriétaire de la bibliothèque pour supprimer un accès autre que le vôtre. Attention : la réponse passera de 200 (renvoyant le partage supprimé) à 204 No Content dans une version future.

200

Réponse réussie

library_id
*string
org_id
*string
role
*string
share_with_type
*string
share_with_uuid
*string|null
user_id
string|null

Playground

Testez les endpoints en direct

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

const mistral = new Mistral({
  apiKey: "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();
from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.libraries.accesses.delete(library_id="709e3cad-9fb2-4f4e-bf88-143cf1808107", share_with_uuid="b843cc47-ce8f-4354-8cfc-5fcd7fb2865b", share_with_type="User")

    # Handle response
    print(res)

curl https://api.mistral.ai/v1/libraries/{library_id}/share \
 -X DELETE \
 -H 'Authorization: Bearer YOUR_APIKEY_HERE' \
 -H 'Content-Type: application/json' \
 -d '{
  "share_with_type": "User",
  "share_with_uuid": "019b2bd7-96e7-7219-8c0b-45a73da50088"
}'

200

{
  "library_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
  "org_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
  "role": "user",
  "share_with_type": "User",
  "share_with_uuid": null
}