@@ -27,12 +27,25 @@ def __init__(self, _connection, id: str, name: str = None, description: str = No
27
27
self .name = name
28
28
self .description = description
29
29
30
+ def __repr__ (self ) -> str :
31
+ return (
32
+ f"Collection("
33
+ f"id={ self .id } , "
34
+ f"name={ self .name } , "
35
+ f"description={ self .description } )"
36
+ )
37
+
30
38
def get_videos (self ) -> List [Video ]:
31
- videos_data = self ._connection .get (path = f"{ ApiPath .video } " )
39
+ videos_data = self ._connection .get (
40
+ path = f"{ ApiPath .video } " ,
41
+ params = {"collection_id" : self .id },
42
+ )
32
43
return [Video (self ._connection , ** video ) for video in videos_data .get ("videos" )]
33
44
34
45
def get_video (self , video_id : str ) -> Video :
35
- video_data = self ._connection .get (path = f"{ ApiPath .video } /{ video_id } " )
46
+ video_data = self ._connection .get (
47
+ path = f"{ ApiPath .video } /{ video_id } " , params = {"collection_id" : self .id }
48
+ )
36
49
return Video (self ._connection , ** video_data )
37
50
38
51
def delete_video (self , video_id : str ) -> None :
@@ -43,29 +56,45 @@ def delete_video(self, video_id: str) -> None:
43
56
:return: None if the delete is successful
44
57
:rtype: None
45
58
"""
46
- return self ._connection .delete (path = f"{ ApiPath .video } /{ video_id } " )
59
+ return self ._connection .delete (
60
+ path = f"{ ApiPath .video } /{ video_id } " , params = {"collection_id" : self .id }
61
+ )
47
62
48
63
def get_audios (self ) -> List [Audio ]:
49
- audios_data = self ._connection .get (path = f"{ ApiPath .audio } " )
64
+ audios_data = self ._connection .get (
65
+ path = f"{ ApiPath .audio } " ,
66
+ params = {"collection_id" : self .id },
67
+ )
50
68
return [Audio (self ._connection , ** audio ) for audio in audios_data .get ("audios" )]
51
69
52
70
def get_audio (self , audio_id : str ) -> Audio :
53
- audio_data = self ._connection .get (path = f"{ ApiPath .audio } /{ audio_id } " )
71
+ audio_data = self ._connection .get (
72
+ path = f"{ ApiPath .audio } /{ audio_id } " , params = {"collection_id" : self .id }
73
+ )
54
74
return Audio (self ._connection , ** audio_data )
55
75
56
76
def delete_audio (self , audio_id : str ) -> None :
57
- return self ._connection .delete (path = f"{ ApiPath .audio } /{ audio_id } " )
77
+ return self ._connection .delete (
78
+ path = f"{ ApiPath .audio } /{ audio_id } " , params = {"collection_id" : self .id }
79
+ )
58
80
59
81
def get_images (self ) -> List [Image ]:
60
- images_data = self ._connection .get (path = f"{ ApiPath .image } " )
82
+ images_data = self ._connection .get (
83
+ path = f"{ ApiPath .image } " ,
84
+ params = {"collection_id" : self .id },
85
+ )
61
86
return [Image (self ._connection , ** image ) for image in images_data .get ("images" )]
62
87
63
88
def get_image (self , image_id : str ) -> Image :
64
- image_data = self ._connection .get (path = f"{ ApiPath .image } /{ image_id } " )
89
+ image_data = self ._connection .get (
90
+ path = f"{ ApiPath .image } /{ image_id } " , params = {"collection_id" : self .id }
91
+ )
65
92
return Image (self ._connection , ** image_data )
66
93
67
94
def delete_image (self , image_id : str ) -> None :
68
- return self ._connection .delete (path = f"{ ApiPath .image } /{ image_id } " )
95
+ return self ._connection .delete (
96
+ path = f"{ ApiPath .image } /{ image_id } " , params = {"collection_id" : self .id }
97
+ )
69
98
70
99
def search (
71
100
self ,
0 commit comments