3 import org
.asamk
.signal
.commands
.exceptions
.IOErrorException
;
5 import org
.freedesktop
.dbus
.DBusPath
;
6 import org
.freedesktop
.dbus
.Struct
;
7 import org
.freedesktop
.dbus
.annotations
.DBusProperty
;
8 import org
.freedesktop
.dbus
.annotations
.Position
;
9 import org
.freedesktop
.dbus
.exceptions
.DBusException
;
10 import org
.freedesktop
.dbus
.exceptions
.DBusExecutionException
;
11 import org
.freedesktop
.dbus
.interfaces
.DBusInterface
;
12 import org
.freedesktop
.dbus
.interfaces
.Properties
;
13 import org
.freedesktop
.dbus
.messages
.DBusSignal
;
15 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 long sendRemoteDeleteMessage(
42 long targetSentTimestamp
, String recipient
43 ) throws Error
.Failure
, Error
.InvalidNumber
;
45 long sendRemoteDeleteMessage(
46 long targetSentTimestamp
, List
<String
> recipients
47 ) throws Error
.Failure
, Error
.InvalidNumber
;
49 long sendGroupRemoteDeleteMessage(
50 long targetSentTimestamp
, byte[] groupId
51 ) throws Error
.Failure
, Error
.GroupNotFound
, Error
.InvalidGroupId
;
53 long sendMessageReaction(
54 String emoji
, boolean remove
, String targetAuthor
, long targetSentTimestamp
, String recipient
55 ) throws Error
.InvalidNumber
, Error
.Failure
;
57 long sendMessageReaction(
58 String emoji
, boolean remove
, String targetAuthor
, long targetSentTimestamp
, List
<String
> recipients
59 ) throws Error
.InvalidNumber
, Error
.Failure
;
61 void sendContacts() throws Error
.Failure
;
63 void sendSyncRequest() throws Error
.Failure
;
65 long sendNoteToSelfMessage(
66 String message
, List
<String
> attachments
67 ) throws Error
.AttachmentInvalid
, Error
.Failure
;
69 void sendEndSessionMessage(List
<String
> recipients
) throws Error
.Failure
, Error
.InvalidNumber
, Error
.UntrustedIdentity
;
71 long sendGroupMessage(
72 String message
, List
<String
> attachments
, byte[] groupId
73 ) throws Error
.GroupNotFound
, Error
.Failure
, Error
.AttachmentInvalid
, Error
.InvalidGroupId
;
75 long sendGroupMessageReaction(
76 String emoji
, boolean remove
, String targetAuthor
, long targetSentTimestamp
, byte[] groupId
77 ) throws Error
.GroupNotFound
, Error
.Failure
, Error
.InvalidNumber
, Error
.InvalidGroupId
;
79 String
getContactName(String number
) throws Error
.InvalidNumber
;
81 void setContactName(String number
, String name
) throws Error
.InvalidNumber
;
83 void setExpirationTimer(final String number
, final int expiration
) throws Error
.Failure
;
85 void setContactBlocked(String number
, boolean blocked
) throws Error
.InvalidNumber
;
87 void setGroupBlocked(byte[] groupId
, boolean blocked
) throws Error
.GroupNotFound
, Error
.InvalidGroupId
;
89 List
<byte[]> getGroupIds();
91 String
getGroupName(byte[] groupId
) throws Error
.InvalidGroupId
;
93 List
<String
> getGroupMembers(byte[] groupId
) throws Error
.InvalidGroupId
;
96 byte[] groupId
, String name
, List
<String
> members
, String avatar
97 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
, Error
.GroupNotFound
, Error
.InvalidGroupId
;
99 boolean isRegistered() throws Error
.Failure
, Error
.InvalidNumber
;
101 boolean isRegistered(String number
) throws Error
.Failure
, Error
.InvalidNumber
;
103 List
<Boolean
> isRegistered(List
<String
> numbers
) throws Error
.Failure
, Error
.InvalidNumber
;
105 void addDevice(String uri
) throws Error
.InvalidUri
;
107 DBusPath
getDevice(long deviceId
);
109 List
<StructDevice
> listDevices() throws Error
.Failure
;
111 DBusPath
getThisDevice();
120 ) throws Error
.Failure
;
123 String name
, String about
, String aboutEmoji
, String avatarPath
, boolean removeAvatar
124 ) throws Error
.Failure
;
128 void setPin(String registrationLockPin
);
132 List
<String
> listNumbers();
134 List
<String
> getContactNumber(final String name
) throws Error
.Failure
;
136 void quitGroup(final byte[] groupId
) throws Error
.GroupNotFound
, Error
.Failure
, Error
.InvalidGroupId
;
138 boolean isContactBlocked(final String number
) throws Error
.InvalidNumber
;
140 boolean isGroupBlocked(final byte[] groupId
) throws Error
.InvalidGroupId
;
142 boolean isMember(final byte[] groupId
) throws Error
.InvalidGroupId
;
144 byte[] joinGroup(final String groupLink
) throws Error
.Failure
;
146 String
uploadStickerPack(String stickerPackPath
) throws Error
.Failure
;
148 void setConfiguration(boolean readReceipts
, boolean unidentifiedDeliveryIndicators
, boolean typingIndicators
, boolean linkPreviews
) throws Error
.IOError
, Error
.UserError
;
150 List
<Boolean
> getConfiguration();
152 void submitRateLimitChallenge(String challenge
, String captchaString
) throws IOErrorException
;
154 class MessageReceived
extends DBusSignal
{
156 private final long timestamp
;
157 private final String sender
;
158 private final byte[] groupId
;
159 private final String message
;
160 private final List
<String
> attachments
;
162 public MessageReceived(
168 List
<String
> attachments
169 ) throws DBusException
{
170 super(objectpath
, timestamp
, sender
, groupId
, message
, attachments
);
171 this.timestamp
= timestamp
;
172 this.sender
= sender
;
173 this.groupId
= groupId
;
174 this.message
= message
;
175 this.attachments
= attachments
;
178 public long getTimestamp() {
182 public String
getSender() {
186 public byte[] getGroupId() {
190 public String
getMessage() {
194 public List
<String
> getAttachments() {
199 class ReceiptReceived
extends DBusSignal
{
201 private final long timestamp
;
202 private final String sender
;
204 public ReceiptReceived(String objectpath
, long timestamp
, String sender
) throws DBusException
{
205 super(objectpath
, timestamp
, sender
);
206 this.timestamp
= timestamp
;
207 this.sender
= sender
;
210 public long getTimestamp() {
214 public String
getSender() {
219 class SyncMessageReceived
extends DBusSignal
{
221 private final long timestamp
;
222 private final String source
;
223 private final String destination
;
224 private final byte[] groupId
;
225 private final String message
;
226 private final List
<String
> attachments
;
228 public SyncMessageReceived(
235 List
<String
> attachments
236 ) throws DBusException
{
237 super(objectpath
, timestamp
, source
, destination
, groupId
, message
, attachments
);
238 this.timestamp
= timestamp
;
239 this.source
= source
;
240 this.destination
= destination
;
241 this.groupId
= groupId
;
242 this.message
= message
;
243 this.attachments
= attachments
;
246 public long getTimestamp() {
250 public String
getSource() {
254 public String
getDestination() {
258 public byte[] getGroupId() {
262 public String
getMessage() {
266 public List
<String
> getAttachments() {
271 class StructDevice
extends Struct
{
282 public StructDevice(final DBusPath objectPath
, final Long id
, final String name
) {
283 this.objectPath
= objectPath
;
288 public DBusPath
getObjectPath() {
292 public Long
getId() {
296 public String
getName() {
301 @DBusProperty(name
= "Id", type
= Long
.class, access
= DBusProperty
.Access
.READ
)
302 @DBusProperty(name
= "Name", type
= String
.class)
303 @DBusProperty(name
= "Created", type
= String
.class, access
= DBusProperty
.Access
.READ
)
304 @DBusProperty(name
= "LastSeen", type
= String
.class, access
= DBusProperty
.Access
.READ
)
305 interface Device
extends DBusInterface
, Properties
{
307 void removeDevice() throws Error
.Failure
;
312 class AttachmentInvalid
extends DBusExecutionException
{
314 public AttachmentInvalid(final String message
) {
319 class InvalidUri
extends DBusExecutionException
{
321 public InvalidUri(final String message
) {
326 class Failure
extends DBusExecutionException
{
328 public Failure(final String message
) {
333 class GroupNotFound
extends DBusExecutionException
{
335 public GroupNotFound(final String message
) {
340 class InvalidGroupId
extends DBusExecutionException
{
342 public InvalidGroupId(final String message
) {
347 class InvalidNumber
extends DBusExecutionException
{
349 public InvalidNumber(final String message
) {
354 class UntrustedIdentity
extends DBusExecutionException
{
356 public UntrustedIdentity(final String message
) {
361 class IOError
extends DBusExecutionException
{
363 public IOError(final String message
) {
368 class UserError
extends DBusExecutionException
{
370 public UserError(final String message
) {