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();
31 List
<String
> attachments
,
33 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
, Error
.UntrustedIdentity
;
37 List
<String
> attachments
,
38 List
<String
> recipients
39 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
, Error
.UntrustedIdentity
;
41 void sendTyping(String recipient
, boolean stop
) throws Error
.Failure
, Error
.UntrustedIdentity
;
43 void sendReadReceipt(String recipient
, List
<Long
> messageIds
) throws Error
.Failure
, Error
.UntrustedIdentity
;
45 void sendViewedReceipt(String recipient
, List
<Long
> messageIds
) throws Error
.Failure
, Error
.UntrustedIdentity
;
47 long sendRemoteDeleteMessage(long targetSentTimestamp
, String recipient
) throws Error
.Failure
, Error
.InvalidNumber
;
49 long sendRemoteDeleteMessage(
50 long targetSentTimestamp
,
51 List
<String
> recipients
52 ) throws Error
.Failure
, Error
.InvalidNumber
;
54 long sendMessageReaction(
58 long targetSentTimestamp
,
60 ) throws Error
.InvalidNumber
, Error
.Failure
;
62 long sendMessageReaction(
66 long targetSentTimestamp
,
67 List
<String
> recipients
68 ) throws Error
.InvalidNumber
, Error
.Failure
;
70 long sendPaymentNotification(byte[] receipt
, String note
, String recipient
) throws Error
.Failure
;
72 void sendContacts() throws Error
.Failure
;
74 void sendSyncRequest() throws Error
.Failure
;
76 long sendNoteToSelfMessage(String message
, List
<String
> attachments
) throws Error
.AttachmentInvalid
, Error
.Failure
;
78 void sendEndSessionMessage(List
<String
> recipients
) throws Error
.Failure
, Error
.InvalidNumber
, Error
.UntrustedIdentity
;
80 void deleteRecipient(final String recipient
) throws Error
.Failure
;
82 void deleteContact(final String recipient
) throws Error
.Failure
;
84 long sendGroupMessage(
86 List
<String
> attachments
,
88 ) throws Error
.GroupNotFound
, Error
.Failure
, Error
.AttachmentInvalid
, Error
.InvalidGroupId
;
93 ) throws Error
.Failure
, Error
.GroupNotFound
, Error
.UntrustedIdentity
;
95 long sendGroupRemoteDeleteMessage(
96 long targetSentTimestamp
,
98 ) throws Error
.Failure
, Error
.GroupNotFound
, Error
.InvalidGroupId
;
100 long sendGroupMessageReaction(
104 long targetSentTimestamp
,
106 ) throws Error
.GroupNotFound
, Error
.Failure
, Error
.InvalidNumber
, Error
.InvalidGroupId
;
108 String
getContactName(String number
) throws Error
.InvalidNumber
;
110 void setContactName(String number
, String name
) throws Error
.InvalidNumber
;
112 void setExpirationTimer(final String number
, final int expiration
) throws Error
.Failure
;
114 void setContactBlocked(String number
, boolean blocked
) throws Error
.InvalidNumber
;
117 void setGroupBlocked(byte[] groupId
, boolean blocked
) throws Error
.GroupNotFound
, Error
.InvalidGroupId
;
120 List
<byte[]> getGroupIds();
122 DBusPath
getGroup(byte[] groupId
);
124 List
<StructGroup
> listGroups();
127 String
getGroupName(byte[] groupId
) throws Error
.InvalidGroupId
;
130 List
<String
> getGroupMembers(byte[] groupId
) throws Error
.InvalidGroupId
;
134 List
<String
> members
,
136 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
;
142 List
<String
> members
,
144 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
, Error
.GroupNotFound
, Error
.InvalidGroupId
;
147 boolean isRegistered() throws Error
.Failure
, Error
.InvalidNumber
;
149 boolean isRegistered(String number
) throws Error
.Failure
, Error
.InvalidNumber
;
151 List
<Boolean
> isRegistered(List
<String
> numbers
) throws Error
.Failure
, Error
.InvalidNumber
;
153 void addDevice(String uri
) throws Error
.InvalidUri
;
155 DBusPath
getDevice(long deviceId
);
157 DBusPath
getIdentity(String number
);
159 List
<StructIdentity
> listIdentities();
161 List
<StructDevice
> listDevices() throws Error
.Failure
;
163 DBusPath
getThisDevice();
172 ) throws Error
.Failure
;
180 ) throws Error
.Failure
;
184 void setPin(String registrationLockPin
);
188 List
<String
> listNumbers();
190 List
<String
> getContactNumber(final String name
) throws Error
.Failure
;
193 void quitGroup(final byte[] groupId
) throws Error
.GroupNotFound
, Error
.Failure
, Error
.InvalidGroupId
;
195 boolean isContactBlocked(final String number
) throws Error
.InvalidNumber
;
198 boolean isGroupBlocked(final byte[] groupId
) throws Error
.InvalidGroupId
;
201 boolean isMember(final byte[] groupId
) throws Error
.InvalidGroupId
;
203 byte[] joinGroup(final String groupLink
) throws Error
.Failure
;
205 String
uploadStickerPack(String stickerPackPath
) throws Error
.Failure
;
207 void submitRateLimitChallenge(String challenge
, String captchaString
) throws Error
.Failure
;
209 void unregister() throws Error
.Failure
;
211 void deleteAccount() throws Error
.Failure
;
213 class MessageReceivedV2
extends DBusSignal
{
215 private final long timestamp
;
216 private final String sender
;
217 private final byte[] groupId
;
218 private final String message
;
219 private final Map
<String
, Variant
<?
>> extras
;
221 public MessageReceivedV2(
227 final Map
<String
, Variant
<?
>> extras
228 ) throws DBusException
{
229 super(objectpath
, timestamp
, sender
, groupId
, message
, extras
);
230 this.timestamp
= timestamp
;
231 this.sender
= sender
;
232 this.groupId
= groupId
;
233 this.message
= message
;
234 this.extras
= extras
;
237 public long getTimestamp() {
241 public String
getSender() {
245 public byte[] getGroupId() {
249 public String
getMessage() {
253 public Map
<String
, Variant
<?
>> getExtras() {
258 class EditMessageReceived
extends DBusSignal
{
260 private final long timestamp
;
261 private final long targetSentTimestamp
;
262 private final String sender
;
263 private final byte[] groupId
;
264 private final String message
;
265 private final Map
<String
, Variant
<?
>> extras
;
267 public EditMessageReceived(
270 final long targetSentTimestamp
,
274 final Map
<String
, Variant
<?
>> extras
275 ) throws DBusException
{
276 super(objectpath
, timestamp
, targetSentTimestamp
, sender
, groupId
, message
, extras
);
277 this.timestamp
= timestamp
;
278 this.targetSentTimestamp
= targetSentTimestamp
;
279 this.sender
= sender
;
280 this.groupId
= groupId
;
281 this.message
= message
;
282 this.extras
= extras
;
285 public long getTimestamp() {
289 public long getTargetSentTimestamp() {
290 return targetSentTimestamp
;
293 public String
getSender() {
297 public byte[] getGroupId() {
301 public String
getMessage() {
305 public Map
<String
, Variant
<?
>> getExtras() {
310 class MessageReceived
extends DBusSignal
{
312 private final long timestamp
;
313 private final String sender
;
314 private final byte[] groupId
;
315 private final String message
;
316 private final List
<String
> attachments
;
318 public MessageReceived(
324 List
<String
> attachments
325 ) throws DBusException
{
326 super(objectpath
, timestamp
, sender
, groupId
, message
, attachments
);
327 this.timestamp
= timestamp
;
328 this.sender
= sender
;
329 this.groupId
= groupId
;
330 this.message
= message
;
331 this.attachments
= attachments
;
334 public long getTimestamp() {
338 public String
getSender() {
342 public byte[] getGroupId() {
346 public String
getMessage() {
350 public List
<String
> getAttachments() {
355 class ReceiptReceived
extends DBusSignal
{
357 private final long timestamp
;
358 private final String sender
;
360 public ReceiptReceived(String objectpath
, long timestamp
, String sender
) throws DBusException
{
361 super(objectpath
, timestamp
, sender
);
362 this.timestamp
= timestamp
;
363 this.sender
= sender
;
366 public long getTimestamp() {
370 public String
getSender() {
375 class ReceiptReceivedV2
extends DBusSignal
{
377 private final long timestamp
;
378 private final String sender
;
379 private final String type
;
380 private final Map
<String
, Variant
<?
>> extras
;
382 public ReceiptReceivedV2(
387 final Map
<String
, Variant
<?
>> extras
388 ) throws DBusException
{
389 super(objectpath
, timestamp
, sender
, type
, extras
);
390 this.timestamp
= timestamp
;
391 this.sender
= sender
;
393 this.extras
= extras
;
396 public long getTimestamp() {
400 public String
getSender() {
404 public String
getReceiptType() {
408 public Map
<String
, Variant
<?
>> getExtras() {
413 class SyncMessageReceived
extends DBusSignal
{
415 private final long timestamp
;
416 private final String source
;
417 private final String destination
;
418 private final byte[] groupId
;
419 private final String message
;
420 private final List
<String
> attachments
;
422 public SyncMessageReceived(
429 List
<String
> attachments
430 ) throws DBusException
{
431 super(objectpath
, timestamp
, source
, destination
, groupId
, message
, attachments
);
432 this.timestamp
= timestamp
;
433 this.source
= source
;
434 this.destination
= destination
;
435 this.groupId
= groupId
;
436 this.message
= message
;
437 this.attachments
= attachments
;
440 public long getTimestamp() {
444 public String
getSource() {
448 public String
getDestination() {
452 public byte[] getGroupId() {
456 public String
getMessage() {
460 public List
<String
> getAttachments() {
465 class SyncMessageReceivedV2
extends DBusSignal
{
467 private final long timestamp
;
468 private final String source
;
469 private final String destination
;
470 private final byte[] groupId
;
471 private final String message
;
472 private final Map
<String
, Variant
<?
>> extras
;
474 public SyncMessageReceivedV2(
481 final Map
<String
, Variant
<?
>> extras
482 ) throws DBusException
{
483 super(objectpath
, timestamp
, source
, destination
, groupId
, message
, extras
);
484 this.timestamp
= timestamp
;
485 this.source
= source
;
486 this.destination
= destination
;
487 this.groupId
= groupId
;
488 this.message
= message
;
489 this.extras
= extras
;
492 public long getTimestamp() {
496 public String
getSource() {
500 public String
getDestination() {
504 public byte[] getGroupId() {
508 public String
getMessage() {
512 public Map
<String
, Variant
<?
>> getExtras() {
517 class StructDevice
extends Struct
{
520 final DBusPath objectPath
;
528 public StructDevice(final DBusPath objectPath
, final Long id
, final String name
) {
529 this.objectPath
= objectPath
;
534 public DBusPath
getObjectPath() {
538 public Long
getId() {
542 public String
getName() {
547 @DBusProperty(name
= "Id", type
= Integer
.class, access
= DBusProperty
.Access
.READ
)
548 @DBusProperty(name
= "Name", type
= String
.class)
549 @DBusProperty(name
= "Created", type
= String
.class, access
= DBusProperty
.Access
.READ
)
550 @DBusProperty(name
= "LastSeen", type
= String
.class, access
= DBusProperty
.Access
.READ
)
551 interface Device
extends DBusInterface
, Properties
{
553 void removeDevice() throws Error
.Failure
;
556 @DBusProperty(name
= "ReadReceipts", type
= Boolean
.class)
557 @DBusProperty(name
= "UnidentifiedDeliveryIndicators", type
= Boolean
.class)
558 @DBusProperty(name
= "TypingIndicators", type
= Boolean
.class)
559 @DBusProperty(name
= "LinkPreviews", type
= Boolean
.class)
560 interface Configuration
extends DBusInterface
, Properties
{}
562 class StructGroup
extends Struct
{
565 final DBusPath objectPath
;
573 public StructGroup(final DBusPath objectPath
, final byte[] id
, final String name
) {
574 this.objectPath
= objectPath
;
579 public DBusPath
getObjectPath() {
583 public byte[] getId() {
587 public String
getName() {
592 @DBusProperty(name
= "Id", type
= Byte
[].class, access
= DBusProperty
.Access
.READ
)
593 @DBusProperty(name
= "Name", type
= String
.class)
594 @DBusProperty(name
= "Description", type
= String
.class)
595 @DBusProperty(name
= "Avatar", type
= String
.class, access
= DBusProperty
.Access
.WRITE
)
596 @DBusProperty(name
= "IsBlocked", type
= Boolean
.class)
597 @DBusProperty(name
= "IsMember", type
= Boolean
.class, access
= DBusProperty
.Access
.READ
)
598 @DBusProperty(name
= "IsAdmin", type
= Boolean
.class, access
= DBusProperty
.Access
.READ
)
599 @DBusProperty(name
= "MessageExpirationTimer", type
= Integer
.class)
600 @DBusProperty(name
= "Members", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
601 @DBusProperty(name
= "PendingMembers", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
602 @DBusProperty(name
= "RequestingMembers", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
603 @DBusProperty(name
= "Admins", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
604 @DBusProperty(name
= "Banned", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
605 @DBusProperty(name
= "PermissionAddMember", type
= String
.class)
606 @DBusProperty(name
= "PermissionEditDetails", type
= String
.class)
607 @DBusProperty(name
= "PermissionSendMessage", type
= String
.class)
608 @DBusProperty(name
= "GroupInviteLink", type
= String
.class, access
= DBusProperty
.Access
.READ
)
609 interface Group
extends DBusInterface
, Properties
{
611 void quitGroup() throws Error
.Failure
, Error
.LastGroupAdmin
;
613 void deleteGroup() throws Error
.Failure
;
615 void addMembers(List
<String
> recipients
) throws Error
.Failure
;
617 void removeMembers(List
<String
> recipients
) throws Error
.Failure
;
619 void addAdmins(List
<String
> recipients
) throws Error
.Failure
;
621 void removeAdmins(List
<String
> recipients
) throws Error
.Failure
;
623 void resetLink() throws Error
.Failure
;
625 void disableLink() throws Error
.Failure
;
627 void enableLink(boolean requiresApproval
) throws Error
.Failure
;
630 class StructIdentity
extends Struct
{
633 final DBusPath objectPath
;
641 public StructIdentity(final DBusPath objectPath
, final String uuid
, final String number
) {
642 this.objectPath
= objectPath
;
644 this.number
= number
;
647 public DBusPath
getObjectPath() {
651 public String
getUuid() {
655 public String
getNumber() {
660 @DBusProperty(name
= "Number", type
= String
.class, access
= DBusProperty
.Access
.READ
)
661 @DBusProperty(name
= "Uuid", type
= String
.class, access
= DBusProperty
.Access
.READ
)
662 @DBusProperty(name
= "Fingerprint", type
= Byte
[].class, access
= DBusProperty
.Access
.READ
)
663 @DBusProperty(name
= "SafetyNumber", type
= String
.class, access
= DBusProperty
.Access
.READ
)
664 @DBusProperty(name
= "TrustLevel", type
= String
.class, access
= DBusProperty
.Access
.READ
)
665 @DBusProperty(name
= "AddedDate", type
= Long
.class, access
= DBusProperty
.Access
.READ
)
666 @DBusProperty(name
= "ScannableSafetyNumber", type
= Byte
[].class, access
= DBusProperty
.Access
.READ
)
667 interface Identity
extends DBusInterface
, Properties
{
669 void trust() throws Error
.Failure
;
671 void trustVerified(String safetyNumber
) throws Error
.Failure
;
676 class AttachmentInvalid
extends DBusExecutionException
{
678 public AttachmentInvalid(final String message
) {
679 super("Invalid attachment: " + message
);
683 class InvalidUri
extends DBusExecutionException
{
685 public InvalidUri(final String message
) {
686 super("Invalid uri: " + message
);
690 class Failure
extends DBusExecutionException
{
692 public Failure(final Exception e
) {
693 super("Failure: " + e
.getMessage() + " (" + e
.getClass().getSimpleName() + ")");
696 public Failure(final String message
) {
697 super("Failure: " + message
);
701 class DeviceNotFound
extends DBusExecutionException
{
703 public DeviceNotFound(final String message
) {
704 super("Device not found: " + message
);
708 class GroupNotFound
extends DBusExecutionException
{
710 public GroupNotFound(final String message
) {
711 super("Group not found: " + message
);
715 class NotAGroupMember
extends DBusExecutionException
{
717 public NotAGroupMember(final String message
) {
718 super("Not a group member: " + message
);
722 class InvalidGroupId
extends DBusExecutionException
{
724 public InvalidGroupId(final String message
) {
725 super("Invalid group id: " + message
);
729 class LastGroupAdmin
extends DBusExecutionException
{
731 public LastGroupAdmin(final String message
) {
732 super("Last group admin: " + message
);
736 class InvalidNumber
extends DBusExecutionException
{
738 public InvalidNumber(final String message
) {
739 super("Invalid number: " + message
);
743 class UntrustedIdentity
extends DBusExecutionException
{
745 public UntrustedIdentity(final String message
) {
746 super("Untrusted identity: " + message
);
750 class UnregisteredRecipient
extends DBusExecutionException
{
752 public UnregisteredRecipient(final String message
) {
753 super("Unregistered recipient: " + message
);