Browse Source

Add MemberList() for teams, and make AddUser() return output from MemberList()

main
Sam 6 years ago
parent
commit
bbe5e9b8a5
  1. 15
      team.go
  2. 49
      types.go

15
team.go

@ -36,6 +36,21 @@ func (t Team) AddUser(user, role string) (TeamAPI, error) {
}, },
} }
r, err := teamAPIOut(t.keybase.Path, m)
if err == nil {
r, err = t.MemberList()
}
return r, err
}
// MemberList returns a list of a team's members
func (t Team) MemberList() (TeamAPI, error) {
m := TeamAPI{
Params: &tParams{},
}
m.Method = "list-team-memberships"
m.Params.Options.Team = t.Name
r, err := teamAPIOut(t.keybase.Path, m) r, err := teamAPIOut(t.keybase.Path, m)
return r, err return r, err
} }

49
types.go

@ -313,7 +313,6 @@ type TeamAPI struct {
Method string `json:"method,omitempty"` Method string `json:"method,omitempty"`
Params *tParams `json:"params,omitempty"` Params *tParams `json:"params,omitempty"`
Result *tResult `json:"result,omitempty"` Result *tResult `json:"result,omitempty"`
OtherResult []tResult `json:"result,omitempty"`
} }
type emails struct { type emails struct {
Email string `json:"email"` Email string `json:"email"`
@ -327,6 +326,47 @@ type user struct {
UID string `json:"uid"` UID string `json:"uid"`
Username string `json:"username"` Username string `json:"username"`
} }
type uv struct {
UID string `json:"uid"`
EldestSeqno int `json:"eldestSeqno"`
}
type owners struct {
Uv uv `json:"uv"`
Username string `json:"username"`
FullName string `json:"fullName"`
NeedsPUK bool `json:"needsPUK"`
Status int `json:"status"`
}
type admins struct {
Uv uv `json:"uv"`
Username string `json:"username"`
FullName string `json:"fullName"`
NeedsPUK bool `json:"needsPUK"`
Status int `json:"status"`
}
type readers struct {
Uv uv `json:"uv"`
Username string `json:"username"`
FullName string `json:"fullName"`
NeedsPUK bool `json:"needsPUK"`
Status int `json:"status"`
}
type members struct {
Owners []owners `json:"owners"`
Admins []admins `json:"admins"`
Writers []interface{} `json:"writers"`
Readers []readers `json:"readers"`
}
type annotatedActiveInvites struct {
}
type settings struct {
Open bool `json:"open"`
JoinAs int `json:"joinAs"`
}
type showcase struct {
IsShowcased bool `json:"is_showcased"`
AnyMemberShowcase bool `json:"any_member_showcase"`
}
type tOptions struct { type tOptions struct {
Team string `json:"team"` Team string `json:"team"`
Emails []emails `json:"emails"` Emails []emails `json:"emails"`
@ -342,6 +382,11 @@ type tResult struct {
User user `json:"user"` User user `json:"user"`
EmailSent bool `json:"emailSent"` EmailSent bool `json:"emailSent"`
ChatSending bool `json:"chatSending"` ChatSending bool `json:"chatSending"`
Members members `json:"members"`
KeyGeneration int `json:"keyGeneration"`
AnnotatedActiveInvites annotatedActiveInvites `json:"annotatedActiveInvites"`
Settings settings `json:"settings"`
Showcase showcase `json:"showcase"`
} }
// Keybase holds basic information about the local Keybase executable // Keybase holds basic information about the local Keybase executable
@ -377,7 +422,9 @@ type Team struct {
} }
type team interface { type team interface {
AddUser(user, role string) (TeamAPI, error)
CreateSubteam(name string) (TeamAPI, error) CreateSubteam(name string) (TeamAPI, error)
MemberList() (TeamAPI, error)
} }
type keybase interface { type keybase interface {

Loading…
Cancel
Save