Skip to main content
reference

InboxApi

Manages PrivMX Bridge Inboxes and Entries.

Constructors

InboxApi

Creates Inbox from existing Connection.

public void InboxApi(
Connection connection
)

NameTypeDescription
connectionConnectioncurrent connection

InboxApi

Creates Inbox from existing Connection, ThreadApi, StoreApi.

public void InboxApi(
Connection connection,
ThreadApi threadApi,
StoreApi storeApi
)

NameTypeDescription
connectionConnectionactive connection to PrivMX Bridge
threadApiThreadApiinstance of ThreadApi created on passed Connection
storeApiStoreApiinstance of StoreApi created on passed Connection

Methods

close

public void close()

closeFile

Closes a file by given handle.

public String closeFile(
long fileHandle
)

NameTypeDescription
fileHandlelonghandle to the file

TypeDescription
String ID of closed file

createFileHandle

Creates a file handle to send a file to an Inbox. You do not have to be logged in to call this function.

public Long createFileHandle(
byte[] publicMeta,
byte[] privateMeta,
long fileSize
)

NameTypeDescription
publicMetabyte[]public file's metadata
privateMetabyte[]private file's metadata
fileSizelongsize of the file to send

TypeDescription
Long File handle

createInbox

Creates a new Inbox.

public String createInbox(
String contextId,
List<UserWithPubKey> users,
List<UserWithPubKey> managers,
byte[] publicMeta,
byte[] privateMeta
)

NameTypeDescription
contextIdStringID of the Context of the new Inbox
usersList<UserWithPubKey>vector of UserWithPubKey structs which indicates who will have access to the created Inbox
managersList<UserWithPubKey>vector of UserWithPubKey structs which indicates who will have access (and management rights) to the created Inbox
publicMetabyte[]public (unencrypted) metadata
privateMetabyte[]private (encrypted) metadata

TypeDescription
String ID of the created Inbox

createInbox

Creates a new Inbox.

public String createInbox(
String contextId,
List<UserWithPubKey> users,
List<UserWithPubKey> managers,
byte[] publicMeta,
byte[] privateMeta,
FilesConfig filesConfig
)

NameTypeDescription
contextIdStringID of the Context of the new Inbox
usersList<UserWithPubKey>list of UserWithPubKey structs which indicates who will have access to the created Inbox
managersList<UserWithPubKey>list of UserWithPubKey structs which indicates who will have access (and management rights) to the created Inbox
publicMetabyte[]public (unencrypted) metadata
privateMetabyte[]private (encrypted) metadata
filesConfigFilesConfigoverrides default file configuration

TypeDescription
String ID of the created Inbox

deleteEntry

Deletes an entry from an Inbox.

public void deleteEntry(
String inboxEntryId
)

NameTypeDescription
inboxEntryIdStringID of an entry to delete

deleteInbox

Deletes an Inbox by given Inbox ID.

public void deleteInbox(
String inboxId
)

NameTypeDescription
inboxIdStringID of the Inbox to delete

getInbox

Gets a single Inbox by given Inbox ID.

public Inbox getInbox(
String inboxId
)

NameTypeDescription
inboxIdStringID of the Inbox to get

TypeDescription
Inbox Information about the Inbox

getInboxPublicView

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

public InboxPublicView getInboxPublicView(
String inboxId
)

NameTypeDescription
inboxIdStringID of the Inbox to get

TypeDescription
InboxPublicView Public accessible information about the Inbox

listEntries

Gets list of entries in given Inbox.

public PagingList<InboxEntry> listEntries(
String inboxId,
long skip,
long limit,
String sortOrder
)

NameTypeDescription
inboxIdStringID of the Inbox
skiplongskip number of elements to skip from result
limitlonglimit of elements to return for query
sortOrderStringorder of elements in result ("asc" for ascending, "desc" for descending)

TypeDescription
PagingList<InboxEntry> list of entries

listEntries

Gets list of entries of given Inbox.

public PagingList<InboxEntry> listEntries(
String inboxId,
long skip,
long limit,
String sortOrder,
String lastId
)

NameTypeDescription
inboxIdStringID of the Inbox
skiplongskip number of elements to skip from result
limitlonglimit of elements to return for query
sortOrderStringorder of elements in result ("asc" for ascending, "desc" for descending)
lastIdStringID of the element from which query results should start

TypeDescription
PagingList<InboxEntry> list of entries

listInboxes

Gets a list of Inboxes in given Context.

public PagingList<Inbox> listInboxes(
String contextId,
long skip,
long limit,
String sortOrder
)

NameTypeDescription
contextIdStringID of the Context to get Inboxes from
skiplongskip number of elements to skip from result
limitlonglimit of elements to return for query
sortOrderStringorder of elements in result ("asc" for ascending, "desc" for descending)

TypeDescription
PagingList<Inbox> list of Inboxes

listInboxes

