@@ -49,21 +49,29 @@ def get_group(
4949
5050 def find_group (
5151 self ,
52+ token : Union [str , uuid .UUID ],
5253 group_id : Optional [Union [str , uuid .UUID ]] = None ,
5354 name : Optional [str ] = None ,
54- token : Union [str , uuid .UUID ] = None ,
5555 ) -> BugoutGroup :
5656 find_group_path = f"group/find"
57- if group_id is not None and name is None :
58- find_group_path += f"?group_id={ group_id } "
59- elif group_id is None and name is not None :
60- find_group_path += f"?name={ name } "
61- elif group_id is not None and name is not None :
62- find_group_path += f"?group_id={ group_id } &name={ name } "
57+ if group_id is None and name is None :
58+ raise GroupInvalidParameters (
59+ "In order to find group, at least one of name, or id must be specified"
60+ )
61+ query_params = {}
62+ if group_id is not None :
63+ query_params .update ({"group_id" : group_id })
64+ if name is not None :
65+ query_params .update ({"name" : name })
6366 headers = {
6467 "Authorization" : f"Bearer { token } " ,
6568 }
66- result = self ._call (method = Method .get , path = find_group_path , headers = headers )
69+ result = self ._call (
70+ method = Method .get ,
71+ path = find_group_path ,
72+ params = query_params ,
73+ headers = headers ,
74+ )
6775 return BugoutGroup (** result )
6876
6977 def get_user_groups (self , token : Union [str , uuid .UUID ]) -> BugoutUserGroups :
0 commit comments