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 void sendContacts() throws Error
.Failure
;
67 void sendSyncRequest() throws Error
.Failure
;
69 long sendNoteToSelfMessage(
70 String message
, List
<String
> attachments
71 ) throws Error
.AttachmentInvalid
, Error
.Failure
;
73 void sendEndSessionMessage(List
<String
> recipients
) throws Error
.Failure
, Error
.InvalidNumber
, Error
.UntrustedIdentity
;
75 void deleteRecipient(final String recipient
) throws Error
.Failure
;
77 void deleteContact(final String recipient
) throws Error
.Failure
;
79 long sendGroupMessage(
80 String message
, List
<String
> attachments
, byte[] groupId
81 ) throws Error
.GroupNotFound
, Error
.Failure
, Error
.AttachmentInvalid
, Error
.InvalidGroupId
;
84 final byte[] groupId
, final boolean stop
85 ) throws Error
.Failure
, Error
.GroupNotFound
, Error
.UntrustedIdentity
;
87 long sendGroupRemoteDeleteMessage(
88 long targetSentTimestamp
, byte[] groupId
89 ) throws Error
.Failure
, Error
.GroupNotFound
, Error
.InvalidGroupId
;
91 long sendGroupMessageReaction(
92 String emoji
, boolean remove
, String targetAuthor
, long targetSentTimestamp
, byte[] groupId
93 ) throws Error
.GroupNotFound
, Error
.Failure
, Error
.InvalidNumber
, Error
.InvalidGroupId
;
95 String
getContactName(String number
) throws Error
.InvalidNumber
;
97 void setContactName(String number
, String name
) throws Error
.InvalidNumber
;
99 void setExpirationTimer(final String number
, final int expiration
) throws Error
.Failure
;
101 void setContactBlocked(String number
, boolean blocked
) throws Error
.InvalidNumber
;
104 void setGroupBlocked(byte[] groupId
, boolean blocked
) throws Error
.GroupNotFound
, Error
.InvalidGroupId
;
107 List
<byte[]> getGroupIds();
109 DBusPath
getGroup(byte[] groupId
);
111 List
<StructGroup
> listGroups();
114 String
getGroupName(byte[] groupId
) throws Error
.InvalidGroupId
;
117 List
<String
> getGroupMembers(byte[] groupId
) throws Error
.InvalidGroupId
;
120 String name
, List
<String
> members
, String avatar
121 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
;
125 byte[] groupId
, String name
, List
<String
> members
, String avatar
126 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
, Error
.GroupNotFound
, Error
.InvalidGroupId
;
128 boolean isRegistered() throws Error
.Failure
, Error
.InvalidNumber
;
130 boolean isRegistered(String number
) throws Error
.Failure
, Error
.InvalidNumber
;
132 List
<Boolean
> isRegistered(List
<String
> numbers
) throws Error
.Failure
, Error
.InvalidNumber
;
134 void addDevice(String uri
) throws Error
.InvalidUri
;
136 DBusPath
getDevice(long deviceId
);
138 List
<StructDevice
> listDevices() throws Error
.Failure
;
140 DBusPath
getThisDevice();
149 ) throws Error
.Failure
;
152 String name
, String about
, String aboutEmoji
, String avatarPath
, boolean removeAvatar
153 ) throws Error
.Failure
;
157 void setPin(String registrationLockPin
);
161 List
<String
> listNumbers();
163 List
<String
> getContactNumber(final String name
) throws Error
.Failure
;
166 void quitGroup(final byte[] groupId
) throws Error
.GroupNotFound
, Error
.Failure
, Error
.InvalidGroupId
;
168 boolean isContactBlocked(final String number
) throws Error
.InvalidNumber
;
171 boolean isGroupBlocked(final byte[] groupId
) throws Error
.InvalidGroupId
;
174 boolean isMember(final byte[] groupId
) throws Error
.InvalidGroupId
;
176 byte[] joinGroup(final String groupLink
) throws Error
.Failure
;
178 String
uploadStickerPack(String stickerPackPath
) throws Error
.Failure
;
180 void submitRateLimitChallenge(String challenge
, String captchaString
) throws Error
.Failure
;
182 void unregister() throws Error
.Failure
;
184 void deleteAccount() throws Error
.Failure
;
186 class MessageReceivedV2
extends DBusSignal
{
188 private final long timestamp
;
189 private final String sender
;
190 private final byte[] groupId
;
191 private final String message
;
192 private final Map
<String
, Variant
<?
>> extras
;
194 public MessageReceivedV2(
200 final Map
<String
, Variant
<?
>> extras
201 ) throws DBusException
{
202 super(objectpath
, timestamp
, sender
, groupId
, message
, extras
);
203 this.timestamp
= timestamp
;
204 this.sender
= sender
;
205 this.groupId
= groupId
;
206 this.message
= message
;
207 this.extras
= extras
;
210 public long getTimestamp() {
214 public String
getSender() {
218 public byte[] getGroupId() {
222 public String
getMessage() {
226 public Map
<String
, Variant
<?
>> getExtras() {
231 class MessageReceived
extends DBusSignal
{
233 private final long timestamp
;
234 private final String sender
;
235 private final byte[] groupId
;
236 private final String message
;
237 private final List
<String
> attachments
;
239 public MessageReceived(
245 List
<String
> attachments
246 ) throws DBusException
{
247 super(objectpath
, timestamp
, sender
, groupId
, message
, attachments
);
248 this.timestamp
= timestamp
;
249 this.sender
= sender
;
250 this.groupId
= groupId
;
251 this.message
= message
;
252 this.attachments
= attachments
;
255 public long getTimestamp() {
259 public String
getSender() {
263 public byte[] getGroupId() {
267 public String
getMessage() {
271 public List
<String
> getAttachments() {
276 class ReceiptReceived
extends DBusSignal
{
278 private final long timestamp
;
279 private final String sender
;
281 public ReceiptReceived(String objectpath
, long timestamp
, String sender
) throws DBusException
{
282 super(objectpath
, timestamp
, sender
);
283 this.timestamp
= timestamp
;
284 this.sender
= sender
;
287 public long getTimestamp() {
291 public String
getSender() {
296 class ReceiptReceivedV2
extends DBusSignal
{
298 private final long timestamp
;
299 private final String sender
;
300 private final String type
;
301 private final Map
<String
, Variant
<?
>> extras
;
303 public ReceiptReceivedV2(
308 final Map
<String
, Variant
<?
>> extras
309 ) throws DBusException
{
310 super(objectpath
, timestamp
, sender
, type
, extras
);
311 this.timestamp
= timestamp
;
312 this.sender
= sender
;
314 this.extras
= extras
;
317 public long getTimestamp() {
321 public String
getSender() {
325 public String
getReceiptType() {
329 public Map
<String
, Variant
<?
>> getExtras() {
334 class SyncMessageReceived
extends DBusSignal
{
336 private final long timestamp
;
337 private final String source
;
338 private final String destination
;
339 private final byte[] groupId
;
340 private final String message
;
341 private final List
<String
> attachments
;
343 public SyncMessageReceived(
350 List
<String
> attachments
351 ) throws DBusException
{
352 super(objectpath
, timestamp
, source
, destination
, groupId
, message
, attachments
);
353 this.timestamp
= timestamp
;
354 this.source
= source
;
355 this.destination
= destination
;
356 this.groupId
= groupId
;
357 this.message
= message
;
358 this.attachments
= attachments
;
361 public long getTimestamp() {
365 public String
getSource() {
369 public String
getDestination() {
373 public byte[] getGroupId() {
377 public String
getMessage() {
381 public List
<String
> getAttachments() {
386 class SyncMessageReceivedV2
extends DBusSignal
{
388 private final long timestamp
;
389 private final String source
;
390 private final String destination
;
391 private final byte[] groupId
;
392 private final String message
;
393 private final Map
<String
, Variant
<?
>> extras
;
395 public SyncMessageReceivedV2(
402 final Map
<String
, Variant
<?
>> extras
403 ) throws DBusException
{
404 super(objectpath
, timestamp
, source
, destination
, groupId
, message
, extras
);
405 this.timestamp
= timestamp
;
406 this.source
= source
;
407 this.destination
= destination
;
408 this.groupId
= groupId
;
409 this.message
= message
;
410 this.extras
= extras
;
413 public long getTimestamp() {
417 public String
getSource() {
421 public String
getDestination() {
425 public byte[] getGroupId() {
429 public String
getMessage() {
433 public Map
<String
, Variant
<?
>> getExtras() {
438 class StructDevice
extends Struct
{
449 public StructDevice(final DBusPath objectPath
, final Long id
, final String name
) {
450 this.objectPath
= objectPath
;
455 public DBusPath
getObjectPath() {
459 public Long
getId() {
463 public String
getName() {
468 @DBusProperty(name
= "Id", type
= Long
.class, access
= DBusProperty
.Access
.READ
)
469 @DBusProperty(name
= "Name", type
= String
.class)
470 @DBusProperty(name
= "Created", type
= String
.class, access
= DBusProperty
.Access
.READ
)
471 @DBusProperty(name
= "LastSeen", type
= String
.class, access
= DBusProperty
.Access
.READ
)
472 interface Device
extends DBusInterface
, Properties
{
474 void removeDevice() throws Error
.Failure
;
477 @DBusProperty(name
= "ReadReceipts", type
= Boolean
.class)
478 @DBusProperty(name
= "UnidentifiedDeliveryIndicators", type
= Boolean
.class)
479 @DBusProperty(name
= "TypingIndicators", type
= Boolean
.class)
480 @DBusProperty(name
= "LinkPreviews", type
= Boolean
.class)
481 interface Configuration
extends DBusInterface
, Properties
{}
483 class StructGroup
extends Struct
{
494 public StructGroup(final DBusPath objectPath
, final byte[] id
, final String name
) {
495 this.objectPath
= objectPath
;
500 public DBusPath
getObjectPath() {
504 public byte[] getId() {
508 public String
getName() {
513 @DBusProperty(name
= "Id", type
= Byte
[].class, access
= DBusProperty
.Access
.READ
)
514 @DBusProperty(name
= "Name", type
= String
.class)
515 @DBusProperty(name
= "Description", type
= String
.class)
516 @DBusProperty(name
= "Avatar", type
= String
.class, access
= DBusProperty
.Access
.WRITE
)
517 @DBusProperty(name
= "IsBlocked", type
= Boolean
.class)
518 @DBusProperty(name
= "IsMember", type
= Boolean
.class, access
= DBusProperty
.Access
.READ
)
519 @DBusProperty(name
= "IsAdmin", type
= Boolean
.class, access
= DBusProperty
.Access
.READ
)
520 @DBusProperty(name
= "MessageExpirationTimer", type
= Integer
.class)
521 @DBusProperty(name
= "Members", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
522 @DBusProperty(name
= "PendingMembers", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
523 @DBusProperty(name
= "RequestingMembers", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
524 @DBusProperty(name
= "Admins", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
525 @DBusProperty(name
= "PermissionAddMember", type
= String
.class)
526 @DBusProperty(name
= "PermissionEditDetails", type
= String
.class)
527 @DBusProperty(name
= "PermissionSendMessage", type
= String
.class)
528 @DBusProperty(name
= "GroupInviteLink", type
= String
.class, access
= DBusProperty
.Access
.READ
)
529 interface Group
extends DBusInterface
, Properties
{
531 void quitGroup() throws Error
.Failure
, Error
.LastGroupAdmin
;
533 void addMembers(List
<String
> recipients
) throws Error
.Failure
;
535 void removeMembers(List
<String
> recipients
) throws Error
.Failure
;
537 void addAdmins(List
<String
> recipients
) throws Error
.Failure
;
539 void removeAdmins(List
<String
> recipients
) throws Error
.Failure
;
541 void resetLink() throws Error
.Failure
;
543 void disableLink() throws Error
.Failure
;
545 void enableLink(boolean requiresApproval
) throws Error
.Failure
;
550 class AttachmentInvalid
extends DBusExecutionException
{
552 public AttachmentInvalid(final String message
) {
553 super("Invalid attachment: " + message
);
557 class InvalidUri
extends DBusExecutionException
{
559 public InvalidUri(final String message
) {
560 super("Invalid uri: " + message
);
564 class Failure
extends DBusExecutionException
{
566 public Failure(final Exception e
) {
567 super("Failure: " + e
.getMessage() + " (" + e
.getClass().getSimpleName() + ")");
570 public Failure(final String message
) {
571 super("Failure: " + message
);
575 class DeviceNotFound
extends DBusExecutionException
{
577 public DeviceNotFound(final String message
) {
578 super("Device not found: " + message
);
582 class GroupNotFound
extends DBusExecutionException
{
584 public GroupNotFound(final String message
) {
585 super("Group not found: " + message
);
589 class InvalidGroupId
extends DBusExecutionException
{
591 public InvalidGroupId(final String message
) {
592 super("Invalid group id: " + message
);
596 class LastGroupAdmin
extends DBusExecutionException
{
598 public LastGroupAdmin(final String message
) {
599 super("Last group admin: " + message
);
603 class InvalidNumber
extends DBusExecutionException
{
605 public InvalidNumber(final String message
) {
606 super("Invalid number: " + message
);
610 class UntrustedIdentity
extends DBusExecutionException
{
612 public UntrustedIdentity(final String message
) {
613 super("Untrusted identity: " + message
);