InboxApi
Manages PrivMX Bridge Inboxes and Entries.
Constructors
InboxApi
Creates Inbox from existing Connection.
public void InboxApi ( Connection connection )
Params Name Type Description connection Connection
current connection
InboxApi
Creates Inbox from existing Connection, ThreadApi, StoreApi.
public void InboxApi ( Connection connection , ThreadApi threadApi , StoreApi storeApi )
Params Name Type Description connection Connection
active connection to PrivMX Bridge threadApi ThreadApi
instance of ThreadApi created on passed Connection storeApi StoreApi
instance of StoreApi created on passed Connection
Methods
close
closeFile
Closes a file by given handle.
public String closeFile ( long fileHandle )
Params Name Type Description fileHandle long
handle to the file
Returns Type Description 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 )
Params Name Type Description publicMeta byte[]
public file's metadata privateMeta byte[]
private file's metadata fileSize long
size of the file to send
Returns Type Description Long
File handle
createInbox
Creates a new Inbox.
public String createInbox ( String contextId , List < UserWithPubKey > users , List < UserWithPubKey > managers , byte [ ] publicMeta , byte [ ] privateMeta )
Params Name Type Description 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 (unencrypted) metadata privateMeta byte[]
private (encrypted) metadata
Returns Type Description 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 )
Params Name Type Description contextId String
ID of the Context of the new Inbox users List<UserWithPubKey>
list of UserWithPubKey structs which indicates who will have access to the created Inbox managers List<UserWithPubKey>
list of UserWithPubKey structs which indicates who will have access (and management rights) to
the created Inbox publicMeta byte[]
public (unencrypted) metadata privateMeta byte[]
private (encrypted) metadata filesConfig FilesConfig
overrides default file configuration
Returns Type Description String
ID of the created Inbox
deleteEntry
Deletes an entry from an Inbox.
public void deleteEntry ( String inboxEntryId )
Params Name Type Description inboxEntryId String
ID of an entry to delete
deleteInbox
Deletes an Inbox by given Inbox ID.
public void deleteInbox ( String inboxId )
Params Name Type Description inboxId String
ID of the Inbox to delete
getInbox
Gets a single Inbox by given Inbox ID.
public Inbox getInbox ( String inboxId )
Params Name Type Description inboxId String
ID of the Inbox to get
Returns Type Description 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 )
Params Name Type Description inboxId String
ID of the Inbox to get
Returns Type Description 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 )
Params Name Type Description inboxId String
ID of the Inbox skip long
skip number of elements to skip from result limit long
limit of elements to return for query sortOrder String
order of elements in result ("asc" for ascending, "desc" for descending)
Returns Type Description 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 )
Params Name Type Description inboxId String
ID of the Inbox skip long
skip number of elements to skip from result limit long
limit of elements to return for query sortOrder String
order of elements in result ("asc" for ascending, "desc" for descending) lastId String
ID of the element from which query results should start
Returns Type Description 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 )
Params Name Type Description contextId String
ID of the Context to get Inboxes from skip long
skip number of elements to skip from result limit long
limit of elements to return for query sortOrder String
order of elements in result ("asc" for ascending, "desc" for descending)
Returns Type Description 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 )
Params Name Type Description contextId String
ID of the Context to get Inboxes from skip long
skip number of elements to skip from result limit long
limit of elements to return for query sortOrder String
order of elements in result ("asc" for ascending, "desc" for descending) lastId String
ID of the element from which query results should start
Returns Type Description PagingList<Inbox>
list of Inboxes
openFile
Opens a file to read.
public Long openFile ( String fileId )
Params Name Type Description fileId String
ID of the file to read
Returns Type Description 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 )
Params Name Type Description inboxId String
ID of the Inbox to which the request applies data byte[]
entry data to send
Returns Type Description 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 )
Params Name Type Description inboxId String
ID of the Inbox to which the request applies data byte[]
entry data to send inboxFileHandles List<Long>
optional list of file handles that will be sent with the request
Returns Type Description 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 )
Params Name Type Description inboxId String
ID of the Inbox to which the request applies data byte[]
entry data to send inboxFileHandles List<Long>
optional list of file handles that will be sent with the request userPrivKey String
optional sender's private key which can be used later to encrypt data for that sender
Returns Type Description Long
Inbox handle
readEntry
Gets an entry from an Inbox.
public InboxEntry readEntry ( String inboxEntryId )
Params Name Type Description inboxEntryId String
ID of an entry to read from the Inbox
Returns Type Description InboxEntry
Data of the selected entry stored in the Inbox
readFromFile
Reads file data.
public byte [ ] readFromFile ( long fileHandle , long length )
Params Name Type Description fileHandle long
handle to the file length long
size of data to read
Returns Type Description byte[]
File data chunk
seekInFile
Moves file's read cursor.
public void seekInFile ( long fileHandle , long position )
Params Name Type Description fileHandle long
handle to the file position long
sets 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 )
Params Name Type Description inboxHandle long
ID of the Inbox to which the request applies
subscribeForEntryEvents
Subscribes for events in given Inbox.
public void subscribeForEntryEvents ( String inboxId )
Params Name Type Description inboxId String
ID 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 )
Params Name Type Description inboxId String
ID 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 )
Params Name Type Description 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 have manage rights) to
the created Inbox publicMeta byte[]
public (unencrypted) metadata privateMeta byte[]
private (encrypted) metadata filesConfig FilesConfig
struct to override default files configuration version long
current version of the updated Inbox force boolean
force 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 )
Params Name Type Description inboxId String
ID of the Inbox to update users List<UserWithPubKey>
list of UserWithPubKey structs which indicates who will have access to the created Inbox managers List<UserWithPubKey>
list of UserWithPubKey structs which indicates who will have access (and management rights) to
the created Inbox publicMeta byte[]
public (unencrypted) metadata privateMeta byte[]
private (encrypted) metadata filesConfig FilesConfig
overrides default file configuration version long
current version of the updated Inbox force boolean
force update (without checking version) forceGenerateNewKey boolean
force 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 )
Params Name Type Description inboxHandle long
ID of the Inbox to which the request applies inboxFileHandle long
handle to the file where the uploaded chunk belongs dataChunk byte[]
file chunk to send