diff --git a/team.go b/team.go index 3ef2108..7ca6c3f 100644 --- a/team.go +++ b/team.go @@ -22,6 +22,24 @@ func teamAPIOut(keybasePath string, w TeamAPI) (TeamAPI, error) { return r, nil } +// AddUser adds members to a team by username +func (t Team) AddUser(user, role string) (TeamAPI, error) { + m := TeamAPI{ + Params: &tParams{}, + } + m.Method = "add-members" + m.Params.Options.Team = t.Name + m.Params.Options.Usernames = []usernames{ + { + Username: user, + Role: role, + }, + } + + r, err := teamAPIOut(t.keybase.Path, m) + return r, err +} + // CreateSubteam creates a subteam func (t Team) CreateSubteam(name string) (TeamAPI, error) { m := TeamAPI{ diff --git a/types.go b/types.go index 0df0aba..31300e7 100644 --- a/types.go +++ b/types.go @@ -310,9 +310,10 @@ type wResult struct { // TeamAPI holds information sent and received to/from the team api type TeamAPI struct { - Method string `json:"method"` - Params *tParams `json:"params"` - Result *tResult `json:"result"` + Method string `json:"method,omitempty"` + Params *tParams `json:"params,omitempty"` + Result *tResult `json:"result,omitempty"` + OtherResult []tResult `json:"result,omitempty"` } type emails struct { Email string `json:"email"` @@ -322,6 +323,10 @@ type usernames struct { Username string `json:"username"` Role string `json:"role"` } +type user struct { + UID string `json:"uid"` + Username string `json:"username"` +} type tOptions struct { Team string `json:"team"` Emails []emails `json:"emails"` @@ -333,6 +338,10 @@ type tParams struct { type tResult struct { ChatSent bool `json:"chatSent"` CreatorAdded bool `json:"creatorAdded"` + Invited bool `json:"invited"` + User user `json:"user"` + EmailSent bool `json:"emailSent"` + ChatSending bool `json:"chatSending"` } // Keybase holds basic information about the local Keybase executable