Skip to content

Commit 3d6730e

Browse files
author
Jens Kürten
committed
add docstrings
1 parent 1a1f258 commit 3d6730e

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

csfunctions/service/file_upload.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,18 @@ def upload_file_content(
125125
filesize: int | None = None,
126126
delete_derived_files: bool = True,
127127
) -> None:
128+
"""
129+
Uploads content to an existing file object in chunks using presigned URLs.
130+
Handles aborting the upload if an error occurs.
131+
132+
Args:
133+
file_object_id: The ID of the file object to upload to.
134+
stream: A binary stream containing the file data.
135+
persno: The user/person number who is uploading the file (default is user that triggered the Function).
136+
check_access: Whether to check access permissions.
137+
filesize: Size of the file in bytes (required only if the stream is not seekable).
138+
delete_derived_files: Whether to delete derived files after upload.
139+
"""
128140
persno = persno or self.metadata.app_user
129141
if filesize is None:
130142
filesize = self._get_stream_size(stream)
@@ -167,6 +179,20 @@ def upload_new_file(
167179
check_access: bool = True,
168180
filesize: int | None = None,
169181
) -> str:
182+
"""
183+
Creates a new file attached to the parent object and uploads content from the provided stream.
184+
185+
Args:
186+
parent_object_id: The ID of the parent object to attach the file to.
187+
filename: The name of the new file.
188+
stream: A binary stream containing the file data.
189+
persno: The user/person number who is uploading the file (default is user that triggered the Function).
190+
check_access: Whether to check access permissions.
191+
filesize: Size of the file in bytes (required only if the stream is not seekable).
192+
193+
Returns:
194+
The ID of the newly created file object.
195+
"""
170196
persno = persno or self.metadata.app_user
171197
file_object_id = self._create_new_file(
172198
filename=filename,

0 commit comments

Comments
 (0)