// GetGroupedInbox implements the Chat interface.
430936
func (c *ChatRPC) GetGroupedInbox(
	ctx context.Context, chatType chat1.TopicType, maxChats int) (
	results []*tlfhandle.Handle, err error) {
	// First get the latest TLFs written by this user.
	seen := make(map[string]bool)
	results, err = c.getLastSelfWrittenHandles(ctx, chatType, seen)
	if err != nil {
		return nil, err
	}

	arg := chat1.GetInboxAndUnboxLocalArg{
		Query: &chat1.GetInboxLocalQuery{
			TopicType: &chatType,
		},
		IdentifyBehavior: keybase1.TLFIdentifyBehavior_KBFS_CHAT,
	}
	res, err := c.client.GetInboxAndUnboxLocal(ctx, arg)
	if err != nil {
		return nil, err
	}

	favs, err := c.config.KBFSOps().GetFavorites(ctx)
	if err != nil {
		c.log.CWarningf(ctx,
			"Unable to fetch favorites while making GroupedInbox: %v",
			err)
	}
	favMap := make(map[favorites.Folder]bool)
	for _, fav := range favs {
		favMap[fav] = true
	}

	// Return the first unique `maxChats` chats.  Eventually the
	// service will support grouping these by TLF ID and we won't
	// have to check for uniques.  For now, we might falsely return
	// fewer than `maxChats` TLFs.  TODO: make sure these are ordered
	// with the most recent one at index 0.
	for i := 0; i < len(res.Conversations) && len(results) < maxChats; i++ {
		info := res.Conversations[i].Info
		if info.TopicName == selfWriteChannel {
			continue
		}

		tlfType := tlf.Private
		if info.Visibility == keybase1.TLFVisibility_PUBLIC {
			tlfType = tlf.Public
		} else if info.MembersType == chat1.ConversationMembersType_TEAM {
			tlfType = tlf.SingleTeam
		}

		tlfIsFavorite := favMap[favorites.Folder{Name: info.TlfName, Type: tlfType}]
		if !tlfIsFavorite {
			continue
		}

		h, err := GetHandleFromFolderNameAndType(
			ctx, c.config.KBPKI(), c.config.MDOps(), c.config,
			info.TlfName, tlfType)
		if err != nil {
			c.log.CDebugf(ctx, "Ignoring errors getting handle for %s/%s: %+v",
				info.TlfName, tlfType, err)
			continue
		}

		p := h.GetCanonicalPath()
		if seen[p] {
			continue
		}
		seen[p] = true
		results = append(results, h)
	}

	return results, nil
}
308531
func (c *Client) GetGroupByID(id string) (common.Group, error) {
	group, err := c.protocol.GetGroup(id)
	if err == nil {
		return group, nil
	}

	var timeout <-chan time.Time
	if c.timeout > 0 {
		timeout = time.After(c.timeout)
	} else {
		timeout = make(<-chan time.Time)
	}

	sub := c.protocol.Subscribe()
	defer func() {
		if err = sub.Close(); err != nil {
			common.Log.Warnf("Failed closing group subscription: %+v", err)
		}
	}()
	events := sub.Events()

	for {
		select {
		case event, ok := <-events:
			if !ok {
				return nil, common.ErrClosed
			}
			switch event := event.(type) {
			case common.EventNewGroup:
				if id == event.Group.ID() {
					return event.Group, nil
				}
			}
		case <-timeout:
			return nil, common.ErrNotFound
		}
	}
}
59664
func (bot *BotAPI) GetChatAdministrators(config ChatConfig) ([]ChatMember, error) {
	v := url.Values{}

	if config.SuperGroupUsername == "" {
		v.Add("chat_id", strconv.FormatInt(config.ChatID, 10))
	} else {
		v.Add("chat_id", config.SuperGroupUsername)
	}

	resp, err := bot.MakeRequest("getChatAdministrators", v)
	if err != nil {
		return []ChatMember{}, err
	}

	var members []ChatMember
	err = json.Unmarshal(resp.Result, &members)

	bot.debugLog("getChatAdministrators", v, members)

	return members, err
}
496297
func (service *VboxPortType) IMediumgetDescription(request *IMediumgetDescription) (*IMediumgetDescriptionResponse, error) {
	response := new(IMediumgetDescriptionResponse)
	err := service.client.Call("", request, response)
	if err != nil {
		return nil, err
	}

	return response, nil
}
30166
func (c *ChatRPC) ChatInboxSyncStarted(
	_ context.Context, _ keybase1.UID) error {
	return nil
}
973374
func (r Product_Item_Category) GetGroup() (resp datatypes.Product_Item_Category_Group, err error) {
	err = r.Session.DoRequest("SoftLayer_Product_Item_Category", "getGroup", nil, &r.Options, &resp)
	return
}
534411
func (service *VboxPortType) IMediumgetType(request *IMediumgetType) (*IMediumgetTypeResponse, error) {
	response := new(IMediumgetTypeResponse)
	err := service.client.Call("", request, response)
	if err != nil {
		return nil, err
	}

	return response, nil
}
992277
func (c *chatServiceHandler) SearchInboxV1(ctx context.Context, opts searchInboxOptionsV1) Reply {
	client, err := GetChatLocalClient(c.G())
	if err != nil {
		return c.errReply(err)
	}

	if opts.MaxHits <= 0 {
		opts.MaxHits = 10
	}

	reindexMode := chat1.ReIndexingMode_NONE
	if opts.ForceReindex {
		reindexMode = chat1.ReIndexingMode_PRESEARCH_SYNC
	}
	searchOpts := chat1.SearchOpts{
		ReindexMode:   reindexMode,
		SentBy:        opts.SentBy,
		MaxHits:       opts.MaxHits,
		BeforeContext: opts.BeforeContext,
		AfterContext:  opts.AfterContext,
	}

	if opts.SentBefore != "" && opts.SentAfter != "" {
		err := fmt.Errorf("Only one of `sent_before` and `sent_after` can be specified")
		return c.errReply(err)
	}
	if opts.SentBefore != "" {
		sentBefore, err := dateparse.ParseAny(opts.SentBefore)
		if err != nil {
			return c.errReply(err)
		}
		searchOpts.SentBefore = gregor1.ToTime(sentBefore)
	}
	if opts.SentAfter != "" {
		sentAfter, err := dateparse.ParseAny(opts.SentAfter)
		if err != nil {
			return c.errReply(err)
		}
		searchOpts.SentAfter = gregor1.ToTime(sentAfter)
	}

	arg := chat1.SearchInboxArg{
		IdentifyBehavior: keybase1.TLFIdentifyBehavior_CHAT_CLI,
		Query:            opts.Query,
		Opts:             searchOpts,
	}

	res, err := client.SearchInbox(ctx, arg)
	if err != nil {
		return c.errReply(err)
	}

	searchRes := SearchInboxRes{
		Results: res.Res,
		RateLimits: RateLimits{
			c.aggRateLimits(res.RateLimits),
		},
		IdentifyFailures: res.IdentifyFailures,
	}
	return Reply{Result: searchRes}
}
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
}
646092
func (c *Client) GetGroups() (groups []common.Group, err error) {
	return c.protocol.GetGroups()
}
1097129
func (service *VboxPortType) INATRedirectEventgetGuestPort(request *INATRedirectEventgetGuestPort) (*INATRedirectEventgetGuestPortResponse, error) {
	response := new(INATRedirectEventgetGuestPortResponse)
	err := service.client.Call("", request, response)
	if err != nil {
		return nil, err
	}

	return response, nil
}
1266070
func (group *Group) GetGroup() {
	groups, err := GetGroups()
	if err != nil {
		return
	}

	for _, g := range groups.Groups.Items {
		if g.GroupID == group.GroupID {
			group.parent = groups
			group.ContractIDs = g.ContractIDs
			group.GroupName = g.GroupName
			group.ParentGroupID = g.ParentGroupID
			group.Complete <- true
			return
		}
	}

	group.Complete <- false
}
292590
func (v *Notebook) GetGroupId() int {
	deprecated_since(2, 12, 0, "gtk_notebook_get_group_id()")
	return int(C.gtk_notebook_get_group_id(NOTEBOOK(v)))
}
426988
func (r Product_Item_Category) GetGroups() (resp []datatypes.Product_Package_Item_Category_Group, err error) {
	err = r.Session.DoRequest("SoftLayer_Product_Item_Category", "getGroups", nil, &r.Options, &resp)
	return
}
1174620
func (service *VboxPortType) IFsObjInfogetGroupName(request *IFsObjInfogetGroupName) (*IFsObjInfogetGroupNameResponse, error) {
	response := new(IFsObjInfogetGroupNameResponse)
	err := service.client.Call("", request, response)
	if err != nil {
		return nil, err
	}

	return response, nil
}
80894
func (mmf *maxMinFunction) GetGroupResult(groupKey []byte) (d types.Datum) {
	return mmf.getContext(groupKey).Value
}
411692
func (r Network_Component) GetNetworkComponentGroup() (resp datatypes.Network_Component_Group, err error) {
	err = r.Session.DoRequest("SoftLayer_Network_Component", "getNetworkComponentGroup", nil, &r.Options, &resp)
	return
}