ElvFabric
Tools for operating content on the Content Fabric
Constructor
Instantiate the ElvFabric Object
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
configUrl | string | ✓ | The Content Fabric configuration URL |
AccessGroupManager
group,
addr
)
AccessGroupManager Check if an address is a manager of the access group
Returns: result of contract method call
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
group | string | ✓ | Group ID (hex or igrp format) |
addr | string | ✓ | User address |
AccessGroupManagers
AccessGroupManagers Returns a list of group managers
Returns: group members
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
group | string | ✓ | Group ID (hex or igrp format) |
AccessGroupMember
group,
addr
)
AccessGroupMemeber Check if an address is a member of the access group
Returns: result of contract method call
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
group | string | ✓ | Group ID (hex or igrp format) |
addr | string | ✓ | User address |
AccessGroupMembers
AccessGroupMembers Returns a list of group members
Returns: group members
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
group | string | ✓ | Group ID (hex or igrp format) |
copyObject
objectId,
meta
)
Make a copy of an object and set content metadata on the new object
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
objectId | string | ✓ | |
meta | object | ✓ | Metadata tree to merge into the object |
copyObjectBatch
Make a copy of a list of object and set content metadata on the new ones.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
ids | object | ✓ | Map of object IDs to metadata |
GetContractMeta
address,
key
)
GetContractMeta
Returns: value stored in the contract metadata
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
address | string | ✓ | contract address |
key | string | ✓ | metadata key |
getMeta
Get content metadata for an object
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
objectId | string | ✓ |
GetMetaBatch
GetMetaBatch
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
csvFile | string | ✓ | File specifying a list of content IDs and metadata fields to read. Note that the first two columns has to be id,hash |
GetMetaByIds
ids,
fields
)
GetMetaByIds
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
ids | Object.<string, Object> | ✓ | Map of content object IDs to their metadata objects |
fields | Array.<string> | ✓ | Metadata field paths to extract for each object |
ReadCsvObjectsMerged
csvFile,
ignore
)
Read a CSV file and parse into a JSON object merging with the object's existing fabric metadata.
Applies string substitutions on input:
- ${UUID}
CSV file format: id,field1,field2 iq_1111,value1,value2 iq_2222,value1,value2
Output format: { "iq_1111" : { "field1": "value1", "field2": "value2" }, "iq_2222" : { "field1": "value1", "field2": "value2" } }
Returns: object Map of object IDs to metadata
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
csvFile | string | ✓ | path to CSV file |
ignore | Array | ✓ | a list of prefixes to ignore eg "eluv." |
SetContractMeta
address,
key,
value
)
SetContractMeta
Returns: result of contract method call
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
address | string | ✓ | contract address |
key | string | ✓ | metadata key |
value | string | ✓ | metadata value |
SetContractMetaAsync
address,
key,
value
) → object
SetContractMetaAsync - async version of client SetContractMeta() Submits the putMeta transaction WITHOUT waiting for completionand returns the ethers transaction response so the caller can wait on it
Returns: ethers transaction response - caller can call .wait()
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
address | string | ✓ | contract address |
key | string | ✓ | metadata key |
value | string | ✓ | metadata value |
setMeta
objectId,
meta,
merge
)
Set content metadata for an object
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
objectId | string | ✓ | |
meta | object | ✓ | Metadata tree to merge into the object |
merge | boolean | ✓ | Merge == true will merge instead of replace |
setMetaBatch
Set content metadata for a bach of objects.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
ids | object | ✓ | Map of object IDs to metadata |
SetMetaBatch
csvFile,
duplicate
)
SetMetaBatch
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
csvFile | string | ✓ | File specifying a list of content IDs and metadata fields |
duplicate | boolean | ✓ | Clone objects and set metadata on the clone instead |