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 long sendPaymentNotification(byte[] receipt
, String note
, String recipient
) throws Error
.Failure
;
67 void sendContacts() throws Error
.Failure
;
69 void sendSyncRequest() throws Error
.Failure
;
71 long sendNoteToSelfMessage(
72 String message
, List
<String
> attachments
73 ) throws Error
.AttachmentInvalid
, Error
.Failure
;
75 void sendEndSessionMessage(List
<String
> recipients
) throws Error
.Failure
, Error
.InvalidNumber
, Error
.UntrustedIdentity
;
77 void deleteRecipient(final String recipient
) throws Error
.Failure
;
79 void deleteContact(final String recipient
) throws Error
.Failure
;
81 long sendGroupMessage(
82 String message
, List
<String
> attachments
, byte[] groupId
83 ) throws Error
.GroupNotFound
, Error
.Failure
, Error
.AttachmentInvalid
, Error
.InvalidGroupId
;
86 final byte[] groupId
, final boolean stop
87 ) throws Error
.Failure
, Error
.GroupNotFound
, Error
.UntrustedIdentity
;
89 long sendGroupRemoteDeleteMessage(
90 long targetSentTimestamp
, byte[] groupId
91 ) throws Error
.Failure
, Error
.GroupNotFound
, Error
.InvalidGroupId
;
93 long sendGroupMessageReaction(
94 String emoji
, boolean remove
, String targetAuthor
, long targetSentTimestamp
, byte[] groupId
95 ) throws Error
.GroupNotFound
, Error
.Failure
, Error
.InvalidNumber
, Error
.InvalidGroupId
;
97 String
getContactName(String number
) throws Error
.InvalidNumber
;
99 void setContactName(String number
, String name
) throws Error
.InvalidNumber
;
101 void setExpirationTimer(final String number
, final int expiration
) throws Error
.Failure
;
103 void setContactBlocked(String number
, boolean blocked
) throws Error
.InvalidNumber
;
106 void setGroupBlocked(byte[] groupId
, boolean blocked
) throws Error
.GroupNotFound
, Error
.InvalidGroupId
;
109 List
<byte[]> getGroupIds();
111 DBusPath
getGroup(byte[] groupId
);
113 List
<StructGroup
> listGroups();
116 String
getGroupName(byte[] groupId
) throws Error
.InvalidGroupId
;
119 List
<String
> getGroupMembers(byte[] groupId
) throws Error
.InvalidGroupId
;
122 String name
, List
<String
> members
, String avatar
123 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
;
127 byte[] groupId
, String name
, List
<String
> members
, String avatar
128 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
, Error
.GroupNotFound
, Error
.InvalidGroupId
;
131 boolean isRegistered() throws Error
.Failure
, Error
.InvalidNumber
;
133 boolean isRegistered(String number
) throws Error
.Failure
, Error
.InvalidNumber
;
135 List
<Boolean
> isRegistered(List
<String
> numbers
) throws Error
.Failure
, Error
.InvalidNumber
;
137 void addDevice(String uri
) throws Error
.InvalidUri
;
139 DBusPath
getDevice(long deviceId
);
141 List
<StructDevice
> listDevices() throws Error
.Failure
;
143 DBusPath
getThisDevice();
152 ) throws Error
.Failure
;
155 String name
, String about
, String aboutEmoji
, String avatarPath
, boolean removeAvatar
156 ) throws Error
.Failure
;
160 void setPin(String registrationLockPin
);
164 List
<String
> listNumbers();
166 List
<String
> getContactNumber(final String name
) throws Error
.Failure
;
169 void quitGroup(final byte[] groupId
) throws Error
.GroupNotFound
, Error
.Failure
, Error
.InvalidGroupId
;
171 boolean isContactBlocked(final String number
) throws Error
.InvalidNumber
;
174 boolean isGroupBlocked(final byte[] groupId
) throws Error
.InvalidGroupId
;
177 boolean isMember(final byte[] groupId
) throws Error
.InvalidGroupId
;
179 byte[] joinGroup(final String groupLink
) throws Error
.Failure
;
181 String
uploadStickerPack(String stickerPackPath
) throws Error
.Failure
;
183 void submitRateLimitChallenge(String challenge
, String captchaString
) throws Error
.Failure
;
185 void unregister() throws Error
.Failure
;
187 void deleteAccount() throws Error
.Failure
;
189 class MessageReceivedV2
extends DBusSignal
{
191 private final long timestamp
;
192 private final String sender
;
193 private final byte[] groupId
;
194 private final String message
;
195 private final Map
<String
, Variant
<?
>> extras
;
197 public MessageReceivedV2(
203 final Map
<String
, Variant
<?
>> extras
204 ) throws DBusException
{
205 super(objectpath
, timestamp
, sender
, groupId
, message
, extras
);
206 this.timestamp
= timestamp
;
207 this.sender
= sender
;
208 this.groupId
= groupId
;
209 this.message
= message
;
210 this.extras
= extras
;
213 public long getTimestamp() {
217 public String
getSender() {
221 public byte[] getGroupId() {
225 public String
getMessage() {
229 public Map
<String
, Variant
<?
>> getExtras() {
234 class MessageReceived
extends DBusSignal
{
236 private final long timestamp
;
237 private final String sender
;
238 private final byte[] groupId
;
239 private final String message
;
240 private final List
<String
> attachments
;
242 public MessageReceived(
248 List
<String
> attachments
249 ) throws DBusException
{
250 super(objectpath
, timestamp
, sender
, groupId
, message
, attachments
);
251 this.timestamp
= timestamp
;
252 this.sender
= sender
;
253 this.groupId
= groupId
;
254 this.message
= message
;
255 this.attachments
= attachments
;
258 public long getTimestamp() {
262 public String
getSender() {
266 public byte[] getGroupId() {
270 public String
getMessage() {
274 public List
<String
> getAttachments() {
279 class ReceiptReceived
extends DBusSignal
{
281 private final long timestamp
;
282 private final String sender
;
284 public ReceiptReceived(String objectpath
, long timestamp
, String sender
) throws DBusException
{
285 super(objectpath
, timestamp
, sender
);
286 this.timestamp
= timestamp
;
287 this.sender
= sender
;
290 public long getTimestamp() {
294 public String
getSender() {
299 class ReceiptReceivedV2
extends DBusSignal
{
301 private final long timestamp
;
302 private final String sender
;
303 private final String type
;
304 private final Map
<String
, Variant
<?
>> extras
;
306 public ReceiptReceivedV2(
311 final Map
<String
, Variant
<?
>> extras
312 ) throws DBusException
{
313 super(objectpath
, timestamp
, sender
, type
, extras
);
314 this.timestamp
= timestamp
;
315 this.sender
= sender
;
317 this.extras
= extras
;
320 public long getTimestamp() {
324 public String
getSender() {
328 public String
getReceiptType() {
332 public Map
<String
, Variant
<?
>> getExtras() {
337 class SyncMessageReceived
extends DBusSignal
{
339 private final long timestamp
;
340 private final String source
;
341 private final String destination
;
342 private final byte[] groupId
;
343 private final String message
;
344 private final List
<String
> attachments
;
346 public SyncMessageReceived(
353 List
<String
> attachments
354 ) throws DBusException
{
355 super(objectpath
, timestamp
, source
, destination
, groupId
, message
, attachments
);
356 this.timestamp
= timestamp
;
357 this.source
= source
;
358 this.destination
= destination
;
359 this.groupId
= groupId
;
360 this.message
= message
;
361 this.attachments
= attachments
;
364 public long getTimestamp() {
368 public String
getSource() {
372 public String
getDestination() {
376 public byte[] getGroupId() {
380 public String
getMessage() {
384 public List
<String
> getAttachments() {
389 class SyncMessageReceivedV2
extends DBusSignal
{
391 private final long timestamp
;
392 private final String source
;
393 private final String destination
;
394 private final byte[] groupId
;
395 private final String message
;
396 private final Map
<String
, Variant
<?
>> extras
;
398 public SyncMessageReceivedV2(
405 final Map
<String
, Variant
<?
>> extras
406 ) throws DBusException
{
407 super(objectpath
, timestamp
, source
, destination
, groupId
, message
, extras
);
408 this.timestamp
= timestamp
;
409 this.source
= source
;
410 this.destination
= destination
;
411 this.groupId
= groupId
;
412 this.message
= message
;
413 this.extras
= extras
;
416 public long getTimestamp() {
420 public String
getSource() {
424 public String
getDestination() {
428 public byte[] getGroupId() {
432 public String
getMessage() {
436 public Map
<String
, Variant
<?
>> getExtras() {
441 class StructDevice
extends Struct
{
452 public StructDevice(final DBusPath objectPath
, final Long id
, final String name
) {
453 this.objectPath
= objectPath
;
458 public DBusPath
getObjectPath() {
462 public Long
getId() {
466 public String
getName() {
471 @DBusProperty(name
= "Id", type
= Integer
.class, access
= DBusProperty
.Access
.READ
)
472 @DBusProperty(name
= "Name", type
= String
.class)
473 @DBusProperty(name
= "Created", type
= String
.class, access
= DBusProperty
.Access
.READ
)
474 @DBusProperty(name
= "LastSeen", type
= String
.class, access
= DBusProperty
.Access
.READ
)
475 interface Device
extends DBusInterface
, Properties
{
477 void removeDevice() throws Error
.Failure
;
480 @DBusProperty(name
= "ReadReceipts", type
= Boolean
.class)
481 @DBusProperty(name
= "UnidentifiedDeliveryIndicators", type
= Boolean
.class)
482 @DBusProperty(name
= "TypingIndicators", type
= Boolean
.class)
483 @DBusProperty(name
= "LinkPreviews", type
= Boolean
.class)
484 interface Configuration
extends DBusInterface
, Properties
{}
486 class StructGroup
extends Struct
{
497 public StructGroup(final DBusPath objectPath
, final byte[] id
, final String name
) {
498 this.objectPath
= objectPath
;
503 public DBusPath
getObjectPath() {
507 public byte[] getId() {
511 public String
getName() {
516 @DBusProperty(name
= "Id", type
= Byte
[].class, access
= DBusProperty
.Access
.READ
)
517 @DBusProperty(name
= "Name", type
= String
.class)
518 @DBusProperty(name
= "Description", type
= String
.class)
519 @DBusProperty(name
= "Avatar", type
= String
.class, access
= DBusProperty
.Access
.WRITE
)
520 @DBusProperty(name
= "IsBlocked", type
= Boolean
.class)
521 @DBusProperty(name
= "IsMember", type
= Boolean
.class, access
= DBusProperty
.Access
.READ
)
522 @DBusProperty(name
= "IsAdmin", type
= Boolean
.class, access
= DBusProperty
.Access
.READ
)
523 @DBusProperty(name
= "MessageExpirationTimer", type
= Integer
.class)
524 @DBusProperty(name
= "Members", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
525 @DBusProperty(name
= "PendingMembers", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
526 @DBusProperty(name
= "RequestingMembers", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
527 @DBusProperty(name
= "Admins", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
528 @DBusProperty(name
= "Banned", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
529 @DBusProperty(name
= "PermissionAddMember", type
= String
.class)
530 @DBusProperty(name
= "PermissionEditDetails", type
= String
.class)
531 @DBusProperty(name
= "PermissionSendMessage", type
= String
.class)
532 @DBusProperty(name
= "GroupInviteLink", type
= String
.class, access
= DBusProperty
.Access
.READ
)
533 interface Group
extends DBusInterface
, Properties
{
535 void quitGroup() throws Error
.Failure
, Error
.LastGroupAdmin
;
537 void deleteGroup() throws Error
.Failure
;
539 void addMembers(List
<String
> recipients
) throws Error
.Failure
;
541 void removeMembers(List
<String
> recipients
) throws Error
.Failure
;
543 void addAdmins(List
<String
> recipients
) throws Error
.Failure
;
545 void removeAdmins(List
<String
> recipients
) throws Error
.Failure
;
547 void resetLink() throws Error
.Failure
;
549 void disableLink() throws Error
.Failure
;
551 void enableLink(boolean requiresApproval
) throws Error
.Failure
;
556 class AttachmentInvalid
extends DBusExecutionException
{
558 public AttachmentInvalid(final String message
) {
559 super("Invalid attachment: " + message
);
563 class InvalidUri
extends DBusExecutionException
{
565 public InvalidUri(final String message
) {
566 super("Invalid uri: " + message
);
570 class Failure
extends DBusExecutionException
{
572 public Failure(final Exception e
) {
573 super("Failure: " + e
.getMessage() + " (" + e
.getClass().getSimpleName() + ")");
576 public Failure(final String message
) {
577 super("Failure: " + message
);
581 class DeviceNotFound
extends DBusExecutionException
{
583 public DeviceNotFound(final String message
) {
584 super("Device not found: " + message
);
588 class GroupNotFound
extends DBusExecutionException
{
590 public GroupNotFound(final String message
) {
591 super("Group not found: " + message
);
595 class NotAGroupMember
extends DBusExecutionException
{
597 public NotAGroupMember(final String message
) {
598 super("Not a group member: " + message
);
602 class InvalidGroupId
extends DBusExecutionException
{
604 public InvalidGroupId(final String message
) {
605 super("Invalid group id: " + message
);
609 class LastGroupAdmin
extends DBusExecutionException
{
611 public LastGroupAdmin(final String message
) {
612 super("Last group admin: " + message
);
616 class InvalidNumber
extends DBusExecutionException
{
618 public InvalidNumber(final String message
) {
619 super("Invalid number: " + message
);
623 class UntrustedIdentity
extends DBusExecutionException
{
625 public UntrustedIdentity(final String message
) {
626 super("Untrusted identity: " + message
);
630 class UnregisteredRecipient
extends DBusExecutionException
{
632 public UnregisteredRecipient(final String message
) {
633 super("Unregistered recipient: " + message
);