fix: add endpoint name
This commit is contained in:
parent
0025b27200
commit
c9f80b46a1
@ -21,15 +21,18 @@ class EndpointCreateApi(Resource):
|
||||
parser = reqparse.RequestParser()
|
||||
parser.add_argument("plugin_unique_identifier", type=str, required=True)
|
||||
parser.add_argument("settings", type=dict, required=True)
|
||||
parser.add_argument("name", type=str, required=True)
|
||||
args = parser.parse_args()
|
||||
|
||||
plugin_unique_identifier = args["plugin_unique_identifier"]
|
||||
settings = args["settings"]
|
||||
name = args["name"]
|
||||
|
||||
return EndpointService.create_endpoint(
|
||||
tenant_id=user.current_tenant_id,
|
||||
user_id=user.id,
|
||||
plugin_unique_identifier=plugin_unique_identifier,
|
||||
name=name,
|
||||
settings=settings,
|
||||
)
|
||||
|
||||
@ -75,15 +78,18 @@ class EndpointUpdateApi(Resource):
|
||||
parser = reqparse.RequestParser()
|
||||
parser.add_argument("endpoint_id", type=str, required=True)
|
||||
parser.add_argument("settings", type=dict, required=True)
|
||||
parser.add_argument("name", type=str, required=True)
|
||||
args = parser.parse_args()
|
||||
|
||||
endpoint_id = args["endpoint_id"]
|
||||
settings = args["settings"]
|
||||
name = args["name"]
|
||||
|
||||
return EndpointService.update_endpoint(
|
||||
tenant_id=user.current_tenant_id,
|
||||
user_id=user.id,
|
||||
endpoint_id=endpoint_id,
|
||||
name=name,
|
||||
settings=settings,
|
||||
)
|
||||
|
||||
|
@ -21,6 +21,7 @@ class EndpointEntity(BasePluginEntity):
|
||||
"""
|
||||
|
||||
settings: dict
|
||||
name: str
|
||||
hook_id: str
|
||||
tenant_id: str
|
||||
plugin_id: str
|
||||
|
@ -3,7 +3,7 @@ from core.plugin.manager.base import BasePluginManager
|
||||
|
||||
|
||||
class PluginEndpointManager(BasePluginManager):
|
||||
def create_endpoint(self, tenant_id: str, user_id: str, plugin_unique_identifier: str, settings: dict):
|
||||
def create_endpoint(self, tenant_id: str, user_id: str, plugin_unique_identifier: str, name: str, settings: dict):
|
||||
"""
|
||||
Create an endpoint for the given plugin.
|
||||
|
||||
@ -20,6 +20,7 @@ class PluginEndpointManager(BasePluginManager):
|
||||
"user_id": user_id,
|
||||
"plugin_unique_identifier": plugin_unique_identifier,
|
||||
"settings": settings,
|
||||
"name": name,
|
||||
},
|
||||
)
|
||||
|
||||
@ -50,7 +51,7 @@ class PluginEndpointManager(BasePluginManager):
|
||||
},
|
||||
)
|
||||
|
||||
def update_endpoint(self, tenant_id: str, user_id: str, endpoint_id: str, settings: dict):
|
||||
def update_endpoint(self, tenant_id: str, user_id: str, endpoint_id: str, name: str, settings: dict):
|
||||
"""
|
||||
Update the settings of the given endpoint.
|
||||
"""
|
||||
@ -61,6 +62,7 @@ class PluginEndpointManager(BasePluginManager):
|
||||
data={
|
||||
"user_id": user_id,
|
||||
"endpoint_id": endpoint_id,
|
||||
"name": name,
|
||||
"settings": settings,
|
||||
},
|
||||
)
|
||||
|
@ -3,11 +3,12 @@ from core.plugin.manager.endpoint import PluginEndpointManager
|
||||
|
||||
class EndpointService:
|
||||
@classmethod
|
||||
def create_endpoint(cls, tenant_id: str, user_id: str, plugin_unique_identifier: str, settings: dict):
|
||||
def create_endpoint(cls, tenant_id: str, user_id: str, plugin_unique_identifier: str, name: str, settings: dict):
|
||||
return PluginEndpointManager().create_endpoint(
|
||||
tenant_id=tenant_id,
|
||||
user_id=user_id,
|
||||
plugin_unique_identifier=plugin_unique_identifier,
|
||||
name=name,
|
||||
settings=settings,
|
||||
)
|
||||
|
||||
@ -19,11 +20,12 @@ class EndpointService:
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def update_endpoint(cls, tenant_id: str, user_id: str, endpoint_id: str, settings: dict):
|
||||
def update_endpoint(cls, tenant_id: str, user_id: str, endpoint_id: str, name: str, settings: dict):
|
||||
return PluginEndpointManager().update_endpoint(
|
||||
tenant_id=tenant_id,
|
||||
user_id=user_id,
|
||||
endpoint_id=endpoint_id,
|
||||
name=name,
|
||||
settings=settings,
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user