Gets s list of Inboxes in given Context.

public PagingList<Inbox> listInboxes(
String contextId,
long skip,
long limit,
String sortOrder,
String lastId
)

NameTypeDescription
contextIdStringID of the Context to get Inboxes from
skiplongskip number of elements to skip from result
limitlonglimit of elements to return for query
sortOrderStringorder of elements in result ("asc" for ascending, "desc" for descending)
lastIdStringID of the element from which query results should start

TypeDescription
PagingList<Inbox> list of Inboxes

openFile

Opens a file to read.

public Long openFile(
String fileId
)

NameTypeDescription
fileIdStringID of the file to read

TypeDescription
Long Handle to read file data

prepareEntry

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
)

NameTypeDescription
inboxIdStringID of the Inbox to which the request applies
databyte[]entry data to send

TypeDescription
Long Inbox handle

prepareEntry

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
)

NameTypeDescription
inboxIdStringID of the Inbox to which the request applies
databyte[]entry data to send
inboxFileHandlesList<Long>optional list of file handles that will be sent with the request

TypeDescription
Long Inbox handle

prepareEntry

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,
String userPrivKey
)

NameTypeDescription
inboxIdStringID of the Inbox to which the request applies
databyte[]entry data to send
inboxFileHandlesList<Long>optional list of file handles that will be sent with the request
userPrivKeyStringoptional sender's private key which can be used later to encrypt data for that sender

TypeDescription
Long Inbox handle

readEntry

Gets an entry from an Inbox.

public InboxEntry readEntry(
String inboxEntryId
)

NameTypeDescription
inboxEntryIdStringID of an entry to read from the Inbox

TypeDescription
InboxEntry Data of the selected entry stored in the Inbox

readFromFile

Reads file data.

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

NameTypeDescription
fileHandlelonghandle to the file
lengthlongsize of data to read

TypeDescription
byte[] File data chunk

seekInFile

Moves file's read cursor.

public void seekInFile(
long fileHandle,
long position
)

NameTypeDescription
fileHandlelonghandle to the file
positionlongsets new cursor position

sendEntry

Sends data to an Inbox. You do not have to be logged in to call this function.

public void sendEntry(
long inboxHandle
)

NameTypeDescription
inboxHandlelongID of the Inbox to which the request applies

subscribeForEntryEvents

Subscribes for events in given Inbox.

public void subscribeForEntryEvents(
String inboxId
)

NameTypeDescription
inboxIdStringID of the Inbox to subscribe

subscribeForInboxEvents

Subscribes for the Inbox module main events.

public void subscribeForInboxEvents()

unsubscribeFromEntryEvents

Unsubscribes from events in given Inbox.

public void unsubscribeFromEntryEvents(
String inboxId
)

NameTypeDescription
inboxIdStringID of the Inbox to unsubscribe

unsubscribeFromInboxEvents

Subscribes for the Inbox module main events.

public void unsubscribeFromInboxEvents()

updateInbox

Updates an existing Inbox.

public void updateInbox(
String inboxId,
List<UserWithPubKey> users,
List<UserWithPubKey> managers,
byte[] publicMeta,
byte[] privateMeta,
FilesConfig filesConfig,
long version,
boolean force
)

NameTypeDescription
inboxIdStringID of the Inbox to update
usersList<UserWithPubKey>vector of UserWithPubKey structs which indicates who will have access to the created Inbox
managersList<UserWithPubKey>vector of UserWithPubKey structs which indicates who will have access (and have manage rights) to the created Inbox
publicMetabyte[]public (unencrypted) metadata
privateMetabyte[]private (encrypted) metadata
filesConfigFilesConfigstruct to override default files configuration
versionlongcurrent version of the updated Inbox
forcebooleanforce update (without checking version)

updateInbox

Updates an existing Inbox.

public void updateInbox(
String inboxId,
List<UserWithPubKey> users,
List<UserWithPubKey> managers,
byte[] publicMeta,
byte[] privateMeta,
FilesConfig filesConfig,
long version,
boolean force,
boolean forceGenerateNewKey
)

NameTypeDescription
inboxIdStringID of the Inbox to update
usersList<UserWithPubKey>list of UserWithPubKey structs which indicates who will have access to the created Inbox
managersList<UserWithPubKey>list of UserWithPubKey structs which indicates who will have access (and management rights) to the created Inbox
publicMetabyte[]public (unencrypted) metadata
privateMetabyte[]private (encrypted) metadata
filesConfigFilesConfigoverrides default file configuration
versionlongcurrent version of the updated Inbox
forcebooleanforce update (without checking version)
forceGenerateNewKeybooleanforce to regenerate a key for the Inbox

writeToFile

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
)

NameTypeDescription
inboxHandlelongID of the Inbox to which the request applies
inboxFileHandlelonghandle to the file where the uploaded chunk belongs
dataChunkbyte[]file chunk to send