Documentation ¶
Index ¶
- Constants
- Variables
- func ArrayContains(array []string, element string) bool
- func CheckAndFixNameTopic(topicName string) (string, error)
- func DateFromFloat(in float64) time.Time
- func Error(err error) (int, interface{})
- func GetDateRef(pattern string) (time.Time, error)
- func ItemInBothArrays(arrayA, arrayB []string) bool
- func NewError(code int, format string, a ...interface{}) error
- func Round(f float64) float64
- func SplitFloatForTimeUnix(in float64) (int64, int64)
- func Sprint(v interface{}) ([]byte, error)
- func TSFromDate(in time.Time) float64
- func TSFromNow() float64
- type APIError
- type Auth
- type Author
- type CacheableCriteria
- type CapabilitieHook
- type Capabilities
- type CheckTopicsUserJSON
- type Client
- func (c *Client) GroupAddAdminUsers(groupname string, users []string) error
- func (c *Client) GroupAddUsers(groupname string, users []string) error
- func (c *Client) GroupCreate(g GroupJSON) (*Group, error)
- func (c *Client) GroupDelete(groupname string) error
- func (c *Client) GroupDeleteAdminUsers(groupname string, users []string) error
- func (c *Client) GroupDeleteUsers(groupname string, users []string) error
- func (c *Client) GroupList(skip, limit int) (*GroupsJSON, error)
- func (c *Client) GroupUpdate(groupname, newGroupname, newDescription string) error
- func (c *Client) IsHTTPS() bool
- func (c *Client) MessageAdd(message MessageJSON) (*MessageJSONOut, error)
- func (c *Client) MessageAddBulk(messages []MessageJSON) ([]MessageJSONOut, error)
- func (c *Client) MessageConcat(topic, idMessage string, addText string) (*MessageJSONOut, error)
- func (c *Client) MessageCount(topic string, criteria *MessageCriteria) (*MessagesCountJSON, error)
- func (c *Client) MessageDelete(id, topic string, cascade bool, cascadeForce bool) ([]byte, error)
- func (c *Client) MessageLabel(topic, idMessage string, label Label) (*MessageJSONOut, error)
- func (c *Client) MessageLike(topic, idMessage string) (*MessageJSONOut, error)
- func (c *Client) MessageList(topic string, criteria *MessageCriteria) (*MessagesJSON, error)
- func (c *Client) MessageMove(oldTopic, idMessage, newTopic string) ([]byte, error)
- func (c *Client) MessageRelabel(topic, idMessage string, labels []Label, options []string) (*MessageJSONOut, error)
- func (c *Client) MessageRelabelOrCreate(msg MessageJSON) (*MessageJSONOut, error)
- func (c *Client) MessageReply(topic, idMessage string, reply string) (*MessageJSONOut, error)
- func (c *Client) MessageTask(topic, idMessage string) (*MessageJSONOut, error)
- func (c *Client) MessageUnVoteDown(topic, idMessage string) (*MessageJSONOut, error)
- func (c *Client) MessageUnVoteUP(topic, idMessage string) (*MessageJSONOut, error)
- func (c *Client) MessageUnlabel(topic, idMessage, label string) (*MessageJSONOut, error)
- func (c *Client) MessageUnlike(topic, idMessage string) (*MessageJSONOut, error)
- func (c *Client) MessageUntask(topic, idMessage string) (*MessageJSONOut, error)
- func (c *Client) MessageUpdate(topic, idMessage string, newText string) (*MessageJSONOut, error)
- func (c *Client) MessageVoteDown(topic, idMessage string) (*MessageJSONOut, error)
- func (c *Client) MessageVoteUP(topic, idMessage string) (*MessageJSONOut, error)
- func (c *Client) MessagesDeleteBulk(topic string, cascade bool, cascadeForce bool, criteria MessageCriteria) ([]byte, error)
- func (c *Client) PresenceAddAndGet(topic, status string) (*PresencesJSON, error)
- func (c *Client) PresenceDelete(topic, username string) error
- func (c *Client) PresenceList(topic string, skip, limit int) (*PresencesJSON, error)
- func (c *Client) StatsCount() (*StatsCountJSON, error)
- func (c *Client) StatsDBCollections() ([]byte, error)
- func (c *Client) StatsDBReplSetGetConfig() ([]byte, error)
- func (c *Client) StatsDBReplSetGetStatus() ([]byte, error)
- func (c *Client) StatsDBServerStatus() ([]byte, error)
- func (c *Client) StatsDBSlowestQueries() ([]byte, error)
- func (c *Client) StatsDBStats() ([]byte, error)
- func (c *Client) StatsDistributionTopics(skip, limit int) (*StatsDistributionTopicsJSON, error)
- func (c *Client) StatsInstance() ([]byte, error)
- func (c *Client) SystemCacheClean() ([]byte, error)
- func (c *Client) SystemCacheInfo() ([]byte, error)
- func (c *Client) TopicAddAdminGroups(topic string, groups []string, recursive bool) error
- func (c *Client) TopicAddAdminUsers(topic string, users []string, recursive bool) error
- func (c *Client) TopicAddFilter(filter Filter) ([]byte, error)
- func (c *Client) TopicAddParameter(topic, key, value string, recursive bool) ([]byte, error)
- func (c *Client) TopicAddRoGroups(topic string, groups []string, recursive bool) error
- func (c *Client) TopicAddRoUsers(topic string, users []string, recursive bool) error
- func (c *Client) TopicAddRwGroups(topic string, groups []string, recursive bool) error
- func (c *Client) TopicAddRwUsers(topic string, users []string, recursive bool) error
- func (c *Client) TopicAllComputeLabels() ([]byte, error)
- func (c *Client) TopicAllComputeReplies() ([]byte, error)
- func (c *Client) TopicAllComputeTags() ([]byte, error)
- func (c *Client) TopicAllSetParam(p ParamJSON) ([]byte, error)
- func (c *Client) TopicComputeLabels(t TopicNameJSON) ([]byte, error)
- func (c *Client) TopicComputeTags(t TopicNameJSON) ([]byte, error)
- func (c *Client) TopicCreate(t TopicCreateJSON) (*Topic, error)
- func (c *Client) TopicDelete(t TopicNameJSON) ([]byte, error)
- func (c *Client) TopicDeleteAdminGroups(topic string, groups []string, recursive bool) error
- func (c *Client) TopicDeleteAdminUsers(topic string, users []string, recursive bool) error
- func (c *Client) TopicDeleteParameters(topic string, params []string, recursive bool) error
- func (c *Client) TopicDeleteRoGroups(topic string, groups []string, recursive bool) error
- func (c *Client) TopicDeleteRoUsers(topic string, users []string, recursive bool) error
- func (c *Client) TopicDeleteRwGroups(topic string, groups []string, recursive bool) error
- func (c *Client) TopicDeleteRwUsers(topic string, users []string, recursive bool) error
- func (c *Client) TopicList(criteria *TopicCriteria) (*TopicsJSON, error)
- func (c *Client) TopicOne(topic string) (*TopicJSON, error)
- func (c *Client) TopicParameter(params TopicParameters) ([]byte, error)
- func (c *Client) TopicRemoveFilter(filter Filter) ([]byte, error)
- func (c *Client) TopicTruncate(t TopicNameJSON) ([]byte, error)
- func (c *Client) TopicTruncateLabels(t TopicNameJSON) ([]byte, error)
- func (c *Client) TopicTruncateTags(t TopicNameJSON) ([]byte, error)
- func (c *Client) TopicUpdateFilter(filter Filter) ([]byte, error)
- func (c *Client) UserAdd(u UserCreateJSON) ([]byte, error)
- func (c *Client) UserAddContact(toAdd string) ([]byte, error)
- func (c *Client) UserAddFavoriteTag(toAdd string) ([]byte, error)
- func (c *Client) UserAddFavoriteTopic(toAdd string) ([]byte, error)
- func (c *Client) UserArchive(username string) error
- func (c *Client) UserCheck(check CheckTopicsUserJSON) ([]byte, error)
- func (c *Client) UserContacts(sinceSeconds int) ([]byte, error)
- func (c *Client) UserConvertToSystem(s ConvertUserJSON) ([]byte, error)
- func (c *Client) UserDisableNotificationsAllTopics() ([]byte, error)
- func (c *Client) UserDisableNotificationsTopic(topic string) ([]byte, error)
- func (c *Client) UserEnableNotificationsAllTopics() ([]byte, error)
- func (c *Client) UserEnableNotificationsTopic(topic string) ([]byte, error)
- func (c *Client) UserList(criteria *UserCriteria) (*UsersJSON, error)
- func (c *Client) UserMe() (*UserJSON, error)
- func (c *Client) UserRemoveContact(toRemove string) ([]byte, error)
- func (c *Client) UserRemoveFavoriteTag(toRemove string) ([]byte, error)
- func (c *Client) UserRemoveFavoriteTopic(toRemove string) ([]byte, error)
- func (c *Client) UserRename(v RenameUserJSON) ([]byte, error)
- func (c *Client) UserReset(v UserResetJSON) ([]byte, error)
- func (c *Client) UserResetSystem(v UsernameUserJSON) ([]byte, error)
- func (c *Client) UserSetAdmin(u UsernameUserJSON) ([]byte, error)
- func (c *Client) UserUpdate(v UpdateUserJSON) ([]byte, error)
- func (c *Client) UserUpdateSystem(u ConvertUserJSON) ([]byte, error)
- func (c *Client) UserVerify(username, tokenVerify string) (*VerifyJSON, error)
- func (c *Client) Version() ([]byte, error)
- type Contact
- type ContactsJSON
- type ConvertUserJSON
- type Filter
- type FilterCriteria
- type Group
- type GroupCriteria
- type GroupJSON
- type GroupsJSON
- type Hook
- type HookJSON
- type HookMessageJSON
- type Label
- type Message
- type MessageCriteria
- type MessageJSON
- type MessageJSONOut
- type MessageReferenceJSON
- type MessagesCountJSON
- type MessagesJSON
- type MessagesJSONIn
- type Options
- type ParamGroupUserJSON
- type ParamJSON
- type ParamTopicGroupJSON
- type ParamTopicUserJSON
- type Presence
- type PresenceCriteria
- type PresenceJSON
- type PresenceJSONOut
- type PresencesJSON
- type RenameUserJSON
- type StatsCountJSON
- type StatsDistributionTopicsJSON
- type Topic
- type TopicCreateJSON
- type TopicCriteria
- type TopicDistributionJSON
- type TopicJSON
- type TopicNameJSON
- type TopicParameter
- type TopicParameterJSON
- type TopicParameters
- type TopicsJSON
- type UpdateUserJSON
- type User
- type UserCreateJSON
- type UserCriteria
- type UserJSON
- type UserPresence
- type UserResetJSON
- type UsernameUserJSON
- type UsersJSON
- type VerifyJSON
Constants ¶
const ( // DefaultMessageMaxSize is max size of message, can be overrided by topic DefaultMessageMaxSize = 140 // DefaultMessageMaxReplies is max number of replies on a message, can be overrided by topic DefaultMessageMaxReplies = 30 // True in url http way -> string True = "true" // False in url http way -> string False = "false" // TreeViewNoTree is default value TreeViewNoTree = "notree" // TreeViewOneTree is onetree value for treeView TreeViewOneTree = "onetree" // TreeViewFullTree is fulltree value for treeView TreeViewFullTree = "fulltree" // MessageActionCreate for create a message MessageActionCreate = "create" // MessageActionUpdate for update action on a message MessageActionUpdate = "update" // MessageActionReply for "reply action on a message MessageActionReply = "reply" // MessageActionLike for "like action on a message MessageActionLike = "like" // MessageActionUnlike for unlike action on a message MessageActionUnlike = "unlike" // MessageActionLabel for "label action on a message MessageActionLabel = "label" // MessageActionUnlabel for nlabel action on a message MessageActionUnlabel = "unlabel" // MessageActionVoteup for voteup action on a message MessageActionVoteup = "voteup" // MessageActionVotedown for tedown action on a message MessageActionVotedown = "votedown" // MessageActionUnvoteup for voteup action on a message MessageActionUnvoteup = "unvoteup" // MessageActionUnvotedown for tedown action on a message MessageActionUnvotedown = "unvotedown" // MessageActionRelabel for relabel action on a message MessageActionRelabel = "relabel" // MessageActionRelabelOrCreate for relabeloradd action on a message MessageActionRelabelOrCreate = "relabelorcreate" // MessageActionConcat for concat action on a message MessageActionConcat = "concat" // MessageActionMove for move action on a message MessageActionMove = "move" // MessageActionTask for task action on a message MessageActionTask = "task" // MessageActionUntask for untask action on a message MessageActionUntask = "untask" )
const ( // TatHeaderUsername is Tat_username header TatHeaderUsername = "Tat_username" // TatHeaderPassword is Tat_password header TatHeaderPassword = "Tat_password" // TatHeaderXTatRefererLower contains tat microservice name & version "X-TAT-FROM" TatHeaderXTatRefererLower = "X-Tat-Referer" )
const Version = "5.0.2"
Version of Tat One Line for this, used by release.sh script Keep "const Version on one line"
Variables ¶
var ( HookTypeWebHook = "tathook-webhook" HookTypeKafka = "tathook-kafka" HookTypeXMPP = "tathook-xmpp" HookTypeXMPPOut = "tathook-xmpp-out" HookTypeXMPPIn = "tathook-xmpp-in" )
var DebugLogFunc = log.Printf //func(string, ...interface{})
DebugLogFunc is a function that logs the provided message with optional fmt.Sprintf-style arguments. By default, logs to the default log.Logger.
var ErrClientNotInitiliazed = fmt.Errorf("Client is not initialized")
ErrClientNotInitiliazed is a predifined Error
var ErrorLogFunc = log.Printf
ErrorLogFunc is a function that logs the provided message with optional fmt.Sprintf-style arguments. By default, logs to the default log.Logger.
var HTTPClient httpClient
HTTPClient is HTTClient or testHTTPClient for tests
var HookTat2XMPPHeaderKey = "Tat2xmppkey"
var HooksType = []string{HookTypeWebHook, HookTypeKafka, HookTypeXMPP, HookTypeXMPPOut, HookTypeXMPPIn}
var IsDebug = false
IsDebug display request / response in ErrorLogFunc if true
Functions ¶
func ArrayContains ¶
ArrayContains return true if element is in array
func CheckAndFixNameTopic ¶
CheckAndFixNameTopic Add a / to topic name is it is not present return an error if length of name is < 4 or > 100
func DateFromFloat ¶
DateFromFloat returns a time.Time from a float
func ItemInBothArrays ¶
ItemInBothArrays return true if an element is in both array
func SplitFloatForTimeUnix ¶
SplitFloatForTimeUnix returns a.b a and b, b with 9 numbers then, time.Unix(a,b) for initialize date from a float64
Types ¶
type Auth ¶
type Auth struct { HashedPassword string `bson:"hashedPassword" json:"-"` HashedTokenVerify string `bson:"hashedTokenVerify" json:"-"` DateRenewPassword int64 `bson:"dateRenewPassword" json:"dateRenewPassword"` DateAskReset int64 `bson:"dateAskReset" json:"dateAskReset"` DateVerify int64 `bson:"dateVerify" json:"dateVerify"` EmailVerified bool `bson:"emailVerified" json:"emailVerified"` }
Auth User Struct
type Author ¶
type Author struct { Username string `bson:"username" json:"username"` Fullname string `bson:"fullname" json:"fullname"` }
Author struct
type CacheableCriteria ¶
type CacheableCriteria interface {
CacheKey() []string
}
CacheableCriteria must return strnig slice describing the redis key
type CapabilitieHook ¶
type Capabilities ¶
type Capabilities struct { UsernameFromEmail bool `json:"username_from_email"` Hooks []CapabilitieHook `json:"hooks"` }
type CheckTopicsUserJSON ¶
type CheckTopicsUserJSON struct { Username string `json:"username" binding:"required"` FixPrivateTopics bool `json:"fixPrivateTopics" binding:"required"` FixDefaultGroup bool `json:"fixDefaultGroup" binding:"required"` }
CheckTopicsUserJSON used to check if user have default topics
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a Client configuration to connect to api
func (*Client) GroupAddAdminUsers ¶
GroupAddAdminUsers adds an admin user on a group
func (*Client) GroupAddUsers ¶
GroupAddUsers adds users on a group
func (*Client) GroupCreate ¶
GroupCreate creates a group
func (*Client) GroupDelete ¶
GroupDelete delete a group
func (*Client) GroupDeleteAdminUsers ¶
GroupDeleteAdminUsers removes admin users from a group
func (*Client) GroupDeleteUsers ¶
GroupDeleteUsers deletes users from a group
func (*Client) GroupList ¶
func (c *Client) GroupList(skip, limit int) (*GroupsJSON, error)
GroupList returns groups
func (*Client) GroupUpdate ¶
GroupUpdate updates a group
func (*Client) MessageAdd ¶
func (c *Client) MessageAdd(message MessageJSON) (*MessageJSONOut, error)
MessageAdd post a tat message
func (*Client) MessageAddBulk ¶
func (c *Client) MessageAddBulk(messages []MessageJSON) ([]MessageJSONOut, error)
MessageAddBulk post many tat message (root msg or replies)
func (*Client) MessageConcat ¶
func (c *Client) MessageConcat(topic, idMessage string, addText string) (*MessageJSONOut, error)
MessageConcat is same as: ```
curl -XPUT \ -H 'Content-Type: application/json' \ -H "Tat_username: username" \ -H "Tat_password: passwordOfUser" \ -d '{ "idReference": "9797q87KJhqsfO7Usdqd", "action": "concat", "text": " additional text"}'\ https://<tatHostname>:<tatPort>/message/topic/sub-topic
```
func (*Client) MessageCount ¶
func (c *Client) MessageCount(topic string, criteria *MessageCriteria) (*MessagesCountJSON, error)
MessageCount count messages on a topic according to criterias
func (*Client) MessageDelete ¶
MessageDelete delete a message. cascade : delete message and its replies. cascadeForce : delete message and its replies, event if it's in a Tasks Topic of one user
func (*Client) MessageLabel ¶
func (c *Client) MessageLabel(topic, idMessage string, label Label) (*MessageJSONOut, error)
MessageLabel add a label to a message
func (*Client) MessageLike ¶
func (c *Client) MessageLike(topic, idMessage string) (*MessageJSONOut, error)
MessageLike add a like to a message
func (*Client) MessageList ¶
func (c *Client) MessageList(topic string, criteria *MessageCriteria) (*MessagesJSON, error)
MessageList lists messages on a topic according to criterias
func (*Client) MessageMove ¶
MessageMove moves a message from a topic to another
func (*Client) MessageRelabel ¶
func (c *Client) MessageRelabel(topic, idMessage string, labels []Label, options []string) (*MessageJSONOut, error)
MessageRelabel removes all labels and add new ones to a message
func (*Client) MessageRelabelOrCreate ¶
func (c *Client) MessageRelabelOrCreate(msg MessageJSON) (*MessageJSONOut, error)
MessageRelabelOrCreate removes all labels and add new ones to a message if message exists, create message otherwise
msg := tat.MessageJSON{ Text: "a text with a #tag", Labels: []tat.Label{{Text:"textLabel", Color:"red"}}, TagReference: "a #tag", Topic: "/Internal/YourTopic", } if _, err := getClient().MessageRelabelOrCreate(msg); err != nil { return fmt.Errorf("Error while MessageAdd:%s", err) }
func (*Client) MessageReply ¶
func (c *Client) MessageReply(topic, idMessage string, reply string) (*MessageJSONOut, error)
MessageReply post a reply to a message
func (*Client) MessageTask ¶
func (c *Client) MessageTask(topic, idMessage string) (*MessageJSONOut, error)
MessageTask creates a task from a message
func (*Client) MessageUnVoteDown ¶
func (c *Client) MessageUnVoteDown(topic, idMessage string) (*MessageJSONOut, error)
MessageUnVoteDown removes a vote down
func (*Client) MessageUnVoteUP ¶
func (c *Client) MessageUnVoteUP(topic, idMessage string) (*MessageJSONOut, error)
MessageUnVoteUP removes a vote UP from a message
func (*Client) MessageUnlabel ¶
func (c *Client) MessageUnlabel(topic, idMessage, label string) (*MessageJSONOut, error)
MessageUnlabel removes a label from one message
func (*Client) MessageUnlike ¶
func (c *Client) MessageUnlike(topic, idMessage string) (*MessageJSONOut, error)
MessageUnlike removes a like from a message
func (*Client) MessageUntask ¶
func (c *Client) MessageUntask(topic, idMessage string) (*MessageJSONOut, error)
MessageUntask removes doing and doing:username label from a message
func (*Client) MessageUpdate ¶
func (c *Client) MessageUpdate(topic, idMessage string, newText string) (*MessageJSONOut, error)
MessageUpdate updates a message
func (*Client) MessageVoteDown ¶
func (c *Client) MessageVoteDown(topic, idMessage string) (*MessageJSONOut, error)
MessageVoteDown add a vote down to a message
func (*Client) MessageVoteUP ¶
func (c *Client) MessageVoteUP(topic, idMessage string) (*MessageJSONOut, error)
MessageVoteUP add a vote UP to a message
func (*Client) MessagesDeleteBulk ¶
func (c *Client) MessagesDeleteBulk(topic string, cascade bool, cascadeForce bool, criteria MessageCriteria) ([]byte, error)
MessagesDeleteBulk Delete a list of messages delete message and its replies. cascadeForce : delete message and its replies, event if it's in a Tasks Topic of one user
func (*Client) PresenceAddAndGet ¶
func (c *Client) PresenceAddAndGet(topic, status string) (*PresencesJSON, error)
PresenceAddAndGet adds a new presence and get presences on topic
func (*Client) PresenceDelete ¶
PresenceDelete deletes a presence
func (*Client) PresenceList ¶
func (c *Client) PresenceList(topic string, skip, limit int) (*PresencesJSON, error)
PresenceList returns presences on topic
func (*Client) StatsCount ¶
func (c *Client) StatsCount() (*StatsCountJSON, error)
StatsCount calls GET /stats/count
func (*Client) StatsDBCollections ¶
StatsDBCollections returns nb msg for each collections
func (*Client) StatsDBReplSetGetConfig ¶
StatsDBReplSetGetConfig returns DB Relica Set Config
func (*Client) StatsDBReplSetGetStatus ¶
StatsDBReplSetGetStatus returns Replica Set Status
func (*Client) StatsDBServerStatus ¶
StatsDBServerStatus returns DB Server Status
func (*Client) StatsDBSlowestQueries ¶
StatsDBSlowestQueries returns DB slowest Queries
func (*Client) StatsDBStats ¶
StatsDBStats returns DB Stats
func (*Client) StatsDistributionTopics ¶
func (c *Client) StatsDistributionTopics(skip, limit int) (*StatsDistributionTopicsJSON, error)
StatsDistributionTopics returns Stats Distribution per topics and per users
func (*Client) StatsInstance ¶
StatsInstance returns DB Instance
func (*Client) SystemCacheClean ¶
SystemCacheClean clean cache, only for tat admin
func (*Client) SystemCacheInfo ¶
SystemCacheInfo returns cache information
func (*Client) TopicAddAdminGroups ¶
TopicAddAdminGroups adds admin groups on a topic
func (*Client) TopicAddAdminUsers ¶
TopicAddAdminUsers adds admin users on a topic
func (*Client) TopicAddFilter ¶
TopicAddFilter adds a filter on a topic
func (*Client) TopicAddParameter ¶
TopicAddParameter adds a parameter on a topic
func (*Client) TopicAddRoGroups ¶
TopicAddRoGroups adds a read-only group on a topic
func (*Client) TopicAddRoUsers ¶
TopicAddRoUsers adds a read-only user on a topic
func (*Client) TopicAddRwGroups ¶
TopicAddRwGroups adds a read-write group on a topic
func (*Client) TopicAddRwUsers ¶
TopicAddRwUsers adds a read-write user on a topic
func (*Client) TopicAllComputeLabels ¶
TopicAllComputeLabels computes labels on all topics
func (*Client) TopicAllComputeReplies ¶
TopicAllComputeReplies computes replies on all topics
func (*Client) TopicAllComputeTags ¶
TopicAllComputeTags computes tags on all topics
func (*Client) TopicAllSetParam ¶
TopicAllSetParam sets a param on all topics
func (*Client) TopicComputeLabels ¶
func (c *Client) TopicComputeLabels(t TopicNameJSON) ([]byte, error)
TopicComputeLabels computes labels on a topic
func (*Client) TopicComputeTags ¶
func (c *Client) TopicComputeTags(t TopicNameJSON) ([]byte, error)
TopicComputeTags computes tags on a topic
func (*Client) TopicCreate ¶
func (c *Client) TopicCreate(t TopicCreateJSON) (*Topic, error)
TopicCreate creates a topic
func (*Client) TopicDelete ¶
func (c *Client) TopicDelete(t TopicNameJSON) ([]byte, error)
TopicDelete delete a topics
func (*Client) TopicDeleteAdminGroups ¶
TopicDeleteAdminGroups deletes some admin groups on a topic
func (*Client) TopicDeleteAdminUsers ¶
TopicDeleteAdminUsers deletes some admin users on a topic
func (*Client) TopicDeleteParameters ¶
TopicDeleteParameters removes a parameter on a topic
func (*Client) TopicDeleteRoGroups ¶
TopicDeleteRoGroups deletes a read-only group on a topic
func (*Client) TopicDeleteRoUsers ¶
TopicDeleteRoUsers deletes a read-only user on a topic
func (*Client) TopicDeleteRwGroups ¶
TopicDeleteRwGroups deletes some read-write groups on a topic
func (*Client) TopicDeleteRwUsers ¶
TopicDeleteRwUsers deletes some read-write users on a topic
func (*Client) TopicList ¶
func (c *Client) TopicList(criteria *TopicCriteria) (*TopicsJSON, error)
TopicList list all topics according to criterias. Default behavior (criteria is Nil) will limit 10 topics.
func (*Client) TopicParameter ¶
func (c *Client) TopicParameter(params TopicParameters) ([]byte, error)
TopicParameter updates param on one topic
func (*Client) TopicRemoveFilter ¶
TopicDeleteFilters removes a filter on a topic
func (*Client) TopicTruncate ¶
func (c *Client) TopicTruncate(t TopicNameJSON) ([]byte, error)
TopicTruncate deletes all messages in a topic
func (*Client) TopicTruncateLabels ¶
func (c *Client) TopicTruncateLabels(t TopicNameJSON) ([]byte, error)
TopicTruncateLabels removes all labels computed on topic
func (*Client) TopicTruncateTags ¶
func (c *Client) TopicTruncateTags(t TopicNameJSON) ([]byte, error)
TopicTruncateTags removes all tags computed on topic
func (*Client) TopicUpdateFilter ¶
TopicUpdateFilters removes a filter on a topic
func (*Client) UserAdd ¶
func (c *Client) UserAdd(u UserCreateJSON) ([]byte, error)
UserAdd creates a new user if callback is "", "tatcli --url=:scheme://:host::port:path user verify --save :username :token" will be used
func (*Client) UserAddContact ¶
UserAddContact adds a contact
func (*Client) UserAddFavoriteTag ¶
UserAddFavoriteTag adds a favorite tag to current user
func (*Client) UserAddFavoriteTopic ¶
UserAddFavoriteTopic adds a favorite topic on current user
func (*Client) UserArchive ¶
UserArchive archives a user
func (*Client) UserCheck ¶
func (c *Client) UserCheck(check CheckTopicsUserJSON) ([]byte, error)
UserCheck checks if user have default topics
func (*Client) UserContacts ¶
UserContacts returns contacts presences since n seconds
func (*Client) UserConvertToSystem ¶
func (c *Client) UserConvertToSystem(s ConvertUserJSON) ([]byte, error)
UserConvertToSystem converts a user to a system user
func (*Client) UserDisableNotificationsAllTopics ¶
UserDisableNotificationsAllTopics disable notification on all topics
func (*Client) UserDisableNotificationsTopic ¶
UserDisableNotificationsTopic disables notifications on one topic
func (*Client) UserEnableNotificationsAllTopics ¶
UserEnableNotificationsAllTopics enables notification on all topics
func (*Client) UserEnableNotificationsTopic ¶
UserEnableNotificationsTopic enables notifications on one topic
func (*Client) UserList ¶
func (c *Client) UserList(criteria *UserCriteria) (*UsersJSON, error)
UserList returns all users
func (*Client) UserRemoveContact ¶
UserRemoveContact removes a contact from a user
func (*Client) UserRemoveFavoriteTag ¶
UserRemoveFavoriteTag removes a favorite tag from current user
func (*Client) UserRemoveFavoriteTopic ¶
UserRemoveFavoriteTopic remove a favorite topic from current user
func (*Client) UserRename ¶
func (c *Client) UserRename(v RenameUserJSON) ([]byte, error)
UserRename renames a user
func (*Client) UserReset ¶
func (c *Client) UserReset(v UserResetJSON) ([]byte, error)
UserReset is used for reset password for a user
func (*Client) UserResetSystem ¶
func (c *Client) UserResetSystem(v UsernameUserJSON) ([]byte, error)
UserResetSystem is used for reset password for a system user
func (*Client) UserSetAdmin ¶
func (c *Client) UserSetAdmin(u UsernameUserJSON) ([]byte, error)
UserSetAdmin set a user as an admin
func (*Client) UserUpdate ¶
func (c *Client) UserUpdate(v UpdateUserJSON) ([]byte, error)
UserUpdate is used for update current user
func (*Client) UserUpdateSystem ¶
func (c *Client) UserUpdateSystem(u ConvertUserJSON) ([]byte, error)
UserUpdateSystem updates a system user
func (*Client) UserVerify ¶
func (c *Client) UserVerify(username, tokenVerify string) (*VerifyJSON, error)
UserVerify is used for verify user and returns password
type Contact ¶
type Contact struct { Username string `bson:"username" json:"username"` Fullname string `bson:"fullname" json:"fullname"` }
Contact User Struct.
type ContactsJSON ¶
type ContactsJSON struct { Contacts []Contact `json:"contacts"` CountContactsPresences int `json:"countContactsPresences"` ContactsPresences *[]Presence `json:"contactsPresence"` }
ContactsJSON represents a contact for a user, in contacts attribute on a user
type ConvertUserJSON ¶
type ConvertUserJSON struct { Username string `json:"username" binding:"required"` CanWriteNotifications bool `json:"canWriteNotifications" binding:"required"` CanListUsersAsAdmin bool `json:"canListUsersAsAdmin" binding:"required"` }
ConvertUserJSON is used to convert a user to a system user
type Filter ¶
type Filter struct { Topic string `bson:"-" json:"topic"` ID string `bson:"_id" json:"_id"` UserID string `bson:"userID" json:"userID"` Username string `bson:"username" json:"username"` Title string `bson:"title" json:"title"` Criteria FilterCriteria `bson:"criteria" json:"criteria"` Hooks []Hook `bson:"hooks" json:"hooks"` }
type FilterCriteria ¶
type FilterCriteria struct { Label string `bson:"label" json:"label,omitempty"` NotLabel string `bson:"notLabel" json:"notLabel,omitempty"` AndLabel string `bson:"andLabel" json:"andLabel,omitempty"` Tag string `bson:"tag" json:"tag,omitempty"` NotTag string `bson:"notTag" json:"notTag,omitempty"` AndTag string `bson:"andTag" json:"andTag,omitempty"` Username string `bson:"username" json:"username,omitempty"` OnlyMsgRoot bool `bson:"onlyMsgRoot" json:"onlyMsgRoot"` }
FilterCriteria are used to list messages
func (FilterCriteria) FilterCriteriaIsEmpty ¶
func (c FilterCriteria) FilterCriteriaIsEmpty() bool
type Group ¶
type Group struct { ID string `bson:"_id" json:"_id"` Name string `bson:"name" json:"name"` Description string `bson:"description" json:"description"` Users []string `bson:"users" json:"users,omitempty"` AdminUsers []string `bson:"adminUsers" json:"adminUsers,omitempty"` DateCreation int64 `bson:"dateCreation" json:"dateCreation,omitempty"` }
Group struct
type GroupCriteria ¶
type GroupCriteria struct { Skip int Limit int IDGroup string Name string Description string DateMinCreation string DateMaxCreation string UserUsername string SortBy string }
GroupCriteria is used by List all Groups
func (*GroupCriteria) CacheKey ¶
func (g *GroupCriteria) CacheKey() []string
CacheKey returns cacke key value
type GroupJSON ¶
type GroupJSON struct { Name string `json:"name" binding:"required"` Description string `json:"description" binding:"required"` }
GroupJSON contains name and description for a group
type GroupsJSON ¶
GroupsJSON is used by Tat Engine, for groups list
type Hook ¶
type Hook struct { ID string `bson:"_id" json:"_id"` Type string `bson:"type" json:"type"` // in HooksType Destination string `bson:"destination" json:"destination"` Errors int `bson:"errors" json:"errors"` Enabled bool `bson:"enabled" json:"enabled"` Item string `json:"item"` // only "message" for now Action string `json:"action"` // MessageActionVoteup, MessageActionCreate, etc... }
type HookJSON ¶
type HookJSON struct { Hook Hook `json:"hook"` HookMessage *HookMessageJSON `json:"hookMessage"` Username string `json:"username"` }
HookJSON represents a json sent to an external system
type HookMessageJSON ¶
type HookMessageJSON struct { Action string `json:"action"` MessageJSONOut *MessageJSONOut `json:"message"` }
HookMessageJSON represents a json sent to an external system, for a event about a message
type Label ¶
type Label struct { Text string `bson:"text" json:"text"` Color string `bson:"color" json:"color"` }
Label struct
type Message ¶
type Message struct { ID string `bson:"_id" json:"_id"` Text string `bson:"text" json:"text"` Topic string `bson:"topic" json:"topic"` InReplyOfID string `bson:"inReplyOfID" json:"inReplyOfID"` InReplyOfIDRoot string `bson:"inReplyOfIDRoot" json:"inReplyOfIDRoot"` NbLikes int64 `bson:"nbLikes" json:"nbLikes"` Labels []Label `bson:"labels" json:"labels,omitempty"` Likers []string `bson:"likers" json:"likers,omitempty"` VotersUP []string `bson:"votersUP" json:"votersUP,omitempty"` VotersDown []string `bson:"votersDown" json:"votersDown,omitempty"` NbVotesUP int64 `bson:"nbVotesUP" json:"nbVotesUP"` NbVotesDown int64 `bson:"nbVotesDown" json:"nbVotesDown"` UserMentions []string `bson:"userMentions" json:"userMentions,omitempty"` Urls []string `bson:"urls" json:"urls,omitempty"` Tags []string `bson:"tags" json:"tags,omitempty"` DateCreation float64 `bson:"dateCreation" json:"dateCreation"` DateUpdate float64 `bson:"dateUpdate" json:"dateUpdate"` Author Author `bson:"author" json:"author"` Replies []Message `bson:"-" json:"replies,omitempty"` NbReplies int64 `bson:"nbReplies" json:"nbReplies"` }
Message struc
func (*Message) ContainsLabel ¶
ContainsLabel returns true if message contains label
func (*Message) ContainsTag ¶
ContainsTag returns true if message contains tag
type MessageCriteria ¶
type MessageCriteria struct { Skip int Limit int TreeView string IDMessage string InReplyOfID string InReplyOfIDRoot string AllIDMessage string // search in IDMessage OR InReplyOfID OR InReplyOfIDRoot Text string Topic string Label string `bson:"label" json:"label,omitempty"` StartLabel string `bson:"startLabel" json:"startLabel,omitempty"` NotLabel string `bson:"notLabel" json:"notLabel,omitempty"` AndLabel string `bson:"andLabel" json:"andLabel,omitempty"` Tag string `bson:"tag" json:"tag,omitempty"` StartTag string `bson:"startTag" json:"startTag,omitempty"` NotTag string `bson:"notTag" json:"notTag,omitempty"` AndTag string `bson:"andTag" json:"andTag,omitempty"` Username string `bson:"username" json:"username,omitempty"` DateMinCreation string DateMaxCreation string DateMinUpdate string DateMaxUpdate string LastMinCreation string LastMaxCreation string LastMinUpdate string LastMaxUpdate string LastHourMinCreation string LastHourMaxCreation string LastHourMinUpdate string LastHourMaxUpdate string DateRefCreation string DateRefDeltaMinCreation string DateRefDeltaMaxCreation string DateRefUpdate string DateRefDeltaMinUpdate string DateRefDeltaMaxUpdate string LimitMinNbReplies string LimitMaxNbReplies string LimitMinNbVotesUP string LimitMinNbVotesDown string LimitMaxNbVotesUP string LimitMaxNbVotesDown string OnlyMsgRoot string `bson:"onlyMsgRoot" json:"onlyMsgRoot,omitempty"` OnlyMsgReply string `bson:"onlyMsgReply" json:"onlyMsgReply,omitempty"` OnlyCount string SortBy string `bson:"sortBy" json:"sortBy"` }
MessageCriteria are used to list messages
func GetMessageCriteriaFromURLValues ¶
func GetMessageCriteriaFromURLValues(values url.Values) (*MessageCriteria, error)
GetMessageCriteriaFromURLValues returns a MessagesCriteria from a url.Values
func (*MessageCriteria) CacheKey ¶
func (m *MessageCriteria) CacheKey() []string
CacheKey returns cache key value
func (*MessageCriteria) GetURL ¶
func (m *MessageCriteria) GetURL() string
GetURL returns URL for messageCriteria
type MessageJSON ¶
type MessageJSON struct { ID string `json:"_id"` Text string `json:"text"` Option string `json:"option"` Topic string IDReference string `json:"idReference"` StartTagReference string `json:"startTagReference"` StartLabelReference string `json:"startLabelReference"` TagReference string `json:"tagReference"` LabelReference string `json:"labelReference"` OnlyRootReference string `json:"onlyRootReference"` Action string `json:"action"` DateCreation float64 `json:"dateCreation"` Labels []Label `json:"labels"` Options []string `json:"options"` Replies []string `json:"replies"` Messages []MessageJSON `json:"messages"` // same as replies, but with Labels... }
MessageJSON represents a message with action on it
type MessageJSONOut ¶
MessageJSONOut represents a message and an additional info
type MessageReferenceJSON ¶
type MessageReferenceJSON struct { TagReference string `json:"tagReference"` StartTagReference string `json:"startTagReference"` LabelReference string `json:"labelReference"` StartLabelReference string `json:"startLabelReference"` IDReference string `json:"idReference"` }
MessageReferenceJSON is used for and action On A Existing Message
type MessagesCountJSON ¶
type MessagesCountJSON struct {
Count int `json:"count"`
}
MessagesCountJSON represents count of messages
type MessagesJSON ¶
type MessagesJSON struct { Messages []Message `json:"messages"` IsTopicRw bool `json:"isTopicRw"` IsTopicAdmin bool `json:"isTopicAdmin"` }
MessagesJSON represents a message and information if current topic is RW
type MessagesJSONIn ¶
type MessagesJSONIn struct {
Messages []*MessageJSON `json:"messages"`
}
type Options ¶
type Options struct { Username string Password string URL string Referer string RequestTimeout time.Duration MaxTries uint }
Options is a struct to initialize a TAT client
type ParamGroupUserJSON ¶
type ParamGroupUserJSON struct { Groupname string `json:"groupname"` Username string `json:"username"` }
ParamGroupUserJSON is used for add or remove user on a group
type ParamTopicGroupJSON ¶
type ParamTopicGroupJSON struct { Topic string `json:"topic"` Groupname string `json:"groupname"` Recursive bool `json:"recursive"` }
ParamTopicGroupJSON is used for manipulate a group on a topic
type ParamTopicUserJSON ¶
type ParamTopicUserJSON struct { Topic string `json:"topic"` // topic topic Username string `json:"username"` Recursive bool `json:"recursive"` }
ParamTopicUserJSON is used to update a parameter on topic
type Presence ¶
type Presence struct { ID string `bson:"_id,omitempty" json:"_id"` Status string `bson:"status" json:"status"` Topic string `bson:"topic" json:"topic"` DatePresence int64 `bson:"datePresence" json:"datePresence"` DateTimePresence time.Time `bson:"dateTimePresence" json:"dateTimePresence"` UserPresence UserPresence `bson:"userPresence" json:"userPresence"` }
Presence struct
type PresenceCriteria ¶
type PresenceCriteria struct { Skip int Limit int IDPresence string Status string Topic string Username string DateMinPresence string DateMaxPresence string SortBy string }
PresenceCriteria used by Presences List
type PresenceJSON ¶
type PresenceJSON struct { Status string `json:"status" binding:"required"` Username string `json:"username,omitempty"` Topic string }
PresenceJSON represents a status on a topic
type PresenceJSONOut ¶
type PresenceJSONOut struct {
Presence Presence `json:"presence"`
}
PresenceJSONOut represents a presence
type PresencesJSON ¶
PresencesJSON represents list of presences with count for total
type RenameUserJSON ¶
type RenameUserJSON struct { Username string `json:"username" binding:"required"` NewUsername string `json:"newUsername" binding:"required"` }
RenameUserJSON is used for rename a user
type StatsCountJSON ¶
type StatsCountJSON struct { Date int64 `json:"date"` DateHuman time.Time `json:"dateHuman"` Version string `json:"version"` Groups int `json:"groups"` Messages int `json:"messages"` Presences int `json:"presences"` Topics int `json:"topics"` Users int `json:"users"` }
StatsCountJSON contains all globals counters
type StatsDistributionTopicsJSON ¶
type StatsDistributionTopicsJSON struct { Total int `json:"total"` Info string `json:"info"` Topics []TopicDistributionJSON `json:"topics"` }
StatsDistributionTopicsJSON is used by GET /distribution/topics
type Topic ¶
type Topic struct { ID string `bson:"_id" json:"_id,omitempty"` Collection string `bson:"collection" json:"collection"` Topic string `bson:"topic" json:"topic"` Description string `bson:"description" json:"description"` ROGroups []string `bson:"roGroups" json:"roGroups,omitempty"` RWGroups []string `bson:"rwGroups" json:"rwGroups,omitempty"` ROUsers []string `bson:"roUsers" json:"roUsers,omitempty"` RWUsers []string `bson:"rwUsers" json:"rwUsers,omitempty"` AdminUsers []string `bson:"adminUsers" json:"adminUsers,omitempty"` AdminGroups []string `bson:"adminGroups" json:"adminGroups,omitempty"` History []string `bson:"history" json:"history"` MaxLength int `bson:"maxlength" json:"maxlength"` MaxReplies int `bson:"maxreplies" json:"maxreplies"` CanForceDate bool `bson:"canForceDate" json:"canForceDate"` CanUpdateMsg bool `bson:"canUpdateMsg" json:"canUpdateMsg"` CanDeleteMsg bool `bson:"canDeleteMsg" json:"canDeleteMsg"` CanUpdateAllMsg bool `bson:"canUpdateAllMsg" json:"canUpdateAllMsg"` CanDeleteAllMsg bool `bson:"canDeleteAllMsg" json:"canDeleteAllMsg"` AdminCanUpdateAllMsg bool `bson:"adminCanUpdateAllMsg" json:"adminCanUpdateAllMsg"` AdminCanDeleteAllMsg bool `bson:"adminCanDeleteAllMsg" json:"adminCanDeleteAllMsg"` IsAutoComputeTags bool `bson:"isAutoComputeTags" json:"isAutoComputeTags"` IsAutoComputeLabels bool `bson:"isAutoComputeLabels" json:"isAutoComputeLabels"` DateModification int64 `bson:"dateModification" json:"dateModificationn,omitempty"` DateCreation int64 `bson:"dateCreation" json:"dateCreation,omitempty"` DateLastMessage int64 `bson:"dateLastMessage" json:"dateLastMessage,omitempty"` Parameters []TopicParameter `bson:"parameters" json:"parameters,omitempty"` Tags []string `bson:"tags" json:"tags,omitempty"` Labels []Label `bson:"labels" json:"labels,omitempty"` Filters []Filter `bson:"filters" json:"filters"` }
Topic struct
type TopicCreateJSON ¶
type TopicCreateJSON struct { Topic string `json:"topic" binding:"required"` Description string `json:"description" binding:"required"` }
TopicCreateJSON is used to create a parameter on topic
type TopicCriteria ¶
type TopicCriteria struct { Skip int Limit int IDTopic string Topic string TopicPath string Description string DateMinCreation string DateMaxCreation string GetNbMsgUnread string OnlyFavorites string GetForTatAdmin string GetForAllTasksTopics bool Group string SortBy string }
TopicCriteria struct, used by List Topic
func (*TopicCriteria) CacheKey ¶
func (t *TopicCriteria) CacheKey() []string
CacheKey returns cache key value
type TopicDistributionJSON ¶
type TopicDistributionJSON struct { ID string `json:"id"` Topic string `json:"topic"` Count int `json:"count"` Dedicated bool `json:"dedicated"` Collection string `json:"collection"` }
TopicDistributionJSON represents struct used by Engine while returns topic distribution
type TopicJSON ¶
type TopicJSON struct { Topic *Topic `json:"topic"` IsTopicRw bool `json:"isTopicRw"` IsTopicAdmin bool `json:"isTopicAdmin"` }
TopicJSON represents struct used by Engine while returns one topic
type TopicNameJSON ¶
type TopicNameJSON struct {
Topic string `json:"topic"`
}
TopicNameJSON represents struct, only topic name
type TopicParameter ¶
type TopicParameter struct { Key string `bson:"key" json:"key"` Value string `bson:"value" json:"value"` }
TopicParameter struct, parameter on topics
type TopicParameterJSON ¶
type TopicParameterJSON struct { Topic string `json:"topic"` Key string `json:"key"` Value string `json:"value"` Recursive bool `json:"recursive"` }
TopicParameterJSON is used to manipulate a parameter on a topic
type TopicParameters ¶
type TopicParameters struct { Topic string `json:"topic"` MaxLength int `json:"maxlength"` MaxReplies int `json:"maxreplies"` CanForceDate bool `json:"canForceDate"` CanUpdateMsg bool `json:"canUpdateMsg"` CanDeleteMsg bool `json:"canDeleteMsg"` CanUpdateAllMsg bool `json:"canUpdateAllMsg"` CanDeleteAllMsg bool `json:"canDeleteAllMsg"` AdminCanUpdateAllMsg bool `json:"adminCanUpdateAllMsg"` AdminCanDeleteAllMsg bool `json:"adminCanDeleteAllMsg"` IsAutoComputeTags bool `json:"isAutoComputeTags"` IsAutoComputeLabels bool `json:"isAutoComputeLabels"` Recursive bool `json:"recursive"` }
TopicParameters updates param on one topic
type TopicsJSON ¶
type TopicsJSON struct { Count int `json:"count"` Topics []Topic `json:"topics"` CountTopicsMsgUnread int `json:"countTopicsMsgUnread"` TopicsMsgUnread map[string]int `json:"topicsMsgUnread"` }
TopicsJSON represents struct used by Engine while returns list of topics
type UpdateUserJSON ¶
type UpdateUserJSON struct { Username string `json:"username" binding:"required"` NewFullname string `json:"newFullname" binding:"required"` NewEmail string `json:"newEmail" binding:"required"` }
UpdateUserJSON is used for update user information
type User ¶
type User struct { ID string `bson:"_id" json:"_id"` Username string `bson:"username" json:"username"` Fullname string `bson:"fullname" json:"fullname"` Email string `bson:"email" json:"email,omitempty"` Groups []string `bson:"-" json:"groups,omitempty"` IsAdmin bool `bson:"isAdmin" json:"isAdmin,omitempty"` IsSystem bool `bson:"isSystem" json:"isSystem,omitempty"` IsArchived bool `bson:"isArchived" json:"isArchived,omitempty"` CanWriteNotifications bool `bson:"canWriteNotifications" json:"canWriteNotifications,omitempty"` CanListUsersAsAdmin bool `bson:"canListUsersAsAdmin" json:"canListUsersAsAdmin,omitempty"` FavoritesTopics []string `bson:"favoritesTopics" json:"favoritesTopics,omitempty"` OffNotificationsTopics []string `bson:"offNotificationsTopics" json:"offNotificationsTopics,omitempty"` FavoritesTags []string `bson:"favoritesTags" json:"favoritesTags,omitempty"` DateCreation int64 `bson:"dateCreation" json:"dateCreation,omitempty"` Contacts []Contact `bson:"contacts" json:"contacts,omitempty"` Auth Auth `bson:"auth" json:"-"` }
User struct
type UserCreateJSON ¶
type UserCreateJSON struct { Username string `json:"username" binding:"required"` Fullname string `json:"fullname" binding:"required"` Email string `json:"email" binding:"required"` // Callback contains command to execute to verify account // this command is displayed in ask for confirmation mail Callback string `json:"callback"` }
UserCreateJSON is used for create a new user
type UserCriteria ¶
type UserCriteria struct { Skip int Limit int WithGroups bool IDUser string Username string Fullname string DateMinCreation string DateMaxCreation string SortBy string }
UserCriteria is used to list users with criterias
type UserPresence ¶
type UserPresence struct { Username string `bson:"username" json:"username"` Fullname string `bson:"fullname" json:"fullname"` }
UserPresence struct
type UserResetJSON ¶
type UserResetJSON struct { Username string `json:"username" binding:"required"` Email string `json:"email" binding:"required"` // Callback contains command to execute to verify account // this command is displayed in ask for confirmation mail Callback string `json:"callback"` }
UserResetJSON is used for reset a new user
type UsernameUserJSON ¶
type UsernameUserJSON struct {
Username string `json:"username" binding:"required"`
}
UsernameUserJSON contains just a username