Fossology Folders

Methods used to access “folders/” endpoints.

class fossology.folders.Folders

Class dedicated to all “folders” related endpoints

copy_folder(folder: Folder, parent: Folder)

Copy a folder

Parameters:
  • folder (Folder() object) – the Folder to be copied

  • parent (Folder() object) – the new parent folder

Returns:

the updated folder

Return type:

Folder() object

Raises:

FossologyApiError – if the REST call failed

create_folder(parent: Folder, name: str, description: str | None = None, group: str | None = None)

Create a new (sub)folder

The name of the new folder must be unique under the same parent. Folder names are case insensitive.

API Endpoint: POST /folders/{id}

Parameters:
  • parent (Folder() object) – the parent folder

  • name (str) – the name of the folder

  • description (str) – a meaningful description for the folder (default: None)

  • group (string) – the name of the group chosen to create the folder (default: None)

Returns:

the folder newly created (or already existing) - or None

Return type:

Folder() object

Raises:
delete_folder(folder: Folder)

Delete a folder

API Endpoint: DELETE /folders/{id}

Parameters:

folder (Folder() object) – the Folder to be deleted

Raises:

FossologyApiError – if the REST call failed

detail_folder(folder_id: int)

Get details of folder.

API Endpoint: GET /folders/{id}

Parameters:

id (int) – the ID of the folder to be analyzed

Returns:

the requested folder

Return type:

Folder() object

Raises:

FossologyApiError – if the REST call failed

list_folders()

List all folders accessible to the authenticated user

API Endpoint: GET /folders

Returns:

a list of folders

Return type:

list()

Raises:

FossologyApiError – if the REST call failed

move_folder(folder, parent)

Move a folder

Parameters:
  • folder (Folder() object) – the Folder to be moved

  • parent (Folder() object) – the new parent folder

Returns:

the updated folder - or None if the REST call failed

Return type:

Folder() object

Raises:

FossologyApiError – if the REST call failed

update_folder(folder: Folder, name: str | None = None, description: str | None = None)

Update a folder’s name or description

The name of the new folder must be unique under the same parent.

API Endpoint: PATCH /folders/{id}

Parameters:
  • name (str) – the new name of the folder (optional)

  • description (str) – the new description for the folder (optional)

Returns:

the updated folder

Return type:

Folder() object

Raises:

FossologyApiError – if the REST call failed