4040
4141############################################################################
4242"""
43+
44+ from dataclasses import dataclass , asdict
4345import functools
4446from typing import List , Literal , NotRequired , TextIO , TypedDict
4547
@@ -60,6 +62,7 @@ class Pagination:
6062 ALL = "all"
6163 NONE = "none"
6264
65+
6366# TODO: Provide filter generators.
6467#
6568# There are some inconsistencies between the different filter types with multiple values,
@@ -143,7 +146,6 @@ class Types:
143146 ARRAY_ISEMPTY = "arrayisempty"
144147 ARRAY_ISNOTEMPTY = "arrayisnotempty"
145148
146-
147149 # Table/Query-wise operators
148150 Q = "q"
149151
@@ -704,6 +706,32 @@ def move_rows(
704706 )
705707
706708
709+ @dataclass
710+ class GetQueriesOptions :
711+ include_columns : bool
712+ include_system_queries : bool
713+ include_title : bool
714+ include_user_queries : bool
715+ include_view_data_url : bool
716+ query_detail_columns : bool
717+
718+
719+ def get_queries (
720+ server_context : ServerContext ,
721+ schema_name : str ,
722+ container_path : str = None ,
723+ options : GetQueriesOptions = None ,
724+ timeout = _default_timeout ,
725+ ) -> dict :
726+ url = server_context .build_url ("query" , "getQueries.api" , container_path = container_path )
727+ payload = {"schemaName" : schema_name }
728+
729+ if options is not None :
730+ payload = {* payload , * asdict (options )}
731+
732+ return server_context .make_request (url , payload , timeout = timeout )
733+
734+
707735class QueryWrapper :
708736 """
709737 Wrapper for all of the API methods exposed in the query module. Used by the APIWrapper class.
@@ -939,3 +967,13 @@ def move_rows(
939967 audit_user_comment ,
940968 timeout ,
941969 )
970+
971+ @functools .wraps (get_queries )
972+ def get_queries (
973+ self ,
974+ schema_name : str ,
975+ container_path : str = None ,
976+ options : GetQueriesOptions = None ,
977+ timeout = _default_timeout ,
978+ ):
979+ return get_queries (self .server_context , schema_name , container_path , options , timeout )
0 commit comments