Skip to content

Commit 586d81a

Browse files
committed
Add the following:
* start-introduction endpoint handler * didexchange endpoints handlers as class
1 parent 23aab65 commit 586d81a

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed

aries_cloudcontroller/controllers/connections.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,3 +234,12 @@ async def set_connection_metadata(self, connection_id: str, metadata: dict = Non
234234
else:
235235
response = await self.admin_POST(f"/connections/{connection_id}/metadata")
236236
return response
237+
238+
async def start_introduction(
239+
self, connection_id: str, target_connection_id: str, message: str = None
240+
):
241+
route = f"/connections/{connection_id}/start-introduction?target_connection_id={target_connection_id}"
242+
if message:
243+
route += f"&message={message}"
244+
response = self.admin_POST(route)
245+
return response
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
from .base import BaseController
2+
from aiohttp import ClientSession
3+
import logging
4+
5+
logger = logging.getLogger("aries_controller.didexchange")
6+
7+
8+
class DidExchangeController(BaseController):
9+
def __init__(self, admin_url: str, client_session: ClientSession):
10+
super().__init__(admin_url, client_session)
11+
12+
async def create_request_against_invite(
13+
self,
14+
their_pub_id: str,
15+
mediation_id: str = None,
16+
my_endpoint: str = None,
17+
my_label: str = None,
18+
):
19+
params = {}
20+
if mediation_id:
21+
params["mediation_id"] = mediation_id
22+
if my_endpoint:
23+
params["my_endpoint"] = my_endpoint
24+
if my_label:
25+
params["my_label"] = my_label
26+
response = self.admin_POST(f"/didexchange/create-request", params=params)
27+
return response
28+
29+
print(params)
30+
31+
async def receive_request_against_invite(
32+
self,
33+
body: {} = None,
34+
alias: str = None,
35+
auto_accept: bool = None,
36+
mediation_id: str = None,
37+
my_endpoint: str = None,
38+
):
39+
params = {}
40+
if alias:
41+
params["alias"] = alias
42+
if auto_accept:
43+
params["auto_accept"] = auto_accept
44+
if mediation_id:
45+
params["mediation_id"] = mediation_id
46+
if my_endpoint:
47+
params["my_endpoint"] = my_endpoint
48+
if body:
49+
response = self.admin_POST(
50+
f"/didexchange/receive-request", body=body, params=params
51+
)
52+
else:
53+
response = self.admin_POST(f"/didexchange/receive-request", params=params)
54+
return response
55+
56+
async def accept_invitation(
57+
self, connection_id: str, my_endpoint: str = None, my_label: str = None
58+
):
59+
params = {}
60+
if my_endpoint:
61+
params["my_endpoint"] = my_endpoint
62+
if my_label:
63+
params["my_label"] = my_label
64+
response = self.admin_POST(
65+
f"/didexchange{connection_id}/accept-invitation", params=params
66+
)
67+
return response
68+
69+
async def accept_stored_invite(
70+
self, connection_id: str, mediation_id: str = None, my_endpoint: str = None
71+
):
72+
params = {}
73+
if mediation_id:
74+
params["mediation_id"] = mediation_id
75+
if my_endpoint:
76+
params["my_endpoint"] = my_endpoint
77+
response = self.admin_POST(
78+
f"/didexchange/{connection_id}/accept-request", params=params
79+
)

0 commit comments

Comments
 (0)