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 DBusPath
getIdentity(String number
);
143 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 EditMessageReceived
extends DBusSignal
{
240 private final long timestamp
;
241 private final long targetSentTimestamp
;
242 private final String sender
;
243 private final byte[] groupId
;
244 private final String message
;
245 private final Map
<String
, Variant
<?
>> extras
;
247 public EditMessageReceived(
250 final long targetSentTimestamp
,
254 final Map
<String
, Variant
<?
>> extras
255 ) throws DBusException
{
256 super(objectpath
, timestamp
, targetSentTimestamp
, sender
, groupId
, message
, extras
);
257 this.timestamp
= timestamp
;
258 this.targetSentTimestamp
= targetSentTimestamp
;
259 this.sender
= sender
;
260 this.groupId
= groupId
;
261 this.message
= message
;
262 this.extras
= extras
;
265 public long getTimestamp() {
269 public long getTargetSentTimestamp() {
270 return targetSentTimestamp
;
273 public String
getSender() {
277 public byte[] getGroupId() {
281 public String
getMessage() {
285 public Map
<String
, Variant
<?
>> getExtras() {
290 class MessageReceived
extends DBusSignal
{
292 private final long timestamp
;
293 private final String sender
;
294 private final byte[] groupId
;
295 private final String message
;
296 private final List
<String
> attachments
;
298 public MessageReceived(
304 List
<String
> attachments
305 ) throws DBusException
{
306 super(objectpath
, timestamp
, sender
, groupId
, message
, attachments
);
307 this.timestamp
= timestamp
;
308 this.sender
= sender
;
309 this.groupId
= groupId
;
310 this.message
= message
;
311 this.attachments
= attachments
;
314 public long getTimestamp() {
318 public String
getSender() {
322 public byte[] getGroupId() {
326 public String
getMessage() {
330 public List
<String
> getAttachments() {
335 class ReceiptReceived
extends DBusSignal
{
337 private final long timestamp
;
338 private final String sender
;
340 public ReceiptReceived(String objectpath
, long timestamp
, String sender
) throws DBusException
{
341 super(objectpath
, timestamp
, sender
);
342 this.timestamp
= timestamp
;
343 this.sender
= sender
;
346 public long getTimestamp() {
350 public String
getSender() {
355 class ReceiptReceivedV2
extends DBusSignal
{
357 private final long timestamp
;
358 private final String sender
;
359 private final String type
;
360 private final Map
<String
, Variant
<?
>> extras
;
362 public ReceiptReceivedV2(
367 final Map
<String
, Variant
<?
>> extras
368 ) throws DBusException
{
369 super(objectpath
, timestamp
, sender
, type
, extras
);
370 this.timestamp
= timestamp
;
371 this.sender
= sender
;
373 this.extras
= extras
;
376 public long getTimestamp() {
380 public String
getSender() {
384 public String
getReceiptType() {
388 public Map
<String
, Variant
<?
>> getExtras() {
393 class SyncMessageReceived
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 List
<String
> attachments
;
402 public SyncMessageReceived(
409 List
<String
> attachments
410 ) throws DBusException
{
411 super(objectpath
, timestamp
, source
, destination
, groupId
, message
, attachments
);
412 this.timestamp
= timestamp
;
413 this.source
= source
;
414 this.destination
= destination
;
415 this.groupId
= groupId
;
416 this.message
= message
;
417 this.attachments
= attachments
;
420 public long getTimestamp() {
424 public String
getSource() {
428 public String
getDestination() {
432 public byte[] getGroupId() {
436 public String
getMessage() {
440 public List
<String
> getAttachments() {
445 class SyncMessageReceivedV2
extends DBusSignal
{
447 private final long timestamp
;
448 private final String source
;
449 private final String destination
;
450 private final byte[] groupId
;
451 private final String message
;
452 private final Map
<String
, Variant
<?
>> extras
;
454 public SyncMessageReceivedV2(
461 final Map
<String
, Variant
<?
>> extras
462 ) throws DBusException
{
463 super(objectpath
, timestamp
, source
, destination
, groupId
, message
, extras
);
464 this.timestamp
= timestamp
;
465 this.source
= source
;
466 this.destination
= destination
;
467 this.groupId
= groupId
;
468 this.message
= message
;
469 this.extras
= extras
;
472 public long getTimestamp() {
476 public String
getSource() {
480 public String
getDestination() {
484 public byte[] getGroupId() {
488 public String
getMessage() {
492 public Map
<String
, Variant
<?
>> getExtras() {
497 class StructDevice
extends Struct
{
500 final DBusPath objectPath
;
508 public StructDevice(final DBusPath objectPath
, final Long id
, final String name
) {
509 this.objectPath
= objectPath
;
514 public DBusPath
getObjectPath() {
518 public Long
getId() {
522 public String
getName() {
527 @DBusProperty(name
= "Id", type
= Integer
.class, access
= DBusProperty
.Access
.READ
)
528 @DBusProperty(name
= "Name", type
= String
.class)
529 @DBusProperty(name
= "Created", type
= String
.class, access
= DBusProperty
.Access
.READ
)
530 @DBusProperty(name
= "LastSeen", type
= String
.class, access
= DBusProperty
.Access
.READ
)
531 interface Device
extends DBusInterface
, Properties
{
533 void removeDevice() throws Error
.Failure
;
536 @DBusProperty(name
= "ReadReceipts", type
= Boolean
.class)
537 @DBusProperty(name
= "UnidentifiedDeliveryIndicators", type
= Boolean
.class)
538 @DBusProperty(name
= "TypingIndicators", type
= Boolean
.class)
539 @DBusProperty(name
= "LinkPreviews", type
= Boolean
.class)
540 interface Configuration
extends DBusInterface
, Properties
{}
542 class StructGroup
extends Struct
{
545 final DBusPath objectPath
;
553 public StructGroup(final DBusPath objectPath
, final byte[] id
, final String name
) {
554 this.objectPath
= objectPath
;
559 public DBusPath
getObjectPath() {
563 public byte[] getId() {
567 public String
getName() {
572 @DBusProperty(name
= "Id", type
= Byte
[].class, access
= DBusProperty
.Access
.READ
)
573 @DBusProperty(name
= "Name", type
= String
.class)
574 @DBusProperty(name
= "Description", type
= String
.class)
575 @DBusProperty(name
= "Avatar", type
= String
.class, access
= DBusProperty
.Access
.WRITE
)
576 @DBusProperty(name
= "IsBlocked", type
= Boolean
.class)
577 @DBusProperty(name
= "IsMember", type
= Boolean
.class, access
= DBusProperty
.Access
.READ
)
578 @DBusProperty(name
= "IsAdmin", type
= Boolean
.class, access
= DBusProperty
.Access
.READ
)
579 @DBusProperty(name
= "MessageExpirationTimer", type
= Integer
.class)
580 @DBusProperty(name
= "Members", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
581 @DBusProperty(name
= "PendingMembers", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
582 @DBusProperty(name
= "RequestingMembers", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
583 @DBusProperty(name
= "Admins", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
584 @DBusProperty(name
= "Banned", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
585 @DBusProperty(name
= "PermissionAddMember", type
= String
.class)
586 @DBusProperty(name
= "PermissionEditDetails", type
= String
.class)
587 @DBusProperty(name
= "PermissionSendMessage", type
= String
.class)
588 @DBusProperty(name
= "GroupInviteLink", type
= String
.class, access
= DBusProperty
.Access
.READ
)
589 interface Group
extends DBusInterface
, Properties
{
591 void quitGroup() throws Error
.Failure
, Error
.LastGroupAdmin
;
593 void deleteGroup() throws Error
.Failure
;
595 void addMembers(List
<String
> recipients
) throws Error
.Failure
;
597 void removeMembers(List
<String
> recipients
) throws Error
.Failure
;
599 void addAdmins(List
<String
> recipients
) throws Error
.Failure
;
601 void removeAdmins(List
<String
> recipients
) throws Error
.Failure
;
603 void resetLink() throws Error
.Failure
;
605 void disableLink() throws Error
.Failure
;
607 void enableLink(boolean requiresApproval
) throws Error
.Failure
;
610 class StructIdentity
extends Struct
{
613 final DBusPath objectPath
;
621 public StructIdentity(final DBusPath objectPath
, final String uuid
, final String number
) {
622 this.objectPath
= objectPath
;
624 this.number
= number
;
627 public DBusPath
getObjectPath() {
631 public String
getUuid() {
635 public String
getNumber() {
640 @DBusProperty(name
= "Number", type
= String
.class, access
= DBusProperty
.Access
.READ
)
641 @DBusProperty(name
= "Uuid", type
= String
.class, access
= DBusProperty
.Access
.READ
)
642 @DBusProperty(name
= "Fingerprint", type
= Byte
[].class, access
= DBusProperty
.Access
.READ
)
643 @DBusProperty(name
= "SafetyNumber", type
= String
.class, access
= DBusProperty
.Access
.READ
)
644 @DBusProperty(name
= "TrustLevel", type
= String
.class, access
= DBusProperty
.Access
.READ
)
645 @DBusProperty(name
= "AddedDate", type
= Integer
.class, access
= DBusProperty
.Access
.READ
)
646 @DBusProperty(name
= "ScannableSafetyNumber", type
= Byte
[].class, access
= DBusProperty
.Access
.READ
)
647 interface Identity
extends DBusInterface
, Properties
{
649 void trust() throws Error
.Failure
;
651 void trustVerified(String safetyNumber
) throws Error
.Failure
;
656 class AttachmentInvalid
extends DBusExecutionException
{
658 public AttachmentInvalid(final String message
) {
659 super("Invalid attachment: " + message
);
663 class InvalidUri
extends DBusExecutionException
{
665 public InvalidUri(final String message
) {
666 super("Invalid uri: " + message
);
670 class Failure
extends DBusExecutionException
{
672 public Failure(final Exception e
) {
673 super("Failure: " + e
.getMessage() + " (" + e
.getClass().getSimpleName() + ")");
676 public Failure(final String message
) {
677 super("Failure: " + message
);
681 class DeviceNotFound
extends DBusExecutionException
{
683 public DeviceNotFound(final String message
) {
684 super("Device not found: " + message
);
688 class GroupNotFound
extends DBusExecutionException
{
690 public GroupNotFound(final String message
) {
691 super("Group not found: " + message
);
695 class NotAGroupMember
extends DBusExecutionException
{
697 public NotAGroupMember(final String message
) {
698 super("Not a group member: " + message
);
702 class InvalidGroupId
extends DBusExecutionException
{
704 public InvalidGroupId(final String message
) {
705 super("Invalid group id: " + message
);
709 class LastGroupAdmin
extends DBusExecutionException
{
711 public LastGroupAdmin(final String message
) {
712 super("Last group admin: " + message
);
716 class InvalidNumber
extends DBusExecutionException
{
718 public InvalidNumber(final String message
) {
719 super("Invalid number: " + message
);
723 class UntrustedIdentity
extends DBusExecutionException
{
725 public UntrustedIdentity(final String message
) {
726 super("Untrusted identity: " + message
);
730 class UnregisteredRecipient
extends DBusExecutionException
{
732 public UnregisteredRecipient(final String message
) {
733 super("Unregistered recipient: " + message
);