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();
26 String message
, List
<String
> attachments
, String recipient
27 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
, Error
.UntrustedIdentity
;
30 String message
, List
<String
> attachments
, List
<String
> recipients
31 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
, Error
.UntrustedIdentity
;
34 String recipient
, boolean stop
35 ) throws Error
.Failure
, Error
.GroupNotFound
, Error
.UntrustedIdentity
;
38 String recipient
, List
<Long
> messageIds
39 ) throws Error
.Failure
, Error
.UntrustedIdentity
;
41 void sendViewedReceipt(
42 String recipient
, List
<Long
> messageIds
43 ) throws Error
.Failure
, Error
.UntrustedIdentity
;
45 long sendRemoteDeleteMessage(
46 long targetSentTimestamp
, String recipient
47 ) throws Error
.Failure
, Error
.InvalidNumber
;
49 long sendRemoteDeleteMessage(
50 long targetSentTimestamp
, List
<String
> recipients
51 ) throws Error
.Failure
, Error
.InvalidNumber
;
53 long sendGroupRemoteDeleteMessage(
54 long targetSentTimestamp
, byte[] groupId
55 ) throws Error
.Failure
, Error
.GroupNotFound
, Error
.InvalidGroupId
;
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 long sendGroupMessage(
76 String message
, List
<String
> attachments
, byte[] groupId
77 ) throws Error
.GroupNotFound
, Error
.Failure
, Error
.AttachmentInvalid
, Error
.InvalidGroupId
;
79 long sendGroupMessageReaction(
80 String emoji
, boolean remove
, String targetAuthor
, long targetSentTimestamp
, byte[] groupId
81 ) throws Error
.GroupNotFound
, Error
.Failure
, Error
.InvalidNumber
, Error
.InvalidGroupId
;
83 String
getContactName(String number
) throws Error
.InvalidNumber
;
85 void setContactName(String number
, String name
) throws Error
.InvalidNumber
;
87 void setExpirationTimer(final String number
, final int expiration
) throws Error
.Failure
;
89 void setContactBlocked(String number
, boolean blocked
) throws Error
.InvalidNumber
;
92 void setGroupBlocked(byte[] groupId
, boolean blocked
) throws Error
.GroupNotFound
, Error
.InvalidGroupId
;
95 List
<byte[]> getGroupIds();
97 DBusPath
getGroup(byte[] groupId
);
99 List
<StructGroup
> listGroups();
102 String
getGroupName(byte[] groupId
) throws Error
.InvalidGroupId
;
105 List
<String
> getGroupMembers(byte[] groupId
) throws Error
.InvalidGroupId
;
108 String name
, List
<String
> members
, String avatar
109 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
;
113 byte[] groupId
, String name
, List
<String
> members
, String avatar
114 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
, Error
.GroupNotFound
, Error
.InvalidGroupId
;
116 boolean isRegistered() throws Error
.Failure
, Error
.InvalidNumber
;
118 boolean isRegistered(String number
) throws Error
.Failure
, Error
.InvalidNumber
;
120 List
<Boolean
> isRegistered(List
<String
> numbers
) throws Error
.Failure
, Error
.InvalidNumber
;
122 void addDevice(String uri
) throws Error
.InvalidUri
;
124 DBusPath
getDevice(long deviceId
);
126 List
<StructDevice
> listDevices() throws Error
.Failure
;
128 DBusPath
getThisDevice();
137 ) throws Error
.Failure
;
140 String name
, String about
, String aboutEmoji
, String avatarPath
, boolean removeAvatar
141 ) throws Error
.Failure
;
145 void setPin(String registrationLockPin
);
149 List
<String
> listNumbers();
151 List
<String
> getContactNumber(final String name
) throws Error
.Failure
;
154 void quitGroup(final byte[] groupId
) throws Error
.GroupNotFound
, Error
.Failure
, Error
.InvalidGroupId
;
156 boolean isContactBlocked(final String number
) throws Error
.InvalidNumber
;
159 boolean isGroupBlocked(final byte[] groupId
) throws Error
.InvalidGroupId
;
162 boolean isMember(final byte[] groupId
) throws Error
.InvalidGroupId
;
164 byte[] joinGroup(final String groupLink
) throws Error
.Failure
;
166 String
uploadStickerPack(String stickerPackPath
) throws Error
.Failure
;
168 void submitRateLimitChallenge(String challenge
, String captchaString
) throws Error
.Failure
;
170 class MessageReceivedV2
extends DBusSignal
{
172 private final long timestamp
;
173 private final String sender
;
174 private final byte[] groupId
;
175 private final String message
;
176 private final Map
<String
, Variant
<?
>> extras
;
178 public MessageReceivedV2(
184 final Map
<String
, Variant
<?
>> extras
185 ) throws DBusException
{
186 super(objectpath
, timestamp
, sender
, groupId
, message
, extras
);
187 this.timestamp
= timestamp
;
188 this.sender
= sender
;
189 this.groupId
= groupId
;
190 this.message
= message
;
191 this.extras
= extras
;
194 public long getTimestamp() {
198 public String
getSender() {
202 public byte[] getGroupId() {
206 public String
getMessage() {
210 public Map
<String
, Variant
<?
>> getExtras() {
215 class MessageReceived
extends DBusSignal
{
217 private final long timestamp
;
218 private final String sender
;
219 private final byte[] groupId
;
220 private final String message
;
221 private final List
<String
> attachments
;
223 public MessageReceived(
229 List
<String
> attachments
230 ) throws DBusException
{
231 super(objectpath
, timestamp
, sender
, groupId
, message
, attachments
);
232 this.timestamp
= timestamp
;
233 this.sender
= sender
;
234 this.groupId
= groupId
;
235 this.message
= message
;
236 this.attachments
= attachments
;
239 public long getTimestamp() {
243 public String
getSender() {
247 public byte[] getGroupId() {
251 public String
getMessage() {
255 public List
<String
> getAttachments() {
260 class ReceiptReceived
extends DBusSignal
{
262 private final long timestamp
;
263 private final String sender
;
265 public ReceiptReceived(String objectpath
, long timestamp
, String sender
) throws DBusException
{
266 super(objectpath
, timestamp
, sender
);
267 this.timestamp
= timestamp
;
268 this.sender
= sender
;
271 public long getTimestamp() {
275 public String
getSender() {
280 class ReceiptReceivedV2
extends DBusSignal
{
282 private final long timestamp
;
283 private final String sender
;
284 private final String type
;
285 private final Map
<String
, Variant
<?
>> extras
;
287 public ReceiptReceivedV2(
292 final Map
<String
, Variant
<?
>> extras
293 ) throws DBusException
{
294 super(objectpath
, timestamp
, sender
, type
, extras
);
295 this.timestamp
= timestamp
;
296 this.sender
= sender
;
298 this.extras
= extras
;
301 public long getTimestamp() {
305 public String
getSender() {
309 public String
getReceiptType() {
313 public Map
<String
, Variant
<?
>> getExtras() {
318 class SyncMessageReceived
extends DBusSignal
{
320 private final long timestamp
;
321 private final String source
;
322 private final String destination
;
323 private final byte[] groupId
;
324 private final String message
;
325 private final List
<String
> attachments
;
327 public SyncMessageReceived(
334 List
<String
> attachments
335 ) throws DBusException
{
336 super(objectpath
, timestamp
, source
, destination
, groupId
, message
, attachments
);
337 this.timestamp
= timestamp
;
338 this.source
= source
;
339 this.destination
= destination
;
340 this.groupId
= groupId
;
341 this.message
= message
;
342 this.attachments
= attachments
;
345 public long getTimestamp() {
349 public String
getSource() {
353 public String
getDestination() {
357 public byte[] getGroupId() {
361 public String
getMessage() {
365 public List
<String
> getAttachments() {
370 class SyncMessageReceivedV2
extends DBusSignal
{
372 private final long timestamp
;
373 private final String source
;
374 private final String destination
;
375 private final byte[] groupId
;
376 private final String message
;
377 private final Map
<String
, Variant
<?
>> extras
;
379 public SyncMessageReceivedV2(
386 final Map
<String
, Variant
<?
>> extras
387 ) throws DBusException
{
388 super(objectpath
, timestamp
, source
, destination
, groupId
, message
, extras
);
389 this.timestamp
= timestamp
;
390 this.source
= source
;
391 this.destination
= destination
;
392 this.groupId
= groupId
;
393 this.message
= message
;
394 this.extras
= extras
;
397 public long getTimestamp() {
401 public String
getSource() {
405 public String
getDestination() {
409 public byte[] getGroupId() {
413 public String
getMessage() {
417 public Map
<String
, Variant
<?
>> getExtras() {
422 class StructDevice
extends Struct
{
433 public StructDevice(final DBusPath objectPath
, final Long id
, final String name
) {
434 this.objectPath
= objectPath
;
439 public DBusPath
getObjectPath() {
443 public Long
getId() {
447 public String
getName() {
452 @DBusProperty(name
= "Id", type
= Long
.class, access
= DBusProperty
.Access
.READ
)
453 @DBusProperty(name
= "Name", type
= String
.class)
454 @DBusProperty(name
= "Created", type
= String
.class, access
= DBusProperty
.Access
.READ
)
455 @DBusProperty(name
= "LastSeen", type
= String
.class, access
= DBusProperty
.Access
.READ
)
456 interface Device
extends DBusInterface
, Properties
{
458 void removeDevice() throws Error
.Failure
;
461 class StructGroup
extends Struct
{
472 public StructGroup(final DBusPath objectPath
, final byte[] id
, final String name
) {
473 this.objectPath
= objectPath
;
478 public DBusPath
getObjectPath() {
482 public byte[] getId() {
486 public String
getName() {
491 @DBusProperty(name
= "Id", type
= Byte
[].class, access
= DBusProperty
.Access
.READ
)
492 @DBusProperty(name
= "Name", type
= String
.class)
493 @DBusProperty(name
= "Description", type
= String
.class)
494 @DBusProperty(name
= "Avatar", type
= String
.class, access
= DBusProperty
.Access
.WRITE
)
495 @DBusProperty(name
= "IsBlocked", type
= Boolean
.class)
496 @DBusProperty(name
= "IsMember", type
= Boolean
.class, access
= DBusProperty
.Access
.READ
)
497 @DBusProperty(name
= "IsAdmin", type
= Boolean
.class, access
= DBusProperty
.Access
.READ
)
498 @DBusProperty(name
= "MessageExpirationTimer", type
= Integer
.class)
499 @DBusProperty(name
= "Members", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
500 @DBusProperty(name
= "PendingMembers", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
501 @DBusProperty(name
= "RequestingMembers", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
502 @DBusProperty(name
= "Admins", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
503 @DBusProperty(name
= "PermissionAddMember", type
= String
.class)
504 @DBusProperty(name
= "PermissionEditDetails", type
= String
.class)
505 @DBusProperty(name
= "PermissionSendMessage", type
= String
.class)
506 @DBusProperty(name
= "GroupInviteLink", type
= String
.class, access
= DBusProperty
.Access
.READ
)
507 interface Group
extends DBusInterface
, Properties
{
509 void quitGroup() throws Error
.Failure
, Error
.LastGroupAdmin
;
511 void addMembers(List
<String
> recipients
) throws Error
.Failure
;
513 void removeMembers(List
<String
> recipients
) throws Error
.Failure
;
515 void addAdmins(List
<String
> recipients
) throws Error
.Failure
;
517 void removeAdmins(List
<String
> recipients
) throws Error
.Failure
;
519 void resetLink() throws Error
.Failure
;
521 void disableLink() throws Error
.Failure
;
523 void enableLink(boolean requiresApproval
) throws Error
.Failure
;
528 class AttachmentInvalid
extends DBusExecutionException
{
530 public AttachmentInvalid(final String message
) {
531 super("Invalid attachment: " + message
);
535 class InvalidUri
extends DBusExecutionException
{
537 public InvalidUri(final String message
) {
538 super("Invalid uri: " + message
);
542 class Failure
extends DBusExecutionException
{
544 public Failure(final Exception e
) {
545 super("Failure: " + e
.getMessage() + " (" + e
.getClass().getSimpleName() + ")");
548 public Failure(final String message
) {
549 super("Failure: " + message
);
553 class DeviceNotFound
extends DBusExecutionException
{
555 public DeviceNotFound(final String message
) {
556 super("Device not found: " + message
);
560 class GroupNotFound
extends DBusExecutionException
{
562 public GroupNotFound(final String message
) {
563 super("Group not found: " + message
);
567 class InvalidGroupId
extends DBusExecutionException
{
569 public InvalidGroupId(final String message
) {
570 super("Invalid group id: " + message
);
574 class LastGroupAdmin
extends DBusExecutionException
{
576 public LastGroupAdmin(final String message
) {
577 super("Last group admin: " + message
);
581 class InvalidNumber
extends DBusExecutionException
{
583 public InvalidNumber(final String message
) {
584 super("Invalid number: " + message
);
588 class UntrustedIdentity
extends DBusExecutionException
{
590 public UntrustedIdentity(final String message
) {
591 super("Untrusted identity: " + message
);