Пример #1
0
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
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
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
func topicCreate(topic, description string) {
	m := topicJSON{topic, description}
	jsonStr, err := json.Marshal(m)
	internal.Check(err)
	internal.PostWant("/topic", jsonStr)
}
Пример #5
0
func groupCreate(group, description string) {
	m := groupJSON{group, description}
	jsonStr, err := json.Marshal(m)
	internal.Check(err)
	internal.PostWant("/group", jsonStr)
}
Пример #6
0
func userPOST(path string) {
	internal.PostWant("/user"+path, nil)
}
Пример #7
0
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))
}