InboxApi
Manages PrivMX Bridge Inboxes and Entries.
Constructors
InboxApi
Creates Inbox from existing Connection.
public void InboxApi(
Connection connection
)
Name | Type | Description |
---|---|---|
connection | Connection | current connection |
InboxApi
Creates Inbox from existing Connection, ThreadApi, StoreApi.
public void InboxApi(
Connection connection,
ThreadApi threadApi,
StoreApi storeApi
)
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
public void close()
closeFile
Closes a file by given handle.
public String closeFile(
long fileHandle
)
Name | Type | Description |
---|---|---|
fileHandle | long | handle to the file |
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
)
Name | Type | Description |
---|---|---|
publicMeta | byte[] | public file's metadata |
privateMeta | byte[] | private file's metadata |
fileSize | long | size of the file to send |
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
)
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 |
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
)
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 |
Type | Description |
---|---|
String | ID of the created Inbox |
deleteEntry
Deletes an entry from an Inbox.
public void deleteEntry(
String inboxEntryId
)
Name | Type | Description |
---|---|---|
inboxEntryId | String | ID of an entry to delete |
deleteInbox
Deletes an Inbox by given Inbox ID.
public void deleteInbox(
String inboxId
)
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
)
Name | Type | Description |
---|---|---|
inboxId | String | ID of the Inbox to get |
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
)
Name | Type | Description |
---|---|---|
inboxId | String | ID of the Inbox to get |
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
)
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) |
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
)
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 |
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
)
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) |
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
)
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 |
Type | Description |
---|---|
PagingList<Inbox> | list of Inboxes |
openFile
Opens a file to read.
public Long openFile(
String fileId
)
Name | Type | Description |
---|---|---|
fileId | String | ID of the file to read |
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
)
Name | Type | Description |
---|---|---|
inboxId | String | ID of the Inbox to which the request applies |
data | byte[] | entry data to send |
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
)
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 |
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
)
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 |
Type | Description |
---|---|
Long | Inbox handle |
readEntry
Gets an entry from an Inbox.
public InboxEntry readEntry(
String inboxEntryId
)
Name | Type | Description |
---|---|---|
inboxEntryId | String | ID of an entry to read from the Inbox |
Type | Description |
---|---|
InboxEntry | Data of the selected entry stored in the Inbox |
readFromFile
Reads file data.
public byte[] readFromFile(
long fileHandle,
long length
)
Name | Type | Description |
---|---|---|
fileHandle | long | handle to the file |
length | long | size of data to read |
Type | Description |
---|---|
byte[] | File data chunk |
seekInFile
Moves file's read cursor.
public void seekInFile(
long fileHandle,
long position
)
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
)
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
)
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
)
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
)
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
)
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
)
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 |