PrivMX DOCS
API Reference/PrivMX Endpoint Web/Stores

StoreApi

Class representing instance of Stores API

Methods

createStore

Creates a new Store in given Context.

Params

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

policies

ContainerPolicy

Store's policies

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

Returns

Promise<string> · created Store ID

updateStore

Updates an existing Store.

Params

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

policies

ContainerPolicy

Store's policies

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

deleteStore

Deletes a Store by given Store ID.

Params

storeId

string

ID of the Store to delete

deleteStore(storeId)

getStore

Gets a single Store by given Store ID.

Params

storeId

string

ID of the Store to get

getStore(storeId)

Returns

Promise<Store> · containing information about the Store

listStores

Gets a list of Stores in given Context.

Params

contextId

string

ID of the Context to get the Stores from

pagingQuery

PagingQuery

with list query parameters

listStores(contextId, pagingQuery)

Returns

Promise<PagingList<Store>> · containing list of Stores

createFile

Creates a new file in a Store.

Params

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

randomWriteSupport

boolean

enable random write support for file

createFile(storeId, publicMeta, privateMeta, size, randomWriteSupport)

Returns

Promise<number> · handle to write data

updateFile

Update an existing file in a Store.

Params

fileId

string

ID of the file to update

publicMeta

Uint8Array

public file metadata

privateMeta

Uint8Array

private file metadata

size

number

size of the file

updateFile(fileId, publicMeta, privateMeta, size)

Returns

Promise<number> · handle to write file data

updateFileMeta

Update metadata of an existing file in a Store.

Params

fileId

string

ID of the file to update

publicMeta

Uint8Array

public file metadata

privateMeta

Uint8Array

private file metadata

updateFileMeta(fileId, publicMeta, privateMeta)

writeToFile

Writes a file data.

Params

fileHandle

number

handle to write file data

dataChunk

Uint8Array

file data chunk

truncate

boolean

truncate the file from: current pos + dataChunk size

writeToFile(fileHandle, dataChunk, truncate)

deleteFile

Deletes a file by given ID.

Params

fileId

string

ID of the file to delete

deleteFile(fileId)

getFile

Gets a single file by the given file ID.

Params

fileId

string

ID of the file to get

getFile(fileId)

Returns

Promise<File> · containing information about the file

listFiles

Gets a list of files in given Store.

Params

storeId

string

ID of the Store to get files from

pagingQuery

PagingQuery

with list query parameters

listFiles(storeId, pagingQuery)

Returns

Promise<PagingList<File>> · containing list of files

openFile

Opens a file to read.

Params

fileId

string

ID of the file to read

openFile(fileId)

Returns

Promise<number> · handle to read file data

readFromFile

Reads file data. Single read call moves the files's cursor position by declared length or set it at the end of the file.

Params

fileHandle

number

handle to write file data

length

number

size of data to read

readFromFile(fileHandle, length)

Returns

Promise<Uint8Array> · array buffer with file data chunk

seekInFile

Moves read cursor.

Params

fileHandle

number

handle to write file data

position

number

new cursor position

seekInFile(fileHandle, position)

closeFile

Closes the file handle.

Params

fileHandle

number

handle to read/write file data

closeFile(fileHandle)

Returns

Promise<string> · ID of closed file

subscribeFor

Subscribe for the Store events on the given subscription query.

Params

subscriptionQueries

string[]

list of queries

subscribeFor(subscriptionQueries)

Returns

Promise<string[]> · list of subscriptionIds in maching order to subscriptionQueries

unsubscribeFrom

Unsubscribe from events for the given subscriptionId.

Params

subscriptionIds

string[]

list of subscriptionId

unsubscribeFrom(subscriptionIds)

buildSubscriptionQuery

Generate subscription Query for the Store events.

Params

eventType

StoreEventType

type of event which you listen for

selectorType

StoreEventSelectorType

scope on which you listen for events

selectorId

string

ID of the selector

buildSubscriptionQuery(eventType, selectorType, selectorId)

Returns

Promise<string> · undefined undefined

We use cookies on our website. We use them to ensure the proper functioning of the site and, if you agree, for purposes we set, such as analytics or marketing.