Skip to content

Commit 23aab65

Browse files
committed
Complete cennections API in accordance with swagger
1 parent 617adbb commit 23aab65

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

aries_cloudcontroller/controllers/connections.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ async def accept_request(self, connection_id: str, my_endpoint: str = None):
140140
# TODO create proper error classes
141141
raise Exception("The connection is not in the request state")
142142

143+
async def get_remote_endpoints(self, connection_id: str):
144+
response = await self.admin_GET(f"/connections/{connection_id}/endpoints")
145+
return response
146+
143147
async def establish_inbound(self, connection_id: str, router_conn_id: str):
144148
response = await self.admin_POST(
145149
f"/connections/{connection_id}/establish-inbound/{router_conn_id}"
@@ -211,3 +215,22 @@ async def is_active(self, connection_id):
211215
logger.error(f"Connection {connection_id} not active")
212216
raise Exception("Connection must be active to send a credential")
213217
return
218+
219+
async def get_connection_metadata(self, connection_id: str, key: str = None):
220+
if key:
221+
response = await self.admin_GET(
222+
f"/connections/{connection_id}/metadata?key={key}"
223+
)
224+
else:
225+
response = await self.admin_GET(f"/connections/{connection_id}/metadata")
226+
return response
227+
228+
async def set_connection_metadata(self, connection_id: str, metadata: dict = None):
229+
if metadata:
230+
metadata = {"metadata": metadata}
231+
response = await self.admin_POST(
232+
f"/connections/{connection_id}/metadata", data=metadata
233+
)
234+
else:
235+
response = await self.admin_POST(f"/connections/{connection_id}/metadata")
236+
return response

0 commit comments

Comments
 (0)