PrivMX DOCS
API Reference/PrivMX Endpoint C# Extra/Stores

StoreApiExtensions

Asynchronous extensions for dtore API.

Static Methods

CreateStoreAsync

Creates a new Store in given Context.

Params

api

this IStoreApi

Extended object.

contextId

string

ID of the Context to create the Store in.

users

List<UserWithPubKey>

Array of UserWithPubKey structs which indicates who will have access to the created Store.

managers

List<UserWithPubKey>

Array of UserWithPubKey structs which indicates who will have access (and management rights) to the created Store.

publicMeta

byte[]

Public (unencrypted) metadata.

privateMeta

byte[]

Private (encrypted) metadata.

policies

ContainerPolicy

(optional) Store policy.

token

CancellationToken

Cancellation token.

static ValueTask<string> CreateStoreAsync(
this IStoreApi api,
string contextId,
List<UserWithPubKey> users,
List<UserWithPubKey> managers,
byte[] publicMeta,
byte[] privateMeta,
ContainerPolicy policies,
CancellationToken token = default
)

Returns

ValueTask<string> · Created Store ID.

UpdateStoreAsync

Updates an existing Store.

Params

api

this IStoreApi

Extended object.

storeId

string

ID of the Store to update.

users

List<UserWithPubKey>

Array of UserWithPubKey structs which indicates who will have access to the created Store.

managers

List<UserWithPubKey>

Array of UserWithPubKey structs which indicates who will have access (and management rights) to the created Store.

publicMeta

byte[]

Public (unencrypted) metadata.

privateMeta

byte[]

Private (encrypted) metadata.

version

long

Current version of the updated Store.

force

bool

Force update (without checking version).

forceGenerateNewKey

bool

Force to renenerate a key for the Store.

policies

ContainerPolicy?

(optional) Store policy.

token

CancellationToken

Cancellation token.

static ValueTask UpdateStoreAsync(
this IStoreApi api,
string storeId,
List<UserWithPubKey> users,
List<UserWithPubKey> managers,
byte[] publicMeta,
byte[] privateMeta,
long version,
bool force,
bool forceGenerateNewKey,
ContainerPolicy? policies = null,
CancellationToken token = default
)

Returns

ValueTask ·

DeleteStoreAsync

Deletes a Store by given Store ID.

Params

api

this IStoreApi

Extended object.

storeId

string

ID of the Store to delete.

token

CancellationToken

Cancellation token.

static ValueTask DeleteStoreAsync(
this IStoreApi api,
string storeId,
CancellationToken token = default
)

Returns

ValueTask ·

GetStoreAsync

Gets a single Store by given Store ID.

Params

api

this IStoreApi

Extended object.

storeId

string

ID of the Store to get.

token

CancellationToken

Cancellation token

static ValueTask<PrivMX.Endpoint.Store.Models.Store> GetStoreAsync(
this IStoreApi api,
string storeId,
CancellationToken token = default
)

Returns

ValueTask<PrivMX.Endpoint.Store.Models.Store> · Information about about the Store.

ListStoresAsync

Gets a list of Stores in given Context.

Params

api

this IStoreApi

Extended object.

contextId

string

ID of the Context to get the Stores from.

pagingQuery

PagingQuery

List query parameters.

token

CancellationToken

Cancellation token.

static ValueTask<PagingList<PrivMX.Endpoint.Store.Models.Store>> ListStoresAsync(
this IStoreApi api,
string contextId,
PagingQuery pagingQuery,
CancellationToken token = default
)

Returns

ValueTask<PagingList<PrivMX.Endpoint.Store.Models.Store>> · List of Stores.

CreateFileAsync

Creates a new file in a Store.

Params

api

this IStoreApi

Extended object.

storeId

string

ID of the Store to create the file in.

publicMeta

byte[]

Public file meta_data.

privateMeta

byte[]

Private file meta_data.

size

long

Size of the file.

token

CancellationToken

Cancellation token.

static ValueTask<long> CreateFileAsync(
this IStoreApi api,
string storeId,
byte[] publicMeta,
byte[] privateMeta,
long size,
CancellationToken token = default
)

Returns

ValueTask<long> · Handle to write data.

UpdateFileAsync

Updates an existing file in a Store.

Params

api

this IStoreApi

Extended object.

fileId

string

ID of the file to update.

publicMeta

byte[]

Public file meta_data.

privateMeta

byte[]

Private file meta_data.

size

long

Size of the file.

token

CancellationToken

Cancellation token.

static ValueTask<long> UpdateFileAsync(
this IStoreApi api,
string fileId,
byte[] publicMeta,
byte[] privateMeta,
long size,
CancellationToken token = default
)

Returns

ValueTask<long> · Handle to write file data.

UpdateFileMetaAsync

