Stores
Class representing instance of Stores API
Methods
createStore
Creates a new Store in given Context.
createStore(contextId, users, managers, publicMeta, privateMeta)
Name | Type | Description |
---|---|---|
contextId | string | ID of the Context to create the Store in |
users | UserWithPubKey[] | array of UserWithPubKey structs which indicates who will have access to the created Store |
managers | UserWithPubKey[] | array of UserWithPubKey structs which indicates who will have access (and management rights) to the created Store |
publicMeta | Uint8Array | public (unencrypted) metadata |
privateMeta | Uint8Array | private (encrypted) metadata |
Type | Description |
---|---|
Promise<string> | created Store ID |
updateStore
Updates an existing Store.
updateStore(storeId, users, managers, publicMeta, privateMeta, version, force, forceGenerateNewKey)
Name | Type | Description |
---|---|---|
storeId | string | ID of the Store to update |
users | UserWithPubKey[] | array of UserWithPubKey structs which indicates who will have access to the created Store |
managers | UserWithPubKey[] | array of UserWithPubKey structs which indicates who will have access (and management rights) to the created Store |
publicMeta | Uint8Array | public (unencrypted) metadata |
privateMeta | Uint8Array | private (encrypted) metadata |
version | number | current version of the updated Store |
force | boolean | force update (without checking version) |
forceGenerateNewKey | boolean | force to regenerate a key for the Store |
deleteStore
Deletes a Store by given Store ID.
deleteStore(storeId)
Name | Type | Description |
---|---|---|
storeId | string | ID of the Store to delete |
getStore
Gets a single Store by given Store ID.
getStore(storeId)
Name | Type | Description |
---|---|---|
storeId | string | ID of the Store to get |
Type | Description |
---|---|
Promise<Store> | struct containing information about the Store |
listStores
Gets a list of Stores in given Context.
listStores(contextId, pagingQuery)
Name | Type | Description |
---|---|---|
contextId | string | ID of the Context to get the Stores from |
pagingQuery | PagingQuery | struct with list query parameters |
Type | Description |
---|---|
Promise<PagingList<Store>> | struct containing list of Stores |
createFile
Creates a new file in a Store.
createFile(storeId, publicMeta, privateMeta, size)
Name | Type | Description |
---|---|---|
storeId | string | ID of the Store to create the file in |
publicMeta | Uint8Array | public file metadata |
privateMeta | Uint8Array | private file metadata |
size | number | size of the file |
Type | Description |
---|---|
Promise<number> | handle to write data |
updateFile
Update an existing file in a Store.
updateFile(fileId, publicMeta, privateMeta, size)
Name | Type | Description |
---|---|---|
fileId | string | ID of the file to update |
publicMeta | Uint8Array | public file metadata |
privateMeta | Uint8Array | private file metadata |
size | number | size of the file |
Type | Description |
---|---|
Promise<number> | handle to write file data |
updateFileMeta
Update metadata of an existing file in a Store.
updateFileMeta(fileId, publicMeta, privateMeta)
Name | Type | Description |
---|---|---|
fileId | string | ID of the file to update |
publicMeta | Uint8Array | public file metadata |
privateMeta | Uint8Array | private file metadata |
writeToFile
Writes a file data.
writeToFile(fileHandle, dataChunk)
Name | Type | Description |
---|---|---|
fileHandle | number | handle to write file data |
dataChunk | Uint8Array | file data chunk |
deleteFile
Deletes a file by given ID.
deleteFile(fileId)
Name | Type | Description |
---|---|---|
fileId | string | ID of the file to delete |
getFile
Gets a single file by the given file ID.
getFile(fileId)
Name | Type | Description |
---|---|---|
fileId | string | ID of the file to get |
Type | Description |
---|---|
Promise<File> | struct containing information about the file |
listFiles
Gets a list of files in given Store.
listFiles(storeId, pagingQuery)
Name | Type | Description |
---|---|---|
storeId | string | ID of the Store to get files from |
pagingQuery | PagingQuery | struct with list query parameters |
Type | Description |
---|---|
Promise<PagingList<File>> | struct containing list of files |
openFile
Opens a file to read.
openFile(fileId)
Name | Type | Description |
---|---|---|
fileId | string | ID of the file to read |
Type | Description |
---|---|
Promise<number> | handle to read file data |
readFromFile
Reads file data.
readFromFile(fileHandle, length)
Name | Type | Description |
---|---|---|
fileHandle | number | handle to write file data |
length | number | size of data to read |
Type | Description |
---|---|
Promise<Uint8Array> | array buffer with file data chunk |
seekInFile
Moves read cursor.
seekInFile(fileHandle, position)
Name | Type | Description |
---|---|---|
fileHandle | number | handle to write file data |
position | number | new cursor position |
closeFile
Closes the file handle.
closeFile(fileHandle)
Name | Type | Description |
---|---|---|
fileHandle | number | handle to read/write file data |
subscribeForStoreEvents
Subscribes for the Store module main events.
subscribeForStoreEvents()
unsubscribeFromStoreEvents
Unsubscribes from the Store module main events.
unsubscribeFromStoreEvents()
subscribeForFileEvents
Subscribes for events in given Store.
subscribeForFileEvents(storeId)
Name | Type | Description |
---|---|---|
storeId | string | ID of the Store to subscribe |
unsubscribeFromFileEvents
Unsubscribes from events in given Store.
unsubscribeFromFileEvents(storeId)
Name | Type | Description |
---|---|---|
storeId | string | ID of the Store to unsubscribe |