polyapi-python 0.3.10.dev6__tar.gz → 0.3.11__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/PKG-INFO +1 -1
  2. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi/cli.py +14 -9
  3. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi/config.py +16 -16
  4. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi/generate.py +7 -7
  5. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi/poly_tables.py +53 -1
  6. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi/typedefs.py +4 -0
  7. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi_python.egg-info/PKG-INFO +1 -1
  8. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/pyproject.toml +1 -1
  9. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/tests/test_tabi.py +49 -1
  10. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/LICENSE +0 -0
  11. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/README.md +0 -0
  12. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi/__init__.py +0 -0
  13. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi/__main__.py +0 -0
  14. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi/api.py +0 -0
  15. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi/auth.py +0 -0
  16. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi/client.py +0 -0
  17. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi/constants.py +0 -0
  18. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi/deployables.py +0 -0
  19. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi/error_handler.py +0 -0
  20. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi/exceptions.py +0 -0
  21. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi/execute.py +0 -0
  22. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi/function_cli.py +0 -0
  23. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi/parser.py +0 -0
  24. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi/poly_schemas.py +0 -0
  25. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi/prepare.py +0 -0
  26. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi/py.typed +0 -0
  27. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi/rendered_spec.py +0 -0
  28. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi/schema.py +0 -0
  29. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi/server.py +0 -0
  30. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi/sync.py +0 -0
  31. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi/utils.py +0 -0
  32. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi/variables.py +0 -0
  33. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi/webhook.py +0 -0
  34. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi_python.egg-info/SOURCES.txt +0 -0
  35. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi_python.egg-info/dependency_links.txt +0 -0
  36. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi_python.egg-info/requires.txt +0 -0
  37. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/polyapi_python.egg-info/top_level.txt +0 -0
  38. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/setup.cfg +0 -0
  39. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/tests/test_api.py +0 -0
  40. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/tests/test_auth.py +0 -0
  41. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/tests/test_deployables.py +0 -0
  42. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/tests/test_generate.py +0 -0
  43. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/tests/test_parser.py +0 -0
  44. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/tests/test_rendered_spec.py +0 -0
  45. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/tests/test_schema.py +0 -0
  46. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/tests/test_server.py +0 -0
  47. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/tests/test_utils.py +0 -0
  48. {polyapi_python-0.3.10.dev6 → polyapi_python-0.3.11}/tests/test_variables.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polyapi-python
3
- Version: 0.3.10.dev6
3
+ Version: 0.3.11
4
4
  Summary: The Python Client for PolyAPI, the IPaaS by Developers for Developers
5
5
  Author-email: Dan Fellin <dan@polyapi.io>
6
6
  License: MIT License
@@ -42,18 +42,23 @@ def execute_from_cli():
42
42
 
43
43
  ###########################################################################
44
44
  # Setup command
45
+
45
46
  setup_parser = subparsers.add_parser("setup", help="Setup your Poly connection")
46
- setup_parser.add_argument("api_key", nargs="?", help="API key for Poly API")
47
47
  setup_parser.add_argument("url", nargs="?", help="URL for the Poly API")
48
+ setup_parser.add_argument("api_key", nargs="?", help="API key for Poly API")
49
+
48
50
 
49
51
  def setup(args):
50
- if args.api_key and args.url:
51
- set_api_key_and_url(args.url, args.api_key)
52
+ url = args.url or os.getenv("POLY_API_BASE_URL")
53
+ api_key = args.api_key or os.getenv("POLY_API_KEY")
54
+
55
+ if api_key and url:
56
+ set_api_key_and_url(url, api_key)
52
57
  else:
53
58
  initialize_config(force=True)
54
59
  # setup command should have default cache values
55
60
  from .config import cache_generate_args
56
- cache_generate_args(contexts=None, names=None, function_ids=None, no_types=False)
61
+ cache_generate_args(contexts=None, names=None, ids=None, no_types=False)
57
62
  generate()
58
63
 
59
64
  setup_parser.set_defaults(command=setup)
@@ -65,7 +70,7 @@ def execute_from_cli():
65
70
  generate_parser.add_argument("--no-types", action="store_true", help="Generate SDK without type definitions")
66
71
  generate_parser.add_argument("--contexts", type=str, required=False, help="Contexts to generate")
67
72
  generate_parser.add_argument("--names", type=str, required=False, help="Resource names to generate (comma-separated)")
68
- generate_parser.add_argument("--function-ids", type=str, required=False, help="Function IDs to generate (comma-separated)")
73
+ generate_parser.add_argument("--ids", "--function-ids", type=str, required=False, help="Resource IDs to generate (comma-separated)")
69
74
 
70
75
  def generate_command(args):
71
76
  from .config import cache_generate_args
@@ -74,24 +79,24 @@ def execute_from_cli():
74
79
 
75
80
  contexts = args.contexts.split(",") if args.contexts else None
76
81
  names = args.names.split(",") if args.names else None
77
- function_ids = args.function_ids.split(",") if args.function_ids else None
82
+ ids = args.ids.split(",") if args.ids else None
78
83
  no_types = args.no_types
79
84
 
80
85
  # overwrite all cached values with the values passed in from the command line
81
86
  final_contexts = contexts
82
87
  final_names = names
83
- final_function_ids = function_ids
88
+ final_ids = ids
84
89
  final_no_types = no_types
85
90
 
86
91
  # cache the values used for this explicit generate command
87
92
  cache_generate_args(
88
93
  contexts=final_contexts,
89
94
  names=final_names,
90
- function_ids=final_function_ids,
95
+ ids=ids,
91
96
  no_types=final_no_types
92
97
  )
93
98
 
94
- generate(contexts=final_contexts, names=final_names, function_ids=final_function_ids, no_types=final_no_types)
99
+ generate(contexts=final_contexts, names=final_names, ids=ids, no_types=final_no_types)
95
100
 
96
101
  generate_parser.set_defaults(command=generate_command)
97
102
 
@@ -14,7 +14,7 @@ MTLS_KEY_PATH = None
14
14
  MTLS_CA_PATH = None
15
15
  LAST_GENERATE_CONTEXTS = None
16
16
  LAST_GENERATE_NAMES = None
17
- LAST_GENERATE_FUNCTION_IDS = None
17
+ LAST_GENERATE_IDS = None
18
18
  LAST_GENERATE_NO_TYPES = None
19
19
 
20
20
 
@@ -61,19 +61,19 @@ def get_api_key_and_url() -> Tuple[str | None, str | None]:
61
61
  MTLS_CA_PATH = config.get("polyapi", "mtls_ca_path", fallback=None)
62
62
 
63
63
  # Read and cache generate command arguments
64
- global LAST_GENERATE_CONTEXTS, LAST_GENERATE_NAMES, LAST_GENERATE_FUNCTION_IDS, LAST_GENERATE_NO_TYPES
64
+ global LAST_GENERATE_CONTEXTS, LAST_GENERATE_NAMES, LAST_GENERATE_IDS, LAST_GENERATE_NO_TYPES
65
65
  contexts_str = config.get("polyapi", "last_generate_contexts_used", fallback=None)
66
66
  LAST_GENERATE_CONTEXTS = contexts_str.split(",") if contexts_str else None
67
67
  names_str = config.get("polyapi", "last_generate_names_used", fallback=None)
68
68
  LAST_GENERATE_NAMES = names_str.split(",") if names_str else None
69
- function_ids_str = config.get("polyapi", "last_generate_function_ids_used", fallback=None)
70
- LAST_GENERATE_FUNCTION_IDS = function_ids_str.split(",") if function_ids_str else None
69
+ ids_str = config.get("polyapi", "last_generate_ids_used", fallback=None)
70
+ LAST_GENERATE_IDS = ids_str.split(",") if ids_str else None
71
71
  LAST_GENERATE_NO_TYPES = config.get("polyapi", "last_generate_no_types_used", fallback="false").lower() == "true"
72
72
 
73
73
  return key, url
74
74
 
75
75
 
76
- def set_api_key_and_url(key: str, url: str):
76
+ def set_api_key_and_url(url: str, key: str):
77
77
  config = configparser.ConfigParser()
78
78
  config["polyapi"] = {}
79
79
  config.set("polyapi", "poly_api_key", key)
@@ -107,7 +107,7 @@ def initialize_config(force=False):
107
107
  print_yellow("\n".join(errors))
108
108
  sys.exit(1)
109
109
 
110
- set_api_key_and_url(key, url)
110
+ set_api_key_and_url(url, key)
111
111
  print_green("Poly setup complete.")
112
112
 
113
113
  if not key or not url:
@@ -152,14 +152,14 @@ def get_direct_execute_config() -> bool:
152
152
 
153
153
  def get_cached_generate_args() -> Tuple[list | None, list | None, list | None, bool]:
154
154
  """Return cached generate command arguments"""