Updates meta data of an existing file in a Store.

Params

api

this IStoreApi

Extended object.

fileId

string

ID of the file to update.

publicMeta

byte[]

Public file meta_data.

privateMeta

byte[]

Private file meta_data.

token

CancellationToken

Cancellation token

static ValueTask UpdateFileMetaAsync(
this IStoreApi api,
string fileId,
byte[] publicMeta,
byte[] privateMeta,
CancellationToken token = default
)

Returns

ValueTask ·

WriteToFileAsync

Writes a file data.

Params

api

this IStoreApi

fileHandle

long

Handle to write file data.

dataChunk

byte[]

File data chunk.

token

CancellationToken

static ValueTask WriteToFileAsync(
this IStoreApi api,
long fileHandle,
byte[] dataChunk,
CancellationToken token = default
)

Returns

ValueTask ·

DeleteFileAsync

Deletes a file by given ID.

Params

api

this IStoreApi

Extended object.

fileId

string

ID of the file to delete.

token

CancellationToken

Cancellation token.

static ValueTask DeleteFileAsync(
this IStoreApi api,
string fileId,
CancellationToken token = default
)

Returns

ValueTask ·

GetFileAsync

Deletes a file by given ID.

Params

api

this IStoreApi

Extended object.

fileId

string

ID of the file to delete.

token

CancellationToken

Cancellation token.

static ValueTask<File> GetFileAsync(
this IStoreApi api,
string fileId,
CancellationToken token = default
)

Returns

ValueTask<File> ·

ListFilesAsync

Gets a list of files in given Store.

Params

api

this IStoreApi

Extended object.

storeId

string

ID of the Store to get files from.

pagingQuery

PagingQuery

List query parameters.

token

CancellationToken

Cancellation token.

static ValueTask<PagingList<File>> ListFilesAsync(
this IStoreApi api,
string storeId,
PagingQuery pagingQuery,
CancellationToken token = default
)

Returns

ValueTask<PagingList<File>> · List of files.

OpenFileAsync

Opens a file to read.

Params

api

this IStoreApi

Extended object.

fileId

string

ID of the file to read.

token

CancellationToken

Cancellation token.

static ValueTask<long> OpenFileAsync(
this IStoreApi api,
string fileId,
CancellationToken token = default
)

Returns

ValueTask<long> · Handle to read file data.

ReadFromFileAsync

Reads file data.

Params

api

this IStoreApi

Extended object.

fileHandle

long

Handle to write file data.

length

long

Size of data to read.

token

CancellationToken

Cancellation token.

static ValueTask<byte[]> ReadFromFileAsync(
this IStoreApi api,
long fileHandle,
long length,
CancellationToken token = default
)

Returns

ValueTask<byte[]> · File data chunk.

SeekInFileAsync

Moves read cursor.

Params

api

this IStoreApi

Extended object.

fileHandle

long

Handle to write file data.

position

long

New cursor position.

token

CancellationToken

Cancellation token

static ValueTask SeekInFileAsync(
this IStoreApi api,
long fileHandle,
long position,
CancellationToken token = default
)

Returns

ValueTask ·

CloseFileAsync

Closes the file handle.

Params

api

this IStoreApi

Extended object.

fileHandle

long

Handle to read/write file data.

token

CancellationToken

Cancellation token.

static ValueTask<string> CloseFileAsync(
this IStoreApi api,
long fileHandle,
CancellationToken token = default
)

Returns

ValueTask<string> · ID of closed file.

SubscribeForStoreEventsAsync

Subscribes for the Store module main events.

Params

api

this IStoreApi

token

CancellationToken

static ValueTask SubscribeForStoreEventsAsync(
this IStoreApi api,
CancellationToken token = default
)

Returns

ValueTask ·

UnsubscribeFromStoreEventsAsync

Unsubscribes from the Store module main events.

Params

api

this IStoreApi

token

CancellationToken

static ValueTask UnsubscribeFromStoreEventsAsync(
this IStoreApi api,
CancellationToken token = default
)

Returns

ValueTask ·

SubscribeForFileEventsAsync

Subscribes for the events in given Store.

Params

api

this IStoreApi

Extended object.

storeId

string

ID of the store to subscribe to.

token

CancellationToken

Cancellation token.

static ValueTask SubscribeForFileEventsAsync(
this IStoreApi api,
string storeId,
CancellationToken token = default
)

Returns

ValueTask ·

UnsubscribeFromFileEventsAsync

Unsubscribes from the events in given Store.

Params

api

this IStoreApi

Extended object

storeId

string

ID of the store to unsubscribe from.

token

CancellationToken

Cancellation token.

static ValueTask UnsubscribeFromFileEventsAsync(
this IStoreApi api,
string storeId,
CancellationToken token = default
)

Returns

ValueTask ·

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.