UserProfileClient
Constructor
Methods used to access and modify information about the user
A note about access level and prompts:
Note: This section only applies to applications working within Eluvio Core
Users can choose whether or not their info is shared to applications. A user may choose to allow open access to their profile, no access to their profile, or they may choose to be prompted to give access when an application requests it. The user's access level can be determined using the AccessLevel method.
By default, users will be prompted to give access. For methods that access the user's private information, Eluvio Core will intercept the request and prompt the user for permission before proceeding. In these cases, the normal FrameClient timeout period will be ignored, and the response will come only after the user accepts or rejects the request.
Access and modification of user metadata is namespaced to the requesting application when using the FrameClient. Public user metadata can be accessed using the PublicUserMetadata method.
If the user refuses to give permission, an error will be thrown. Otherwise, the request will proceed as normal.
Usage
Access the UserProfileClient from ElvClient or FrameClient via client.userProfileClient
AccessLevel
Return the permissions the current user allows for apps to access their profile.
"private" - No access allowed "prompt" - (default) - When access is requested by an app, the user will be prompted to give permission "public - Public - Any access allowed
Returns: Access setting
CollectedTags
Get the accumulated tags for the current user
Note: Subject to user's access level
Returns: User tags
DeleteUserMetadata
Delete the specified subtree from the users profile metadata
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
metadataSubtree | string | Subtree to delete - deletes all metadata if not specified |
MergeUserMetadata
metadata,
metadataSubtree // optional
})
Merge the current user's profile metadata
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
metadata | Object | ✓ | New metadata |
metadataSubtree | string | Subtree to merge into - modifies root metadata if not specified |
PublicUserMetadata
address, // optional
metadataSubtree, // optional
queryParams, // optional
select, // optional
resolveLinks, // optional
resolveIncludeSource, // optional
resolveIgnoreErrors, // optional
linkDepthLimit // optional
}) → Promise.<(Object|string)>
Access the specified user's public profile metadata
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
address | string | The address of the user | |
metadataSubtree | string | Subtree of the metadata to retrieve | |
queryParams | Object | Additional query params for the call (default:{}) | |
select | Array.<string> | Limit the returned metadata to the specified attributes
| |
resolveLinks | boolean | If specified, links in the metadata will be resolved (default:false) | |
resolveIncludeSource | boolean | If specified, resolved links will include the hash of the link at the root of the metadata false) | |
resolveIgnoreErrors | boolean | If specified, link errors within the requested metadata will not cause the entire response to result in an error (default:false) | |
linkDepthLimit | number | Limit link resolution to the specified depth. Default link depth is 1 (only links directly in the object's metadata will be resolved) (default:1) |
ReplaceUserMetadata
metadata,
metadataSubtree // optional
})
Replace the current user's profile metadata
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
metadata | Object | ✓ | New metadata |
metadataSubtree | string | Subtree to replace - modifies root metadata if not specified |
SetAccessLevel
Set the current user's access level.
Note: This method is not accessible to applications. Eluvio core will drop the request.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
level | ✓ |
SetTenantContractId
tenantContractId,
address
})
Set the current user's tenant contract.
Note: This method is not accessible to applications. Eluvio core will drop the request.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
tenantContractId | string | ✓ | The tenant contract ID in hash format |
address | string | ✓ | The tenant address to use in the hash if id is not provided |
SetTenantId
id,
address
})
Set the current user's tenant admin group ID
Note: This method is not accessible to applications. Eluvio core will drop the request.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | ✓ | The tenant ID in hash format |
address | string | ✓ | The group address to use in the hash if id is not provided |
SetUserProfileImage
Set a new profile image for the current user
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
image | blob | ✓ | The new profile image for the current user |
TenantContractId
Return the ID of the tenant contract this user belongs to, if set.
Returns: Tenant Contract ID
TenantId
Return the ID of the tenant admin group set for current user
Returns: Tenant ID
UserMetadata
metadataSubtree, // optional
queryParams, // optional
select, // optional
resolveLinks, // optional
resolveIncludeSource, // optional
resolveIgnoreErrors, // optional
linkDepthLimit // optional
}) → Promise.<(Object|string)>
Access the current user's metadata
Note: Subject to user's access level
Returns: The user's profile metadata - returns undefined if no metadata set or subtree doesn't exist
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
metadataSubtree | string | Subtree of the metadata to retrieve | |
queryParams | Object | Additional query params for the call (default:{}) | |
select | Array.<string> | Limit the returned metadata to the specified attributes
| |
resolveLinks | boolean | If specified, links in the metadata will be resolved (default:false) | |
resolveIncludeSource | boolean | If specified, resolved links will include the hash of the link at the root of the metadata false) | |
resolveIgnoreErrors | boolean | If specified, link errors within the requested metadata will not cause the entire response to result in an error (default:false) | |
linkDepthLimit | number | Limit link resolution to the specified depth. Default link depth is 1 (only links directly in the object's metadata will be resolved) (default:1) |
UserProfileImage
address, // optional
height // optional
}) → Promise.<(string|undefined)>
Get the URL of the current user's profile image
Note: Part hash of profile image will be appended to the URL as a query parameter to invalidate browser caching when the image is updated
Returns: URL of the user's profile image. Will be undefined if no profile image is set.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
address | string | The address of the user. If not specified, the address of the current user will be used. | |
height | number | If specified, the image will be scaled to the specified maximum height |
UserWalletAddress
Get the user wallet address for the specified user, if it exists
Returns: The wallet address of the specified user, if it exists
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
address | string | ✓ | The address of the user |
UserWalletObjectInfo
Retrieve the user wallet object information (library ID and object ID)
The user's wallet can be modified in the same way as any other object, using EditContentObject to get a write token, modification methods to change it, and FinalizeContentObject to finalize the draft
Returns: An object containing the libraryId and objectId for the wallet object.
WalletAddress
Get the contract address of the current user's BaseAccessWallet contract
Returns: The contract address of the current user's wallet contract