155
- global LAST_GENERATE_CONTEXTS, LAST_GENERATE_NAMES, LAST_GENERATE_FUNCTION_IDS, LAST_GENERATE_NO_TYPES
156
- if LAST_GENERATE_CONTEXTS is None and LAST_GENERATE_NAMES is None and LAST_GENERATE_FUNCTION_IDS is None and LAST_GENERATE_NO_TYPES is None:
155
+ global LAST_GENERATE_CONTEXTS, LAST_GENERATE_NAMES, LAST_GENERATE_IDS, LAST_GENERATE_NO_TYPES
156
+ if LAST_GENERATE_CONTEXTS is None and LAST_GENERATE_NAMES is None and LAST_GENERATE_IDS is None and LAST_GENERATE_NO_TYPES is None:
157
157
  # Force a config read if values aren't cached
158
158
  get_api_key_and_url()
159
- return LAST_GENERATE_CONTEXTS, LAST_GENERATE_NAMES, LAST_GENERATE_FUNCTION_IDS, bool(LAST_GENERATE_NO_TYPES)
159
+ return LAST_GENERATE_CONTEXTS, LAST_GENERATE_NAMES, LAST_GENERATE_IDS, bool(LAST_GENERATE_NO_TYPES)
160
160
 
161
161
 
162
- def cache_generate_args(contexts: list | None = None, names: list | None = None, function_ids: list | None = None, no_types: bool = False):
162
+ def cache_generate_args(contexts: list | None = None, names: list | None = None, ids: list | None = None, no_types: bool = False):
163
163
  """Cache generate command arguments to config file"""
164
164
  from typing import List
165
165
 
