From 8398b9b115931230cdd242525071ae790b3bee3a Mon Sep 17 00:00:00 2001 From: Jason Matthias Date: Thu, 10 Nov 2022 21:32:24 -0800 Subject: [PATCH] feat: get calls for user doc, entity, node types etc. CF-571 --- client.go | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/client.go b/client.go index 98435ea..e4e5563 100644 --- a/client.go +++ b/client.go @@ -11,7 +11,7 @@ Instantiate client "FINGERPRINT", ) -Examples +# Examples Enable logging & turn off developer mode (developer mode is true by default) @@ -69,7 +69,6 @@ Submit optional query parameters params := "per_page=3&page=2" data, err := client.GetUsers(params) - */ package synapse @@ -161,10 +160,10 @@ func (c *Client) GetPublicKey(scope ...string) (map[string]interface{}, error) { } qp := []string{"issue_public_key=YES&scope=" + defaultScope} - + if len(scope) > 1 { userId := scope[1] - qp[0] += "&user_id=" + userId + qp[0] += "&user_id=" + userId } return c.do("GET", url, "", qp) @@ -190,6 +189,14 @@ func (c *Client) GetTradeMarketData(tickerSymbol string) (map[string]interface{} return c.do("GET", url, "", ts) } +// GetNodeTypes returns available node types +func (c *Client) GetNodeTypes() (map[string]interface{}, error) { + log.info("========== GET NODE TYPES ==========") + url := buildURL(path["nodes"], "types") + + return c.do("GET", url, "", nil) +} + /********** OTHER **********/ // GetCryptoMarketData returns market data for cryptocurrencies @@ -340,3 +347,27 @@ func (c *Client) CreateUser(data, fingerprint, ipAddress string, idempotencyKey return &user, err } + +// GetUserDocumentTypes returns available user document types +func (c *Client) GetUserDocumentTypes() (map[string]interface{}, error) { + log.info("========== GET USER DOCUMENT TYPES ==========") + url := buildURL(path["users"], "document-types") + + return c.do("GET", url, "", nil) +} + +// GetUserEntityTypes returns available user entity types +func (c *Client) GetUserEntityTypes() (map[string]interface{}, error) { + log.info("========== GET USER ENTITY TYPES ==========") + url := buildURL(path["users"], "entity-types") + + return c.do("GET", url, "", nil) +} + +// GetUserEntityScopes returns available user entity scopes +func (c *Client) GetUserEntityScopes() (map[string]interface{}, error) { + log.info("========== GET USER ENTITY TYPES ==========") + url := buildURL(path["users"], "entity-scopes") + + return c.do("GET", url, "", nil) +}