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) } }
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) } } }
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) } } }
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)) } }
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) }
func setAdminUserAction(username string) { m := usernameUserJSON{username} jsonStr, err := json.Marshal(m) internal.Check(err) internal.PutWant("/user/setadmin", jsonStr) }
func renameUserAction(username, newUsername string) { m := renameUserJSON{username, newUsername} jsonStr, err := json.Marshal(m) internal.Check(err) internal.PutWant("/user/rename", jsonStr) }
func archiveUserAction(username string) { m := usernameUserJSON{username} jsonStr, err := json.Marshal(m) internal.Check(err) internal.PutWant("/user/archive", jsonStr) }