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 long sendGroupMessage(
80 String message
, List
<String
> attachments
, byte[] groupId
81 ) throws Error
.GroupNotFound
, Error
.Failure
, Error
.AttachmentInvalid
, Error
.InvalidGroupId
;
83 long sendGroupMessageReaction(
84 String emoji
, boolean remove
, String targetAuthor
, long targetSentTimestamp
, byte[] groupId
85 ) throws Error
.GroupNotFound
, Error
.Failure
, Error
.InvalidNumber
, Error
.InvalidGroupId
;
87 String
getContactName(String number
) throws Error
.InvalidNumber
;
89 void setContactName(String number
, String name
) throws Error
.InvalidNumber
;
91 void setExpirationTimer(final String number
, final int expiration
) throws Error
.Failure
;
93 void setContactBlocked(String number
, boolean blocked
) throws Error
.InvalidNumber
;
96 void setGroupBlocked(byte[] groupId
, boolean blocked
) throws Error
.GroupNotFound
, Error
.InvalidGroupId
;
99 List
<byte[]> getGroupIds();
101 DBusPath
getGroup(byte[] groupId
);
103 List
<StructGroup
> listGroups();
106 String
getGroupName(byte[] groupId
) throws Error
.InvalidGroupId
;
109 List
<String
> getGroupMembers(byte[] groupId
) throws Error
.InvalidGroupId
;
112 String name
, List
<String
> members
, String avatar
113 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
;
117 byte[] groupId
, String name
, List
<String
> members
, String avatar
118 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
, Error
.GroupNotFound
, Error
.InvalidGroupId
;
120 boolean isRegistered() throws Error
.Failure
, Error
.InvalidNumber
;
122 boolean isRegistered(String number
) throws Error
.Failure
, Error
.InvalidNumber
;
124 List
<Boolean
> isRegistered(List
<String
> numbers
) throws Error
.Failure
, Error
.InvalidNumber
;
126 void addDevice(String uri
) throws Error
.InvalidUri
;
128 DBusPath
getDevice(long deviceId
);
130 List
<StructDevice
> listDevices() throws Error
.Failure
;
132 DBusPath
getThisDevice();
141 ) throws Error
.Failure
;
144 String name
, String about
, String aboutEmoji
, String avatarPath
, boolean removeAvatar
145 ) throws Error
.Failure
;
149 void setPin(String registrationLockPin
);
153 List
<String
> listNumbers();
155 List
<String
> getContactNumber(final String name
) throws Error
.Failure
;
158 void quitGroup(final byte[] groupId
) throws Error
.GroupNotFound
, Error
.Failure
, Error
.InvalidGroupId
;
160 boolean isContactBlocked(final String number
) throws Error
.InvalidNumber
;
163 boolean isGroupBlocked(final byte[] groupId
) throws Error
.InvalidGroupId
;
166 boolean isMember(final byte[] groupId
) throws Error
.InvalidGroupId
;
168 byte[] joinGroup(final String groupLink
) throws Error
.Failure
;
170 String
uploadStickerPack(String stickerPackPath
) throws Error
.Failure
;
172 void submitRateLimitChallenge(String challenge
, String captchaString
) throws Error
.Failure
;
174 void unregister() throws Error
.Failure
;
176 void deleteAccount() throws Error
.Failure
;
178 class MessageReceivedV2
extends DBusSignal
{
180 private final long timestamp
;
181 private final String sender
;
182 private final byte[] groupId
;
183 private final String message
;
184 private final Map
<String
, Variant
<?
>> extras
;
186 public MessageReceivedV2(
192 final Map
<String
, Variant
<?
>> extras
193 ) throws DBusException
{
194 super(objectpath
, timestamp
, sender
, groupId
, message
, extras
);
195 this.timestamp
= timestamp
;
196 this.sender
= sender
;
197 this.groupId
= groupId
;
198 this.message
= message
;
199 this.extras
= extras
;
202 public long getTimestamp() {
206 public String
getSender() {
210 public byte[] getGroupId() {
214 public String
getMessage() {
218 public Map
<String
, Variant
<?
>> getExtras() {
223 class MessageReceived
extends DBusSignal
{
225 private final long timestamp
;
226 private final String sender
;
227 private final byte[] groupId
;
228 private final String message
;
229 private final List
<String
> attachments
;
231 public MessageReceived(
237 List
<String
> attachments
238 ) throws DBusException
{
239 super(objectpath
, timestamp
, sender
, groupId
, message
, attachments
);
240 this.timestamp
= timestamp
;
241 this.sender
= sender
;
242 this.groupId
= groupId
;
243 this.message
= message
;
244 this.attachments
= attachments
;
247 public long getTimestamp() {
251 public String
getSender() {
255 public byte[] getGroupId() {
259 public String
getMessage() {
263 public List
<String
> getAttachments() {
268 class ReceiptReceived
extends DBusSignal
{
270 private final long timestamp
;
271 private final String sender
;
273 public ReceiptReceived(String objectpath
, long timestamp
, String sender
) throws DBusException
{
274 super(objectpath
, timestamp
, sender
);
275 this.timestamp
= timestamp
;
276 this.sender
= sender
;
279 public long getTimestamp() {
283 public String
getSender() {
288 class ReceiptReceivedV2
extends DBusSignal
{
290 private final long timestamp
;
291 private final String sender
;
292 private final String type
;
293 private final Map
<String
, Variant
<?
>> extras
;
295 public ReceiptReceivedV2(
300 final Map
<String
, Variant
<?
>> extras
301 ) throws DBusException
{
302 super(objectpath
, timestamp
, sender
, type
, extras
);
303 this.timestamp
= timestamp
;
304 this.sender
= sender
;
306 this.extras
= extras
;
309 public long getTimestamp() {
313 public String
getSender() {
317 public String
getReceiptType() {
321 public Map
<String
, Variant
<?
>> getExtras() {
326 class SyncMessageReceived
extends DBusSignal
{
328 private final long timestamp
;
329 private final String source
;
330 private final String destination
;
331 private final byte[] groupId
;
332 private final String message
;
333 private final List
<String
> attachments
;
335 public SyncMessageReceived(
342 List
<String
> attachments
343 ) throws DBusException
{
344 super(objectpath
, timestamp
, source
, destination
, groupId
, message
, attachments
);
345 this.timestamp
= timestamp
;
346 this.source
= source
;
347 this.destination
= destination
;
348 this.groupId
= groupId
;
349 this.message
= message
;
350 this.attachments
= attachments
;
353 public long getTimestamp() {
357 public String
getSource() {
361 public String
getDestination() {
365 public byte[] getGroupId() {
369 public String
getMessage() {
373 public List
<String
> getAttachments() {
378 class SyncMessageReceivedV2
extends DBusSignal
{
380 private final long timestamp
;
381 private final String source
;
382 private final String destination
;
383 private final byte[] groupId
;
384 private final String message
;
385 private final Map
<String
, Variant
<?
>> extras
;
387 public SyncMessageReceivedV2(
394 final Map
<String
, Variant
<?
>> extras
395 ) throws DBusException
{
396 super(objectpath
, timestamp
, source
, destination
, groupId
, message
, extras
);
397 this.timestamp
= timestamp
;
398 this.source
= source
;
399 this.destination
= destination
;
400 this.groupId
= groupId
;
401 this.message
= message
;
402 this.extras
= extras
;
405 public long getTimestamp() {
409 public String
getSource() {
413 public String
getDestination() {
417 public byte[] getGroupId() {
421 public String
getMessage() {
425 public Map
<String
, Variant
<?
>> getExtras() {
430 class StructDevice
extends Struct
{
441 public StructDevice(final DBusPath objectPath
, final Long id
, final String name
) {
442 this.objectPath
= objectPath
;
447 public DBusPath
getObjectPath() {
451 public Long
getId() {
455 public String
getName() {
460 @DBusProperty(name
= "Id", type
= Long
.class, access
= DBusProperty
.Access
.READ
)
461 @DBusProperty(name
= "Name", type
= String
.class)
462 @DBusProperty(name
= "Created", type
= String
.class, access
= DBusProperty
.Access
.READ
)
463 @DBusProperty(name
= "LastSeen", type
= String
.class, access
= DBusProperty
.Access
.READ
)
464 interface Device
extends DBusInterface
, Properties
{
466 void removeDevice() throws Error
.Failure
;
469 @DBusProperty(name
= "ReadReceipts", type
= Boolean
.class)
470 @DBusProperty(name
= "UnidentifiedDeliveryIndicators", type
= Boolean
.class)
471 @DBusProperty(name
= "TypingIndicators", type
= Boolean
.class)
472 @DBusProperty(name
= "LinkPreviews", type
= Boolean
.class)
473 interface Configuration
extends DBusInterface
, Properties
{}
475 class StructGroup
extends Struct
{
486 public StructGroup(final DBusPath objectPath
, final byte[] id
, final String name
) {
487 this.objectPath
= objectPath
;
492 public DBusPath
getObjectPath() {
496 public byte[] getId() {
500 public String
getName() {
505 @DBusProperty(name
= "Id", type
= Byte
[].class, access
= DBusProperty
.Access
.READ
)
506 @DBusProperty(name
= "Name", type
= String
.class)
507 @DBusProperty(name
= "Description", type
= String
.class)
508 @DBusProperty(name
= "Avatar", type
= String
.class, access
= DBusProperty
.Access
.WRITE
)
509 @DBusProperty(name
= "IsBlocked", type
= Boolean
.class)
510 @DBusProperty(name
= "IsMember", type
= Boolean
.class, access
= DBusProperty
.Access
.READ
)
511 @DBusProperty(name
= "IsAdmin", type
= Boolean
.class, access
= DBusProperty
.Access
.READ
)
512 @DBusProperty(name
= "MessageExpirationTimer", type
= Integer
.class)
513 @DBusProperty(name
= "Members", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
514 @DBusProperty(name
= "PendingMembers", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
515 @DBusProperty(name
= "RequestingMembers", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
516 @DBusProperty(name
= "Admins", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
517 @DBusProperty(name
= "PermissionAddMember", type
= String
.class)
518 @DBusProperty(name
= "PermissionEditDetails", type
= String
.class)
519 @DBusProperty(name
= "PermissionSendMessage", type
= String
.class)
520 @DBusProperty(name
= "GroupInviteLink", type
= String
.class, access
= DBusProperty
.Access
.READ
)
521 interface Group
extends DBusInterface
, Properties
{
523 void quitGroup() throws Error
.Failure
, Error
.LastGroupAdmin
;
525 void addMembers(List
<String
> recipients
) throws Error
.Failure
;
527 void removeMembers(List
<String
> recipients
) throws Error
.Failure
;
529 void addAdmins(List
<String
> recipients
) throws Error
.Failure
;
531 void removeAdmins(List
<String
> recipients
) throws Error
.Failure
;
533 void resetLink() throws Error
.Failure
;
535 void disableLink() throws Error
.Failure
;
537 void enableLink(boolean requiresApproval
) throws Error
.Failure
;
542 class AttachmentInvalid
extends DBusExecutionException
{
544 public AttachmentInvalid(final String message
) {
545 super("Invalid attachment: " + message
);
549 class InvalidUri
extends DBusExecutionException
{
551 public InvalidUri(final String message
) {
552 super("Invalid uri: " + message
);
556 class Failure
extends DBusExecutionException
{
558 public Failure(final Exception e
) {
559 super("Failure: " + e
.getMessage() + " (" + e
.getClass().getSimpleName() + ")");
562 public Failure(final String message
) {
563 super("Failure: " + message
);
567 class DeviceNotFound
extends DBusExecutionException
{
569 public DeviceNotFound(final String message
) {
570 super("Device not found: " + message
);
574 class GroupNotFound
extends DBusExecutionException
{
576 public GroupNotFound(final String message
) {
577 super("Group not found: " + message
);
581 class InvalidGroupId
extends DBusExecutionException
{
583 public InvalidGroupId(final String message
) {
584 super("Invalid group id: " + message
);
588 class LastGroupAdmin
extends DBusExecutionException
{
590 public LastGroupAdmin(final String message
) {
591 super("Last group admin: " + message
);
595 class InvalidNumber
extends DBusExecutionException
{
597 public InvalidNumber(final String message
) {
598 super("Invalid number: " + message
);
602 class UntrustedIdentity
extends DBusExecutionException
{
604 public UntrustedIdentity(final String message
) {
605 super("Untrusted identity: " + message
);