베타 라이브러리 접근 엔드포인트
베타 라이브러리 접근 엔드포인트 (Beta Libraries Accesses Endpoints)
(beta) Libraries API - 라이브러리에 대한 접근(공유) 권한을 관리합니다.
출처: 문서
본문
라이브러리를 누구와 어떤 수준으로 공유할지 관리하는 엔드포인트예요. 공유된 대상과 권한을 조회하고, 권한을 만들거나 갱신·삭제할 수 있답니다.
GET /v1/libraries/{library_id}/share — List all of the access to this library (라이브러리 접근 목록 조회)
주어진 라이브러리에 대해, 접근 권한이 있는 엔티티와 그 수준을 모두 나열합니다.
경로 파라미터:
library_id#string(필수)
응답 필드 (200 Successful Response):
data#array<Sharing>(필수) — 공유/접근 정보 목록.
TypeScript:
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: proces...EY"] ?? "",
});
async function run() {
const result = await mistral.beta.libraries.accesses.list({
libraryId: "d2169833-d8e2-416e-a372-76518d3d99c2",
});
console.log(result);
}
run();
Python:
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:
curl https://api.mistral.ai/v1/libraries/{library_id}/share \
-X GET \
-H 'Authorization: Bearer ***'
응답 예시 (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
}
]
}
PUT /v1/libraries/{library_id}/share — Create or update an access level (접근 수준 생성·갱신)
라이브러리 ID로 어떤 엔티티의 접근 수준을 만들거나 갱신합니다. 라이브러리를 공유하려면 라이브러리 소유자여야 해요. 소유자는 자기 자신의 역할을 바꿀 수 없고, 라이브러리는 조직 밖으로 공유될 수 없어요.
경로 파라미터:
library_id#string(필수)
요청 본문:
level#"Viewer"|"Editor"(필수) — 접근 수준.share_with_type#"User"|"Workspace"|"Org"(필수) — 공유 대상 엔티티 타입.share_with_uuid#string(필수) — 공유할 엔티티(유저·워크스페이스·조직)의 ID.org_id#string|null
응답 필드 (200 Successful Response):
library_id#string(필수)org_id#string(필수)role#string(필수)share_with_type#string(필수)share_with_uuid#string|null(필수)user_id#string|null
TypeScript:
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: proces...EY"] ?? "",
});
async function run() {
const result = await mistral.beta.libraries.accesses.updateOrCreate({
libraryId: "ae92ecb2-1ed7-4c5f-97e0-b2cbe325a206",
sharingRequest: {
level: "Editor",
shareWithUuid: "add9ae1f-2854-4378-84a0-91c77efa6fd2",
shareWithType: "User",
},
});
console.log(result);
}
run();
Python:
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:
curl https://api.mistral.ai/v1/libraries/{library_id}/share \
-X PUT \
-H 'Authorization: Bearer ***' \
-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
}
DELETE /v1/libraries/{library_id}/share — Delete an access level (접근 수준 삭제)
라이브러리 ID로 어떤 엔티티의 접근 수준을 삭제합니다. 소유자는 자기 자신의 접근을 삭제할 수 없고, 자기 외 접근을 삭제하려면 라이브러리 소유자여야 해요. 참고로 응답은 향후 버전에서 200(삭제된 sharing 반환)에서 204 No Content로 바뀔 예정입니다.
경로 파라미터:
library_id#string(필수)
요청 본문:
share_with_type#"User"|"Workspace"|"Org"(필수) — 공유 대상 엔티티 타입.share_with_uuid#string(필수) — 공유 대상 엔티티 ID.org_id#string|null
응답 (200): Access deleted (deprecated, 204로 대체 예정).
library_id#string(필수),org_id#string(필수),role#string(필수),share_with_type#string(필수),share_with_uuid#string|null(필수),user_id#string|null
TypeScript:
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: proces...EY"] ?? "",
});
async function run() {
const result = await mistral.beta.libraries.accesses.delete({
libraryId: "843cc47c-e8f3-454c-9fc5-fcd7fb2865b0",
sharingDelete: {
shareWithUuid: "0814a235-c2d0-4814-875a-4b85f93d3dc7",
shareWithType: "Org",
},
});
console.log(result);
}
run();
Python:
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)
curl:
curl https://api.mistral.ai/v1/libraries/{library_id}/share \
-X DELETE \
-H 'Authorization: Bearer ***' \
-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
}
더 알아보기 (Learn more)
- Beta Libraries Accesses Endpoints — 공식 API 문서
- Libraries — 라이브러리 안내