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