// Get the specified organization's information
//
// https://developer.github.com/v3/orgs/#get-an-organization
165623
func (g *OrganizationService) OrganizationGet(uri *Hyperlink, params M) (
	organization Organization, result *Result) {
	if uri == nil {
		uri = &OrganizationURL
	}
	url, err := uri.Expand(params)
	if err != nil {
		return Organization{}, &Result{Err: err}
	}
	result = g.client.get(url, &organization)
	return
}
1220017
func (s *Service) OrganizationInfo(ctx context.Context, organizationIdentity string) (*Organization, error) {
	var organization Organization
	return &organization, s.Get(ctx, &organization, fmt.Sprintf("/organizations/%v", organizationIdentity), nil, nil)
}
401877
func (s *Service) OrganizationID(w http.ResponseWriter, r *http.Request) {
	ctx := r.Context()

	id := httprouter.GetParamFromContext(ctx, "oid")

	org, err := s.Store.Organizations(ctx).Get(ctx, chronograf.OrganizationQuery{ID: &id})
	if err != nil {
		Error(w, http.StatusBadRequest, err.Error(), s.Logger)
		return
	}

	res := newOrganizationResponse(org)
	encodeJSON(w, http.StatusOK, res, s.Logger)
}
855322
func (s *SourcesStore) Get(ctx context.Context, id int) (chronograf.Source, error) {
	err := validOrganization(ctx)
	if err != nil {
		return chronograf.Source{}, err
	}

	d, err := s.store.Get(ctx, id)
	if err != nil {
		return chronograf.Source{}, err
	}

	if d.Organization != s.organization {
		return chronograf.Source{}, chronograf.ErrSourceNotFound
	}

	return d, nil
}
561313
func Get(c *context.APIContext) {
	c.JSON(200, convert.ToOrganization(c.Org.Organization))
}
1172802
func (p *ProjectOptions) GetOrganizationPermission() string {
	if p == nil || p.OrganizationPermission == nil {
		return ""
	}
	return *p.OrganizationPermission
}
1115839
func (h *OrgHandler) handleGetOrgs(w http.ResponseWriter, r *http.Request) {
	ctx := r.Context()

	req, err := decodeGetOrgsRequest(ctx, r)
	if err != nil {
		EncodeError(ctx, err, w)
		return
	}

	orgs, _, err := h.OrganizationService.FindOrganizations(ctx, req.filter)
	if err != nil {
		EncodeError(ctx, err, w)
		return
	}

	if err := encodeResponse(ctx, w, http.StatusOK, newOrgsResponse(orgs)); err != nil {
		logEncodingError(h.Logger, r, err)
		return
	}
}
897486
func (s *OrgService) FindOrganization(ctx context.Context, filter influxdb.OrganizationFilter) (*influxdb.Organization, error) {
	o, err := s.s.FindOrganization(ctx, filter)
	if err != nil {
		return nil, err
	}

	if err := authorizeReadOrg(ctx, o.ID); err != nil {
		return nil, err
	}

	return o, nil
}
601463
func (s *orgController) Get() interface{} {
	var handler OrgGetHandler = func(params martini.Params, log *log.Logger, r render.Render, tokens oauth2.Tokens) {
		username := params[UserParam]
		org := NewOrg(username, log, tokens, s.store(), s.authClient)
		result, err := org.Show()
		genericResponseFormatter(r, "", structs.Map(result), err)
	}
	return handler
}
1358673
func (m *Manager) Get(id string) (*Organization, error) {
	var organization Organization

	objectID := bson.ObjectIdHex(id)

	if err := m.collection.FindId(objectID).One(&organization); err != nil {
		return nil, err
	}

	return &organization, nil
}
810850
func (o *OrgsClient) Get(ctx context.Context, orgID *identity.ID) (*envelope.Org, error) {
	org := envelope.Org{}
	err := o.client.RoundTrip(ctx, "GET", "/orgs/"+orgID.String(), nil, nil, &org)
	return &org, err
}
925785
func (c *Client) GetInfo() (*Info, error) {
	r := c.NewRequest("GET", "/v2/info")
	resp, err := c.DoRequest(r)
	if err != nil {
		return nil, errors.Wrap(err, "Error requesting info")
	}
	defer resp.Body.Close()
	var i Info
	err = json.NewDecoder(resp.Body).Decode(&i)
	if err != nil {
		return nil, errors.Wrap(err, "Error unmarshalling info")
	}
	return &i, nil
}
230916
func (client *Client) GetOrganizations(filters ...Filter) ([]Organization, Warnings, error) {
	allQueries := ConvertFilterParameters(filters)
	allQueries.Add("order-by", "name")
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.GetOrganizationsRequest,
		Query:       allQueries,
	})

	if err != nil {
		return nil, nil, err
	}

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

	return fullOrgsList, warnings, err
}
325153
func (o *Organization) GetID() int64 {
	if o == nil || o.ID == nil {
		return 0
	}
	return *o.ID
}
1040623
func (o *Organization) GetEmail() string {
	if o == nil || o.Email == nil {
		return ""
	}
	return *o.Email
}
1075298
func (c *Client) GetOrganization(orgID string, args Arguments) (organization *Organization, err error) {
	path := fmt.Sprintf("organizations/%s", orgID)
	err = c.Get(path, args, &organization)
	if organization != nil {
		organization.client = c
	}
	return
}
736618
func (api *API) OrganizationDetails(organizationID string) (OrganizationDetails, error) {
	var r organizationDetailsResponse
	uri := "/organizations/" + organizationID
	res, err := api.makeRequest("GET", uri, nil)
	if err != nil {
		return OrganizationDetails{}, errors.Wrap(err, errMakeRequestError)
	}

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

	return r.Result, nil
}