public class Client
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
<T> java.util.concurrent.CompletableFuture<T> |
callScriptUrl(java.lang.String scriptUrl,
java.lang.Class<T> resultType)
run script by hive url
|
static Client |
createInstance(ApplicationContext context) |
java.util.concurrent.CompletableFuture<Vault> |
createVault(java.lang.String ownerDid,
java.lang.String preferredProviderAddress)
Create Vault for user with specified DID.
|
<T> java.util.concurrent.CompletableFuture<T> |
downloadFileByScriptUrl(java.lang.String scriptUrl,
java.lang.Class<T> resultType)
Convenient method that first calls a script by url using callScriptURL(), and expects the
JSON output to contain a file download information.
|
java.util.concurrent.CompletableFuture<Vault> |
getVault(java.lang.String ownerDid,
java.lang.String preferredProviderAddress)
get Vault instance with specified DID.
|
java.util.concurrent.CompletableFuture<java.lang.String> |
getVaultProvider(java.lang.String ownerDid,
java.lang.String preferredProviderAddress)
Try to acquire provider address for the specific user DID with rules with sequence orders:
- Use 'preferredProviderAddress' first when it's being with real value; Otherwise
- Resolve DID document according to the ownerDid from DID sidechain,
and find if there are more than one "HiveVault" services, then would
choose the first one service point as target provider address.
|
java.util.concurrent.CompletableFuture<HiveURLInfo> |
parseHiveURL(java.lang.String scriptUrl)
Parses a Hive standard url into a url info that can later be executed to get the result or the
target url.
|
static void |
setupResolver()
Constructor without parameters
resolver url and cache path use default value,
resolver url default value: http://api.elastos.io:20606
cache path default value: new java.io.File("didCache")
|
static void |
setupResolver(java.lang.String resolver)
Recommendation for cache dir:
- Laptop/standard Java
System.getProperty("user.home") + "/.cache.did.elastos"
- Android Java
Context.getFilesDir() + "/.cache.did.elastos"
|
public static void setupResolver()
throws HiveException
HiveExceptionpublic static void setupResolver(java.lang.String resolver)
throws HiveException
resolver - the DIDResolver objectHiveExceptionpublic static Client createInstance(ApplicationContext context) throws HiveException
HiveExceptionpublic java.util.concurrent.CompletableFuture<Vault> getVault(java.lang.String ownerDid, java.lang.String preferredProviderAddress)
ownerDid - the owner did related to target vaultpreferredProviderAddress - the preferred target provider addresspublic java.util.concurrent.CompletableFuture<Vault> createVault(java.lang.String ownerDid, java.lang.String preferredProviderAddress)
ownerDid - the owner did that want to create a vaultpreferredProviderAddress - the preferred provider address to usepublic java.util.concurrent.CompletableFuture<java.lang.String> getVaultProvider(java.lang.String ownerDid,
java.lang.String preferredProviderAddress)
ownerDid - the owner did that want be set provider addresspreferredProviderAddress - the preferred provider address to usepublic <T> java.util.concurrent.CompletableFuture<T> callScriptUrl(java.lang.String scriptUrl,
java.lang.Class<T> resultType)
T - scriptUrl - hive://target_did@target_app_did/script_name?params={key=value}resultType - public <T> java.util.concurrent.CompletableFuture<T> downloadFileByScriptUrl(java.lang.String scriptUrl,
java.lang.Class<T> resultType)
public java.util.concurrent.CompletableFuture<HiveURLInfo> parseHiveURL(java.lang.String scriptUrl)