Skip to content
Snippets Groups Projects
Commit 1e2f7394 authored by Moul's avatar Moul
Browse files

bma.wot: Support new optimized '?pubkey' query (#201)

on requirements, certifiers-of, and certified-by
New optional pubkey argument to keep
backward compatibility
parent 606d5405
No related branches found
No related tags found
No related merge requests found
Pipeline #32047 passed
...@@ -279,26 +279,34 @@ def lookup(client: Client, search: str) -> dict: ...@@ -279,26 +279,34 @@ def lookup(client: Client, search: str) -> dict:
return client.get(f"{MODULE}/lookup/{search}", schema=LOOKUP_SCHEMA) return client.get(f"{MODULE}/lookup/{search}", schema=LOOKUP_SCHEMA)
def certifiers_of(client: Client, search: str) -> dict: def certifiers_of(client: Client, search: str, pubkey: bool = False) -> dict:
""" """
GET UID/Public key certifiers GET UID/Public key certifiers
:param client: Client to connect to the api :param client: Client to connect to the api
:param search: UID or public key :param search: UID or public key
:param pubkey: Query argument for passing a public key for quicker response
:return: :return:
""" """
return client.get(f"{MODULE}/certifiers-of/{search}", schema=CERTIFICATIONS_SCHEMA) pubkey_query = "?pubkey" if pubkey else ""
return client.get(
f"{MODULE}/certifiers-of/{search}{pubkey_query}", schema=CERTIFICATIONS_SCHEMA
)
def certified_by(client: Client, search: str) -> dict: def certified_by(client: Client, search: str, pubkey: bool = False) -> dict:
""" """
GET identities certified by UID/Public key GET identities certified by UID/Public key
:param client: Client to connect to the api :param client: Client to connect to the api
:param search: UID or public key :param search: UID or public key
:param pubkey: Query argument for passing a public key for quicker response
:return: :return:
""" """
return client.get(f"{MODULE}/certified-by/{search}", schema=CERTIFICATIONS_SCHEMA) pubkey_query = "?pubkey" if pubkey else ""
return client.get(
f"{MODULE}/certified-by/{search}{pubkey_query}", schema=CERTIFICATIONS_SCHEMA
)
def members(client: Client) -> dict: def members(client: Client) -> dict:
...@@ -311,15 +319,19 @@ def members(client: Client) -> dict: ...@@ -311,15 +319,19 @@ def members(client: Client) -> dict:
return client.get(f"{MODULE}/members", schema=MEMBERS_SCHEMA) return client.get(f"{MODULE}/members", schema=MEMBERS_SCHEMA)
def requirements(client: Client, search: str) -> dict: def requirements(client: Client, search: str, pubkey: bool = False) -> dict:
""" """
GET list of requirements for a given UID/Public key GET list of requirements for a given UID/Public key
:param client: Client to connect to the api :param client: Client to connect to the api
:param search: UID or public key :param search: UID or public key
:param pubkey: Query argument for passing a public key for quicker response
:return: :return:
""" """
return client.get(f"{MODULE}/requirements/{search}", schema=REQUIREMENTS_SCHEMA) pubkey_query = "?pubkey" if pubkey else ""
return client.get(
f"{MODULE}/requirements/{search}{pubkey_query}", schema=REQUIREMENTS_SCHEMA
)
def requirements_of_pending(client: Client, minsig: int) -> dict: def requirements_of_pending(client: Client, minsig: int) -> dict:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment