Skip to content

Files

Latest commit

4a0e235 · Oct 27, 2022

History

History
313 lines (196 loc) · 11.8 KB

godel-reference.md

File metadata and controls

313 lines (196 loc) · 11.8 KB

Godel Reference

GoldenAPI

add_triple_to_entity(entity_id, predicate_id, citation_url, object_entity_id=None, object_value=None, **kwargs)

WARNING: To be deprecated in near future version

Add a triple given the subject enity id, predicate id, object id/value, and citation url

Parameters:

Name Type Description Default
entity_id str UID of the subject entity required
predicate_id str UID of the predicate required
object_entity_id str UID of the object entity None
citation_url str citation URL required

Returns:

Name Type Description
dict dict created triple

authenticate(user_id, signature, **kwargs)

Authenticate your signature with the GraphQL API

Parameters:

Name Type Description Default
user_id(str) Ether wallet address (Hex) required
signature str Signed auth message (Hex) required

Returns:

Name Type Description
dict dict payload with JWT bearer token

create_entity(create_entity_input, **kwargs)

Create an entity given the MDTs/statement inputs required for entity creation.

Parameters:

Name Type Description Default
input CreateEntityInput Create Entity input required

Returns:

Name Type Description
dict created entity

create_statement(create_statement_input, **kwargs)

Create statement triple given the statement input combinations of subject entity id, predicate id, object id/value, and citation url

Parameters:

Name Type Description Default
input CreateStatementInput Create statement record input required

Returns:

Name Type Description
dict created statement

entity_by_golden_id(golden_id, **kwargs)

Retrieve entity by golden.com entity ID

Parameters:

Name Type Description Default
golden_id str must be an integer required

Returns:

Name Type Description
dict dict description

entity_by_name(name, first=10, **kwargs)

Retrieve entity by name

Parameters:

Name Type Description Default
name str name of entity required
first int number of results. Defaults to 20. 10

Returns:

Name Type Description
dict dict search results

entity_detail(id, **kwargs)

Retrieve entity details, includes rich template and statement values

Parameters:

Name Type Description Default
id str id of entity to retrieve required

Returns:

Name Type Description
dict dict Entity with details

entity_search(name, first=20, **kwargs)

Base entity search with SQL

Parameters:

Name Type Description Default
name str name of entity searched required
first int, Optional number of results. Defaults to 20. 20

Returns:

Name Type Description
dict dict search results

entity_with_triples(id)

Retrieve entity with both entity to value triples and entity to entity triples

Parameters:

Name Type Description Default
entity_id str id of entity to retrieve required

Returns:

Name Type Description
dict dict Entity with triples

generate_variables(op, params) classmethod

Helper for retrieving variable names from operation and making variable object for endpoint

Parameters:

Name Type Description Default
op Operation sgqlc operation required
params dict variable values from methods required

Returns:

Name Type Description
dict dict dict of variable names

get_authentication_message(user_id, **kwargs)

Retrieve auth message to sign with your wallet to verify your role and account

Parameters:

Name Type Description Default
user_id str Ether wallet address (Hex) required

Returns:

Name Type Description
dict dict payload with string message

get_authentication_token(user_id, wallet_private_key, **kwargs)

Convenience method for calling getAuthenticationMessage and authenticate given a user's wallet address and private key to obtain a JWT bearer token. Private key param is never sent to the API. This package only uses it to generate your signature using web3.py

Calling this method will automatically set self.jwt_token which will be used in your graphql request headers.

Parameters:

Name Type Description Default
user_id(str) Wallet address (Hex) required
sign str Wallet private key required

Returns:

Name Type Description
str str your JWT bearer token

get_triple_for_validation(**kwargs)

Get triple for verification

Returns:

Name Type Description
dict dict data contain triple to verify

predicate_by_id(id)

Get all predicates

Returns:

Name Type Description
dict dict List of available predicates

predicate_by_name(name, **kwargs)

Get predicate given name

Parameters:

Name Type Description Default
name str name of prediate required

Returns:

Name Type Description
dict dict predicate object returned

predicates()

Get all predicates

Returns:

Name Type Description
dict dict List of available predicates

query(query='', headers={})

Generic method to query graphql endpoint

set_jwt_token(jwt_token='')

Set your token to start accessing the API with your wallet/role

Parameters:

Name Type Description Default
jwt_token str JWT Token. Defaults to "". ''

templates()

Get all templates

Returns:

Name Type Description
dict dict List of available templates

to_camel_case(snake_str) staticmethod

Convert snake str to camel case since all params should eventually adhere to graphql camel case

Parameters:

Name Type Description Default
snake_str str snake string required

Returns:

Name Type Description
str str lower camel case

unvalidated_triple()

Get all templates

Returns:

Name Type Description
dict dict List of available templates

get_godel_version()

Grabs the version of Godel from builtin importlib library

Returns:

Name Type Description
str str version name, unknown if fails to dynamically pull