A collection in R2R is a logical grouping of users and documents that allows for efficient access control and organization. Collections enable you to manage permissions and access to documents at a collection level, rather than individually.R2R provides a comprehensive set of collection features, allowing you to implement efficient access control and organization of users and documents in your applications.
Collection permissioning in R2R is still under development and as a result the API will likely evolve.
user_id = '456e789f-g01h-34i5-j678-901234567890' # This should be a valid user IDadd_user_result = client.add_user_to_collection(user_id, collection_id)
document_id = '789g012j-k34l-56m7-n890-123456789012' # must be a valid document idassign_doc_result = client.assign_document_to_collection(document_id, collection_id)
Many collection-related methods support pagination and filtering:
Copy
Ask AI
# List collections with paginationpaginated_collection = client.list_collections(offset=10, limit=20)# Get users in a collection with paginationpaginated_users = client.get_users_in_collection(collection_id, offset=5, limit=10)# Get documents in a collection with paginationpaginated_docs = client.documents_in_collection(collection_id, offset=0, limit=50)# Get collections overview with specific collection IDsspecific_collections_overview = client.collections_overview(collection_ids=['id1', 'id2', 'id3'])