3 import org
.asamk
.signal
.commands
.exceptions
.IOErrorException
;
4 import org
.freedesktop
.dbus
.DBusPath
;
5 import org
.freedesktop
.dbus
.Struct
;
6 import org
.freedesktop
.dbus
.annotations
.DBusProperty
;
7 import org
.freedesktop
.dbus
.annotations
.Position
;
8 import org
.freedesktop
.dbus
.exceptions
.DBusException
;
9 import org
.freedesktop
.dbus
.exceptions
.DBusExecutionException
;
10 import org
.freedesktop
.dbus
.interfaces
.DBusInterface
;
11 import org
.freedesktop
.dbus
.interfaces
.Properties
;
12 import org
.freedesktop
.dbus
.messages
.DBusSignal
;
14 import java
.util
.List
;
17 * DBus interface for the org.asamk.Signal service.
18 * Including emitted Signals and returned Errors.
20 public interface Signal
extends DBusInterface
{
22 String
getSelfNumber();
25 String message
, List
<String
> attachments
, String recipient
26 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
, Error
.UntrustedIdentity
;
29 String message
, List
<String
> attachments
, List
<String
> recipients
30 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
, Error
.UntrustedIdentity
;
33 String recipient
, boolean stop
34 ) throws Error
.Failure
, Error
.GroupNotFound
, Error
.UntrustedIdentity
;
37 String recipient
, List
<Long
> messageIds
38 ) throws Error
.Failure
, Error
.UntrustedIdentity
;
40 long sendRemoteDeleteMessage(
41 long targetSentTimestamp
, String recipient
42 ) throws Error
.Failure
, Error
.InvalidNumber
;
44 long sendRemoteDeleteMessage(
45 long targetSentTimestamp
, List
<String
> recipients
46 ) throws Error
.Failure
, Error
.InvalidNumber
;
48 long sendGroupRemoteDeleteMessage(
49 long targetSentTimestamp
, byte[] groupId
50 ) throws Error
.Failure
, Error
.GroupNotFound
, Error
.InvalidGroupId
;
52 long sendMessageReaction(
53 String emoji
, boolean remove
, String targetAuthor
, long targetSentTimestamp
, String recipient
54 ) throws Error
.InvalidNumber
, Error
.Failure
;
56 long sendMessageReaction(
57 String emoji
, boolean remove
, String targetAuthor
, long targetSentTimestamp
, List
<String
> recipients
58 ) throws Error
.InvalidNumber
, Error
.Failure
;
60 void sendContacts() throws Error
.Failure
;
62 void sendSyncRequest() throws Error
.Failure
;
64 long sendNoteToSelfMessage(
65 String message
, List
<String
> attachments
66 ) throws Error
.AttachmentInvalid
, Error
.Failure
;
68 void sendEndSessionMessage(List
<String
> recipients
) throws Error
.Failure
, Error
.InvalidNumber
, Error
.UntrustedIdentity
;
70 long sendGroupMessage(
71 String message
, List
<String
> attachments
, byte[] groupId
72 ) throws Error
.GroupNotFound
, Error
.Failure
, Error
.AttachmentInvalid
, Error
.InvalidGroupId
;
74 long sendGroupMessageReaction(
75 String emoji
, boolean remove
, String targetAuthor
, long targetSentTimestamp
, byte[] groupId
76 ) throws Error
.GroupNotFound
, Error
.Failure
, Error
.InvalidNumber
, Error
.InvalidGroupId
;
78 String
getContactName(String number
) throws Error
.InvalidNumber
;
80 void setContactName(String number
, String name
) throws Error
.InvalidNumber
;
82 void setExpirationTimer(final String number
, final int expiration
) throws Error
.Failure
;
84 void setContactBlocked(String number
, boolean blocked
) throws Error
.InvalidNumber
;
87 void setGroupBlocked(byte[] groupId
, boolean blocked
) throws Error
.GroupNotFound
, Error
.InvalidGroupId
;
90 List
<byte[]> getGroupIds();
92 DBusPath
getGroup(byte[] groupId
);
94 List
<StructGroup
> listGroups();
97 String
getGroupName(byte[] groupId
) throws Error
.InvalidGroupId
;
100 List
<String
> getGroupMembers(byte[] groupId
) throws Error
.InvalidGroupId
;
103 String name
, List
<String
> members
, String avatar
104 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
;
108 byte[] groupId
, String name
, List
<String
> members
, String avatar
109 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
, Error
.GroupNotFound
, Error
.InvalidGroupId
;
111 boolean isRegistered() throws Error
.Failure
, Error
.InvalidNumber
;
113 boolean isRegistered(String number
) throws Error
.Failure
, Error
.InvalidNumber
;
115 List
<Boolean
> isRegistered(List
<String
> numbers
) throws Error
.Failure
, Error
.InvalidNumber
;
117 void addDevice(String uri
) throws Error
.InvalidUri
;
119 DBusPath
getDevice(long deviceId
);
121 List
<StructDevice
> listDevices() throws Error
.Failure
;
123 DBusPath
getThisDevice();
132 ) throws Error
.Failure
;
135 String name
, String about
, String aboutEmoji
, String avatarPath
, boolean removeAvatar
136 ) throws Error
.Failure
;
140 void setPin(String registrationLockPin
);
144 List
<String
> listNumbers();
146 List
<String
> getContactNumber(final String name
) throws Error
.Failure
;
149 void quitGroup(final byte[] groupId
) throws Error
.GroupNotFound
, Error
.Failure
, Error
.InvalidGroupId
;
151 boolean isContactBlocked(final String number
) throws Error
.InvalidNumber
;
154 boolean isGroupBlocked(final byte[] groupId
) throws Error
.InvalidGroupId
;
157 boolean isMember(final byte[] groupId
) throws Error
.InvalidGroupId
;
159 byte[] joinGroup(final String groupLink
) throws Error
.Failure
;
161 String
uploadStickerPack(String stickerPackPath
) throws Error
.Failure
;
163 void setConfiguration(boolean readReceipts
, boolean unidentifiedDeliveryIndicators
, boolean typingIndicators
, boolean linkPreviews
) throws Error
.IOError
, Error
.UserError
;
165 List
<Boolean
> getConfiguration();
167 void submitRateLimitChallenge(String challenge
, String captchaString
) throws IOErrorException
;
169 class MessageReceived
extends DBusSignal
{
171 private final long timestamp
;
172 private final String sender
;
173 private final byte[] groupId
;
174 private final String message
;
175 private final List
<String
> attachments
;
177 public MessageReceived(
183 List
<String
> attachments
184 ) throws DBusException
{
185 super(objectpath
, timestamp
, sender
, groupId
, message
, attachments
);
186 this.timestamp
= timestamp
;
187 this.sender
= sender
;
188 this.groupId
= groupId
;
189 this.message
= message
;
190 this.attachments
= attachments
;
193 public long getTimestamp() {
197 public String
getSender() {
201 public byte[] getGroupId() {
205 public String
getMessage() {
209 public List
<String
> getAttachments() {
214 class ReceiptReceived
extends DBusSignal
{
216 private final long timestamp
;
217 private final String sender
;
219 public ReceiptReceived(String objectpath
, long timestamp
, String sender
) throws DBusException
{
220 super(objectpath
, timestamp
, sender
);
221 this.timestamp
= timestamp
;
222 this.sender
= sender
;
225 public long getTimestamp() {
229 public String
getSender() {
234 class SyncMessageReceived
extends DBusSignal
{
236 private final long timestamp
;
237 private final String source
;
238 private final String destination
;
239 private final byte[] groupId
;
240 private final String message
;
241 private final List
<String
> attachments
;
243 public SyncMessageReceived(
250 List
<String
> attachments
251 ) throws DBusException
{
252 super(objectpath
, timestamp
, source
, destination
, groupId
, message
, attachments
);
253 this.timestamp
= timestamp
;
254 this.source
= source
;
255 this.destination
= destination
;
256 this.groupId
= groupId
;
257 this.message
= message
;
258 this.attachments
= attachments
;
261 public long getTimestamp() {
265 public String
getSource() {
269 public String
getDestination() {
273 public byte[] getGroupId() {
277 public String
getMessage() {
281 public List
<String
> getAttachments() {
286 class StructDevice
extends Struct
{
297 public StructDevice(final DBusPath objectPath
, final Long id
, final String name
) {
298 this.objectPath
= objectPath
;
303 public DBusPath
getObjectPath() {
307 public Long
getId() {
311 public String
getName() {
316 @DBusProperty(name
= "Id", type
= Long
.class, access
= DBusProperty
.Access
.READ
)
317 @DBusProperty(name
= "Name", type
= String
.class)
318 @DBusProperty(name
= "Created", type
= String
.class, access
= DBusProperty
.Access
.READ
)
319 @DBusProperty(name
= "LastSeen", type
= String
.class, access
= DBusProperty
.Access
.READ
)
320 interface Device
extends DBusInterface
, Properties
{
322 void removeDevice() throws Error
.Failure
;
325 class StructGroup
extends Struct
{
336 public StructGroup(final DBusPath objectPath
, final byte[] id
, final String name
) {
337 this.objectPath
= objectPath
;
342 public DBusPath
getObjectPath() {
346 public byte[] getId() {
350 public String
getName() {
355 @DBusProperty(name
= "Id", type
= Byte
[].class, access
= DBusProperty
.Access
.READ
)
356 @DBusProperty(name
= "Name", type
= String
.class)
357 @DBusProperty(name
= "Description", type
= String
.class)
358 @DBusProperty(name
= "Avatar", type
= String
.class, access
= DBusProperty
.Access
.WRITE
)
359 @DBusProperty(name
= "IsBlocked", type
= Boolean
.class)
360 @DBusProperty(name
= "IsMember", type
= Boolean
.class, access
= DBusProperty
.Access
.READ
)
361 @DBusProperty(name
= "IsAdmin", type
= Boolean
.class, access
= DBusProperty
.Access
.READ
)
362 @DBusProperty(name
= "MessageExpirationTimer", type
= Integer
.class)
363 @DBusProperty(name
= "Members", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
364 @DBusProperty(name
= "PendingMembers", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
365 @DBusProperty(name
= "RequestingMembers", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
366 @DBusProperty(name
= "Admins", type
= String
[].class, access
= DBusProperty
.Access
.READ
)
367 @DBusProperty(name
= "PermissionAddMember", type
= String
.class)
368 @DBusProperty(name
= "PermissionEditDetails", type
= String
.class)
369 @DBusProperty(name
= "PermissionSendMessage", type
= String
.class)
370 @DBusProperty(name
= "GroupInviteLink", type
= String
.class, access
= DBusProperty
.Access
.READ
)
371 interface Group
extends DBusInterface
, Properties
{
373 void quitGroup() throws Error
.Failure
, Error
.LastGroupAdmin
;
375 void addMembers(List
<String
> recipients
) throws Error
.Failure
;
377 void removeMembers(List
<String
> recipients
) throws Error
.Failure
;
379 void addAdmins(List
<String
> recipients
) throws Error
.Failure
;
381 void removeAdmins(List
<String
> recipients
) throws Error
.Failure
;
383 void resetLink() throws Error
.Failure
;
385 void disableLink() throws Error
.Failure
;
387 void enableLink(boolean requiresApproval
) throws Error
.Failure
;
392 class AttachmentInvalid
extends DBusExecutionException
{
394 public AttachmentInvalid(final String message
) {
399 class InvalidUri
extends DBusExecutionException
{
401 public InvalidUri(final String message
) {
406 class Failure
extends DBusExecutionException
{
408 public Failure(final String message
) {
413 class DeviceNotFound
extends DBusExecutionException
{
415 public DeviceNotFound(final String message
) {
420 class GroupNotFound
extends DBusExecutionException
{
422 public GroupNotFound(final String message
) {
427 class InvalidGroupId
extends DBusExecutionException
{
429 public InvalidGroupId(final String message
) {
434 class LastGroupAdmin
extends DBusExecutionException
{
436 public LastGroupAdmin(final String message
) {
441 class InvalidNumber
extends DBusExecutionException
{
443 public InvalidNumber(final String message
) {
448 class UntrustedIdentity
extends DBusExecutionException
{
450 public UntrustedIdentity(final String message
) {
455 class IOError
extends DBusExecutionException
{
457 public IOError(final String message
) {
462 class UserError
extends DBusExecutionException
{
464 public UserError(final String message
) {