示例#1
0
文件: add.go 项目: bnjjj/tatcli
func messageCreate(topic, message string) {
	m := messageJSON{Text: message}
	if dateCreation > 0 {
		m.DateCreation = dateCreation
	}
	jsonStr, err := json.Marshal(m)
	if err != nil {
		panic(err)
	}
	fmt.Print(internal.PostWant("/message"+topic, jsonStr))
}
示例#2
0
文件: reset.go 项目: bnjjj/tatcli
func userReset(username, email string) {
	ssl := ""
	if internal.SSLInsecureSkipVerify {
		ssl = "--sslInsecureSkipVerify=true"
	}

	m := userJSON{
		Username: username,
		Email:    email,
		Callback: fmt.Sprintf("tatcli %s --url=:scheme://:host::port:path user verify --save :username :token", ssl),
	}
	jsonStr, err := json.Marshal(m)
	internal.Check(err)
	fmt.Printf(internal.PostWant("/user/reset", 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
文件: create.go 项目: bnjjj/tatcli
func topicCreate(topic, description string) {
	m := topicJSON{topic, description}
	jsonStr, err := json.Marshal(m)
	internal.Check(err)
	internal.PostWant("/topic", jsonStr)
}
示例#5
0
文件: create.go 项目: bnjjj/tatcli
func groupCreate(group, description string) {
	m := groupJSON{group, description}
	jsonStr, err := json.Marshal(m)
	internal.Check(err)
	internal.PostWant("/group", jsonStr)
}
示例#6
0
文件: user.go 项目: bnjjj/tatcli
func userPOST(path string) {
	internal.PostWant("/user"+path, nil)
}
示例#7
0
文件: add.go 项目: bnjjj/tatcli
func userAdd(username, email, fullname string) {
	m := userJSON{username, fullname, email, "tatcli --url=:scheme://:host::port:path user verify --save :username :token"}
	jsonStr, err := json.Marshal(m)
	internal.Check(err)
	fmt.Printf(internal.PostWant("/user", jsonStr))
}