adsfolio.api.libraries
Libraries API wrapper for ADS.
Provides access to personal library management: - Create, read, update, delete libraries - Add/remove documents - Permissions management - Set operations (union, intersection, difference)
- class adsfolio.api.libraries.LibrariesAPI(client)[source]
Bases:
objectLibraries API for managing personal ADS libraries.
Examples
>>> api = LibrariesAPI(client) >>> libs = api.list_libraries() >>> lib = api.get_library(libs[0].id) >>> print(lib.documents)
- Parameters:
client (BaseClient)
- create_library(name, description='My ADS library', public=False, bibcodes=None)[source]
Create a new library.
- difference(primary_id, secondary_ids, name=None)[source]
Create difference of libraries (primary - secondary).
- Parameters:
- Return type:
- empty(library_id)[source]
Empty a library of all its contents.
- Parameters:
library_id (str)
- Return type:
- get_library(library_id, raw=False, start=0, rows=2000)[source]
Get a specific library with its documents.
- Parameters:
- Returns:
Library with full document list.
- Return type:
- intersection(primary_id, secondary_ids, name=None)[source]
Create intersection of libraries.
- Parameters:
- Return type:
- iter_documents(library_id, *, raw=False, rows=2000)[source]
Lazily iterate over every document in a library.
- Parameters:
- Returns:
Bibcodes returned across all pages.
- Return type:
iterator of str
- Raises:
ValueError – If rows is not positive or exceeds 2,000.
ADSError – If the API repeats a non-empty page.
- iter_libraries(*, rows=100, sort='date_created', order='asc')[source]
Lazily iterate over all libraries for the authenticated user.
- Parameters:
- Returns:
Libraries returned across all pages.
- Return type:
iterator of Library
- Raises:
ValueError – If rows is not positive.
ADSError – If the API repeats a non-empty page.
- list_libraries(start=0, rows=100, sort='date_created', order='asc')[source]
List all libraries for the authenticated user.
- Parameters:
- Returns:
List of library metadata.
- Return type:
- operation(primary_id, action, secondary_ids=None, name=None, description=None, public=False)[source]
Perform set operations on libraries.
- Parameters:
primary_id (str) – Primary library identifier.
action (str) – Operation: “union”, “intersection”, “difference”, “copy”, “empty”.
secondary_ids (list[str], optional) – Secondary library IDs (not needed for “empty”).
name (str, optional) – Name for new library (for union/intersection/difference).
description (str, optional) – Description for new library.
public (bool, optional) – Make new library public.
- Returns:
Resulting library.
- Return type:
- union(primary_id, secondary_ids, name=None)[source]
Create union of libraries.
- Parameters:
- Return type:
- class adsfolio.api.libraries.Library(id, name, description='', num_documents=0, public=False, permission='', owner='', date_created=None, date_last_modified=None, documents=<factory>)[source]
Bases:
objectContainer for library metadata and documents.
- Parameters: