示例#1
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)
		}
	}
}
示例#2
0
文件: topic.go 项目: bnjjj/tatcli
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)
		}
	}
}
示例#3
0
文件: message.go 项目: bnjjj/tatcli
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))
	}
}
示例#4
0
文件: user.go 项目: bnjjj/tatcli
func userDelete(path string) {
	internal.DeleteWant("/user"+path, nil)
}