Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

README.md

Beta.Libraries.Accesses

Overview

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

Available Operations

  • list - List all of the access to this library.
  • update_or_create - 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

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)

Parameters

Parameter Type Required Description
library_id str ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.ListSharingResponse

Errors

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

update_or_create

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

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)

Parameters

Parameter Type Required Description
library_id str ✔️ N/A
level models.ShareEnum ✔️ N/A
share_with_uuid str ✔️ The id of the entity (user, workspace or organization) to share with
share_with_type models.EntityType ✔️ The type of entity, used to share a library.
org_id OptionalNullable[str] : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.Sharing

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 their own access. You have to be the owner of the library to delete an access other than yours. Warning: the response will change from 200 (returning the deleted sharing) to 204 No Content in a future version.

Example Usage

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")

    assert res is not None

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
library_id str ✔️ N/A
share_with_uuid str ✔️ The id of the entity (user, workspace or organization) to share with
share_with_type models.EntityType ✔️ The type of entity, used to share a library.
org_id OptionalNullable[str] : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.Sharing

Errors

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