// GetTeams チ-ムを取得する
489532
func (t *TeamService) GetTeams() (*TeamsResponse, error) {
	var teamsRes TeamsResponse
	_, err := t.client.get(TeamURL, url.Values{}, &teamsRes)
	if err != nil {
		return nil, err
	}

	return &teamsRes, nil
}
363468
func (o *OrgStats) GetTotalTeams() int {
	if o == nil || o.TotalTeams == nil {
		return 0
	}
	return *o.TotalTeams
}
655361
func (c *CommentService) GetComments(teamName string, postNumber int) (*CommentsResponse, error) {
	var commentsResponse CommentsResponse
	postNumberStr := strconv.Itoa(postNumber)
	commentURL := CommnetURL + "/" + teamName + "/posts" + "/" + postNumberStr + "/comments"

	res, err := c.client.get(commentURL, url.Values{}, &commentsResponse)
	if err != nil {
		return nil, err
	}

	defer res.Body.Close()

	return &commentsResponse, nil
}
17830
func (i *Invitation) GetTeamCount() int {
	if i == nil || i.TeamCount == nil {
		return 0
	}
	return *i.TeamCount
}
1224386
func (hs *HTTPServer) GetTeamPreferences(c *m.ReqContext) Response {
	teamId := c.ParamsInt64(":teamId")
	orgId := c.OrgId

	if err := teamguardian.CanAdmin(hs.Bus, orgId, teamId, c.SignedInUser); err != nil {
		return Error(403, "Not allowed to view team preferences.", err)
	}

	return getPreferencesFor(orgId, 0, teamId)
}
185873
func (hs *HTTPServer) UpdateTeam(c *m.ReqContext, cmd m.UpdateTeamCommand) Response {
	cmd.OrgId = c.OrgId
	cmd.Id = c.ParamsInt64(":teamId")

	if err := teamguardian.CanAdmin(hs.Bus, cmd.OrgId, cmd.Id, c.SignedInUser); err != nil {
		return Error(403, "Not allowed to update team", err)
	}

	if err := hs.Bus.Dispatch(&cmd); err != nil {
		if err == m.ErrTeamNameTaken {
			return Error(400, "Team name taken", err)
		}
		return Error(500, "Failed to update Team", err)
	}

	return Success("Team updated")
}
917587
func GetTeamByID(c *m.ReqContext) Response {
	query := m.GetTeamByIdQuery{OrgId: c.OrgId, Id: c.ParamsInt64(":teamId")}

	if err := bus.Dispatch(&query); err != nil {
		if err == m.ErrTeamNotFound {
			return Error(404, "Team not found", err)
		}

		return Error(500, "Failed to get Team", err)
	}

	query.Result.AvatarUrl = dtos.GetGravatarUrlWithDefault(query.Result.Email, query.Result.Name)
	return JSON(200, &query.Result)
}
585192
func fetchTeamMemberStatements(mctx libkb.MetaContext,
	teamID keybase1.TeamID) (statementMap map[keybase1.UID]*keybase1.UserEkStatement, err error) {
	defer mctx.TraceTimed("fetchTeamMemberStatements", func() error { return err })()

	apiArg := libkb.APIArg{
		Endpoint:    "team/member_eks",
		SessionType: libkb.APISessionTypeREQUIRED,
		Args: libkb.HTTPArgs{
			"team_id": libkb.S{Val: string(teamID)},
		},
	}
	res, err := mctx.G().GetAPI().Get(mctx, apiArg)
	if err != nil {
		return nil, err
	}

	parsedResponse := teamMemberEKStatementResponse{}
	err = res.Body.UnmarshalAgain(&parsedResponse)
	if err != nil {
		return nil, err
	}

	team, err := teams.Load(mctx.Ctx(), mctx.G(), keybase1.LoadTeamArg{
		ID:          teamID,
		ForceRepoll: true,
	})
	if err != nil {
		return nil, err
	}
	statementMap = make(map[keybase1.UID]*keybase1.UserEkStatement)
	for uid, sig := range parsedResponse.Sigs {
		// Verify the server only returns actual members of our team.
		upak, _, err := mctx.G().GetUPAKLoader().LoadV2(
			libkb.NewLoadUserArgWithMetaContext(mctx).WithUID(uid))
		if err != nil {
			return nil, err
		}
		uv := upak.Current.ToUserVersion()
		isMember := team.IsMember(mctx.Ctx(), uv)
		if !isMember {
			return nil, fmt.Errorf("Server lied about team membership! %v is not a member of team %v", uv, teamID)
		}
		memberStatement, _, wrongKID, err := verifySigWithLatestPUK(mctx, uid, sig)
		// Check the wrongKID condition before checking the error, since an error
		// is still returned in this case. TODO: Turn this warning into an error
		// after EK support is sufficiently widespread.
		if wrongKID {
			mctx.Debug("Member %v revoked a device without generating new ephemeral keys. They might be running an old version?", uid)
			// Don't box for this member since they have no valid userEK
			continue
		} else if err != nil {
			return nil, err
		}
		statementMap[uid] = memberStatement
	}
	return statementMap, nil
}
646092
func (c *Client) GetGroups() (groups []common.Group, err error) {
	return c.protocol.GetGroups()
}
1261649
func (c *Conn) GetSnapshots(repository string, args map[string]interface{}) (GetSnapshotsResponse, error) {
	return c.getSnapshots(repository, "_all", args)
}
777535
func GetUserTeams(orgID, userID int64) ([]*Team, error) {
	return getUserTeams(x, orgID, userID)
}
888838
func (m *MMClient) GetTeamFromChannel(channelId string) string { //nolint:golint
	m.RLock()
	defer m.RUnlock()
	var channels []*model.Channel
	for _, t := range m.OtherTeams {
		channels = append(channels, t.Channels...)
		if t.MoreChannels != nil {
			channels = append(channels, t.MoreChannels...)
		}
		for _, c := range channels {
			if c.Id == channelId {
				if c.Type == model.CHANNEL_GROUP {
					return "G"
				}
				return t.Id
			}
		}
		channels = nil
	}
	return ""
}
842139
func (k *SimpleFS) SimpleFSGetTeamQuotaUsage(
	ctx context.Context, teamName keybase1.TeamName) (
	res keybase1.SimpleFSQuotaUsage, err error) {
	ctx = k.makeContext(ctx)
	path := keybase1.NewPathWithKbfs(
		fmt.Sprintf("team/%s", teamName.String()))
	fb, _, err := k.getFolderBranchFromPath(ctx, path)
	if err != nil {
		return keybase1.SimpleFSQuotaUsage{}, err
	}
	if fb == (data.FolderBranch{}) {
		return keybase1.SimpleFSQuotaUsage{}, nil
	}

	status, _, err := k.config.KBFSOps().FolderStatus(ctx, fb)
	if err != nil {
		return keybase1.SimpleFSQuotaUsage{}, err
	}

	res.UsageBytes = status.UsageBytes
	res.ArchiveBytes = status.ArchiveBytes
	res.LimitBytes = status.LimitBytes
	res.GitUsageBytes = status.GitUsageBytes
	res.GitArchiveBytes = status.GitArchiveBytes
	res.GitLimitBytes = status.GitLimitBytes
	return res, nil
}
1355503
func (org *User) GetUserTeams(userID int64) ([]*Team, error) {
	return org.getUserTeams(x, userID)
}
433075
func (s *MembersService) Get(teamName string) (*MembersResponse, error) {
	var membersRes MembersResponse

	membersURL := MembersURL+ "/" + teamName + "/members"
	res, err := s.client.get(membersURL, url.Values{}, &membersRes)
	if err != nil {
		return nil, err
	}

	defer res.Body.Close()

	return &membersRes, nil
}
896983
func (c *githubConnector) getGroups(ctx context.Context, client *http.Client, groupScope bool, userLogin string) ([]string, error) {
	if len(c.orgs) > 0 {
		return c.groupsForOrgs(ctx, client, userLogin)
	} else if c.org != "" {
		return c.teamsForOrg(ctx, client, c.org)
	} else if groupScope && c.loadAllGroups {
		return c.userGroups(ctx, client)
	}
	return nil, nil
}
1137836
func (k *KBPKIClient) GetTeamRootID(
	ctx context.Context, tid keybase1.TeamID,
	offline keybase1.OfflineAvailability) (keybase1.TeamID, error) {
	if !tid.IsSubTeam() {
		return tid, nil
	}

	teamInfo, err := k.serviceOwner.KeybaseService().LoadTeamPlusKeys(
		ctx, tid, tlf.Unknown, kbfsmd.UnspecifiedKeyGen, keybase1.UserVersion{},
		kbfscrypto.VerifyingKey{}, keybase1.TeamRole_NONE, offline)
	if err != nil {
		return keybase1.TeamID(""), err
	}
	return teamInfo.RootID, nil
}