StoreApi
Swift wrapper for privmx.NativeStoreApiWrapper
, providing functionality to manage Stores and files within PrivMX platform.
Static Methods
create(connection:)
Creates a new instance of StoreApi
from a connection object.
This method initializes the StoreApi
instance, enabling Store-related operations over the specified connection.
Params
connection
inout Connection
The connection object used for Store operations.
Returns
StoreApi
·
A newly created StoreApi
instance.
Methods
listStores(contextId:pagingQuery:)
Lists all Stores the user has access to within a specified Context.
Params
contextId
std.string
The Context from which the Stores should be listed.
pagingQuery
privmx.endpoint.core.PagingQuery
A PagingQuery
object to filter and paginate the results.
Returns
privmx.StoreList
·
A privmx.StoreList
instance containing the list of Stores.
listStores(contextId:query:)
Params
contextId
std.string
query
privmx.endpoint.core.PagingQuery
Returns
privmx.StoreList
·
getStore(storeId:)
Retrieves detailed information about a specified Store.
Params
storeId
std.string
The unique identifier of the Store to retrieve.
Returns
privmx.endpoint.store.Store
·
A privmx.endpoint.store.Store
instance containing Store details.
createStore(contextId:users:managers:publicMeta:privateMeta:policies:)
Creates a new Store within a specified Context.
This method creates a new Store with specified users and managers. Note that managers must be added as users to gain access to the Store.
If policies
argument is set to nil
, the default policies will be applied.
Params
contextId
std.string
The Context in which the Store should be created.
users
privmx.UserWithPubKeyVector
A vector of users who will have access to the Store.
managers
privmx.UserWithPubKeyVector
A vector of managers responsible for the Store.
publicMeta
privmx.endpoint.core.Buffer
Public metadata for the Store, which will not be encrypted.
privateMeta
privmx.endpoint.core.Buffer
Private metadata for the Store, which will be encrypted.
policies
privmx.endpoint.core.ContainerPolicy?
A set of policies for the Container.
Returns
std.string
·
The ID of the newly created Store as a std.string
.
updateStore(storeId:version:users:managers:publicMeta:privateMeta:force:forceGenerateNewKey:policies:)
Updates an existing Store.
The provided values will override the existing ones. You can also force regeneration of the Store’s key if needed.
If policies
argument is set to nil
, the default policies will be applied.
Params
storeId
std.string
The unique identifier of the Store to be updated.
version
Int64
The current version of the Store for consistency checking.
users
privmx.UserWithPubKeyVector
A vector of users who will have access to the Store.
managers
privmx.UserWithPubKeyVector
A vector of managers responsible for the Store.
publicMeta
privmx.endpoint.core.Buffer
New public metadata for the Store, which will not be encrypted.
privateMeta
privmx.endpoint.core.Buffer
New private metadata for the Store, which will be encrypted.
force
Bool
Whether to force the update, bypassing version control.
forceGenerateNewKey
Bool
Whether to generate a new key for the Store.
policies
privmx.endpoint.core.ContainerPolicy?
New set of policies for the Container.
deleteStore(storeId:)
Deletes a specified Store.
Params
storeId
std.string
The unique identifier of the Store to delete.
getFile(fileId:)
Retrieves detailed information about a specified file.
Params
fileId
std.string
The unique identifier of the file to retrieve.
Returns
privmx.endpoint.store.File
·
A privmx.endpoint.store.File
instance representing the file details.
listFiles(storeId:pagingQuery:)
Lists all files in a specified Store.
This method retrieves metadata about files in the Store. To download files, use the openFile()
and readFile()
methods.
Params
storeId
std.string
The Store from which to list files.
pagingQuery
privmx.endpoint.core.PagingQuery
A PagingQuery
object to filter and paginate the results.
Returns
privmx.FileList
·
A privmx.FileList
instance containing the list of files.
listFiles(storeId:query:)
Params
storeId
std.string
query
privmx.endpoint.core.PagingQuery
Returns
privmx.FileList
·
createFile(storeId:publicMeta:privateMeta:size:)
Creates a new file handle for writing in a Store.
Use writeToFile()
to upload data to this handle and closeFile()
to finalize the process.
Params
storeId
std.string
The Store in which the file should be created.
publicMeta
privmx.endpoint.core.Buffer
Public metadata for the file.
privateMeta
privmx.endpoint.core.Buffer
Private metadata for the file.
size
Int64
The size of the file in bytes.
Returns
privmx.StoreFileHandle
·
A privmx.StoreFileHandle
for writing to the file.
seekInFile(handle:position:)
Moves the read cursor within an open file.
Params
handle
privmx.StoreFileHandle
The handle to the open file.
position
Int64
The new position of the read cursor in bytes.
updateFile(fileId:publicMeta:privateMeta:size:)
Updates an existing file within a Store.
This method creates a new handle for updating the file’s content and metadata. Use writeToFile()
to upload data and closeFile()
to finalize the update.
Params
fileId
std.string
The unique identifier of the file to be updated.
publicMeta
privmx.endpoint.core.Buffer
New public metadata for the file.
privateMeta
privmx.endpoint.core.Buffer
New private metadata for the file.
size
Int64
The size of the updated file in bytes.
Returns
privmx.StoreFileHandle
·
A privmx.StoreFileHandle
for writing to the updated file.
updateFileMeta(fileId:publicMeta:privateMeta:)
Updates the metadata of an existing File.
Params
fileId
std.string
id of a File to be updated
publicMeta
privmx.endpoint.core.Buffer
new public metadata
privateMeta
privmx.endpoint.core.Buffer
new private metadata
closeFile(handle:)
Closes an open file handle. This method finalizes a file operation, such as writing or updating.
Params
handle
privmx.StoreFileHandle
The handle to the open file.
Returns
std.string
·
The ID of the closed file as a std.string
.
openFile(fileId:)
Opens a file for reading from the Store.
Params
fileId
std.string
The unique identifier of the file to be opened.
Returns
privmx.StoreFileHandle
·
A privmx.StoreFileHandle
for reading the file.
readFromFile(handle:length:)
Reads data from an open file.
Params
handle
privmx.StoreFileHandle
The handle to the open file.
length
Int64
The number of bytes to read.
Returns
privmx.endpoint.core.Buffer
·
A buffer containing the read data.
writeToFile(handle:dataChunk:)
Writes a chunk of data to an open file on the platform.
Params
handle
privmx.StoreFileHandle
The handle to the open file.
dataChunk
privmx.endpoint.core.Buffer
The chunk of data to be written to the file.
deleteFile(fileId:)
Deletes a specified file from the Store.
Params
fileId
std.string
The unique identifier of the file to delete.
subscribeForStoreEvents()
Subscribes to Store-related events.
unsubscribeFromStoreEvents()
Unsubscribes from Store-related events.
subscribeForFileEvents(storeId:)
Subscribes to file-related events within a specified Store.
Params
storeId
std.string
The unique identifier of the Store to subscribe to file events for.
unsubscribeFromFileEvents(storeId:)
Unsubscribes from file-related events within a specified Store.
Params
storeId
std.string
The unique identifier of the Store to unsubscribe from file events for.
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.