Skip to content

Commit fc8630e

Browse files
committed
Merge branch 'main' into issue_14/create_invitation
2 parents a8cf415 + 708ac94 commit fc8630e

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

aries_cloudcontroller/controllers/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ def handle_output(self, *output, source: str = None, **kwargs):
5555
async def admin_request(
5656
self, method, path, json_data=None, text=False, params=None, data=None
5757
) -> ClientResponse:
58-
params = json.dumps(params)
5958
params = {k: v for (k, v) in (params or {}).items() if v is not None}
6059
async with self.client_session.request(
6160
method, self.admin_url + path, json=json_data, params=params, data=data

aries_cloudcontroller/controllers/connections.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ def default_handler(self, payload):
2929
connection.update_state(state)
3030
logger.debug(f"{connection_id} state updated")
3131

32+
# Combines receive and accept connection api calls
33+
async def accept_connection(self, invitation):
34+
response = await self.receive_invitation(invitation)
35+
36+
accepted = await self.accept_invitation(response["connection_id"])
37+
return accepted
38+
3239
### TODO refactor to extract out generic base - /connections
3340

3441
async def get_connections(
@@ -68,18 +75,17 @@ async def create_invitation(
6875
self,
6976
alias: str = None,
7077
auto_accept: bool = None,
71-
public: bool = None,
72-
multi_use: bool = None,
73-
invite_options: dict = None,
78+
public: str = None,
79+
multi_use: str = None,
7480
):
7581
params = {}
7682
if alias:
7783
params["alias"] = alias
78-
if auto_accept in [True, False]:
84+
if auto_accept:
7985
params["auto_accept"] = auto_accept
80-
if public in [True, False]:
86+
if public:
8187
params["public"] = public
82-
if multi_use in [True, False]:
88+
if multi_use:
8389
params["multi_use"] = multi_use
8490
if invite_option:
8591
"""A dictionary of the form:
@@ -114,7 +120,7 @@ async def receive_invitation(
114120
params = {}
115121
if alias:
116122
params["alias"] = alias
117-
if auto_accept in [True, False]:
123+
if auto_accept:
118124
params["auto_accept"] = auto_accept
119125

120126
response = await self.admin_POST(

aries_cloudcontroller/controllers/messaging.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ async def send_message(self, connection_id, msg):
2121
)
2222
return response
2323

24-
async def trust_ping(self, connection_id: str, msg: str):
25-
response = await self.admin_POST(
26-
f"/connections/{connection_id}/send-ping", {"content": msg}
27-
)
24+
async def trust_ping(self, connection_id: str, comment_msg: str = None):
25+
if comment_msg:
26+
response = await self.admin_POST(
27+
f"/connections/{connection_id}/send-ping", {"comment": comment_msg}
28+
)
29+
else:
30+
response = await self.admin_POST(f"/connections/{connection_id}/send-ping", {})
2831
return response

0 commit comments

Comments
 (0)