org.igniterealtime.restclient.Apl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rest-api-client Show documentation
Show all versions of rest-api-client Show documentation
Java REST API Client for the Openfire to manage Openfire instances by sending an REST/HTTP request to the server
package org.igniterealtime.restclient;
import java.util.ArrayList;
import java.util.List;
import org.igniterealtime.restclient.entity.AuthenticationToken;
import org.igniterealtime.restclient.entity.GroupEntity;
import org.igniterealtime.restclient.entity.RosterItemEntity;
import org.igniterealtime.restclient.entity.SystemProperty;
import org.igniterealtime.restclient.entity.UserGroupsEntity;
public class Apl {
public static void main(String[] args) {
AuthenticationToken token = new AuthenticationToken("PehtV8mbAm5M5MM0");
RestApiClient restApiClient = new RestApiClient("http://localhost", 9090, token);
// restApiCient.getFilteredUsers("user1");
// UserEntity userEntity = new UserEntity("user1", "name", "[email protected]", "12345");
// restApiCient.createUser(userEntity);
// restApiCient.getSessions("romant");
// restApiCient.getUser("admin");
// restApiClient.getUserGroups("admin");
//
// List groupNames = new ArrayList();
// groupNames.add("Moderators");
// groupNames.add("Supporters");
// UserGroupsEntity userGroupsEntity = new UserGroupsEntity(groupNames);
// restApiClient.addUserToGroups("admin", userGroupsEntity);
//
// restApiClient.lockoutUser("kafka");
// restApiClient.unlockUser("kafka");
// restApiClient.getChatRoomParticipants("global1");
// restApiClient.getSystemProperties();
// SystemProperty systemProperty = new SystemProperty("propertyName", "propertyValue");
// restApiClient.createSystemProperty(systemProperty);
// SystemProperty systemProperty = new SystemProperty("propertyName", "ChangedPropertyValue");
// restApiClient.updateSystemProperty(systemProperty);
// restApiClient.getSystemProperty("propertyName");
// restApiClient.deleteSystemProperty(systemProperty.getKey());
// GroupEntity groupEntity = new GroupEntity("Moderators", "Moderator Group");
// restApiClient.createGroup(groupEntity);
// GroupEntity groupEntity = new GroupEntity("Moderators", "Changed Moderator Group description");
// restApiClient.updateGroup(groupEntity);
// restApiClient.getGroup("Moderators");
//
// restApiClient.deleteGroup("Moderators");
// restApiClient.getRoster("admin111");
// Possible numeric values are: -1 (remove), 0 (none), 1 (to), 2 (from), 3 (both)
RosterItemEntity rosterItemEntity = new RosterItemEntity("[email protected]", "TestUser55", 3);
List groups = new ArrayList();
groups.add("Supporter");
rosterItemEntity.setGroups(groups);
// restApiClient.addRosterEntry("admin111", rosterItemEntity);
restApiClient.updateRosterEntry("admin111", rosterItemEntity);
// restApiClient.deleteRosterEntry("admin111", "[email protected]");
}
}