polyapi-python 0.2.7.dev1__tar.gz → 0.2.7.dev3__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.
- {polyapi_python-0.2.7.dev1/polyapi_python.egg-info → polyapi_python-0.2.7.dev3}/PKG-INFO +1 -1
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi/function_cli.py +21 -1
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3/polyapi_python.egg-info}/PKG-INFO +1 -1
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/pyproject.toml +1 -1
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/tests/test_rendered_spec.py +2 -2
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/tests/test_utils.py +0 -7
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/LICENSE +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/README.md +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi/__init__.py +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi/__main__.py +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi/api.py +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi/auth.py +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi/cli.py +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi/client.py +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi/config.py +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi/constants.py +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi/error_handler.py +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi/exceptions.py +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi/execute.py +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi/generate.py +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi/py.typed +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi/rendered_spec.py +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi/schema.py +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi/server.py +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi/typedefs.py +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi/utils.py +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi/variables.py +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi/webhook.py +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi_python.egg-info/SOURCES.txt +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi_python.egg-info/dependency_links.txt +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi_python.egg-info/requires.txt +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi_python.egg-info/top_level.txt +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/setup.cfg +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/tests/test_api.py +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/tests/test_auth.py +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/tests/test_function_cli.py +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/tests/test_schema.py +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/tests/test_server.py +0 -0
- {polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/tests/test_variables.py +0 -0
|
@@ -286,4 +286,24 @@ def function_execute(context: str, subcommands: List) -> Any:
|
|
|
286
286
|
context_code = importlib.import_module(f"polyapi.poly.{context}")
|
|
287
287
|
print(f"Executing poly.{context}.{subcommands[1]}... ")
|
|
288
288
|
fn = getattr(context_code, subcommands[1])
|
|
289
|
-
return fn(*subcommands[2:])
|
|
289
|
+
return fn(*subcommands[2:])
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
def spec_delete(function_type: str, function_id: str):
|
|
293
|
+
api_key, api_url = get_api_key_and_url()
|
|
294
|
+
assert api_key
|
|
295
|
+
if function_type == "api":
|
|
296
|
+
url = f"{api_url}/functions/api/{function_id}"
|
|
297
|
+
elif function_type == "serverFunction":
|
|
298
|
+
url = f"{api_url}/functions/server/{function_id}"
|
|
299
|
+
elif function_type == "customFunction":
|
|
300
|
+
url = f"{api_url}/functions/client/{function_id}"
|
|
301
|
+
elif function_type == "webhookHandle":
|
|
302
|
+
url = f"{api_url}/webhooks/{function_id}"
|
|
303
|
+
else:
|
|
304
|
+
print_red("ERROR")
|
|
305
|
+
print(f"Unknown function type: {function_type}")
|
|
306
|
+
sys.exit(1)
|
|
307
|
+
headers = get_auth_headers(api_key)
|
|
308
|
+
resp = requests.delete(url, headers=headers)
|
|
309
|
+
return resp
|
|
@@ -3,7 +3,7 @@ requires = ["setuptools>=61.2", "wheel"]
|
|
|
3
3
|
|
|
4
4
|
[project]
|
|
5
5
|
name = "polyapi-python"
|
|
6
|
-
version = "0.2.7.
|
|
6
|
+
version = "0.2.7.dev3"
|
|
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 = [
|
|
@@ -36,7 +36,7 @@ class T(unittest.TestCase):
|
|
|
36
36
|
""" pass in a bad id to update and make sure it returns False
|
|
37
37
|
"""
|
|
38
38
|
_get_spec.return_value = None
|
|
39
|
-
updated = get_and_update_rendered_spec("
|
|
39
|
+
updated = get_and_update_rendered_spec("123")
|
|
40
40
|
self.assertEqual(_get_spec.call_count, 1)
|
|
41
41
|
self.assertFalse(updated)
|
|
42
42
|
|
|
@@ -47,6 +47,6 @@ class T(unittest.TestCase):
|
|
|
47
47
|
"""
|
|
48
48
|
_get_spec.return_value = GET_PRODUCTS_COUNT
|
|
49
49
|
post.return_value = Mock(status_code=201, text="Created")
|
|
50
|
-
updated = get_and_update_rendered_spec("
|
|
50
|
+
updated = get_and_update_rendered_spec("123")
|
|
51
51
|
self.assertEqual(_get_spec.call_count, 1)
|
|
52
52
|
self.assertTrue(updated)
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import unittest
|
|
2
|
-
from polyapi.schema import _fix_title
|
|
3
2
|
from polyapi.utils import get_type_and_def
|
|
4
3
|
|
|
5
4
|
OPENAPI_FUNCTION = {'kind': 'function', 'spec': {'arguments': [{'name': 'event', 'required': False, 'type': {'kind': 'object', 'schema': {'$schema': 'http://json-schema.org/draft-06/schema#', 'type': 'array', 'items': {'$ref': '#/definitions/WebhookEventTypeElement'}, 'definitions': {'WebhookEventTypeElement': {'type': 'object', 'additionalProperties': False, 'properties': {'title': {'type': 'string'}, 'manufacturerName': {'type': 'string'}, 'carType': {'type': 'string'}, 'id': {'type': 'integer'}}, 'required': ['carType', 'id', 'manufacturerName', 'title'], 'title': 'WebhookEventTypeElement'}}}}}, {'name': 'headers', 'required': False, 'type': {'kind': 'object', 'typeName': 'Record<string, any>'}}, {'name': 'params', 'required': False, 'type': {'kind': 'object', 'typeName': 'Record<string, any>'}}, {'name': 'polyCustom', 'required': False, 'type': {'kind': 'object', 'properties': [{'name': 'responseStatusCode', 'type': {'type': 'number', 'kind': 'primitive'}, 'required': True}, {'name': 'responseContentType', 'type': {'type': 'string', 'kind': 'primitive'}, 'required': True, 'nullable': True}]}}], 'returnType': {'kind': 'void'}, 'synchronous': True}}
|
|
6
5
|
|
|
7
6
|
|
|
8
7
|
class T(unittest.TestCase):
|
|
9
|
-
def test_fix_titles(self):
|
|
10
|
-
input_data = {'properties': {'requestNumber': {'title': 'Requestnumber', 'type': 'integer'}}, 'required': ['requestNumber'], 'title': 'numOfCars', 'type': 'object', 'metadata': {'pydantic.internal.needs_apply_discriminated_union': False}}
|
|
11
|
-
output = 'from typing import TypedDict\nfrom typing_extensions import Required\n\n\nclass Numofcars(TypedDict, total=False):\n """ numOfCars. """\n\n requestNumber: Required[int]\n """\n Requestnumber.\n\n Required property\n """\n\n'
|
|
12
|
-
fixed = _fix_title(input_data, output)
|
|
13
|
-
self.assertIn("class numOfCars", fixed)
|
|
14
|
-
|
|
15
8
|
def test_get_type_and_def(self):
|
|
16
9
|
arg_type, arg_def = get_type_and_def(OPENAPI_FUNCTION)
|
|
17
10
|
self.assertEqual(arg_type, "Callable[[List[WebhookEventTypeElement], Dict, Dict, Dict], None]")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi_python.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi_python.egg-info/requires.txt
RENAMED
|
File without changes
|
{polyapi_python-0.2.7.dev1 → polyapi_python-0.2.7.dev3}/polyapi_python.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|