Skip to content

Commit 5a7e281

Browse files
committed
Add calls v1/qrcodelink to and /v1/accounts
1 parent cc0b95c commit 5a7e281

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

pysignalclirestapi/api.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,23 @@ def about(self):
5555
return resp.json()
5656
return None
5757

58+
def link(self, device_name) -> bytes:
59+
# returns png file
60+
try:
61+
resp = requests.get(self._base_url + "/v1/qrcodelink", params={"device_name": device_name})
62+
resp.raise_for_status()
63+
return resp.content
64+
except Exception as exc:
65+
raise_from(SignalCliRestApiError("Could not link device"), exc)
66+
67+
def get_accounts(self) -> [str]:
68+
try:
69+
resp = requests.get(self._base_url + "/v1/accounts")
70+
resp.raise_for_status()
71+
return resp.json()
72+
except Exception as exc:
73+
raise_from(SignalCliRestApiError(f"Could not get accounts: {exc}"), exc)
74+
5875
def api_info(self):
5976
try:
6077
data = self.about()

0 commit comments

Comments
 (0)