Table of Contents

Class InboxApi

Namespace
PrivMX.Endpoint.Inbox
Assembly
PrivMX.Endpoint.dll
public class InboxApi : IInboxApi
Inheritance
InboxApi
Implements
Inherited Members

Methods

CloseFile(long)

Closes a file by given handle.

public string CloseFile(long fileHandle)

Parameters

fileHandle long

Handle to the file.

Returns

string

ID of closed file.

Create(Connection, ThreadApi, StoreApi)

Creates an instance of the InboxApi.

public static InboxApi Create(Connection connection, ThreadApi threadApi, StoreApi storeApi)

Parameters

connection Connection

Instance of Connection

threadApi ThreadApi

Instance of ThreadApi

storeApi StoreApi

Instance of StoreApi

Returns

InboxApi

Created instance of the InboxApi.

CreateFileHandle(byte[], byte[], long)

Creates a file handle to send a file to an Inbox.

public long CreateFileHandle(byte[] publicMeta, byte[] privateMeta, long fileSize)

Parameters

publicMeta byte[]

Public file metadata.

privateMeta byte[]

Private file metadata.

fileSize long

Size of the file to send.

Returns

long

File handle.

CreateInbox(string, List<UserWithPubKey>, List<UserWithPubKey>, byte[], byte[], FilesConfig?, ContainerPolicyWithoutItem?)

Creates a new Inbox.

public string CreateInbox(string contextId, List<UserWithPubKey> users, List<UserWithPubKey> managers, byte[] publicMeta, byte[] privateMeta, FilesConfig? filesConfig, ContainerPolicyWithoutItem? policies = null)

Parameters

contextId string

ID of the Context of the new Inbox.

users List<UserWithPubKey>

Vector of UserWithPubKey structs which indicates who will have access to the created Inbox.

managers List<UserWithPubKey>

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

publicMeta byte[]

Public metadata that will remain unencrypted on the Bridge.

privateMeta byte[]

Private metadata that will be encrypted before being sent to the Bridge.

filesConfig FilesConfig

(optional) Configuration of files.

policies ContainerPolicyWithoutItem

(optional) Inbox policy.

Returns

string

ID of the created Inbox.

DeleteEntry(string)

Delete an entry from an Inbox.

public void DeleteEntry(string inboxEntryId)

Parameters

inboxEntryId string

ID of an entry to delete.

DeleteInbox(string)

Deletes an Inbox by given Inbox ID.

public void DeleteInbox(string inboxId)

Parameters

inboxId string

ID of the Inbox to delete.

~InboxApi()

protected ~InboxApi()

GetInbox(string)

Gets a Inbox by given Inbox ID.

public Inbox GetInbox(string inboxId)

Parameters

inboxId string

ID of the Inbox to get.

Returns

Inbox

Information about about the Inbox.

GetInboxPublicView(string)

Gets public data of an Inbox. You do not have to be logged in to call this function.

public InboxPublicView GetInboxPublicView(string inboxId)

Parameters

inboxId string

ID of the Inbox to get.

Returns

InboxPublicView

Public accessible information about the Inbox.

ListEntries(string, PagingQuery)

Gets list of entries in given Inbox.

public PagingList<InboxEntry> ListEntries(string inboxId, PagingQuery pagingQuery)

Parameters

inboxId string

ID of the Inbox.

pagingQuery PagingQuery

List query parameters.

Returns

PagingList<InboxEntry>

List of entries.

ListInboxes(string, PagingQuery)

Gets s list of Inboxes in given Context.

public PagingList<Inbox> ListInboxes(string contextId, PagingQuery pagingQuery)

Parameters

contextId string

ID of the Context to get Inboxes from.

pagingQuery PagingQuery

List query parameters.

Returns

PagingList<Inbox>

List of Inboxes.

OpenFile(string)

Opens a file to read.

public long OpenFile(string fileId)

Parameters

fileId string

