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
.GroupNotFound
, 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 sendGroupRemoteDeleteMessage(
58 long targetSentTimestamp
, byte[] groupId
59 ) throws Error
.Failure
, Error
.GroupNotFound
, Error
.InvalidGroupId
;
61 long sendMessageReaction(
62 String emoji
, boolean remove
, String targetAuthor
, long targetSentTimestamp
, String recipient
63 ) throws Error
.InvalidNumber
, Error
.Failure
;
65 long sendMessageReaction(
66 String emoji
, boolean remove
, String targetAuthor
, long targetSentTimestamp
, List
<String
> recipients
67 ) throws Error
.InvalidNumber
, Error
.Failure
;
69 void sendContacts() throws Error
.Failure
;
71 void sendSyncRequest() throws Error
.Failure
;
73 long sendNoteToSelfMessage(
74 String message
, List
<String
> attachments
75 ) throws Error
.AttachmentInvalid
, Error
.Failure
;
77 void sendEndSessionMessage(List
<String
> recipients
) throws Error
.Failure
, Error
.InvalidNumber
, Error
.UntrustedIdentity
;
79 void deleteRecipient(final String recipient
) throws Error
.Failure
;
81 void deleteContact(final String recipient
) throws Error
.Failure
;
83 long sendGroupMessage(
84 String message
, List
<String
> attachments
, byte[] groupId
85 ) throws Error
.GroupNotFound
, Error
.Failure
, Error
.AttachmentInvalid
, Error
.InvalidGroupId
;
87 long sendGroupMessageReaction(
88 String emoji
, boolean remove
, String targetAuthor
, long targetSentTimestamp
, byte[] groupId
89 ) throws Error
.GroupNotFound
, Error
.Failure
, Error
.InvalidNumber
, Error
.InvalidGroupId
;
91 String
getContactName(String number
) throws Error
.InvalidNumber
;
93 void setContactName(String number
, String name
) throws Error
.InvalidNumber
;
95 void setExpirationTimer(final String number
, final int expiration
) throws Error
.Failure
;
97 void setContactBlocked(String number
, boolean blocked
) throws Error
.InvalidNumber
;
100 void setGroupBlocked(byte[] groupId
, boolean blocked
) throws Error
.GroupNotFound
, Error
.InvalidGroupId
;
103 List
<byte[]> getGroupIds();
105 DBusPath
getGroup(byte[] groupId
);
107 List
<StructGroup
> listGroups();
110 String
getGroupName(byte[] groupId
) throws Error
.InvalidGroupId
;
113 List
<String
> getGroupMembers(byte[] groupId
) throws Error
.InvalidGroupId
;
116 String name
, List
<String
> members
, String avatar
117 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
;
121 byte[] groupId
, String name
, List
<String
> members
, String avatar
122 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
, Error
.GroupNotFound
, Error
.InvalidGroupId
;
124 boolean isRegistered() throws Error
.Failure
, Error
.InvalidNumber
;
126 boolean isRegistered(String number
) throws Error
.Failure
, Error
.InvalidNumber
;
128 List
<Boolean
> isRegistered(List
<String
> numbers
) throws Error
.Failure
, Error
.InvalidNumber
;
130 void addDevice(String uri
) throws Error
.InvalidUri
;
132 DBusPath
getDevice(long deviceId
);
134 List
<StructDevice
> listDevices() throws Error
.Failure
;
136 DBusPath
getThisDevice();
145 ) throws Error
.Failure
;
148 String name
, String about
, String aboutEmoji
, String avatarPath
, boolean removeAvatar
149 ) throws Error
.Failure
;
153 void setPin(String registrationLockPin
);
157 List
<String
> listNumbers();
159 List
<String
> getContactNumber(final String name
) throws Error
.Failure
;
162 void quitGroup(final byte[] groupId
) throws Error
.GroupNotFound
, Error
.Failure
, Error
.InvalidGroupId
;
164 boolean isContactBlocked(final String number
) throws Error
.InvalidNumber
;
167 boolean isGroupBlocked(final byte[] groupId
) throws Error
.InvalidGroupId
;
170 boolean isMember(final byte[] groupId
) throws Error
.InvalidGroupId
;
172 byte[] joinGroup(final String groupLink
) throws Error
.Failure
;
174 String
uploadStickerPack(String stickerPackPath
) throws Error
.Failure
;
176 void submitRateLimitChallenge(String challenge
, String captchaString
) throws Error
.Failure
;
178 void unregister() throws Error
.Failure
;
180 void deleteAccount() throws Error
.Failure
;
182 class MessageReceivedV2
extends DBusSignal
{
184 private final long timestamp
;
185 private final String sender
;
186 private final byte[] groupId
;
187 private final String message
;
188 private final Map
<String
, Variant
<?
>> extras
;
190 public MessageReceivedV2(
196 final Map
<String
, Variant
<?
>> extras
197 ) throws DBusException
{
198 super(objectpath
, timestamp
, sender
, groupId
, message
, extras
);
199 this.timestamp
= timestamp
;
200 this.sender
= sender
;
201 this.groupId
= groupId
;
202 this.message
= message
;
203 this.extras
= extras
;
206 public long getTimestamp() {
210 public String
getSender() {
214 public byte[] getGroupId() {
218 public String
getMessage() {
222 public Map
<String
, Variant
<?
>> getExtras() {
227 class MessageReceived
extends DBusSignal
{
229 private final long timestamp
;
230 private final String sender
;
231 private final byte[] groupId
;
232 private final String message
;
233 private final List
<String
> attachments
;
235 public MessageReceived(
241 List
<String
> attachments
242 ) throws DBusException
{
243 super(objectpath
, timestamp
, sender
, groupId
, message
, attachments
);
244 this.timestamp
= timestamp
;
245 this.sender
= sender
;
246 this.groupId
= groupId
;
247 this.message
= message
;
248 this.attachments
= attachments
;
251 public long getTimestamp() {
255 public String
getSender() {
259 public byte[] getGroupId() {
263 public String
getMessage() {
267 public List
<String
> getAttachments() {
272 class ReceiptReceived
extends DBusSignal
{
274 private final long timestamp
;
275 private final String sender
;
277 public ReceiptReceived(String objectpath
, long timestamp
, String sender
) throws DBusException
{
278 super(objectpath
, timestamp
, sender
);
279 this.timestamp
= timestamp
;
280 this.sender
= sender
;
283 public long getTimestamp() {
287 public String
getSender() {
292 class ReceiptReceivedV2
extends DBusSignal
{
294 private final long timestamp
;
295 private final String sender
;
296 private final String type
;
297 private final Map
<String
, Variant
<?
>> extras
;
299 public ReceiptReceivedV2(
304 final Map
<String
, Variant
<?
>> extras
305 ) throws DBusException
{
306 super(objectpath
, timestamp
, sender
, type
, extras
);
307 this.timestamp
= timestamp
;
308 this.sender
= sender
;
310 this.extras
= extras
;
313 public long getTimestamp() {
317 public String
getSender() {
321 public String
getReceiptType() {
325 public Map
<String
, Variant
<?
>> getExtras() {
330 class SyncMessageReceived
extends DBusSignal
{
332 private final long timestamp
;
333 private final String source
;
334 private final String destination
;
335 private final byte[] groupId
;
336 private final String message
;
337 private final List
<String
> attachments
;
339 public SyncMessageReceived(
346 List
<String
> attachments
347 ) throws DBusException
{
348 super(objectpath
, timestamp
, source
, destination
, groupId
, message
, attachments
);
349 this.timestamp
= timestamp
;
350 this.source
= source
;
351 this.destination
= destination
;
352 this.groupId
= groupId
;
353 this.message
= message
;
354 this.attachments
= attachments
;
357 public long getTimestamp() {
361 public String
getSource() {
365 public String
getDestination() {
369 public byte[] getGroupId() {
373 public String
getMessage() {
377 public List
<String
> getAttachments() {
382 class SyncMessageReceivedV2
extends DBusSignal
{
384 private final long timestamp
;
385 private final String source
;
386 private final String destination
;
387 private final byte[] groupId
;
388 private final String message
;
389 private final Map
<String
, Variant
<?
>> extras
;
391 public SyncMessageReceivedV2(
398 final Map
<String
, Variant
<?
>> extras
399 ) throws DBusException
{
400 super(objectpath
, timestamp
, source
, destination
, groupId
, message
, extras
);
401 this.timestamp
= timestamp
;
402 this.source
= source
;
403 this.destination
= destination
;
404 this.groupId
= groupId
;
405 this.message
= message
;
406 this.extras
= extras
;
409 public long getTimestamp() {
413 public String
getSource() {
417 public String
getDestination() {
421 public byte[] getGroupId() {
425 public String
getMessage() {
429 public Map
<String
, Variant
<?
>> getExtras() {
434 class StructDevice
extends Struct
{
445 public StructDevice(final DBusPath objectPath
, final Long id
, final String name
) {
446 this.objectPath
= objectPath
;
451 public DBusPath
getObjectPath() {
455 public Long
getId() {
459 public String
getName() {
464 @DBusProperty(name
= "Id", type
= Long
.class, access
= DBusProperty
.Access
.READ
)
465 @DBusProperty(name
= "Name", type
= String
.class)
466 @DBusProperty(name
= "Created", type
= String
.class, access
= DBusProperty
.Access
.READ
)
467 @DBusProperty(name
= "LastSeen", type
= String
.class, access
= DBusProperty
.Access
.READ
)
468 interface Device
extends DBusInterface
, Properties
{
470 void removeDevice() throws Error
.Failure
;
473 @DBusProperty(name
= "ReadReceipts", type
= Boolean
.class)
474 @DBusProperty(name
= "UnidentifiedDeliveryIndicators", type
= Boolean
.class)
475 @DBusProperty(name
= "TypingIndicators", type
= Boolean
.class)
476 @DBusProperty(name
= "LinkPreviews", type
= Boolean
.class)
477 interface Configuration
extends DBusInterface
, Properties
{}
479 class StructGroup
extends Struct
{
490 public StructGroup(final DBusPath objectPath
, final byte[] id
, final String name
) {
491 this.objectPath
= objectPath
;
496 public DBusPath
getObjectPath() {
500 public byte[] getId() {
504 public String
getName() {
509 @DBusProperty(name
= "Id", type
= Byte
[].class, access
= DBusProperty
.Access
.READ
)
510 @DBusProperty(name
= "Name", type
= String
.class)
511 @DBusProperty(name
= "Description", type
= String
.class)
512 @DBusProperty(name
= "Avatar", type
= String
.class, access
= DBusProperty
.Access
.WRITE
)
513 @DBusProperty(name
= "IsBlocked", type
= Boolean
.class)
514 @DBusProperty(name
= "IsMember", type
= Boolean
.class, access
= DBusProperty
.Access
.READ
)
515 @DBusProperty(name
= "IsAdmin", type
= Boolean
.class, access
= DBusProperty
.Access
.READ
)
516 @DBusProperty(name
= "MessageExpirationTimer", type
= Integer
.class)
517 @DBusProperty(name
= "Members", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
518 @DBusProperty(name
= "PendingMembers", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
519 @DBusProperty(name
= "RequestingMembers", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
520 @DBusProperty(name
= "Admins", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
521 @DBusProperty(name
= "PermissionAddMember", type
= String
.class)
522 @DBusProperty(name
= "PermissionEditDetails", type
= String
.class)
523 @DBusProperty(name
= "PermissionSendMessage", type
= String
.class)
524 @DBusProperty(name
= "GroupInviteLink", type
= String
.class, access
= DBusProperty
.Access
.READ
)
525 interface Group
extends DBusInterface
, Properties
{
527 void quitGroup() throws Error
.Failure
, Error
.LastGroupAdmin
;
529 void addMembers(List
<String
> recipients
) throws Error
.Failure
;
531 void removeMembers(List
<String
> recipients
) throws Error
.Failure
;
533 void addAdmins(List
<String
> recipients
) throws Error
.Failure
;
535 void removeAdmins(List
<String
> recipients
) throws Error
.Failure
;
537 void resetLink() throws Error
.Failure
;
539 void disableLink() throws Error
.Failure
;
541 void enableLink(boolean requiresApproval
) throws Error
.Failure
;
546 class AttachmentInvalid
extends DBusExecutionException
{
548 public AttachmentInvalid(final String message
) {
549 super("Invalid attachment: " + message
);
553 class InvalidUri
extends DBusExecutionException
{
555 public InvalidUri(final String message
) {
556 super("Invalid uri: " + message
);
560 class Failure
extends DBusExecutionException
{
562 public Failure(final Exception e
) {
563 super("Failure: " + e
.getMessage() + " (" + e
.getClass().getSimpleName() + ")");
566 public Failure(final String message
) {
567 super("Failure: " + message
);
571 class DeviceNotFound
extends DBusExecutionException
{
573 public DeviceNotFound(final String message
) {
574 super("Device not found: " + message
);
578 class GroupNotFound
extends DBusExecutionException
{
580 public GroupNotFound(final String message
) {
581 super("Group not found: " + message
);
585 class InvalidGroupId
extends DBusExecutionException
{
587 public InvalidGroupId(final String message
) {
588 super("Invalid group id: " + message
);
592 class LastGroupAdmin
extends DBusExecutionException
{
594 public LastGroupAdmin(final String message
) {
595 super("Last group admin: " + message
);
599 class InvalidNumber
extends DBusExecutionException
{
601 public InvalidNumber(final String message
) {
602 super("Invalid number: " + message
);
606 class UntrustedIdentity
extends DBusExecutionException
{
608 public UntrustedIdentity(final String message
) {
609 super("Untrusted identity: " + message
);