@@ -176,10 +176,10 @@ def cache_generate_args(contexts: list | None = None, names: list | None = None,
176
176
  config["polyapi"] = {}
177
177
 
178
178
  # Update cached values
179
- global LAST_GENERATE_CONTEXTS, LAST_GENERATE_NAMES, LAST_GENERATE_FUNCTION_IDS, LAST_GENERATE_NO_TYPES
179
+ global LAST_GENERATE_CONTEXTS, LAST_GENERATE_NAMES, LAST_GENERATE_IDS, LAST_GENERATE_NO_TYPES
180
180
  LAST_GENERATE_CONTEXTS = contexts
181
181
  LAST_GENERATE_NAMES = names
182
- LAST_GENERATE_FUNCTION_IDS = function_ids
182
+ LAST_GENERATE_IDS = ids
183
183
  LAST_GENERATE_NO_TYPES = no_types
184
184
 
185
185
  # Write values to config
@@ -193,10 +193,10 @@ def cache_generate_args(contexts: list | None = None, names: list | None = None,
193
193
  elif config.has_option("polyapi", "last_generate_names_used"):
194
194
  config.remove_option("polyapi", "last_generate_names_used")
195
195
 
196
- if function_ids is not None:
197
- config.set("polyapi", "last_generate_function_ids_used", ",".join(function_ids))
198
- elif config.has_option("polyapi", "last_generate_function_ids_used"):
199
- config.remove_option("polyapi", "last_generate_function_ids_used")
196
+ if ids is not None:
197
+ config.set("polyapi", "last_generate_ids_used", ",".join(ids))
198
+ elif config.has_option("polyapi", "last_generate_ids_used"):
199
+ config.remove_option("polyapi", "last_generate_ids_used")
200
200
 
201
201
  config.set("polyapi", "last_generate_no_types_used", str(no_types).lower())
202
202
 
@@ -42,7 +42,7 @@ Unresolved schema, please add the following schema to complete it:
42
42
  path:'''
43
43
 
44
44
 
45
- def get_specs(contexts: Optional[List[str]] = None, names: Optional[List[str]] = None, function_ids: Optional[List[str]] = None, no_types: bool = False) -> List:
45
+ def get_specs(contexts: Optional[List[str]] = None, names: Optional[List[str]] = None, ids: Optional[List[str]] = None, no_types: bool = False) -> List:
46
46
  api_key, api_url = get_api_key_and_url()
47
47
  assert api_key
48
48
  headers = get_auth_headers(api_key)
@@ -55,8 +55,8 @@ def get_specs(contexts: Optional[List[str]] = None, names: Optional[List[str]] =
55
55
  if names:
56
56
  params["names"] = names
57
57
 
58
- if function_ids:
59
- params["functionIds"] = function_ids
58
+ if ids:
59
+ params["ids"] = ids
60
60
 
61
61
  # Add apiFunctionDirectExecute parameter if direct execute is enabled
62
62
  if get_direct_execute_config():
@@ -297,12 +297,12 @@ def generate_from_cache() -> None:
297
297
  """
298
298
  Generate using cached values after non-explicit call.
299
299
  """
300
- cached_contexts, cached_names, cached_function_ids, cached_no_types = get_cached_generate_args()
300
+ cached_contexts, cached_names, cached_ids, cached_no_types = get_cached_generate_args()
301
301
 
302
302
  generate(
303
303
  contexts=cached_contexts,
304
304
  names=cached_names,
305
- function_ids=cached_function_ids,
305
+ ids=cached_ids,
306
306
  no_types=cached_no_types
307
307
  )
308
308
 
@@ -338,12 +338,12 @@ def normalize_args_schema(
338
338
  return spec
339
339
 
340
340
 
341
- def generate(contexts: Optional[List[str]] = None, names: Optional[List[str]] = None, function_ids: Optional[List[str]] = None, no_types: bool = False) -> None:
341
+ def generate(contexts: Optional[List[str]] = None, names: Optional[List[str]] = None, ids: Optional[List[str]] = None, no_types: bool = False) -> None:
342
342
  generate_msg = f"Generating Poly Python SDK for contexts ${contexts}..." if contexts else "Generating Poly Python SDK..."
343
343
  print(generate_msg, end="", flush=True)
344
344
  remove_old_library()
345
345
 
346
- specs = get_specs(contexts=contexts, names=names, function_ids=function_ids, no_types=no_types)
346
+ specs = get_specs(contexts=contexts, names=names, ids=ids, no_types=no_types)
347
347
  cache_specs(specs)
348
348
 
349
349
  limit_ids: List[str] = [] # useful for narrowing down generation to a single function to debug
@@ -55,6 +55,10 @@ def first_result(rsp):
55
55
  return rsp['results'][0] if rsp['results'] else None
56
56
  return rsp
57
57
 
58
+ def delete_one_response(rsp):
59
+ if isinstance(rsp, dict) and isinstance(rsp.get('deleted'), int):
60
+ return { 'deleted': bool(rsp.get('deleted')) }
61
+ return { 'deleted': false }
58
62
 
59
63
  _key_transform_map = {
60
64
  "not_": "not",
@@ -301,6 +305,30 @@ class {table_name}:{table_description}
301
305
  query = kwargs
302
306
  return execute_query({table_name}.table_id, "update", transform_query(query))
303
307
 
308
+ @overload
309
+ @staticmethod
310
+ def update_one(id: str, query: {table_name}UpdateManyQuery) -> {table_name}Row: ...
311
+ @overload
312
+ @staticmethod
313
+ def update_one(*, id: str, where: Optional[{table_name}WhereFilter], data: {table_name}Subset) -> {table_name}Row: ...
314
+
315
+ @staticmethod
316
+ def update_one(*args, **kwargs) -> {table_name}Row:
317
+ if args:
318
+ if len(args) != 2 or or not isinstance(args[0], str) not isinstance(args[1], dict):
319
+ raise TypeError("Expected id and query as arguments or as kwargs")
320
+ query = args[1]
321
+ if not isinstance(query["where"], dict):
322
+ query["where"] = {{}}
323
+ query["where"]["id"] = args[0]
324
+ else:
325
+ query = kwargs
326
+ if not isinstance(query["where"], dict):
327
+ query["where"] = {{}}
328
+ query["where"]["id"] = kwargs["id"]
329
+ query.pop("id", None)
330
+ return first_result(execute_query({table_name}.table_id, "update", transform_query(query)))
331
+
304
332
  @overload
305
333
  @staticmethod
306
334
  def delete_many(query: {table_name}DeleteQuery) -> PolyDeleteResults: ...
@@ -316,7 +344,31 @@ class {table_name}:{table_description}
316
344
  query = args[0]
317
345
  else:
318
346
  query = kwargs
319
- return execute_query({table_name}.table_id, "delete", query)
347
+ return execute_query({table_name}.table_id, "delete", transform_query(query))
348
+
349
+ @overload
350
+ @staticmethod
351
+ def delete_one(query: {table_name}DeleteQuery) -> PolyDeleteResult: ...
352
+ @overload
353
+ @staticmethod
354
+ def delete_one(*, where: Optional[{table_name}WhereFilter]) -> PolyDeleteResult: ...
355
+
356
+ @staticmethod
357
+ def delete_one(*args, **kwargs) -> PolyDeleteResult:
358
+ if args:
359
+ if len(args) != 2 or or not isinstance(args[0], str) not isinstance(args[1], dict):
360
+ raise TypeError("Expected id and query as arguments or as kwargs")
361
+ query = args[1]
362
+ if not isinstance(query["where"], dict):
363
+ query["where"] = {{}}
364
+ query["where"]["id"] = args[0]
365
+ else:
366
+ query = kwargs
367
+ if not isinstance(query["where"], dict):
368
+ query["where"] = {{}}
369
+ query["where"]["id"] = kwargs["id"]
370
+ query.pop("id", None)
371
+ return delete_one_response(execute_query({table_name}.table_id, "delete", transform_query(query)))
320
372
  '''
321
373
 
322
374
 
@@ -118,6 +118,10 @@ class PolyDeleteResults(TypedDict):
118
118
  deleted: int
119
119
 
120
120
 
121
+ class PolyDeleteResult(TypedDict):
122
+ deleted: bool
123
+
124
+
121
125
 
122
126
  QueryMode = Literal["default", "insensitive"]
123
127
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polyapi-python
3
- Version: 0.3.10.dev6
3
+ Version: 0.3.11
4
4
  Summary: The Python Client for PolyAPI, the IPaaS by Developers for Developers
5
5
  Author-email: Dan Fellin <dan@polyapi.io>
6
6
  License: MIT License
@@ -3,7 +3,7 @@ requires = ["setuptools>=61.2", "wheel"]
3
3
 
4
4
  [project]
5
5
  name = "polyapi-python"
6
- version = "0.3.10.dev6"
6
+ version = "0.3.11"
7
7
  description = "The Python Client for PolyAPI, the IPaaS by Developers for Developers"
8
8
  authors = [{ name = "Dan Fellin", email = "dan@polyapi.io" }]
9
9
  dependencies = [
@@ -285,6 +285,30 @@ class MyTable:
285
285
  query = kwargs
286
286
  return execute_query(MyTable.table_id, "update", transform_query(query))
287
287
 
288
+ @overload
289
+ @staticmethod
290
+ def update_one(id: str, query: MyTableUpdateManyQuery) -> MyTableRow: ...
291
+ @overload
292
+ @staticmethod
293
+ def update_one(*, id: str, where: Optional[MyTableWhereFilter], data: MyTableSubset) -> MyTableRow: ...
294
+
295
+ @staticmethod
296
+ def update_one(*args, **kwargs) -> MyTableRow:
297
+ if args:
298
+ if len(args) != 2 or or not isinstance(args[0], str) not isinstance(args[1], dict):
299
+ raise TypeError("Expected id and query as arguments or as kwargs")
300
+ query = args[1]
301
+ if not isinstance(query["where"], dict):
302
+ query["where"] = {}
303
+ query["where"]["id"] = args[0]
304
+ else:
305
+ query = kwargs
306
+ if not isinstance(query["where"], dict):
307
+ query["where"] = {}
308
+ query["where"]["id"] = kwargs["id"]
309
+ query.pop("id", None)
310
+ return first_result(execute_query(MyTable.table_id, "update", transform_query(query)))
311
+
288
312
  @overload
289
313
  @staticmethod
290
314
  def delete_many(query: MyTableDeleteQuery) -> PolyDeleteResults: ...
@@ -300,7 +324,31 @@ class MyTable:
300
324
  query = args[0]
301
325
  else:
302
326
  query = kwargs
303
- return execute_query(MyTable.table_id, "delete", query)
327
+ return execute_query(MyTable.table_id, "delete", transform_query(query))
328
+
329
+ @overload
330
+ @staticmethod
331
+ def delete_one(query: MyTableDeleteQuery) -> PolyDeleteResult: ...
332
+ @overload
333
+ @staticmethod
334
+ def delete_one(*, where: Optional[MyTableWhereFilter]) -> PolyDeleteResult: ...
335
+
336
+ @staticmethod
337
+ def delete_one(*args, **kwargs) -> PolyDeleteResult:
338
+ if args:
339
+ if len(args) != 2 or or not isinstance(args[0], str) not isinstance(args[1], dict):
340
+ raise TypeError("Expected id and query as arguments or as kwargs")
341
+ query = args[1]
342
+ if not isinstance(query["where"], dict):
343
+ query["where"] = {}
344
+ query["where"]["id"] = args[0]
345
+ else:
346
+ query = kwargs
347
+ if not isinstance(query["where"], dict):
348
+ query["where"] = {}
349
+ query["where"]["id"] = kwargs["id"]
350
+ query.pop("id", None)
351
+ return delete_one_response(execute_query(MyTable.table_id, "delete", transform_query(query)))
304
352
  '''
305
353
 
306
354
  TABLE_SPEC_COMPLEX = {