ID of the file to read.

Returns

long

Handle to read file data.

PrepareEntry(string, byte[], List<long>, byte[]?)

Prepares a request to send data to an Inbox.

You do not have to be logged in to call this function.

public long PrepareEntry(string inboxId, byte[] data, List<long> inboxFileHandles, byte[]? userPrivKey)

Parameters

inboxId string

ID of the Inbox to which the request applies.

data byte[]

Entry data to send.

inboxFileHandles List<long>

List of file handles that will be sent with the request.

userPrivKey byte[]

(optional) Sender's private key which can be used later to encrypt data for that sender.

Returns

long

Inbox handle.

ReadEntry(string)

Gets an entry from an Inbox.

public InboxEntry ReadEntry(string inboxEntryId)

Parameters

inboxEntryId string

ID of an entry to read from the Inbox.

Returns

InboxEntry

Data of the entry stored in the Inbox.

ReadFromFile(long, long)

Reads file data.

public byte[] ReadFromFile(long fileHandle, long length)

Parameters

fileHandle long

Handle to the open file.

length long

Size of data chunk to read.

Returns

byte[]

File data chunk which size is equal to length, or smaller size when is end of file.

SeekInFile(long, long)

Moves file's read cursor.

public void SeekInFile(long fileHandle, long position)

Parameters

fileHandle long

Handle to the file.

position long

New position of the cursor.

SendEntry(long)

Sends data to an Inbox.

You do not have to be logged in to call this function.

public void SendEntry(long inboxHandle)

Parameters

inboxHandle long

ID of the Inbox to which the request applies.

SubscribeForEntryEvents(string)

Subscribes for events in given Inbox.

public void SubscribeForEntryEvents(string inboxId)

Parameters

inboxId string

ID of the Inbox.

SubscribeForInboxEvents()

Subscribes for the Inbox module main events.

public void SubscribeForInboxEvents()

UnsubscribeFromEntryEvents(string)

Unsubscribes from events in given Inbox.

public void UnsubscribeFromEntryEvents(string inboxId)

Parameters

inboxId string

ID of the Inbox.

UnsubscribeFromInboxEvents()

Unsubscribes from the Inbox module main events.

public void UnsubscribeFromInboxEvents()

UpdateInbox(string, List<UserWithPubKey>, List<UserWithPubKey>, byte[], byte[], FilesConfig?, long, bool, bool, ContainerPolicyWithoutItem?)

Updates an existing Inbox.

public void UpdateInbox(string inboxId, List<UserWithPubKey> users, List<UserWithPubKey> managers, byte[] publicMeta, byte[] privateMeta, FilesConfig? filesConfig, long version, bool force, bool forceGenerateNewKey, ContainerPolicyWithoutItem? policies = null)

Parameters

inboxId string

ID of the Inbox to update.

users List<UserWithPubKey>

Vector of UserWithPubKey structs which indicates who will have access to the created Inbox.

managers List<UserWithPubKey>

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

publicMeta byte[]

Public metadata that will remain unencrypted on the Bridge.

privateMeta byte[]

Private metadata that will be encrypted before being sent to the Bridge.

filesConfig FilesConfig

(optional) Configuration of files.

version long

Current version of the updated Inbox.

force bool

Force update without checking version.

forceGenerateNewKey bool

Force to regenerate a key for the Inbox.

policies ContainerPolicyWithoutItem

(optional) Inbox policy.

WriteToFile(long, long, byte[])

Sends a file's data chunk to an Inbox.

To send the entire file - divide it into pieces of the desired size and call the function for each fragment.

You do not have to be logged in to call this function.

public void WriteToFile(long inboxHandle, long inboxFileHandle, byte[] dataChunk)

Parameters

inboxHandle long

ID of the Inbox to which the request applies.

inboxFileHandle long

Handle to the file which the uploaded chunk belongs.

dataChunk byte[]

File chunk to send.