Skip to content

Commit 60a8afe

Browse files
committed
imp: added support for specifying the number of copies when calling shallow copy
1 parent c14ce3b commit 60a8afe

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

h51/resources.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,13 @@ def persist(self):
150150

151151
self._document.update(r)
152152

153-
def shallow_copy(self):
153+
def shallow_copy(self, copies=1):
154154
"""Shallow copy an asset (remove the expires time)"""
155155

156156
r = self._client(
157157
'post',
158-
f'assets/{self.uid}/shallow-copy'
158+
f'assets/{self.uid}/shallow-copy',
159+
data={'copies': copies}
159160
)
160161

161162
@classmethod
@@ -314,15 +315,18 @@ def persist_many(cls, client, uids):
314315
)
315316

316317
@classmethod
317-
def shallow_copy_many(cls, client, uids):
318+
def shallow_copy_many(cls, client, uids, copies=1):
318319
"""
319320
Find one or more assets matching the given uids and shallow copy them
320321
(remove the expires time).
321322
"""
322323
return client(
323324
'post',
324325
'assets/shallow-copy',
325-
data={'uids': uids}
326+
data={
327+
'copies': copies,
328+
'uids': uids
329+
}
326330
)
327331

328332
@classmethod

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.9',
24+
version='0.0.10',
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)