Add CreateTeam()

This commit is contained in:
Sam
2019-07-26 15:53:42 -04:00
parent 0a6f33e429
commit a7d58558b2
2 changed files with 29 additions and 6 deletions

12
team.go
View File

@ -33,3 +33,15 @@ func (t Team) CreateSubteam(name string) (TeamAPI, error) {
r, err := teamAPIOut(t.keybase.Path, m) r, err := teamAPIOut(t.keybase.Path, m)
return r, err 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
}

View File

@ -314,8 +314,18 @@ type TeamAPI struct {
Params *tParams `json:"params"` Params *tParams `json:"params"`
Result *tResult `json:"result"` 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 { type tOptions struct {
Team string `json:"team"` Team string `json:"team"`
Emails []emails `json:"emails"`
Usernames []usernames `json:"usernames"`
} }
type tParams struct { type tParams struct {
Options tOptions `json:"options"` Options tOptions `json:"options"`
@ -340,10 +350,10 @@ type Chat struct {
} }
type chat interface { type chat interface {
Send(message ...string) (ChatAPI, error) Delete(messageID int) (ChatAPI, error)
Edit(messageID int, message ...string) (ChatAPI, error) Edit(messageID int, message ...string) (ChatAPI, error)
React(messageID int, reaction string) (ChatAPI, error) React(messageID int, reaction string) (ChatAPI, error)
Delete(messageID int) (ChatAPI, error) Send(message ...string) (ChatAPI, error)
} }
type chatAPI interface { type chatAPI interface {
@ -362,10 +372,11 @@ type team interface {
} }
type keybase interface { type keybase interface {
NewTeam(name string) Team
NewChat(channel Channel) Chat
Run(handler func(ChatAPI), options ...RunOptions)
ChatList() ([]conversation, error) ChatList() ([]conversation, error)
CreateTeam(name string) (TeamAPI, error)
NewChat(channel Channel) Chat
NewTeam(name string) Team
Run(handler func(ChatAPI), options ...RunOptions)
loggedIn() bool loggedIn() bool
username() string username() string
version() string version() string