1818from videodb .video import Video
1919from videodb .audio import Audio
2020from videodb .image import Image
21+ from videodb .meeting import Meeting
2122
2223from videodb ._upload import (
2324 upload ,
2930class Connection (HttpClient ):
3031 """Connection class to interact with the VideoDB"""
3132
32- def __init__ (self , api_key : str , base_url : str ) -> "Connection" :
33+ def __init__ (self , api_key : str , base_url : str , ** kwargs ) -> "Connection" :
3334 """Initializes a new instance of the Connection class with specified API credentials.
3435
3536 Note: Users should not initialize this class directly.
@@ -44,7 +45,9 @@ def __init__(self, api_key: str, base_url: str) -> "Connection":
4445 self .api_key = api_key
4546 self .base_url = base_url
4647 self .collection_id = "default"
47- super ().__init__ (api_key = api_key , base_url = base_url , version = __version__ )
48+ super ().__init__ (
49+ api_key = api_key , base_url = base_url , version = __version__ , ** kwargs
50+ )
4851
4952 def get_collection (self , collection_id : Optional [str ] = "default" ) -> Collection :
5053 """Get a collection object by its ID.
@@ -256,32 +259,35 @@ def get_transcode_details(self, job_id: str) -> dict:
256259
257260 def upload (
258261 self ,
259- file_path : str = None ,
260- url : str = None ,
262+ source : Optional [str ] = None ,
261263 media_type : Optional [str ] = None ,
262264 name : Optional [str ] = None ,
263265 description : Optional [str ] = None ,
264266 callback_url : Optional [str ] = None ,
267+ file_path : Optional [str ] = None ,
268+ url : Optional [str ] = None ,
265269 ) -> Union [Video , Audio , Image , None ]:
266270 """Upload a file.
267271
268- :param str file_path: Path to the file to upload (optional)
269- :param str url: URL of the file to upload (optional)
272+ :param str source: Local path or URL of the file to upload (optional)
270273 :param MediaType media_type: MediaType object (optional)
271274 :param str name: Name of the file (optional)
272275 :param str description: Description of the file (optional)
273276 :param str callback_url: URL to receive the callback (optional)
277+ :param str file_path: Path to the file to upload (optional)
278+ :param str url: URL of the file to upload (optional)
274279 :return: :class:`Video <Video>`, or :class:`Audio <Audio>`, or :class:`Image <Image>` object
275280 :rtype: Union[ :class:`videodb.video.Video`, :class:`videodb.audio.Audio`, :class:`videodb.image.Image`]
276281 """
277282 upload_data = upload (
278283 self ,
279- file_path ,
280- url ,
281- media_type ,
282- name ,
283- description ,
284- callback_url ,
284+ source ,
285+ media_type = media_type ,
286+ name = name ,
287+ description = description ,
288+ callback_url = callback_url ,
289+ file_path = file_path ,
290+ url = url ,
285291 )
286292 media_id = upload_data .get ("id" , "" )
287293 if media_id .startswith ("m-" ):
@@ -290,3 +296,54 @@ def upload(
290296 return Audio (self , ** upload_data )
291297 elif media_id .startswith ("img-" ):
292298 return Image (self , ** upload_data )
299+
300+ def record_meeting (
301+ self ,
302+ meeting_url : str ,
303+ bot_name : str = None ,
304+ bot_image_url : str = None ,
305+ meeting_title : str = None ,
306+ callback_url : str = None ,
307+ callback_data : Optional [dict ] = None ,
308+ time_zone : str = "UTC" ,
309+ ) -> Meeting :
310+ """Record a meeting and upload it to the default collection.
311+
312+ :param str meeting_url: Meeting url
313+ :param str bot_name: Name of the recorder bot
314+ :param str bot_image_url: URL of the recorder bot image
315+ :param str meeting_title: Name of the meeting
316+ :param str callback_url: URL to receive callback once recording is done
317+ :param dict callback_data: Data to be sent in the callback (optional)
318+ :param str time_zone: Time zone for the meeting (default ``UTC``)
319+ :return: :class:`Meeting <Meeting>` object representing the recording bot
320+ :rtype: :class:`videodb.meeting.Meeting`
321+ """
322+ if callback_data is None :
323+ callback_data = {}
324+
325+ response = self .post (
326+ path = f"{ ApiPath .collection } /default/{ ApiPath .meeting } /{ ApiPath .record } " ,
327+ data = {
328+ "meeting_url" : meeting_url ,
329+ "bot_name" : bot_name ,
330+ "bot_image_url" : bot_image_url ,
331+ "meeting_title" : meeting_title ,
332+ "callback_url" : callback_url ,
333+ "callback_data" : callback_data ,
334+ "time_zone" : time_zone ,
335+ },
336+ )
337+ meeting_id = response .get ("meeting_id" )
338+ return Meeting (self , id = meeting_id , collection_id = "default" , ** response )
339+
340+ def get_meeting (self , meeting_id : str ) -> Meeting :
341+ """Get a meeting by its ID.
342+
343+ :param str meeting_id: ID of the meeting
344+ :return: :class:`Meeting <Meeting>` object
345+ :rtype: :class:`videodb.meeting.Meeting`
346+ """
347+ meeting = Meeting (self , id = meeting_id , collection_id = "default" )
348+ meeting .refresh ()
349+ return meeting
0 commit comments