// List organizations in which you are a member.
779807
func (s *Service) OrganizationList(ctx context.Context, lr *ListRange) (OrganizationListResult, error) {
	var organization OrganizationListResult
	return organization, s.Get(ctx, &organization, fmt.Sprintf("/organizations"), nil, lr)
}
1132036
func Members() echo.HandlerFunc {

	// swagger:route GET /projects/{id}/members project info members getProjectMembers
	//
	// Shows the members informations for the specified project
	//
	// You can personalize the request via query string parameters
	//
	//	Produces:
	//	- application/json
	//
	//	Security:
	//		oauth: projects:read
	//
	//	Responses:
	//		default: ProjectsIdMembers

	return func(c echo.Context) error {
		if !rest.IsGranted("projects:read", c) {
			return rest.InvalidScopeResponse("projects:read", c)
		}
		members := c.Get("project").(*nerdz.Project).Members()
		return rest.SelectFields(rest.GetUsersInfo(members), c)
	}
}
634153
func (s *Service) OrganizationInvoiceInfo(ctx context.Context, organizationIdentity string, organizationInvoiceIdentity int) (*OrganizationInvoice, error) {
	var organizationInvoice OrganizationInvoice
	return &organizationInvoice, s.Get(ctx, &organizationInvoice, fmt.Sprintf("/organizations/%v/invoices/%v", organizationIdentity, organizationInvoiceIdentity), nil, nil)
}
614810
func (client *Client) GetOrganizations(query ...Query) ([]Organization, Warnings, error) {
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.GetOrganizationsRequest,
		Query:       query,
	})
	if err != nil {
		return nil, nil, err
	}

	var fullOrgsList []Organization
	warnings, err := client.paginate(request, Organization{}, func(item interface{}) error {
		if app, ok := item.(Organization); ok {
			fullOrgsList = append(fullOrgsList, app)
		} else {
			return ccerror.UnknownObjectInListError{
				Expected:   Organization{},
				Unexpected: item,
			}
		}
		return nil
	})

	return fullOrgsList, warnings, err
}
790643
func (n *Network) Organization(orgName string) *Organization {
	for _, org := range n.Organizations {
		if org.Name == orgName {
			return org
		}
	}
	return nil
}
546274
func (api *API) ListOrganizations() ([]Organization, ResultInfo, error) {
	var r organizationResponse
	res, err := api.makeRequest("GET", "/user/organizations", nil)
	if err != nil {
		return []Organization{}, ResultInfo{}, errors.Wrap(err, errMakeRequestError)
	}

	err = json.Unmarshal(res, &r)
	if err != nil {
		return []Organization{}, ResultInfo{}, errors.Wrap(err, errUnmarshalError)
	}

	return r.Result, r.ResultInfo, nil
}
345979
func (c *ApiController) GetAccountOrganizations() {
	fmt.Println("Start get account organizations")

	client := github.NewClient(oauthCfg.Client(oauth2.NoContext, tkn))

	organizations, _, err := client.Organizations.List("", nil)
	if err != nil {
		fmt.Println("error getting organizations")
		fmt.Println(nil)
	}

	c.Data["json"] = organizations
	c.ServeJson()
}
207593
func (s *Service) OrganizationAppListForOrganization(ctx context.Context, organizationIdentity string, lr *ListRange) (OrganizationAppListForOrganizationResult, error) {
	var organizationApp OrganizationAppListForOrganizationResult
	return organizationApp, s.Get(ctx, &organizationApp, fmt.Sprintf("/organizations/%v/apps", organizationIdentity), nil, lr)
}
977554
func (api *API) OrganizationInvites(organizationID string) ([]OrganizationInvite, ResultInfo, error) {
	var r organizationInvitesResponse
	uri := "/organizations/" + organizationID + "/invites"
	res, err := api.makeRequest("GET", uri, nil)
	if err != nil {
		return []OrganizationInvite{}, ResultInfo{}, errors.Wrap(err, errMakeRequestError)
	}

	err = json.Unmarshal(res, &r)
	if err != nil {
		return []OrganizationInvite{}, ResultInfo{}, errors.Wrap(err, errUnmarshalError)
	}

	return r.Result, r.ResultInfo, nil
}
153542
func isMember(requiredOrgs []string, userOrgs []*github.Organization) bool {
	for _, requiredOrg := range requiredOrgs {
		for _, userOrg := range userOrgs {
			if userOrg.Login != nil && *userOrg.Login == requiredOrg {
				return true
			}
		}
	}
	return false
}
753768
func (c *OrganizationController) List(ctx *app.ListOrganizationContext) error {
	currentUser, err := manager.ContextIdentity(ctx)
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, errors.NewUnauthorizedError(err.Error()))
	}

	if currentUser == nil {
		return jsonapi.JSONErrorResponse(ctx, errors.NewUnauthorizedError("error finding the current user"))
	}

	orgs, err := c.app.OrganizationService().ListOrganizations(ctx, *currentUser)

	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"err": err,
		}, "failed to list organizations")
		return jsonapi.JSONErrorResponse(ctx, errors.NewInternalError(ctx, err))
	}

	return ctx.OK(&app.OrganizationArray{Data: convertToAppOrganization(orgs)})
}
255350
func (c *Client) OrganizationList(lr *ListRange) ([]Organization, error) {
	req, err := c.NewRequest("GET", "/organizations", nil, nil)
	if err != nil {
		return nil, err
	}

	if lr != nil {
		lr.SetHeader(req)
	}

	var organizationsRes []Organization
	return organizationsRes, c.DoReq(req, &organizationsRes)
}
405097
func (s *ListsService) Members(params *ListsMembersParams) (*Members, *http.Response, error) {
	members := new(Members)
	apiError := new(APIError)
	resp, err := s.sling.New().Get("members.json").QueryStruct(params).Receive(members, apiError)
	return members, resp, relevantError(err, *apiError)
}
1338785
func (jcm *joinChannelMessage) Members() []api.OrgIdentityType {
	members := make([]api.OrgIdentityType, len(jcm.members2AnchorPeers))
	i := 0
	for org := range jcm.members2AnchorPeers {
		members[i] = api.OrgIdentityType(org)
		i++
	}
	return members
}
1095245
func (api OrganizationsAPI) AddOrganizationMember(w http.ResponseWriter, r *http.Request) {
	api.inviteUser(w, r, invitations.RoleMember)
}
577397
func (c *Client) OrganizationMemberDelete(organizationIdentity string, organizationMemberIdentity string) error {
	return c.Delete("/organizations/" + organizationIdentity + "/members/" + organizationIdentity)
}
89244
func (s *organizationServiceImpl) ListOrganizations(ctx context.Context, identityID uuid.UUID) ([]authorization.IdentityAssociation, error) {
	resourceType := authorization.IdentityResourceTypeOrganization

	// first find the identity's memberships
	memberships, err := s.Repositories().Identities().FindIdentityMemberships(ctx, identityID, &resourceType)

	if err != nil {
		return nil, err
	}

	// then find the identity's roles
	roles, err := s.Repositories().IdentityRoleRepository().FindIdentityRolesForIdentity(ctx, identityID, &resourceType)

	if err != nil {
		return nil, err
	}

	return authorization.MergeAssociations(memberships, roles), nil
}