Beispiel #1
0
func topicDeleteParameter(topic string, keys []string) {
	for _, key := range keys {
		t := topicParameterJSON{Topic: topic, Key: key, Recursive: recursive}
		jsonStr, err := json.Marshal(t)
		internal.Check(err)
		internal.PutWant("/topic/remove/parameter", jsonStr)
	}
}
Beispiel #2
0
func groupAddDeleteUsers(method string, groupname string, users []string, path string) {
	for _, username := range users {
		t := groupUsernameJSON{groupname, username}
		jsonStr, err := json.Marshal(t)
		internal.Check(err)
		if method == "PUT" {
			internal.PutWant("/group"+path, jsonStr)
		} else {
			internal.DeleteWant("/group"+path, jsonStr)
		}
	}
}
Beispiel #3
0
func topicAddDeleteGroups(method string, topic string, groups []string, path string) {
	for _, groupname := range groups {
		t := topicGroupnameJSON{topic, groupname, recursive}
		jsonStr, err := json.Marshal(t)
		internal.Check(err)
		if method == "PUT" {
			internal.PutWant("/topic"+path, jsonStr)
		} else {
			internal.DeleteWant("/topic"+path, jsonStr)
		}
	}
}
Beispiel #4
0
func messageAction(action, topic, idReference, message, option string) {
	m := messageActionJSON{message, idReference, action, option}
	jsonStr, err := json.Marshal(m)
	internal.Check(err)
	if action == "remove" {
		internal.DeleteWant("/message/"+idReference, nil)
	} else if action == "like" || action == "unlike" ||
		action == "label" || action == "unlabel" ||
		action == "task" || action == "untask" ||
		action == "tag" || action == "untag" ||
		action == "update" {
		internal.PutWant("/message"+topic, jsonStr)
	} else {
		fmt.Print(internal.PostWant(fmt.Sprintf("/message%s", topic), jsonStr))
	}
}
Beispiel #5
0
func topicParam(topic string, maxLength int, canForceDate, canUpdateMsg, canDeleteMsg, canUpdateAllMsg, canDeleteAllMsg, isROPublic bool) {
	t := paramJSON{
		Topic:           topic,
		MaxLength:       maxLength,
		CanForceDate:    canForceDate,
		CanUpdateMsg:    canUpdateMsg,
		CanDeleteMsg:    canDeleteMsg,
		CanUpdateAllMsg: canUpdateAllMsg,
		CanDeleteAllMsg: canDeleteAllMsg,
		IsROPublic:      isROPublic,
		Recursive:       recursive,
	}
	jsonStr, err := json.Marshal(t)
	internal.Check(err)
	internal.PutWant("/topic/param", jsonStr)
}
Beispiel #6
0
func setAdminUserAction(username string) {
	m := usernameUserJSON{username}
	jsonStr, err := json.Marshal(m)
	internal.Check(err)
	internal.PutWant("/user/setadmin", jsonStr)
}
Beispiel #7
0
func renameUserAction(username, newUsername string) {
	m := renameUserJSON{username, newUsername}
	jsonStr, err := json.Marshal(m)
	internal.Check(err)
	internal.PutWant("/user/rename", jsonStr)
}
Beispiel #8
0
func archiveUserAction(username string) {
	m := usernameUserJSON{username}
	jsonStr, err := json.Marshal(m)
	internal.Check(err)
	internal.PutWant("/user/archive", jsonStr)
}