mirror of
https://github.com/gogcom/galaxy-integrations-python-api.git
synced 2026-01-02 20:08:19 -05:00
SDK-2762: Standarize parameter binding
This commit is contained in:
@@ -162,12 +162,12 @@ class Server():
|
||||
|
||||
if internal:
|
||||
# internal requests are handled immediately
|
||||
response = callback(request.params)
|
||||
response = callback(**request.params)
|
||||
self._send_response(request.id, response)
|
||||
else:
|
||||
async def handle():
|
||||
try:
|
||||
result = await callback(request.params)
|
||||
result = await callback(**request.params)
|
||||
self._send_response(request.id, result)
|
||||
except TypeError:
|
||||
self._send_error(request.id, InvalidParams())
|
||||
|
||||
@@ -140,8 +140,8 @@ class Plugin():
|
||||
|
||||
def _register_method(self, name, handler, result_name=None, internal=False, sensitive_params=False, feature=None):
|
||||
if internal:
|
||||
def method(params):
|
||||
result = handler(**params)
|
||||
def method(*args, **kwargs):
|
||||
result = handler(*args, **kwargs)
|
||||
if result_name:
|
||||
result = {
|
||||
result_name: result
|
||||
@@ -149,8 +149,8 @@ class Plugin():
|
||||
return result
|
||||
self._server.register_method(name, method, True, sensitive_params)
|
||||
else:
|
||||
async def method(params):
|
||||
result = await handler(**params)
|
||||
async def method(*args, **kwargs):
|
||||
result = await handler(*args, **kwargs)
|
||||
if result_name:
|
||||
result = {
|
||||
result_name: result
|
||||
|
||||
Reference in New Issue
Block a user