@@ -27,12 +27,25 @@ def __init__(self, _connection, id: str, name: str = None, description: str = No
2727 self .name = name
2828 self .description = description
2929
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+
3038 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+ )
3243 return [Video (self ._connection , ** video ) for video in videos_data .get ("videos" )]
3344
3445 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+ )
3649 return Video (self ._connection , ** video_data )
3750
3851 def delete_video (self , video_id : str ) -> None :
@@ -43,29 +56,45 @@ def delete_video(self, video_id: str) -> None:
4356 :return: None if the delete is successful
4457 :rtype: None
4558 """
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+ )
4762
4863 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+ )
5068 return [Audio (self ._connection , ** audio ) for audio in audios_data .get ("audios" )]
5169
5270 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+ )
5474 return Audio (self ._connection , ** audio_data )
5575
5676 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+ )
5880
5981 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+ )
6186 return [Image (self ._connection , ** image ) for image in images_data .get ("images" )]
6287
6388 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+ )
6592 return Image (self ._connection , ** image_data )
6693
6794 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+ )
6998
7099 def search (
71100 self ,
0 commit comments