use of io.fabric8.letschat.RoomDTO in project fabric8 by fabric8io.
the class DevOpsConnector method getChatRoomLink.
protected String getChatRoomLink(LetsChatClient letschat) {
if (letschat != null) {
try {
String url = letschat.getAddress();
String slug = evaluateRoomExpression(letschatRoomExpression);
if (Strings.isNotBlank(url) && Strings.isNotBlank(slug)) {
RoomDTO room = letschat.getOrCreateRoom(slug);
if (room != null) {
String roomId = room.getId();
if (Strings.isNotBlank(roomId)) {
return URLUtils.pathJoin(url, "/#!/room/" + roomId);
}
}
}
} catch (Exception e) {
getLog().error("Failed to get the link to the chat room: " + e, e);
}
}
return null;
}
use of io.fabric8.letschat.RoomDTO in project fabric8 by fabric8io.
the class Example method main.
public static void main(String[] args) {
String roomName = "fabric8_default";
if (args.length > 0) {
roomName = args[0];
}
try {
KubernetesClient kubernetes = new DefaultKubernetesClient();
LetsChatClient letschat = LetsChatKubernetes.createLetsChat(kubernetes);
System.out.println("Connecting to letschat on: " + letschat.getAddress());
List<RoomDTO> rooms = letschat.getRooms();
for (RoomDTO room : rooms) {
System.out.println("Room " + room.getId() + " has slug: " + room.getSlug() + " name " + room.getName());
}
// looking up a room
RoomDTO myRoom = letschat.getRoom(roomName);
System.out.println("Found room: " + myRoom + " by slug: " + roomName);
RoomDTO notExist = letschat.getRoom("does-not-exist");
System.out.println("Found non existing room: " + notExist);
// lets try lazily create a room if it doesn't exist
RoomDTO newRoom = letschat.getOrCreateRoom("my_new_room_slug");
System.out.println("Found/created room: " + newRoom);
} catch (Exception e) {
System.out.println("Caught: " + e);
e.printStackTrace();
}
}
Aggregations