3 import org
.freedesktop
.dbus
.DBusPath
;
4 import org
.freedesktop
.dbus
.Struct
;
5 import org
.freedesktop
.dbus
.annotations
.DBusProperty
;
6 import org
.freedesktop
.dbus
.annotations
.Position
;
7 import org
.freedesktop
.dbus
.exceptions
.DBusException
;
8 import org
.freedesktop
.dbus
.exceptions
.DBusExecutionException
;
9 import org
.freedesktop
.dbus
.interfaces
.DBusInterface
;
10 import org
.freedesktop
.dbus
.interfaces
.Properties
;
11 import org
.freedesktop
.dbus
.messages
.DBusSignal
;
12 import org
.freedesktop
.dbus
.types
.Variant
;
14 import java
.util
.List
;
18 * DBus interface for the org.asamk.Signal service.
19 * Including emitted Signals and returned Errors.
21 public interface Signal
extends DBusInterface
{
23 String
getSelfNumber();
25 void subscribeReceive();
27 void unsubscribeReceive();
30 String message
, List
<String
> attachments
, String recipient
31 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
, Error
.UntrustedIdentity
;
34 String message
, List
<String
> attachments
, List
<String
> recipients
35 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
, Error
.UntrustedIdentity
;
38 String recipient
, boolean stop
39 ) throws Error
.Failure
, Error
.UntrustedIdentity
;
42 String recipient
, List
<Long
> messageIds
43 ) throws Error
.Failure
, Error
.UntrustedIdentity
;
45 void sendViewedReceipt(
46 String recipient
, List
<Long
> messageIds
47 ) throws Error
.Failure
, Error
.UntrustedIdentity
;
49 long sendRemoteDeleteMessage(
50 long targetSentTimestamp
, String recipient
51 ) throws Error
.Failure
, Error
.InvalidNumber
;
53 long sendRemoteDeleteMessage(
54 long targetSentTimestamp
, List
<String
> recipients
55 ) throws Error
.Failure
, Error
.InvalidNumber
;
57 long sendMessageReaction(
58 String emoji
, boolean remove
, String targetAuthor
, long targetSentTimestamp
, String recipient
59 ) throws Error
.InvalidNumber
, Error
.Failure
;
61 long sendMessageReaction(
62 String emoji
, boolean remove
, String targetAuthor
, long targetSentTimestamp
, List
<String
> recipients
63 ) throws Error
.InvalidNumber
, Error
.Failure
;
65 long sendPaymentNotification(byte[] receipt
, String note
, String recipient
) throws Error
.Failure
;
67 void sendContacts() throws Error
.Failure
;
69 void sendSyncRequest() throws Error
.Failure
;
71 long sendNoteToSelfMessage(
72 String message
, List
<String
> attachments
73 ) throws Error
.AttachmentInvalid
, Error
.Failure
;
75 void sendEndSessionMessage(List
<String
> recipients
) throws Error
.Failure
, Error
.InvalidNumber
, Error
.UntrustedIdentity
;
77 void deleteRecipient(final String recipient
) throws Error
.Failure
;
79 void deleteContact(final String recipient
) throws Error
.Failure
;
81 long sendGroupMessage(
82 String message
, List
<String
> attachments
, byte[] groupId
83 ) throws Error
.GroupNotFound
, Error
.Failure
, Error
.AttachmentInvalid
, Error
.InvalidGroupId
;
86 final byte[] groupId
, final boolean stop
87 ) throws Error
.Failure
, Error
.GroupNotFound
, Error
.UntrustedIdentity
;
89 long sendGroupRemoteDeleteMessage(
90 long targetSentTimestamp
, byte[] groupId
91 ) throws Error
.Failure
, Error
.GroupNotFound
, Error
.InvalidGroupId
;
93 long sendGroupMessageReaction(
94 String emoji
, boolean remove
, String targetAuthor
, long targetSentTimestamp
, byte[] groupId
95 ) throws Error
.GroupNotFound
, Error
.Failure
, Error
.InvalidNumber
, Error
.InvalidGroupId
;
97 String
getContactName(String number
) throws Error
.InvalidNumber
;
99 void setContactName(String number
, String name
) throws Error
.InvalidNumber
;
101 void setExpirationTimer(final String number
, final int expiration
) throws Error
.Failure
;
103 void setContactBlocked(String number
, boolean blocked
) throws Error
.InvalidNumber
;
106 void setGroupBlocked(byte[] groupId
, boolean blocked
) throws Error
.GroupNotFound
, Error
.InvalidGroupId
;
109 List
<byte[]> getGroupIds();
111 DBusPath
getGroup(byte[] groupId
);
113 List
<StructGroup
> listGroups();
116 String
getGroupName(byte[] groupId
) throws Error
.InvalidGroupId
;
119 List
<String
> getGroupMembers(byte[] groupId
) throws Error
.InvalidGroupId
;
122 String name
, List
<String
> members
, String avatar
123 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
;
127 byte[] groupId
, String name
, List
<String
> members
, String avatar
128 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
, Error
.GroupNotFound
, Error
.InvalidGroupId
;
131 boolean isRegistered() throws Error
.Failure
, Error
.InvalidNumber
;
133 boolean isRegistered(String number
) throws Error
.Failure
, Error
.InvalidNumber
;
135 List
<Boolean
> isRegistered(List
<String
> numbers
) throws Error
.Failure
, Error
.InvalidNumber
;
137 void addDevice(String uri
) throws Error
.InvalidUri
;
139 DBusPath
getDevice(long deviceId
);
141 public DBusPath
getIdentity(String number
);
143 public List
<StructIdentity
> listIdentities();
145 List
<StructDevice
> listDevices() throws Error
.Failure
;
147 DBusPath
getThisDevice();
156 ) throws Error
.Failure
;
159 String name
, String about
, String aboutEmoji
, String avatarPath
, boolean removeAvatar
160 ) throws Error
.Failure
;
164 void setPin(String registrationLockPin
);
168 List
<String
> listNumbers();
170 List
<String
> getContactNumber(final String name
) throws Error
.Failure
;
173 void quitGroup(final byte[] groupId
) throws Error
.GroupNotFound
, Error
.Failure
, Error
.InvalidGroupId
;
175 boolean isContactBlocked(final String number
) throws Error
.InvalidNumber
;
178 boolean isGroupBlocked(final byte[] groupId
) throws Error
.InvalidGroupId
;
181 boolean isMember(final byte[] groupId
) throws Error
.InvalidGroupId
;
183 byte[] joinGroup(final String groupLink
) throws Error
.Failure
;
185 String
uploadStickerPack(String stickerPackPath
) throws Error
.Failure
;
187 void submitRateLimitChallenge(String challenge
, String captchaString
) throws Error
.Failure
;
189 void unregister() throws Error
.Failure
;
191 void deleteAccount() throws Error
.Failure
;
193 class MessageReceivedV2
extends DBusSignal
{
195 private final long timestamp
;
196 private final String sender
;
197 private final byte[] groupId
;
198 private final String message
;
199 private final Map
<String
, Variant
<?
>> extras
;
201 public MessageReceivedV2(
207 final Map
<String
, Variant
<?
>> extras
208 ) throws DBusException
{
209 super(objectpath
, timestamp
, sender
, groupId
, message
, extras
);
210 this.timestamp
= timestamp
;
211 this.sender
= sender
;
212 this.groupId
= groupId
;
213 this.message
= message
;
214 this.extras
= extras
;
217 public long getTimestamp() {
221 public String
getSender() {
225 public byte[] getGroupId() {
229 public String
getMessage() {
233 public Map
<String
, Variant
<?
>> getExtras() {
238 class MessageReceived
extends DBusSignal
{
240 private final long timestamp
;
241 private final String sender
;
242 private final byte[] groupId
;
243 private final String message
;
244 private final List
<String
> attachments
;
246 public MessageReceived(
252 List
<String
> attachments
253 ) throws DBusException
{
254 super(objectpath
, timestamp
, sender
, groupId
, message
, attachments
);
255 this.timestamp
= timestamp
;
256 this.sender
= sender
;
257 this.groupId
= groupId
;
258 this.message
= message
;
259 this.attachments
= attachments
;
262 public long getTimestamp() {
266 public String
getSender() {
270 public byte[] getGroupId() {
274 public String
getMessage() {
278 public List
<String
> getAttachments() {
283 class ReceiptReceived
extends DBusSignal
{
285 private final long timestamp
;
286 private final String sender
;
288 public ReceiptReceived(String objectpath
, long timestamp
, String sender
) throws DBusException
{
289 super(objectpath
, timestamp
, sender
);
290 this.timestamp
= timestamp
;
291 this.sender
= sender
;
294 public long getTimestamp() {
298 public String
getSender() {
303 class ReceiptReceivedV2
extends DBusSignal
{
305 private final long timestamp
;
306 private final String sender
;
307 private final String type
;
308 private final Map
<String
, Variant
<?
>> extras
;
310 public ReceiptReceivedV2(
315 final Map
<String
, Variant
<?
>> extras
316 ) throws DBusException
{
317 super(objectpath
, timestamp
, sender
, type
, extras
);
318 this.timestamp
= timestamp
;
319 this.sender
= sender
;
321 this.extras
= extras
;
324 public long getTimestamp() {
328 public String
getSender() {
332 public String
getReceiptType() {
336 public Map
<String
, Variant
<?
>> getExtras() {
341 class SyncMessageReceived
extends DBusSignal
{
343 private final long timestamp
;
344 private final String source
;
345 private final String destination
;
346 private final byte[] groupId
;
347 private final String message
;
348 private final List
<String
> attachments
;
350 public SyncMessageReceived(
357 List
<String
> attachments
358 ) throws DBusException
{
359 super(objectpath
, timestamp
, source
, destination
, groupId
, message
, attachments
);
360 this.timestamp
= timestamp
;
361 this.source
= source
;
362 this.destination
= destination
;
363 this.groupId
= groupId
;
364 this.message
= message
;
365 this.attachments
= attachments
;
368 public long getTimestamp() {
372 public String
getSource() {
376 public String
getDestination() {
380 public byte[] getGroupId() {
384 public String
getMessage() {
388 public List
<String
> getAttachments() {
393 class SyncMessageReceivedV2
extends DBusSignal
{
395 private final long timestamp
;
396 private final String source
;
397 private final String destination
;
398 private final byte[] groupId
;
399 private final String message
;
400 private final Map
<String
, Variant
<?
>> extras
;
402 public SyncMessageReceivedV2(
409 final Map
<String
, Variant
<?
>> extras
410 ) throws DBusException
{
411 super(objectpath
, timestamp
, source
, destination
, groupId
, message
, extras
);
412 this.timestamp
= timestamp
;
413 this.source
= source
;
414 this.destination
= destination
;
415 this.groupId
= groupId
;
416 this.message
= message
;
417 this.extras
= extras
;
420 public long getTimestamp() {
424 public String
getSource() {
428 public String
getDestination() {
432 public byte[] getGroupId() {
436 public String
getMessage() {
440 public Map
<String
, Variant
<?
>> getExtras() {
445 class StructDevice
extends Struct
{
456 public StructDevice(final DBusPath objectPath
, final Long id
, final String name
) {
457 this.objectPath
= objectPath
;
462 public DBusPath
getObjectPath() {
466 public Long
getId() {
470 public String
getName() {
475 @DBusProperty(name
= "Id", type
= Integer
.class, access
= DBusProperty
.Access
.READ
)
476 @DBusProperty(name
= "Name", type
= String
.class)
477 @DBusProperty(name
= "Created", type
= String
.class, access
= DBusProperty
.Access
.READ
)
478 @DBusProperty(name
= "LastSeen", type
= String
.class, access
= DBusProperty
.Access
.READ
)
479 interface Device
extends DBusInterface
, Properties
{
481 void removeDevice() throws Error
.Failure
;
484 @DBusProperty(name
= "ReadReceipts", type
= Boolean
.class)
485 @DBusProperty(name
= "UnidentifiedDeliveryIndicators", type
= Boolean
.class)
486 @DBusProperty(name
= "TypingIndicators", type
= Boolean
.class)
487 @DBusProperty(name
= "LinkPreviews", type
= Boolean
.class)
488 interface Configuration
extends DBusInterface
, Properties
{}
490 class StructGroup
extends Struct
{
501 public StructGroup(final DBusPath objectPath
, final byte[] id
, final String name
) {
502 this.objectPath
= objectPath
;
507 public DBusPath
getObjectPath() {
511 public byte[] getId() {
515 public String
getName() {
520 @DBusProperty(name
= "Id", type
= Byte
[].class, access
= DBusProperty
.Access
.READ
)
521 @DBusProperty(name
= "Name", type
= String
.class)
522 @DBusProperty(name
= "Description", type
= String
.class)
523 @DBusProperty(name
= "Avatar", type
= String
.class, access
= DBusProperty
.Access
.WRITE
)
524 @DBusProperty(name
= "IsBlocked", type
= Boolean
.class)
525 @DBusProperty(name
= "IsMember", type
= Boolean
.class, access
= DBusProperty
.Access
.READ
)
526 @DBusProperty(name
= "IsAdmin", type
= Boolean
.class, access
= DBusProperty
.Access
.READ
)
527 @DBusProperty(name
= "MessageExpirationTimer", type
= Integer
.class)
528 @DBusProperty(name
= "Members", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
529 @DBusProperty(name
= "PendingMembers", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
530 @DBusProperty(name
= "RequestingMembers", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
531 @DBusProperty(name
= "Admins", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
532 @DBusProperty(name
= "Banned", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
533 @DBusProperty(name
= "PermissionAddMember", type
= String
.class)
534 @DBusProperty(name
= "PermissionEditDetails", type
= String
.class)
535 @DBusProperty(name
= "PermissionSendMessage", type
= String
.class)
536 @DBusProperty(name
= "GroupInviteLink", type
= String
.class, access
= DBusProperty
.Access
.READ
)
537 interface Group
extends DBusInterface
, Properties
{
539 void quitGroup() throws Error
.Failure
, Error
.LastGroupAdmin
;
541 void deleteGroup() throws Error
.Failure
;
543 void addMembers(List
<String
> recipients
) throws Error
.Failure
;
545 void removeMembers(List
<String
> recipients
) throws Error
.Failure
;
547 void addAdmins(List
<String
> recipients
) throws Error
.Failure
;
549 void removeAdmins(List
<String
> recipients
) throws Error
.Failure
;
551 void resetLink() throws Error
.Failure
;
553 void disableLink() throws Error
.Failure
;
555 void enableLink(boolean requiresApproval
) throws Error
.Failure
;
558 class StructIdentity
extends Struct
{
569 public StructIdentity(final DBusPath objectPath
, final String uuid
, final String number
) {
570 this.objectPath
= objectPath
;
572 this.number
= number
;
575 public DBusPath
getObjectPath() {
579 public String
getUuid() {
583 public String
getNumber() {
588 @DBusProperty(name
= "Number", type
= String
.class, access
= DBusProperty
.Access
.READ
)
589 @DBusProperty(name
= "Uuid", type
= String
.class, access
= DBusProperty
.Access
.READ
)
590 @DBusProperty(name
= "Fingerprint", type
= Byte
[].class, access
= DBusProperty
.Access
.READ
)
591 @DBusProperty(name
= "SafetyNumber", type
= String
.class, access
= DBusProperty
.Access
.READ
)
592 @DBusProperty(name
= "TrustLevel", type
= String
.class, access
= DBusProperty
.Access
.READ
)
593 @DBusProperty(name
= "AddedDate", type
= Integer
.class, access
= DBusProperty
.Access
.READ
)
594 @DBusProperty(name
= "ScannableSafetyNumber", type
= Byte
[].class, access
= DBusProperty
.Access
.READ
)
595 interface Identity
extends DBusInterface
, Properties
{
597 void trust() throws Error
.Failure
;
599 void trustVerified(String safetyNumber
) throws Error
.Failure
;
604 class AttachmentInvalid
extends DBusExecutionException
{
606 public AttachmentInvalid(final String message
) {
607 super("Invalid attachment: " + message
);
611 class InvalidUri
extends DBusExecutionException
{
613 public InvalidUri(final String message
) {
614 super("Invalid uri: " + message
);
618 class Failure
extends DBusExecutionException
{
620 public Failure(final Exception e
) {
621 super("Failure: " + e
.getMessage() + " (" + e
.getClass().getSimpleName() + ")");
624 public Failure(final String message
) {
625 super("Failure: " + message
);
629 class DeviceNotFound
extends DBusExecutionException
{
631 public DeviceNotFound(final String message
) {
632 super("Device not found: " + message
);
636 class GroupNotFound
extends DBusExecutionException
{
638 public GroupNotFound(final String message
) {
639 super("Group not found: " + message
);
643 class NotAGroupMember
extends DBusExecutionException
{
645 public NotAGroupMember(final String message
) {
646 super("Not a group member: " + message
);
650 class InvalidGroupId
extends DBusExecutionException
{
652 public InvalidGroupId(final String message
) {
653 super("Invalid group id: " + message
);
657 class LastGroupAdmin
extends DBusExecutionException
{
659 public LastGroupAdmin(final String message
) {
660 super("Last group admin: " + message
);
664 class InvalidNumber
extends DBusExecutionException
{
666 public InvalidNumber(final String message
) {
667 super("Invalid number: " + message
);
671 class UntrustedIdentity
extends DBusExecutionException
{
673 public UntrustedIdentity(final String message
) {
674 super("Untrusted identity: " + message
);
678 class UnregisteredRecipient
extends DBusExecutionException
{
680 public UnregisteredRecipient(final String message
) {
681 super("Unregistered recipient: " + message
);