Skip to content

Commit 61ff868

Browse files
committed
Add raw_api.update_file_retention
1 parent fb5b68c commit 61ff868

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

b2sdk/raw_api.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,18 @@ def update_bucket(
284284
):
285285
pass
286286

287+
@abstractmethod
288+
def update_file_retention(
289+
self,
290+
api_url,
291+
account_auth_token,
292+
file_id,
293+
file_name,
294+
file_retention: FileRetentionSetting,
295+
bypass_governance: bool = False,
296+
):
297+
pass
298+
287299
@abstractmethod
288300
def upload_file(
289301
self,
@@ -698,6 +710,27 @@ def update_bucket(
698710
**kwargs
699711
)
700712

713+
def update_file_retention(
714+
self,
715+
api_url,
716+
account_auth_token,
717+
file_id,
718+
file_name,
719+
file_retention,
720+
bypass_governance=False
721+
):
722+
kwargs = {}
723+
kwargs['fileRetention'] = file_retention.serialize_to_json_for_request()
724+
return self._post_json(
725+
api_url,
726+
'b2_update_file_retention',
727+
account_auth_token,
728+
fileId=file_id,
729+
fileName=file_name,
730+
bypassGovernance=bypass_governance,
731+
**kwargs
732+
)
733+
701734
def unprintable_to_hex(self, string):
702735
"""
703736
Replace unprintable chars in string with a hex representation.

0 commit comments

Comments
 (0)