Skip to content

Commit fbc857b

Browse files
authored
Merge pull request #32 from video-db/ankit/add-public-url
feat: add generate url
2 parents a8366de + b6dfee0 commit fbc857b

File tree

5 files changed

+20
-2
lines changed

5 files changed

+20
-2
lines changed

videodb/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
""" About information for videodb sdk"""
22

33

4-
__version__ = "0.2.9"
4+
__version__ = "0.2.10"
55
__title__ = "videodb"
66
__author__ = "videodb"
77
__email__ = "[email protected]"

videodb/_constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ class ApiPath:
7070
storage = "storage"
7171
download = "download"
7272
title = "title"
73+
generate_url = "generate_url"
7374

7475

7576
class Status:

videodb/audio.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,12 @@ def __repr__(self) -> str:
2020
f"length={self.length})"
2121
)
2222

23+
def generate_url(self) -> str:
24+
url_data = self._connection.post(
25+
path=f"{ApiPath.audio}/{self.id}/{ApiPath.generate_url}",
26+
params={"collection_id": self.collection_id},
27+
)
28+
return url_data.get("signed_url", None)
29+
2330
def delete(self) -> None:
2431
self._connection.delete(f"{ApiPath.audio}/{self.id}")

videodb/client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,15 @@ def get_collections(self) -> List[Collection]:
5454
for collection in collections_data.get("collections")
5555
]
5656

57-
def create_collection(self, name: str, description: str) -> Collection:
57+
def create_collection(
58+
self, name: str, description: str, is_public: bool = False
59+
) -> Collection:
5860
collection_data = self.post(
5961
path=ApiPath.collection,
6062
data={
6163
"name": name,
6264
"description": description,
65+
"is_public": is_public,
6366
},
6467
)
6568
self.collection_id = collection_data.get("id", "default")

videodb/image.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ def __repr__(self) -> str:
2020
f"url={self.url})"
2121
)
2222

23+
def generate_url(self) -> str:
24+
url_data = self._connection.post(
25+
path=f"{ApiPath.image}/{self.id}/{ApiPath.generate_url}",
26+
params={"collection_id": self.collection_id},
27+
)
28+
return url_data.get("signed_url", None)
29+
2330
def delete(self) -> None:
2431
self._connection.delete(f"{ApiPath.image}/{self.id}")
2532

0 commit comments

Comments
 (0)