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 class MessageReceivedV2
extends DBusSignal
{
176 private final long timestamp
;
177 private final String sender
;
178 private final byte[] groupId
;
179 private final String message
;
180 private final Map
<String
, Variant
<?
>> extras
;
182 public MessageReceivedV2(
188 final Map
<String
, Variant
<?
>> extras
189 ) throws DBusException
{
190 super(objectpath
, timestamp
, sender
, groupId
, message
, extras
);
191 this.timestamp
= timestamp
;
192 this.sender
= sender
;
193 this.groupId
= groupId
;
194 this.message
= message
;
195 this.extras
= extras
;
198 public long getTimestamp() {
202 public String
getSender() {
206 public byte[] getGroupId() {
210 public String
getMessage() {
214 public Map
<String
, Variant
<?
>> getExtras() {
219 class MessageReceived
extends DBusSignal
{
221 private final long timestamp
;
222 private final String sender
;
223 private final byte[] groupId
;
224 private final String message
;
225 private final List
<String
> attachments
;
227 public MessageReceived(
233 List
<String
> attachments
234 ) throws DBusException
{
235 super(objectpath
, timestamp
, sender
, groupId
, message
, attachments
);
236 this.timestamp
= timestamp
;
237 this.sender
= sender
;
238 this.groupId
= groupId
;
239 this.message
= message
;
240 this.attachments
= attachments
;
243 public long getTimestamp() {
247 public String
getSender() {
251 public byte[] getGroupId() {
255 public String
getMessage() {
259 public List
<String
> getAttachments() {
264 class ReceiptReceived
extends DBusSignal
{
266 private final long timestamp
;
267 private final String sender
;
269 public ReceiptReceived(String objectpath
, long timestamp
, String sender
) throws DBusException
{
270 super(objectpath
, timestamp
, sender
);
271 this.timestamp
= timestamp
;
272 this.sender
= sender
;
275 public long getTimestamp() {
279 public String
getSender() {
284 class ReceiptReceivedV2
extends DBusSignal
{
286 private final long timestamp
;
287 private final String sender
;
288 private final String type
;
289 private final Map
<String
, Variant
<?
>> extras
;
291 public ReceiptReceivedV2(
296 final Map
<String
, Variant
<?
>> extras
297 ) throws DBusException
{
298 super(objectpath
, timestamp
, sender
, type
, extras
);
299 this.timestamp
= timestamp
;
300 this.sender
= sender
;
302 this.extras
= extras
;
305 public long getTimestamp() {
309 public String
getSender() {
313 public String
getReceiptType() {
317 public Map
<String
, Variant
<?
>> getExtras() {
322 class SyncMessageReceived
extends DBusSignal
{
324 private final long timestamp
;
325 private final String source
;
326 private final String destination
;
327 private final byte[] groupId
;
328 private final String message
;
329 private final List
<String
> attachments
;
331 public SyncMessageReceived(
338 List
<String
> attachments
339 ) throws DBusException
{
340 super(objectpath
, timestamp
, source
, destination
, groupId
, message
, attachments
);
341 this.timestamp
= timestamp
;
342 this.source
= source
;
343 this.destination
= destination
;
344 this.groupId
= groupId
;
345 this.message
= message
;
346 this.attachments
= attachments
;
349 public long getTimestamp() {
353 public String
getSource() {
357 public String
getDestination() {
361 public byte[] getGroupId() {
365 public String
getMessage() {
369 public List
<String
> getAttachments() {
374 class SyncMessageReceivedV2
extends DBusSignal
{
376 private final long timestamp
;
377 private final String source
;
378 private final String destination
;
379 private final byte[] groupId
;
380 private final String message
;
381 private final Map
<String
, Variant
<?
>> extras
;
383 public SyncMessageReceivedV2(
390 final Map
<String
, Variant
<?
>> extras
391 ) throws DBusException
{
392 super(objectpath
, timestamp
, source
, destination
, groupId
, message
, extras
);
393 this.timestamp
= timestamp
;
394 this.source
= source
;
395 this.destination
= destination
;
396 this.groupId
= groupId
;
397 this.message
= message
;
398 this.extras
= extras
;
401 public long getTimestamp() {
405 public String
getSource() {
409 public String
getDestination() {
413 public byte[] getGroupId() {
417 public String
getMessage() {
421 public Map
<String
, Variant
<?
>> getExtras() {
426 class StructDevice
extends Struct
{
437 public StructDevice(final DBusPath objectPath
, final Long id
, final String name
) {
438 this.objectPath
= objectPath
;
443 public DBusPath
getObjectPath() {
447 public Long
getId() {
451 public String
getName() {
456 @DBusProperty(name
= "Id", type
= Long
.class, access
= DBusProperty
.Access
.READ
)
457 @DBusProperty(name
= "Name", type
= String
.class)
458 @DBusProperty(name
= "Created", type
= String
.class, access
= DBusProperty
.Access
.READ
)
459 @DBusProperty(name
= "LastSeen", type
= String
.class, access
= DBusProperty
.Access
.READ
)
460 interface Device
extends DBusInterface
, Properties
{
462 void removeDevice() throws Error
.Failure
;
465 @DBusProperty(name
= "ReadReceipts", type
= Boolean
.class)
466 @DBusProperty(name
= "UnidentifiedDeliveryIndicators", type
= Boolean
.class)
467 @DBusProperty(name
= "TypingIndicators", type
= Boolean
.class)
468 @DBusProperty(name
= "LinkPreviews", type
= Boolean
.class)
469 interface Configuration
extends DBusInterface
, Properties
{}
471 class StructGroup
extends Struct
{
482 public StructGroup(final DBusPath objectPath
, final byte[] id
, final String name
) {
483 this.objectPath
= objectPath
;
488 public DBusPath
getObjectPath() {
492 public byte[] getId() {
496 public String
getName() {
501 @DBusProperty(name
= "Id", type
= Byte
[].class, access
= DBusProperty
.Access
.READ
)
502 @DBusProperty(name
= "Name", type
= String
.class)
503 @DBusProperty(name
= "Description", type
= String
.class)
504 @DBusProperty(name
= "Avatar", type
= String
.class, access
= DBusProperty
.Access
.WRITE
)
505 @DBusProperty(name
= "IsBlocked", type
= Boolean
.class)
506 @DBusProperty(name
= "IsMember", type
= Boolean
.class, access
= DBusProperty
.Access
.READ
)
507 @DBusProperty(name
= "IsAdmin", type
= Boolean
.class, access
= DBusProperty
.Access
.READ
)
508 @DBusProperty(name
= "MessageExpirationTimer", type
= Integer
.class)
509 @DBusProperty(name
= "Members", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
510 @DBusProperty(name
= "PendingMembers", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
511 @DBusProperty(name
= "RequestingMembers", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
512 @DBusProperty(name
= "Admins", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
513 @DBusProperty(name
= "PermissionAddMember", type
= String
.class)
514 @DBusProperty(name
= "PermissionEditDetails", type
= String
.class)
515 @DBusProperty(name
= "PermissionSendMessage", type
= String
.class)
516 @DBusProperty(name
= "GroupInviteLink", type
= String
.class, access
= DBusProperty
.Access
.READ
)
517 interface Group
extends DBusInterface
, Properties
{
519 void quitGroup() throws Error
.Failure
, Error
.LastGroupAdmin
;
521 void addMembers(List
<String
> recipients
) throws Error
.Failure
;
523 void removeMembers(List
<String
> recipients
) throws Error
.Failure
;
525 void addAdmins(List
<String
> recipients
) throws Error
.Failure
;
527 void removeAdmins(List
<String
> recipients
) throws Error
.Failure
;
529 void resetLink() throws Error
.Failure
;
531 void disableLink() throws Error
.Failure
;
533 void enableLink(boolean requiresApproval
) throws Error
.Failure
;
538 class AttachmentInvalid
extends DBusExecutionException
{
540 public AttachmentInvalid(final String message
) {
541 super("Invalid attachment: " + message
);
545 class InvalidUri
extends DBusExecutionException
{
547 public InvalidUri(final String message
) {
548 super("Invalid uri: " + message
);
552 class Failure
extends DBusExecutionException
{
554 public Failure(final Exception e
) {
555 super("Failure: " + e
.getMessage() + " (" + e
.getClass().getSimpleName() + ")");
558 public Failure(final String message
) {
559 super("Failure: " + message
);
563 class DeviceNotFound
extends DBusExecutionException
{
565 public DeviceNotFound(final String message
) {
566 super("Device not found: " + message
);
570 class GroupNotFound
extends DBusExecutionException
{
572 public GroupNotFound(final String message
) {
573 super("Group not found: " + message
);
577 class InvalidGroupId
extends DBusExecutionException
{
579 public InvalidGroupId(final String message
) {
580 super("Invalid group id: " + message
);
584 class LastGroupAdmin
extends DBusExecutionException
{
586 public LastGroupAdmin(final String message
) {
587 super("Last group admin: " + message
);
591 class InvalidNumber
extends DBusExecutionException
{
593 public InvalidNumber(final String message
) {
594 super("Invalid number: " + message
);
598 class UntrustedIdentity
extends DBusExecutionException
{
600 public UntrustedIdentity(final String message
) {
601 super("Untrusted identity: " + message
);