Skip to content

Commit 026eec1

Browse files
committed
client: add function to fetch product groups and their ID
1 parent fbf67f3 commit 026eec1

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

onekey_client/client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,12 @@ def upload_firmware(
205205
res = self._post_with_token(upload_url, files={"firmware": path.open("rb")})
206206
return res
207207

208+
@_tenant_required
209+
def get_product_groups(self):
210+
product_groups_query = load_query("get_product_groups.graphql")
211+
response = self.query(product_groups_query)
212+
return {pg["name"]: pg["id"] for pg in response["allProductGroups"]}
213+
208214
def logout(self):
209215
del self._state
210216
gc.collect()
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
query {
2+
allProductGroups {
3+
id
4+
name
5+
}
6+
}

0 commit comments

Comments
 (0)