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
;
129 boolean isRegistered() throws Error
.Failure
, Error
.InvalidNumber
;
131 boolean isRegistered(String number
) throws Error
.Failure
, Error
.InvalidNumber
;
133 List
<Boolean
> isRegistered(List
<String
> numbers
) throws Error
.Failure
, Error
.InvalidNumber
;
135 void addDevice(String uri
) throws Error
.InvalidUri
;
137 DBusPath
getDevice(long deviceId
);
139 List
<StructDevice
> listDevices() throws Error
.Failure
;
141 DBusPath
getThisDevice();
150 ) throws Error
.Failure
;
153 String name
, String about
, String aboutEmoji
, String avatarPath
, boolean removeAvatar
154 ) throws Error
.Failure
;
158 void setPin(String registrationLockPin
);
162 List
<String
> listNumbers();
164 List
<String
> getContactNumber(final String name
) throws Error
.Failure
;
167 void quitGroup(final byte[] groupId
) throws Error
.GroupNotFound
, Error
.Failure
, Error
.InvalidGroupId
;
169 boolean isContactBlocked(final String number
) throws Error
.InvalidNumber
;
172 boolean isGroupBlocked(final byte[] groupId
) throws Error
.InvalidGroupId
;
175 boolean isMember(final byte[] groupId
) throws Error
.InvalidGroupId
;
177 byte[] joinGroup(final String groupLink
) throws Error
.Failure
;
179 String
uploadStickerPack(String stickerPackPath
) throws Error
.Failure
;
181 void submitRateLimitChallenge(String challenge
, String captchaString
) throws Error
.Failure
;
183 void unregister() throws Error
.Failure
;
185 void deleteAccount() throws Error
.Failure
;
187 class MessageReceivedV2
extends DBusSignal
{
189 private final long timestamp
;
190 private final String sender
;
191 private final byte[] groupId
;
192 private final String message
;
193 private final Map
<String
, Variant
<?
>> extras
;
195 public MessageReceivedV2(
201 final Map
<String
, Variant
<?
>> extras
202 ) throws DBusException
{
203 super(objectpath
, timestamp
, sender
, groupId
, message
, extras
);
204 this.timestamp
= timestamp
;
205 this.sender
= sender
;
206 this.groupId
= groupId
;
207 this.message
= message
;
208 this.extras
= extras
;
211 public long getTimestamp() {
215 public String
getSender() {
219 public byte[] getGroupId() {
223 public String
getMessage() {
227 public Map
<String
, Variant
<?
>> getExtras() {
232 class MessageReceived
extends DBusSignal
{
234 private final long timestamp
;
235 private final String sender
;
236 private final byte[] groupId
;
237 private final String message
;
238 private final List
<String
> attachments
;
240 public MessageReceived(
246 List
<String
> attachments
247 ) throws DBusException
{
248 super(objectpath
, timestamp
, sender
, groupId
, message
, attachments
);
249 this.timestamp
= timestamp
;
250 this.sender
= sender
;
251 this.groupId
= groupId
;
252 this.message
= message
;
253 this.attachments
= attachments
;
256 public long getTimestamp() {
260 public String
getSender() {
264 public byte[] getGroupId() {
268 public String
getMessage() {
272 public List
<String
> getAttachments() {
277 class ReceiptReceived
extends DBusSignal
{
279 private final long timestamp
;
280 private final String sender
;
282 public ReceiptReceived(String objectpath
, long timestamp
, String sender
) throws DBusException
{
283 super(objectpath
, timestamp
, sender
);
284 this.timestamp
= timestamp
;
285 this.sender
= sender
;
288 public long getTimestamp() {
292 public String
getSender() {
297 class ReceiptReceivedV2
extends DBusSignal
{
299 private final long timestamp
;
300 private final String sender
;
301 private final String type
;
302 private final Map
<String
, Variant
<?
>> extras
;
304 public ReceiptReceivedV2(
309 final Map
<String
, Variant
<?
>> extras
310 ) throws DBusException
{
311 super(objectpath
, timestamp
, sender
, type
, extras
);
312 this.timestamp
= timestamp
;
313 this.sender
= sender
;
315 this.extras
= extras
;
318 public long getTimestamp() {
322 public String
getSender() {
326 public String
getReceiptType() {
330 public Map
<String
, Variant
<?
>> getExtras() {
335 class SyncMessageReceived
extends DBusSignal
{
337 private final long timestamp
;
338 private final String source
;
339 private final String destination
;
340 private final byte[] groupId
;
341 private final String message
;
342 private final List
<String
> attachments
;
344 public SyncMessageReceived(
351 List
<String
> attachments
352 ) throws DBusException
{
353 super(objectpath
, timestamp
, source
, destination
, groupId
, message
, attachments
);
354 this.timestamp
= timestamp
;
355 this.source
= source
;
356 this.destination
= destination
;
357 this.groupId
= groupId
;
358 this.message
= message
;
359 this.attachments
= attachments
;
362 public long getTimestamp() {
366 public String
getSource() {
370 public String
getDestination() {
374 public byte[] getGroupId() {
378 public String
getMessage() {
382 public List
<String
> getAttachments() {
387 class SyncMessageReceivedV2
extends DBusSignal
{
389 private final long timestamp
;
390 private final String source
;
391 private final String destination
;
392 private final byte[] groupId
;
393 private final String message
;
394 private final Map
<String
, Variant
<?
>> extras
;
396 public SyncMessageReceivedV2(
403 final Map
<String
, Variant
<?
>> extras
404 ) throws DBusException
{
405 super(objectpath
, timestamp
, source
, destination
, groupId
, message
, extras
);
406 this.timestamp
= timestamp
;
407 this.source
= source
;
408 this.destination
= destination
;
409 this.groupId
= groupId
;
410 this.message
= message
;
411 this.extras
= extras
;
414 public long getTimestamp() {
418 public String
getSource() {
422 public String
getDestination() {
426 public byte[] getGroupId() {
430 public String
getMessage() {
434 public Map
<String
, Variant
<?
>> getExtras() {
439 class StructDevice
extends Struct
{
450 public StructDevice(final DBusPath objectPath
, final Long id
, final String name
) {
451 this.objectPath
= objectPath
;
456 public DBusPath
getObjectPath() {
460 public Long
getId() {
464 public String
getName() {
469 @DBusProperty(name
= "Id", type
= Integer
.class, access
= DBusProperty
.Access
.READ
)
470 @DBusProperty(name
= "Name", type
= String
.class)
471 @DBusProperty(name
= "Created", type
= String
.class, access
= DBusProperty
.Access
.READ
)
472 @DBusProperty(name
= "LastSeen", type
= String
.class, access
= DBusProperty
.Access
.READ
)
473 interface Device
extends DBusInterface
, Properties
{
475 void removeDevice() throws Error
.Failure
;
478 @DBusProperty(name
= "ReadReceipts", type
= Boolean
.class)
479 @DBusProperty(name
= "UnidentifiedDeliveryIndicators", type
= Boolean
.class)
480 @DBusProperty(name
= "TypingIndicators", type
= Boolean
.class)
481 @DBusProperty(name
= "LinkPreviews", type
= Boolean
.class)
482 interface Configuration
extends DBusInterface
, Properties
{}
484 class StructGroup
extends Struct
{
495 public StructGroup(final DBusPath objectPath
, final byte[] id
, final String name
) {
496 this.objectPath
= objectPath
;
501 public DBusPath
getObjectPath() {
505 public byte[] getId() {
509 public String
getName() {
514 @DBusProperty(name
= "Id", type
= Byte
[].class, access
= DBusProperty
.Access
.READ
)
515 @DBusProperty(name
= "Name", type
= String
.class)
516 @DBusProperty(name
= "Description", type
= String
.class)
517 @DBusProperty(name
= "Avatar", type
= String
.class, access
= DBusProperty
.Access
.WRITE
)
518 @DBusProperty(name
= "IsBlocked", type
= Boolean
.class)
519 @DBusProperty(name
= "IsMember", type
= Boolean
.class, access
= DBusProperty
.Access
.READ
)
520 @DBusProperty(name
= "IsAdmin", type
= Boolean
.class, access
= DBusProperty
.Access
.READ
)
521 @DBusProperty(name
= "MessageExpirationTimer", type
= Integer
.class)
522 @DBusProperty(name
= "Members", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
523 @DBusProperty(name
= "PendingMembers", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
524 @DBusProperty(name
= "RequestingMembers", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
525 @DBusProperty(name
= "Admins", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
526 @DBusProperty(name
= "Banned", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
527 @DBusProperty(name
= "PermissionAddMember", type
= String
.class)
528 @DBusProperty(name
= "PermissionEditDetails", type
= String
.class)
529 @DBusProperty(name
= "PermissionSendMessage", type
= String
.class)
530 @DBusProperty(name
= "GroupInviteLink", type
= String
.class, access
= DBusProperty
.Access
.READ
)
531 interface Group
extends DBusInterface
, Properties
{
533 void quitGroup() throws Error
.Failure
, Error
.LastGroupAdmin
;
535 void deleteGroup() throws Error
.Failure
;
537 void addMembers(List
<String
> recipients
) throws Error
.Failure
;
539 void removeMembers(List
<String
> recipients
) throws Error
.Failure
;
541 void addAdmins(List
<String
> recipients
) throws Error
.Failure
;
543 void removeAdmins(List
<String
> recipients
) throws Error
.Failure
;
545 void resetLink() throws Error
.Failure
;
547 void disableLink() throws Error
.Failure
;
549 void enableLink(boolean requiresApproval
) throws Error
.Failure
;
554 class AttachmentInvalid
extends DBusExecutionException
{
556 public AttachmentInvalid(final String message
) {
557 super("Invalid attachment: " + message
);
561 class InvalidUri
extends DBusExecutionException
{
563 public InvalidUri(final String message
) {
564 super("Invalid uri: " + message
);
568 class Failure
extends DBusExecutionException
{
570 public Failure(final Exception e
) {
571 super("Failure: " + e
.getMessage() + " (" + e
.getClass().getSimpleName() + ")");
574 public Failure(final String message
) {
575 super("Failure: " + message
);
579 class DeviceNotFound
extends DBusExecutionException
{
581 public DeviceNotFound(final String message
) {
582 super("Device not found: " + message
);
586 class GroupNotFound
extends DBusExecutionException
{
588 public GroupNotFound(final String message
) {
589 super("Group not found: " + message
);
593 class InvalidGroupId
extends DBusExecutionException
{
595 public InvalidGroupId(final String message
) {
596 super("Invalid group id: " + message
);
600 class LastGroupAdmin
extends DBusExecutionException
{
602 public LastGroupAdmin(final String message
) {
603 super("Last group admin: " + message
);
607 class InvalidNumber
extends DBusExecutionException
{
609 public InvalidNumber(final String message
) {
610 super("Invalid number: " + message
);
614 class UntrustedIdentity
extends DBusExecutionException
{
616 public UntrustedIdentity(final String message
) {
617 super("Untrusted identity: " + message
);
621 class UnregisteredRecipient
extends DBusExecutionException
{
623 public UnregisteredRecipient(final String message
) {
624 super("Unregistered recipient: " + message
);