Merge the matrix-java-sdk due to it no longer maintained. Remove thirdparty repositories.
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* matrix-java-sdk - Matrix Client SDK for Java
|
||||
* Copyright (C) 2018 Kamax Sarl
|
||||
*
|
||||
* https://www.kamax.io/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.kamax.matrix.room;
|
||||
|
||||
import io.kamax.matrix.event._MatrixPersistentEvent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MatrixRoomMessageChunk implements _MatrixRoomMessageChunk {
|
||||
|
||||
private String startToken;
|
||||
private String endToken;
|
||||
private List<_MatrixPersistentEvent> events;
|
||||
|
||||
public MatrixRoomMessageChunk(String startToken, String endToken, List<_MatrixPersistentEvent> events) {
|
||||
this.startToken = startToken;
|
||||
this.endToken = endToken;
|
||||
this.events = events;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStartToken() {
|
||||
return startToken;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEndToken() {
|
||||
return endToken;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<_MatrixPersistentEvent> getEvents() {
|
||||
return events;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* matrix-java-sdk - Matrix Client SDK for Java
|
||||
* Copyright (C) 2018 Kamax Sarl
|
||||
*
|
||||
* https://www.kamax.io/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.kamax.matrix.room;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class MatrixRoomMessageChunkOptions implements _MatrixRoomMessageChunkOptions {
|
||||
|
||||
public static class Builder {
|
||||
|
||||
private MatrixRoomMessageChunkOptions obj;
|
||||
|
||||
public Builder() {
|
||||
this.obj = new MatrixRoomMessageChunkOptions();
|
||||
}
|
||||
|
||||
public Builder setFromToken(String token) {
|
||||
obj.from = token;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setToToken(String token) {
|
||||
obj.to = token;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setDirection(String direction) {
|
||||
obj.dir = direction;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setDirection(_MatrixRoomMessageChunkOptions.Direction direction) {
|
||||
return setDirection(direction.get());
|
||||
}
|
||||
|
||||
public Builder setLimit(long limit) {
|
||||
obj.limit = limit;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MatrixRoomMessageChunkOptions get() {
|
||||
return obj;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Builder build() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
private String from;
|
||||
private String to;
|
||||
private String dir;
|
||||
private Long limit;
|
||||
|
||||
@Override
|
||||
public String getFromToken() {
|
||||
return from;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<String> getToToken() {
|
||||
return Optional.ofNullable(to);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDirection() {
|
||||
return dir;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Long> getLimit() {
|
||||
return Optional.ofNullable(limit);
|
||||
}
|
||||
|
||||
}
|
||||
37
src/main/java/io/kamax/matrix/room/ReceiptType.java
Normal file
37
src/main/java/io/kamax/matrix/room/ReceiptType.java
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* matrix-java-sdk - Matrix Client SDK for Java
|
||||
* Copyright (C) 2018 Kamax Sàrl
|
||||
*
|
||||
* https://www.kamax.io/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.kamax.matrix.room;
|
||||
|
||||
public enum ReceiptType {
|
||||
|
||||
Read("m.read");
|
||||
|
||||
private String id;
|
||||
|
||||
ReceiptType(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
}
|
||||
82
src/main/java/io/kamax/matrix/room/RoomAlias.java
Normal file
82
src/main/java/io/kamax/matrix/room/RoomAlias.java
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* matrix-java-sdk - Matrix Client SDK for Java
|
||||
* Copyright (C) 2018 Kamax Sàrl
|
||||
*
|
||||
* https://www.kamax.io/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.kamax.matrix.room;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class RoomAlias {
|
||||
|
||||
private static final String sigill = "#";
|
||||
private static final Pattern idPattern = Pattern.compile(sigill + "(.+?):(.+)");
|
||||
|
||||
private String id;
|
||||
private String localpart;
|
||||
private String domain;
|
||||
|
||||
public static RoomAlias from(String localpart, String domain) {
|
||||
return from(sigill + localpart + ":" + domain);
|
||||
}
|
||||
|
||||
public static RoomAlias from(String id) {
|
||||
if (id.length() > 255) {
|
||||
throw new IllegalArgumentException("Room aliases cannot be longer than 255 characters");
|
||||
}
|
||||
|
||||
Matcher m = idPattern.matcher(id);
|
||||
if (!m.matches()) {
|
||||
throw new IllegalArgumentException(id + " is not a valid Room alias");
|
||||
}
|
||||
|
||||
RoomAlias r = new RoomAlias();
|
||||
r.id = id;
|
||||
r.localpart = m.group(1);
|
||||
r.domain = m.group(2);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
public static boolean is(String id) {
|
||||
try {
|
||||
from(id);
|
||||
return true;
|
||||
} catch (IllegalArgumentException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private RoomAlias() {
|
||||
// cannot instantiate directly
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getLocalpart() {
|
||||
return localpart;
|
||||
}
|
||||
|
||||
public String getDomain() {
|
||||
return domain;
|
||||
}
|
||||
|
||||
}
|
||||
41
src/main/java/io/kamax/matrix/room/RoomAliasLookup.java
Normal file
41
src/main/java/io/kamax/matrix/room/RoomAliasLookup.java
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* matrix-java-sdk - Matrix Client SDK for Java
|
||||
* Copyright (C) 2018 Kamax Sàrl
|
||||
*
|
||||
* https://www.kamax.io/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.kamax.matrix.room;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class RoomAliasLookup extends RoomAliasMapping implements _RoomAliasLookup {
|
||||
|
||||
private List<String> servers;
|
||||
|
||||
public RoomAliasLookup(String id, String alias, Collection<String> servers) {
|
||||
super(id, alias);
|
||||
this.servers = new ArrayList<>(servers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getServers() {
|
||||
return servers;
|
||||
}
|
||||
|
||||
}
|
||||
43
src/main/java/io/kamax/matrix/room/RoomAliasMapping.java
Normal file
43
src/main/java/io/kamax/matrix/room/RoomAliasMapping.java
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* matrix-java-sdk - Matrix Client SDK for Java
|
||||
* Copyright (C) 2018 Kamax Sàrl
|
||||
*
|
||||
* https://www.kamax.io/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.kamax.matrix.room;
|
||||
|
||||
public class RoomAliasMapping implements _RoomAliasMapping {
|
||||
|
||||
private String id;
|
||||
private String alias;
|
||||
|
||||
public RoomAliasMapping(String id, String alias) {
|
||||
this.id = id;
|
||||
this.alias = alias;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAlias() {
|
||||
return alias;
|
||||
}
|
||||
|
||||
}
|
||||
161
src/main/java/io/kamax/matrix/room/RoomCreationOptions.java
Normal file
161
src/main/java/io/kamax/matrix/room/RoomCreationOptions.java
Normal file
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
* matrix-java-sdk - Matrix Client SDK for Java
|
||||
* Copyright (C) 2018 Kamax Sarl
|
||||
*
|
||||
* https://www.kamax.io/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.kamax.matrix.room;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
|
||||
import io.kamax.matrix._MatrixID;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Optional;
|
||||
|
||||
public class RoomCreationOptions implements _RoomCreationOptions {
|
||||
|
||||
public static class Builder {
|
||||
|
||||
private RoomCreationOptions obj;
|
||||
|
||||
public Builder() {
|
||||
this.obj = new RoomCreationOptions();
|
||||
}
|
||||
|
||||
public Builder setVisibility(String visibility) {
|
||||
obj.visibility = visibility;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setVisibility(RoomDirectoryVisibility visibility) {
|
||||
return setVisibility(visibility.get());
|
||||
}
|
||||
|
||||
public Builder setAliasName(String aliasName) {
|
||||
obj.aliasName = aliasName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setName(String name) {
|
||||
obj.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setTopic(String topic) {
|
||||
obj.topic = topic;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setInvites(Set<_MatrixID> invites) {
|
||||
obj.invites = Collections.unmodifiableSet(new HashSet<>(invites));
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setCreationContent(Map<String, JsonElement> creationContent) {
|
||||
obj.creationContent = Collections.unmodifiableMap(new HashMap<>(creationContent));
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setPreset(String preset) {
|
||||
obj.preset = preset;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setPreset(RoomCreationPreset preset) {
|
||||
return setPreset(preset.get());
|
||||
}
|
||||
|
||||
public Builder setDirect(boolean isDirect) {
|
||||
obj.isDirect = isDirect;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setGuestCanJoin(boolean guestCanJoin) {
|
||||
obj.guestCanJoin = guestCanJoin;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RoomCreationOptions get() {
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
||||
public static Builder build() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public static RoomCreationOptions none() {
|
||||
return build().get();
|
||||
}
|
||||
|
||||
private String visibility;
|
||||
private String aliasName;
|
||||
private String name;
|
||||
private String topic;
|
||||
private Set<_MatrixID> invites = new HashSet<>();
|
||||
private Map<String, JsonElement> creationContent = new HashMap<>();
|
||||
private String preset;
|
||||
private Boolean isDirect;
|
||||
private Boolean guestCanJoin;
|
||||
|
||||
@Override
|
||||
public Optional<String> getVisibility() {
|
||||
return Optional.ofNullable(visibility);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<String> getAliasName() {
|
||||
return Optional.ofNullable(aliasName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<String> getName() {
|
||||
return Optional.ofNullable(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<String> getTopic() {
|
||||
return Optional.ofNullable(topic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Set<_MatrixID>> getInvites() {
|
||||
return Optional.ofNullable(invites);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Map<String, JsonElement>> getCreationContent() {
|
||||
return Optional.ofNullable(creationContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<String> getPreset() {
|
||||
return Optional.ofNullable(preset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Boolean> isDirect() {
|
||||
return Optional.ofNullable(isDirect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Boolean> isGuestCanJoin() {
|
||||
return Optional.ofNullable(guestCanJoin);
|
||||
}
|
||||
|
||||
}
|
||||
65
src/main/java/io/kamax/matrix/room/RoomCreationPreset.java
Normal file
65
src/main/java/io/kamax/matrix/room/RoomCreationPreset.java
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* matrix-java-sdk - Matrix Client SDK for Java
|
||||
* Copyright (C) 2018 Kamax Sarl
|
||||
*
|
||||
* https://www.kamax.io/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.kamax.matrix.room;
|
||||
|
||||
/**
|
||||
* Room creation presets available in the specification.
|
||||
*/
|
||||
public enum RoomCreationPreset {
|
||||
|
||||
/**
|
||||
* The following room state will be set:
|
||||
* - join_rules is set to invite.
|
||||
* - history_visibility is set to shared.
|
||||
*/
|
||||
Private("private_chat"),
|
||||
|
||||
/**
|
||||
* The following room state will be set:
|
||||
* - join_rules is set to invite.
|
||||
* - history_visibility is set to shared.
|
||||
* - All invitees are given the same power level as the room creator.
|
||||
*/
|
||||
TrustedPrivate("trusted_private_chat"),
|
||||
|
||||
/**
|
||||
* The following room state will be set:
|
||||
* - join_rules is set to public.
|
||||
* - history_visibility is set to shared.
|
||||
*/
|
||||
PublicChat("public_chat");
|
||||
|
||||
private String id;
|
||||
|
||||
RoomCreationPreset(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Matrix value for this setting.
|
||||
*
|
||||
* @return the value.
|
||||
*/
|
||||
public String get() {
|
||||
return id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* matrix-java-sdk - Matrix Client SDK for Java
|
||||
* Copyright (C) 2018 Kamax Sarl
|
||||
*
|
||||
* https://www.kamax.io/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.kamax.matrix.room;
|
||||
|
||||
/**
|
||||
* Room Directory visibility status available in the specification.
|
||||
*/
|
||||
public enum RoomDirectoryVisibility {
|
||||
|
||||
/**
|
||||
* The room will not be visible in the directory.
|
||||
*/
|
||||
Private("private"),
|
||||
|
||||
/**
|
||||
* The room will be visible by anyone, without authentication.
|
||||
*/
|
||||
Public("public");
|
||||
|
||||
private String id;
|
||||
|
||||
RoomDirectoryVisibility(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Matrix value for this setting.
|
||||
*
|
||||
* @return the value.
|
||||
*/
|
||||
public String get() {
|
||||
return id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* matrix-java-sdk - Matrix Client SDK for Java
|
||||
* Copyright (C) 2018 Arne Augenstein
|
||||
*
|
||||
* https://www.kamax.io/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.kamax.matrix.room;
|
||||
|
||||
/**
|
||||
* Room history visibility settings available in the specification.
|
||||
*/
|
||||
public enum RoomHistoryVisibility {
|
||||
|
||||
Invited("invited"),
|
||||
|
||||
Joined("joined"),
|
||||
|
||||
Shared("shared"),
|
||||
|
||||
WorldReadable("world_readable");
|
||||
|
||||
private String id;
|
||||
|
||||
RoomHistoryVisibility(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Matrix value for this setting.
|
||||
*
|
||||
* @return the value.
|
||||
*/
|
||||
public String get() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public boolean is(String id) {
|
||||
return this.id.contentEquals(id);
|
||||
}
|
||||
}
|
||||
49
src/main/java/io/kamax/matrix/room/Tag.java
Normal file
49
src/main/java/io/kamax/matrix/room/Tag.java
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* matrix-java-sdk - Matrix Client SDK for Java
|
||||
* Copyright (C) 2018 Arne Augenstein
|
||||
* Copyright (C) 2018 Kamax Sarl
|
||||
*
|
||||
* https://www.kamax.io/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.kamax.matrix.room;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class Tag {
|
||||
|
||||
private String namespace;
|
||||
private String name;
|
||||
private Double order;
|
||||
|
||||
public Tag(String namespace, String name, Double order) {
|
||||
this.namespace = namespace;
|
||||
this.name = name;
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
public String getNamespace() {
|
||||
return namespace;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Optional<Double> getOrder() {
|
||||
return Optional.ofNullable(order);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* matrix-java-sdk - Matrix Client SDK for Java
|
||||
* Copyright (C) 2018 Kamax Sarl
|
||||
*
|
||||
* https://www.kamax.io/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.kamax.matrix.room;
|
||||
|
||||
import io.kamax.matrix.event._MatrixPersistentEvent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Room messages pagination chunk.
|
||||
*/
|
||||
public interface _MatrixRoomMessageChunk {
|
||||
|
||||
/**
|
||||
* The token the pagination starts from.
|
||||
*
|
||||
* @return the token.
|
||||
*/
|
||||
String getStartToken();
|
||||
|
||||
/**
|
||||
* The token the pagination ends at.
|
||||
*
|
||||
* @return the token.
|
||||
*/
|
||||
String getEndToken();
|
||||
|
||||
/**
|
||||
* A list of room events.
|
||||
*
|
||||
* @return the list.
|
||||
*/
|
||||
List<_MatrixPersistentEvent> getEvents();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* matrix-java-sdk - Matrix Client SDK for Java
|
||||
* Copyright (C) 2018 Kamax Sarl
|
||||
*
|
||||
* https://www.kamax.io/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.kamax.matrix.room;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Possible options that can be passed to the room messages chunk call.
|
||||
*/
|
||||
public interface _MatrixRoomMessageChunkOptions {
|
||||
|
||||
/**
|
||||
* The direction to return events from.
|
||||
*/
|
||||
enum Direction {
|
||||
|
||||
/**
|
||||
* Fetch events backward.
|
||||
*/
|
||||
Backward("b"),
|
||||
|
||||
/**
|
||||
* Fetch events forward.
|
||||
*/
|
||||
Forward("f");
|
||||
|
||||
private String id;
|
||||
|
||||
Direction(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the protocol value.
|
||||
*
|
||||
* @return the value.
|
||||
*/
|
||||
public String get() {
|
||||
return id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The token to start returning events from.
|
||||
*
|
||||
* @return the token.
|
||||
*/
|
||||
String getFromToken();
|
||||
|
||||
/**
|
||||
* The token to stop returning events at, if any.
|
||||
*
|
||||
* @return the token.
|
||||
*/
|
||||
Optional<String> getToToken();
|
||||
|
||||
/**
|
||||
* The direction to return events from.
|
||||
*
|
||||
* @return the direction.
|
||||
*/
|
||||
String getDirection();
|
||||
|
||||
/**
|
||||
* The maximum number of events to return.
|
||||
*
|
||||
* @return the value.
|
||||
*/
|
||||
Optional<Long> getLimit();
|
||||
|
||||
}
|
||||
29
src/main/java/io/kamax/matrix/room/_RoomAliasLookup.java
Normal file
29
src/main/java/io/kamax/matrix/room/_RoomAliasLookup.java
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* matrix-java-sdk - Matrix Client SDK for Java
|
||||
* Copyright (C) 2018 Kamax Sàrl
|
||||
*
|
||||
* https://www.kamax.io/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.kamax.matrix.room;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface _RoomAliasLookup extends _RoomAliasMapping {
|
||||
|
||||
List<String> getServers();
|
||||
|
||||
}
|
||||
29
src/main/java/io/kamax/matrix/room/_RoomAliasMapping.java
Normal file
29
src/main/java/io/kamax/matrix/room/_RoomAliasMapping.java
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* matrix-java-sdk - Matrix Client SDK for Java
|
||||
* Copyright (C) 2018 Kamax Sàrl
|
||||
*
|
||||
* https://www.kamax.io/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.kamax.matrix.room;
|
||||
|
||||
public interface _RoomAliasMapping {
|
||||
|
||||
String getId();
|
||||
|
||||
String getAlias();
|
||||
|
||||
}
|
||||
99
src/main/java/io/kamax/matrix/room/_RoomCreationOptions.java
Normal file
99
src/main/java/io/kamax/matrix/room/_RoomCreationOptions.java
Normal file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* matrix-java-sdk - Matrix Client SDK for Java
|
||||
* Copyright (C) 2018 Kamax Sarl
|
||||
*
|
||||
* https://www.kamax.io/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.kamax.matrix.room;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
|
||||
import io.kamax.matrix._MatrixID;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Possible options that can be passed to the room creation call.
|
||||
*/
|
||||
public interface _RoomCreationOptions {
|
||||
|
||||
/**
|
||||
* Get the room directory visibility.
|
||||
*
|
||||
* @return the optional value.
|
||||
*/
|
||||
Optional<String> getVisibility();
|
||||
|
||||
/**
|
||||
* Get the desired room alias local part.
|
||||
*
|
||||
* @return the optional value.
|
||||
*/
|
||||
Optional<String> getAliasName();
|
||||
|
||||
/**
|
||||
* Get the room name.
|
||||
*
|
||||
* @return the optional value.
|
||||
*/
|
||||
Optional<String> getName();
|
||||
|
||||
/**
|
||||
* Get the room topic.
|
||||
*
|
||||
* @return the optional value.
|
||||
*/
|
||||
Optional<String> getTopic();
|
||||
|
||||
/**
|
||||
* Get the list of user Matrix IDs to invite to the room.
|
||||
*
|
||||
* @return the optional value.
|
||||
*/
|
||||
Optional<Set<_MatrixID>> getInvites();
|
||||
|
||||
/**
|
||||
* Get the extra keys to be added to the content of the m.room.create event.
|
||||
*
|
||||
* @return the optional value.
|
||||
*/
|
||||
Optional<Map<String, JsonElement>> getCreationContent();
|
||||
|
||||
/**
|
||||
* Get the convenience parameter for setting various default state events.
|
||||
*
|
||||
* @return the optional value.
|
||||
*/
|
||||
Optional<String> getPreset();
|
||||
|
||||
/**
|
||||
* What the is_direct flag on the m.room.member event for the invites should be set to.
|
||||
*
|
||||
* @return the optional value.
|
||||
*/
|
||||
Optional<Boolean> isDirect();
|
||||
|
||||
/**
|
||||
* Get guest allowance to join the room.
|
||||
*
|
||||
* @return the optional value.
|
||||
*/
|
||||
Optional<Boolean> isGuestCanJoin();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user