diff --git a/team.go b/team.go index e439332..3ef2108 100644 --- a/team.go +++ b/team.go @@ -33,3 +33,15 @@ func (t Team) CreateSubteam(name string) (TeamAPI, error) { r, err := teamAPIOut(t.keybase.Path, m) return r, err } + +// CreateTeam creates a new team +func (k *Keybase) CreateTeam(name string) (TeamAPI, error) { + m := TeamAPI{ + Params: &tParams{}, + } + m.Method = "create-team" + m.Params.Options.Team = name + + r, err := teamAPIOut(k.Path, m) + return r, err +} diff --git a/types.go b/types.go index a7c2864..0df0aba 100644 --- a/types.go +++ b/types.go @@ -314,8 +314,18 @@ type TeamAPI struct { Params *tParams `json:"params"` Result *tResult `json:"result"` } +type emails struct { + Email string `json:"email"` + Role string `json:"role"` +} +type usernames struct { + Username string `json:"username"` + Role string `json:"role"` +} type tOptions struct { - Team string `json:"team"` + Team string `json:"team"` + Emails []emails `json:"emails"` + Usernames []usernames `json:"usernames"` } type tParams struct { Options tOptions `json:"options"` @@ -340,10 +350,10 @@ type Chat struct { } type chat interface { - Send(message ...string) (ChatAPI, error) + Delete(messageID int) (ChatAPI, error) Edit(messageID int, message ...string) (ChatAPI, error) React(messageID int, reaction string) (ChatAPI, error) - Delete(messageID int) (ChatAPI, error) + Send(message ...string) (ChatAPI, error) } type chatAPI interface { @@ -362,10 +372,11 @@ type team interface { } type keybase interface { - NewTeam(name string) Team + ChatList() ([]conversation, error) + CreateTeam(name string) (TeamAPI, error) NewChat(channel Channel) Chat + NewTeam(name string) Team Run(handler func(ChatAPI), options ...RunOptions) - ChatList() ([]conversation, error) loggedIn() bool username() string version() string