Assess Reputation for Your dApp Users
An SDK to integrate Orange to your dApp
The "algorithm" and "AP" in method and variable names refer to "model" and "MP" respectively.
You can invoke the models of your choice available via Orange by sending invocation requests from your dApp to the system using the Orange Server SDK.
The general sequence in which you would call the methods to send an invocation request by specifying an model and a dataset is:
Call
GetAlgorithmProvidersandGetDataProvidersto go through the available model and data providers.Choose an MP and DP, and call
GetAlgorithmMethodsandGetDataMethodsto fetch the method details on available models and datasets.Choose an MP method and a DP method ensuring the schemas match, then call
RequestOrangeScoreto send an invocation request along with authorized and signed wallet information.Call
GetUserTaskto fetch the invocation results, or the status of a task.
The results can be exported in the form of Verifiable Credentials. Refer to the verifiable credential docs here for more details on how that can be implemented.
SDK intro
The Orange server uses GraphQL for its interface design. You can use the methods defined below to perform actions such as fetching MP and DP schema details and sending calculation requests using a model-data pair for specific wallets and DIDs.
Initialization
Add this dependency in the go.mod file in your project.
github.com/orange-protocol/orange-sdk-go latestSchema definition
The major schemas defined for the interface are described below.
Interface methods
1. Fetch details for all available MPs
Returns the details of all the currently registered model providers.
Method: GetAlgorithmProviders
Parameters: none
Returns: []*AlgorithmProvider
2. Fetch available methods for an MP
Returns all the currently available models and the associated schemas as defined by an MP.
Method: GetAlgorithmMethods
Parameters
apdid- The DID of specified MP
Returns: []*ProviderMethod
3. Fetch details for all available DPs
Returns the details of all the currently registered data providers.
Method: GetDataProviders
Parameters: none
Returns: []*DataProvider
4. Fetch available data methods for a DP
Returns all the currently available datasets and the associated schemas as defined by a DP.
Method: GetDataMethods
Parameters
dpdid- The DID of specified DP
Returns: []*ProviderMethod
5. Send a request to run the model with selected data
Sends a request to generate the score or report for the specified wallet addresses using the specified model and dataset, or MP and DP method respectively. Returns a taskId.
Method: RequestOrangeScore
Parameters
*RequestOrangeScoreReq- defined below
Returns: int64
6. Fetch result/status for a task
Method: GetUserTask
Parameters
key- API keytaskId- task ID
Returns: *UserTasks
Sample invocation
Refer to the sample code below that invokes the GetAlgorithmProviders method.
Last updated
Was this helpful?