Skip to content

Commit

Permalink
imp: added support for specifying the number of copies when calling s…
Browse files Browse the repository at this point in the history
…hallow copy
  • Loading branch information
anthonyjb committed Sep 12, 2024
1 parent c14ce3b commit 60a8afe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions h51/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,13 @@ def persist(self):

self._document.update(r)

def shallow_copy(self):
def shallow_copy(self, copies=1):
"""Shallow copy an asset (remove the expires time)"""

r = self._client(
'post',
f'assets/{self.uid}/shallow-copy'
f'assets/{self.uid}/shallow-copy',
data={'copies': copies}
)

@classmethod
Expand Down Expand Up @@ -314,15 +315,18 @@ def persist_many(cls, client, uids):
)

@classmethod
def shallow_copy_many(cls, client, uids):
def shallow_copy_many(cls, client, uids, copies=1):
"""
Find one or more assets matching the given uids and shallow copy them
(remove the expires time).
"""
return client(
'post',
'assets/shallow-copy',
data={'uids': uids}
data={
'copies': copies,
'uids': uids
}
)

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version='0.0.9',
version='0.0.10',
description=\
'The H51 Python library provides a pythonic interface to the H51 API.',
long_description=long_description,
Expand Down

0 comments on commit 60a8afe

Please sign in to comment.