// getCategories fetchs distinct available categories to which we can send notifications
960082
func getCategories() []string {
	session := db.Conn.Session.Copy()
	defer session.Close()

	var categories []string

	db.Conn.GetCursor(
		session, db.AvailableTopicCollection, utils.M{},
	).Distinct("app_name", &categories)

	return categories
}
1319366
func (s *DescribeEventsInput) SetEventCategories(v []*string) *DescribeEventsInput {
	s.EventCategories = v
	return s
}
28844
func (o *Enterprise) WebCategories(info *bambou.FetchingInfo) (WebCategoriesList, *bambou.Error) {

	var list WebCategoriesList
	err := bambou.CurrentSession().FetchChildren(o, WebCategoryIdentity, &list, info)
	return list, err
}
355869
func (mc MongoClient) GetNotifications() ([]contract.Notification, error) {
	return mc.getNotifications(bson.M{})
}
1313987
func (s *EventCategoriesMap) SetEventCategories(v []*string) *EventCategoriesMap {
	s.EventCategories = v
	return s
}
1288044
func (c *Client) GetMyNotifications(args Arguments) (notifications []*Notification, err error) {
	path := "members/me/notifications"
	err = c.Get(path, args, &notifications)
	for i := range notifications {
		notifications[i].client = c
	}
	return
}
777034
func (s *ModifyEventSubscriptionInput) SetEventCategories(v []*string) *ModifyEventSubscriptionInput {
	s.EventCategories = v
	return s
}
1373678
func (s *Event) SetEventCategories(v []*string) *Event {
	s.EventCategories = v
	return s
}
612888
func NewCategory(name string) *Category {
	return &Category{
		Name:               name,
		childrenMap:        make(map[string]ConsoleElement),
		children:           make([]ConsoleElement, 0),
		cachedNumLeafNodes: -1,
	}
}
48366
func (c *Manager) UpdateCategory(ctx context.Context, category *Category) error {
	spec := struct {
		Category Category `json:"update_spec"`
	}{
		Category: Category{
			AssociableTypes: category.AssociableTypes,
			Cardinality:     category.Cardinality,
			Description:     category.Description,
			Name:            category.Name,
		},
	}
	url := internal.URL(c, internal.CategoryPath).WithID(category.ID)
	return c.Do(ctx, url.Request(http.MethodPatch, spec), nil)
}
965176
func (p *Payload) Category(category string) *Payload {
	p.aps().Category = category
	return p
}
660323
func (s *GetSigningPlatformOutput) SetCategory(v string) *GetSigningPlatformOutput {
	s.Category = &v
	return s
}
1139495
func (page *Page) getLinks(text []byte) {
	linksLeft := true

	for linksLeft {
		startTag := []byte("[[")
		startIndex := bytes.Index(text, startTag)

		endTag := []byte("]]")
		endIndex := bytes.Index(text, endTag)

		if startIndex != -1 && endIndex != -1 && startIndex+len(startTag) < endIndex {
			linkBody := text[startIndex+len(startTag) : endIndex]

			pipeIndex := bytes.Index(linkBody, []byte("|"))

			if pipeIndex != -1 {
				linkBody = linkBody[:pipeIndex]
			}

			categoryTag := []byte("Category:")
			categoryIndex := bytes.Index(linkBody, categoryTag)

			if categoryIndex != -1 {
				category := linkBody[len(categoryTag):]

				page.Categories = append(page.Categories, string(category))
			} else {
				if isTitle(linkBody) {
					page.Links = append(page.Links, string(linkBody))
				}
			}

			text = text[endIndex+len(endTag):]
		} else {
			linksLeft = false
		}
	}
}
1348784
func (c *Client) GetCategory(id string) (Category, error) {
	return c.GetCategoryOpt(id, "", "")
}
771905
func (s *Preset) SetCategory(v string) *Preset {
	s.Category = &v
	return s
}
140945
func (s *RelationalDatabaseEvent) SetEventCategories(v []*string) *RelationalDatabaseEvent {
	s.EventCategories = v
	return s
}
637296
func (c *Manager) GetCategory(ctx context.Context, id string) (*Category, error) {
	if isName(id) {
		cat, err := c.GetCategories(ctx)
		if err != nil {
			return nil, err
		}

		for i := range cat {
			if cat[i].Name == id {
				return &cat[i], nil
			}
		}
	}
	url := internal.URL(c, internal.CategoryPath).WithID(id)
	var res Category
	return &res, c.Do(ctx, url.Request(http.MethodGet), &res)
}