예제 #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)
	}
}
예제 #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)
		}
	}
}
예제 #3
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)
		}
	}
}
예제 #4
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))
	}
}
예제 #5
0
파일: parameter.go 프로젝트: bnjjj/tatcli
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)
}
예제 #6
0
파일: set_admin.go 프로젝트: bnjjj/tatcli
func setAdminUserAction(username string) {
	m := usernameUserJSON{username}
	jsonStr, err := json.Marshal(m)
	internal.Check(err)
	internal.PutWant("/user/setadmin", jsonStr)
}
예제 #7
0
파일: rename.go 프로젝트: bnjjj/tatcli
func renameUserAction(username, newUsername string) {
	m := renameUserJSON{username, newUsername}
	jsonStr, err := json.Marshal(m)
	internal.Check(err)
	internal.PutWant("/user/rename", jsonStr)
}
예제 #8
0
파일: archive.go 프로젝트: bnjjj/tatcli
func archiveUserAction(username string) {
	m := usernameUserJSON{username}
	jsonStr, err := json.Marshal(m)
	internal.Check(err)
	internal.PutWant("/user/archive", jsonStr)
}