Skip to content

Commit c14ce3b

Browse files
committed
feat: addeded resource methods for shallow-copy
1 parent 4a5422f commit c14ce3b

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

h51/resources.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,14 @@ def persist(self):
150150

151151
self._document.update(r)
152152

153+
def shallow_copy(self):
154+
"""Shallow copy an asset (remove the expires time)"""
155+
156+
r = self._client(
157+
'post',
158+
f'assets/{self.uid}/shallow-copy'
159+
)
160+
153161
@classmethod
154162
def all(cls, client, secure=None, type=None, q=None, rate_buffer=0):
155163
"""
@@ -305,6 +313,18 @@ def persist_many(cls, client, uids):
305313
data={'uids': uids}
306314
)
307315

316+
@classmethod
317+
def shallow_copy_many(cls, client, uids):
318+
"""
319+
Find one or more assets matching the given uids and shallow copy them
320+
(remove the expires time).
321+
"""
322+
return client(
323+
'post',
324+
'assets/shallow-copy',
325+
data={'uids': uids}
326+
)
327+
308328
@classmethod
309329
def zip(
310330
cls,

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# Versions should comply with PEP440. For a discussion on single-sourcing
2222
# the version across setup.py and the project code, see
2323
# https://packaging.python.org/en/latest/single_source_version.html
24-
version='0.0.8',
24+
version='0.0.9',
2525
description=\
2626
'The H51 Python library provides a pythonic interface to the H51 API.',
2727
long_description=long_description,

0 commit comments

Comments
 (0)