Skip to main content
reference

Stores

Class representing instance of Stores API

Methods

createStore

Creates a new Store in given Context.

createStore(contextId, users, managers, publicMeta, privateMeta)

NameTypeDescription
contextIdstringID of the Context to create the Store in
usersUserWithPubKey[]array of UserWithPubKey structs which indicates who will have access to the created Store
managersUserWithPubKey[]array of UserWithPubKey structs which indicates who will have access (and management rights) to the created Store
publicMetaUint8Arraypublic (unencrypted) metadata
privateMetaUint8Arrayprivate (encrypted) metadata

TypeDescription
Promise<string> created Store ID

updateStore

Updates an existing Store.

updateStore(storeId, users, managers, publicMeta, privateMeta, version, force, forceGenerateNewKey)

NameTypeDescription
storeIdstringID of the Store to update
usersUserWithPubKey[]array of UserWithPubKey structs which indicates who will have access to the created Store
managersUserWithPubKey[]array of UserWithPubKey structs which indicates who will have access (and management rights) to the created Store
publicMetaUint8Arraypublic (unencrypted) metadata
privateMetaUint8Arrayprivate (encrypted) metadata
versionnumbercurrent version of the updated Store
forcebooleanforce update (without checking version)
forceGenerateNewKeybooleanforce to regenerate a key for the Store

deleteStore

Deletes a Store by given Store ID.

deleteStore(storeId)

NameTypeDescription
storeIdstringID of the Store to delete

getStore

Gets a single Store by given Store ID.

getStore(storeId)

NameTypeDescription
storeIdstringID of the Store to get

TypeDescription
Promise<Store> struct containing information about the Store

listStores

Gets a list of Stores in given Context.

listStores(contextId, pagingQuery)

NameTypeDescription
contextIdstringID of the Context to get the Stores from
pagingQueryPagingQuerystruct with list query parameters

TypeDescription
Promise<PagingList<Store>> struct containing list of Stores

createFile

Creates a new file in a Store.

createFile(storeId, publicMeta, privateMeta, size)

NameTypeDescription
storeIdstringID of the Store to create the file in
publicMetaUint8Arraypublic file metadata
privateMetaUint8Arrayprivate file metadata
sizenumbersize of the file

TypeDescription
Promise<number> handle to write data

updateFile

Update an existing file in a Store.

updateFile(fileId, publicMeta, privateMeta, size)

NameTypeDescription
fileIdstringID of the file to update
publicMetaUint8Arraypublic file metadata
privateMetaUint8Arrayprivate file metadata
sizenumbersize of the file

TypeDescription
Promise<number> handle to write file data

updateFileMeta

Update metadata of an existing file in a Store.

updateFileMeta(fileId, publicMeta, privateMeta)

NameTypeDescription
fileIdstringID of the file to update
publicMetaUint8Arraypublic file metadata
privateMetaUint8Arrayprivate file metadata

writeToFile

Writes a file data.

writeToFile(fileHandle, dataChunk)

NameTypeDescription
fileHandlenumberhandle to write file data
dataChunkUint8Arrayfile data chunk

deleteFile

Deletes a file by given ID.

deleteFile(fileId)

NameTypeDescription
fileIdstringID of the file to delete

getFile

Gets a single file by the given file ID.

getFile(fileId)

NameTypeDescription
fileIdstringID of the file to get

TypeDescription
Promise<File> struct containing information about the file

listFiles

Gets a list of files in given Store.

listFiles(storeId, pagingQuery)

NameTypeDescription
storeIdstringID of the Store to get files from
pagingQueryPagingQuerystruct with list query parameters

TypeDescription
Promise<PagingList<File>> struct containing list of files

openFile

Opens a file to read.

openFile(fileId)

NameTypeDescription
fileIdstringID of the file to read

TypeDescription
Promise<number> handle to read file data

readFromFile

Reads file data.

readFromFile(fileHandle, length)

NameTypeDescription
fileHandlenumberhandle to write file data
lengthnumbersize of data to read

TypeDescription
Promise<Uint8Array> array buffer with file data chunk

seekInFile

Moves read cursor.

seekInFile(fileHandle, position)

NameTypeDescription
fileHandlenumberhandle to write file data
positionnumbernew cursor position

closeFile

Closes the file handle.

closeFile(fileHandle)

NameTypeDescription
fileHandlenumberhandle 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)

NameTypeDescription
storeIdstringID of the Store to subscribe

unsubscribeFromFileEvents

Unsubscribes from events in given Store.

unsubscribeFromFileEvents(storeId)

NameTypeDescription
storeIdstringID of the Store to unsubscribe