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 submitRateLimitChallenge(String challenge
, String captchaString
) throws IOErrorException
;
150 class MessageReceived
extends DBusSignal
{
152 private final long timestamp
;
153 private final String sender
;
154 private final byte[] groupId
;
155 private final String message
;
156 private final List
<String
> attachments
;
158 public MessageReceived(
164 List
<String
> attachments
165 ) throws DBusException
{
166 super(objectpath
, timestamp
, sender
, groupId
, message
, attachments
);
167 this.timestamp
= timestamp
;
168 this.sender
= sender
;
169 this.groupId
= groupId
;
170 this.message
= message
;
171 this.attachments
= attachments
;
174 public long getTimestamp() {
178 public String
getSender() {
182 public byte[] getGroupId() {
186 public String
getMessage() {
190 public List
<String
> getAttachments() {
195 class ReceiptReceived
extends DBusSignal
{
197 private final long timestamp
;
198 private final String sender
;
200 public ReceiptReceived(String objectpath
, long timestamp
, String sender
) throws DBusException
{
201 super(objectpath
, timestamp
, sender
);
202 this.timestamp
= timestamp
;
203 this.sender
= sender
;
206 public long getTimestamp() {
210 public String
getSender() {
215 class SyncMessageReceived
extends DBusSignal
{
217 private final long timestamp
;
218 private final String source
;
219 private final String destination
;
220 private final byte[] groupId
;
221 private final String message
;
222 private final List
<String
> attachments
;
224 public SyncMessageReceived(
231 List
<String
> attachments
232 ) throws DBusException
{
233 super(objectpath
, timestamp
, source
, destination
, groupId
, message
, attachments
);
234 this.timestamp
= timestamp
;
235 this.source
= source
;
236 this.destination
= destination
;
237 this.groupId
= groupId
;
238 this.message
= message
;
239 this.attachments
= attachments
;
242 public long getTimestamp() {
246 public String
getSource() {
250 public String
getDestination() {
254 public byte[] getGroupId() {
258 public String
getMessage() {
262 public List
<String
> getAttachments() {
267 class StructDevice
extends Struct
{
278 public StructDevice(final DBusPath objectPath
, final Long id
, final String name
) {
279 this.objectPath
= objectPath
;
284 public DBusPath
getObjectPath() {
288 public Long
getId() {
292 public String
getName() {
297 @DBusProperty(name
= "Id", type
= Long
.class, access
= DBusProperty
.Access
.READ
)
298 @DBusProperty(name
= "Name", type
= String
.class)
299 @DBusProperty(name
= "Created", type
= String
.class, access
= DBusProperty
.Access
.READ
)
300 @DBusProperty(name
= "LastSeen", type
= String
.class, access
= DBusProperty
.Access
.READ
)
301 interface Device
extends DBusInterface
, Properties
{
303 void removeDevice() throws Error
.Failure
;
308 class AttachmentInvalid
extends DBusExecutionException
{
310 public AttachmentInvalid(final String message
) {
315 class InvalidUri
extends DBusExecutionException
{
317 public InvalidUri(final String message
) {
322 class Failure
extends DBusExecutionException
{
324 public Failure(final String message
) {
329 class DeviceNotFound
extends DBusExecutionException
{
331 public DeviceNotFound(final String message
) {
336 class GroupNotFound
extends DBusExecutionException
{
338 public GroupNotFound(final String message
) {
343 class InvalidGroupId
extends DBusExecutionException
{
345 public InvalidGroupId(final String message
) {
350 class InvalidNumber
extends DBusExecutionException
{
352 public InvalidNumber(final String message
) {
357 class UntrustedIdentity
extends DBusExecutionException
{
359 public UntrustedIdentity(final String message
) {