Add CreateTeam()
This commit is contained in:
12
team.go
12
team.go
@ -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
|
||||||
|
}
|
||||||
|
|||||||
23
types.go
23
types.go
@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user