quetzal.app.api.data package¶
Subpackages¶
Submodules¶
quetzal.app.api.data.file module¶
-
quetzal.app.api.data.file.
_all_metadata
(file_id, workspace)¶ Gather all metadata of a file in a workspace
If a file has metadata of families f1, f2, …, this function returns a dictionary
{'f1': {...}, 'f2': {...}, ...}
. This structure is suitable for the responses of file fetch metadata operations.
-
quetzal.app.api.data.file.
_now
()¶ Get a datetime object with the current datetime (in UTC) as a string
This function is also created for ease of unit test mocks
-
quetzal.app.api.data.file.
_verify_filename_path
(filename, path)¶ Perform some security considerations on filename and path
-
quetzal.app.api.data.file.
create
(*, wid, content=None, user, token_info=None)¶ Create a file on a workspace
This function is the implementation of the upload file endpoint in the Quetzal API. After verifying the workspace and user permissions, it will save the contents of the file in the configured file backend. Finally, it initializes the base metadata family entries for the new file.
Parameters: - wid (int) – Workspace identifier where the file will be uploaded.
- content (file-like) – Contents of the file.
- user (quetzal.app.models.User) – User that owns the file. This parameter is set by connexion.
- token_info – Authentication token. This parameter is set by connexion.
Returns: - details (dict) – File details object.
- code (int) – HTTP response code.
API endpoints
- POST /api/v1/data/workspaces/{wid}/files/ See in redoc.
-
quetzal.app.api.data.file.
delete
(*, wid, uuid, user, token_info=None)¶
-
quetzal.app.api.data.file.
details
(*, uuid)¶ Get the contents or metadata of a file that has been committed
-
quetzal.app.api.data.file.
details_w
(*, wid=None, uuid)¶ Get contents or metadata of a file on a workspace
-
quetzal.app.api.data.file.
fetch
(*args, **kwargs)¶ Get all the files that have been committed.
-
quetzal.app.api.data.file.
fetch_w
(*, wid)¶ Get all the files on a workspace
-
quetzal.app.api.data.file.
set_metadata
(*, wid, uuid, body)¶
-
quetzal.app.api.data.file.
update_metadata
(*, wid, uuid, body)¶
quetzal.app.api.data.query module¶
-
quetzal.app.api.data.query.
create
(*, body, user, token_info=None)¶
-
quetzal.app.api.data.query.
create_w
(*, wid, body, user, token_info=None)¶
-
quetzal.app.api.data.query.
details
(*, qid, user, token_info=None)¶
-
quetzal.app.api.data.query.
details_w
(*, wid, qid, user, token_info=None)¶
-
quetzal.app.api.data.query.
fetch
(*, user, token_info=None)¶
-
quetzal.app.api.data.query.
fetch_w
(*, wid, user, token_info=None)¶
quetzal.app.api.data.workspace module¶
-
quetzal.app.api.data.workspace.
commit
(*, wid)¶ Request commit of all metadata and files of a workspace
Parameters: wid (int) – Workspace identifier Returns: - dict – Workspace details
- int – HTTP response code
-
quetzal.app.api.data.workspace.
create
(*, body, user, token_info=None)¶ Create a new workspace
Returns: - dict – Workspace details
- int – HTTP response code
-
quetzal.app.api.data.workspace.
delete
(*, user, wid)¶ Request deletion of a workspace by id
Parameters: wid (int) – Workspace identifier Returns: - dict – Workspace details
- int – HTTP response code
-
quetzal.app.api.data.workspace.
details
(*, wid)¶ Get workspace details by id
Parameters: wid (int) – Workspace identifier Returns: - dict – Workspace details
- int – HTTP response code
-
quetzal.app.api.data.workspace.
fetch
(*, user)¶ List workspaces
Returns: - list – List of Workspace details as a dictionaries
- int – HTTP response code