# Books API . mylibrary . bookshelves

## Instance Methods

Returns the volumes Resource.

Adds a volume to a bookshelf.

Clears all volumes from a bookshelf.

Retrieves metadata for a specific bookshelf belonging to the authenticated user.

Retrieves a list of bookshelves belonging to the authenticated user.

Moves a volume within a bookshelf.

Removes a volume from a bookshelf.

### Method Details

`addVolume(shelf, volumeId, source=None, reason=None)`

    Adds a volume to a bookshelf.

    Args:
      shelf: string, ID of bookshelf to which to add a volume. (required)
      volumeId: string, ID of volume to add. (required)
      source: string, String to identify the originator of this request.
      reason: string, The reason for which the book is added to the library.
        Allowed values
          IOS_PREX - Volumes added from the PREX flow on iOS.
          IOS_SEARCH - Volumes added from the Search flow on iOS.
          ONBOARDING - Volumes added from the Onboarding flow.

`clearVolumes(shelf, source=None)`

    Clears all volumes from a bookshelf.

    Args:
      shelf: string, ID of bookshelf from which to remove a volume. (required)
      source: string, String to identify the originator of this request.

`get(shelf, source=None)`

    Retrieves metadata for a specific bookshelf belonging to the authenticated user.

    Args:
      shelf: string, ID of bookshelf to retrieve. (required)
      source: string, String to identify the originator of this request.

    Returns:
      An object of the form:

        {
        "kind": "books#bookshelf", # Resource type for bookshelf metadata.
        "description": "A String", # Description of this bookshelf.
        "created": "A String", # Created time for this bookshelf (formatted UTC timestamp with millisecond resolution).
        "volumeCount": 42, # Number of volumes in this bookshelf.
        "title": "A String", # Title of this bookshelf.
        "updated": "A String", # Last modified time of this bookshelf (formatted UTC timestamp with millisecond resolution).
        "access": "A String", # Whether this bookshelf is PUBLIC or PRIVATE.
        "volumesLastUpdated": "A String", # Last time a volume was added or removed from this bookshelf (formatted UTC timestamp with millisecond resolution).
        "id": 42, # Id of this bookshelf, only unique by user.
        "selfLink": "A String", # URL to this resource.
      }

`list(source=None)`

    Retrieves a list of bookshelves belonging to the authenticated user.

    Args:
      source: string, String to identify the originator of this request.

    Returns:
      An object of the form:

        {
        "items": [ # A list of bookshelves.
          {
            "kind": "books#bookshelf", # Resource type for bookshelf metadata.
            "description": "A String", # Description of this bookshelf.
            "created": "A String", # Created time for this bookshelf (formatted UTC timestamp with millisecond resolution).
            "volumeCount": 42, # Number of volumes in this bookshelf.
            "title": "A String", # Title of this bookshelf.
            "updated": "A String", # Last modified time of this bookshelf (formatted UTC timestamp with millisecond resolution).
            "access": "A String", # Whether this bookshelf is PUBLIC or PRIVATE.
            "volumesLastUpdated": "A String", # Last time a volume was added or removed from this bookshelf (formatted UTC timestamp with millisecond resolution).
            "id": 42, # Id of this bookshelf, only unique by user.
            "selfLink": "A String", # URL to this resource.
          },
        ],
        "kind": "books#bookshelves", # Resource type.
      }

`moveVolume(shelf, volumeId, volumePosition, source=None)`

    Moves a volume within a bookshelf.

    Args:
      shelf: string, ID of bookshelf with the volume. (required)
      volumeId: string, ID of volume to move. (required)
      volumePosition: integer, Position on shelf to move the item (0 puts the item before the current first item, 1 puts it between the first and the second and so on.) (required)
      source: string, String to identify the originator of this request.

`removeVolume(shelf, volumeId, source=None, reason=None)`

    Removes a volume from a bookshelf.

    Args:
      shelf: string, ID of bookshelf from which to remove a volume. (required)
      volumeId: string, ID of volume to remove. (required)
      source: string, String to identify the originator of this request.
      reason: string, The reason for which the book is removed from the library.
        Allowed values
          ONBOARDING - Samples removed from the Onboarding flow.