public class APIConnector extends Object
Modifier and Type | Class and Description |
---|---|
class |
APIConnector.InputStreamLength |
static interface |
APIConnector.ProgressListener |
Constructor and Description |
---|
APIConnector(String apiIdentity,
String secret,
PublicKeyStore publicKeyStore) |
APIConnector(String apiIdentity,
String secret,
String apiUrl,
PublicKeyStore publicKeyStore) |
Modifier and Type | Method and Description |
---|---|
byte[] |
downloadFile(byte[] blobId)
Download a file given its blob ID.
|
byte[] |
downloadFile(byte[] blobId,
APIConnector.ProgressListener progressListener)
Download a file given its blob ID.
|
Integer |
lookupCredits() |
String |
lookupEmail(String email)
Lookup an ID by email address.
|
byte[] |
lookupKey(String id)
Lookup a public key by ID.
|
CapabilityResult |
lookupKeyCapability(String threemaId)
Lookup the capabilities of a ID
|
String |
lookupPhone(String phoneNumber)
Lookup an ID by phone number.
|
String |
sendE2EMessage(String to,
byte[] nonce,
byte[] box)
Send an end-to-end encrypted message.
|
String |
sendTextMessageSimple(String to,
String text)
Send a text message with server-side encryption.
|
UploadResult |
uploadFile(EncryptResult fileEncryptionResult)
Upload a file.
|
public APIConnector(String apiIdentity, String secret, PublicKeyStore publicKeyStore)
public APIConnector(String apiIdentity, String secret, String apiUrl, PublicKeyStore publicKeyStore)
public String sendTextMessageSimple(String to, String text) throws IOException
to
- recipient IDtext
- message text (max. 3500 bytes)IOException
- if a communication or server error occurspublic String sendE2EMessage(String to, byte[] nonce, byte[] box) throws IOException
to
- recipient IDnonce
- nonce used for encryption (24 bytes)box
- encrypted message data (max. 4000 bytes)IOException
- if a communication or server error occurspublic String lookupPhone(String phoneNumber) throws IOException
phoneNumber
- the phone number in E.164 formatIOException
- if a communication or server error occurspublic String lookupEmail(String email) throws IOException
email
- the email addressIOException
- if a communication or server error occurspublic byte[] lookupKey(String id) throws IOException
id
- the ID whose public key is desiredIOException
- if a communication or server error occurspublic CapabilityResult lookupKeyCapability(String threemaId) throws IOException
threemaId
- The ID whose capabilities should be checkedIOException
public Integer lookupCredits() throws IOException
IOException
public UploadResult uploadFile(EncryptResult fileEncryptionResult) throws IOException
fileEncryptionResult
- The result of the file encryption (i.e. encrypted file data)IOException
public byte[] downloadFile(byte[] blobId) throws IOException
blobId
- The blob ID of the fileIOException
public byte[] downloadFile(byte[] blobId, APIConnector.ProgressListener progressListener) throws IOException
blobId
- The blob ID of the fileprogressListener
- An object that will receive progress information, or nullIOException
Copyright © 2015 Threema GmbH, Staldenbachstrasse 11, 8808 Pfäffikon SZ, Schweiz. All rights reserved.