// NextPlaylistResults loads the next page of playlists into the specified search result.
481027
func (c *Client) NextPlaylistResults(s *SearchResult) error {
	if s.Playlists == nil || s.Playlists.Next == "" {
		return ErrNoMorePages
	}
	return c.get(s.Playlists.Next, s)
}
1232382
func (c *Client) GetPlaylistTracks(playlistID ID) (*PlaylistTrackPage, error) {
	return c.GetPlaylistTracksOpt(playlistID, nil, "")
}
656806
func (c *Client) PreviousArtistResults(s *SearchResult) error {
	if s.Artists == nil || s.Artists.Previous == "" {
		return ErrNoMorePages
	}
	return c.get(s.Artists.Previous, s)
}
675110
func playlistRange(c Playlister) ([2]int, error) {
	// Don't fetch or display more than this many playlist entries.
	max := 500
	// Give MPD a start/end of -1/-1 to fetch the full playlist.
	var rngAll = [2]int{-1, -1}
	// A sensible default for when we can't determine the current playlist size.
	var rngFirst = [2]int{0, max}

	s, err := c.Status()
	if err != nil {
		return rngFirst, err
	}
	if _, ok := s["song"]; !ok {
		// No current song playing, so use the whole (empty) playlist.
		return rngAll, nil
	}

	pos, err := strconv.Atoi(s["song"])
	if err != nil {
		return rngFirst, err
	}
	length, err := strconv.Atoi(s["playlistlength"])
	if err != nil {
		return rngFirst, err
	}

	if length > max {
		// Fetch this chunk of the current playlist. Adjust the starting position to
		// return n items before the current song, for context.
		start := math.Max(float64(0), float64(pos-1))
		return [2]int{int(start), pos + max}, nil
	} else {
		// Fetch all of the current playlist.
		return rngAll, nil
	}
}
769752
func AppsList(results int) error {
	c, err := client.New()

	if err != nil {
		return err
	}

	if results == defaultLimit {
		results = c.ResponseLimit
	}

	apps, count, err := apps.List(c, results)

	if err != nil {
		return err
	}

	fmt.Printf("=== Apps%s", limitCount(len(apps), count))

	sort.Sort(apps)
	for _, app := range apps {
		fmt.Println(app.ID)
	}
	return nil
}
689633
func (s *ticketStore) nextRegisterLookup() (lookupInfo, time.Duration) {
	// Queue up any new topics (or discarded ones), preserving iteration order
	for topic := range s.tickets {
		if _, ok := s.regSet[topic]; !ok {
			s.regQueue = append(s.regQueue, topic)
			s.regSet[topic] = struct{}{}
		}
	}
	// Iterate over the set of all topics and look up the next suitable one
	for len(s.regQueue) > 0 {
		// Fetch the next topic from the queue, and ensure it still exists
		topic := s.regQueue[0]
		s.regQueue = s.regQueue[1:]
		delete(s.regSet, topic)

		if s.tickets[topic] == nil {
			continue
		}
		// If the topic needs more tickets, return it
		if s.tickets[topic].nextLookup < mclock.Now() {
			next, delay := s.radius[topic].nextTarget(false), 100*time.Millisecond
			log.Trace("Found discovery topic to register", "topic", topic, "target", next.target, "delay", delay)
			return next, delay
		}
	}
	// No registration topics found or all exhausted, sleep
	delay := 40 * time.Second
	log.Trace("No topic found to register", "delay", delay)
	return lookupInfo{}, delay
}
428349
func (b *Batch) QueryResults() (*Rows, error) {
	rows := b.conn.getRows("batch query", nil)

	if b.err != nil {
		rows.fatal(b.err)
		return rows, b.err
	}

	select {
	case <-b.ctx.Done():
		b.die(b.ctx.Err())
		rows.fatal(b.err)
		return rows, b.ctx.Err()
	default:
	}

	if err := b.ensureCommandComplete(); err != nil {
		b.die(err)
		rows.fatal(err)
		return rows, err
	}

	b.resultsRead++

	b.pendingCommandComplete = true

	fieldDescriptions, err := b.conn.readUntilRowDescription()
	if err != nil {
		b.die(err)
		rows.fatal(b.err)
		return rows, err
	}

	rows.batch = b
	rows.fields = fieldDescriptions
	return rows, nil
}
305606
func (e *IndexLookUpExecutor) Next(ctx context.Context, req *chunk.RecordBatch) error {
	if e.runtimeStats != nil {
		start := time.Now()
		defer func() { e.runtimeStats.Record(time.Since(start), req.NumRows()) }()
	}
	if !e.workerStarted {
		if err := e.startWorkers(ctx, req.RequiredRows()); err != nil {
			return err
		}
	}
	req.Reset()
	for {
		resultTask, err := e.getResultTask()
		if err != nil {
			return err
		}
		if resultTask == nil {
			return nil
		}
		for resultTask.cursor < len(resultTask.rows) {
			req.AppendRow(resultTask.rows[resultTask.cursor])
			resultTask.cursor++
			if req.IsFull() {
				return nil
			}
		}
	}
}
1311253
func (cursor *ListAccountCursor) Next(ctx context.Context) ([]*UserRecord, error) {
	resp, err := cursor.auth.client.DownloadAccount(&identitytoolkit.IdentitytoolkitRelyingpartyDownloadAccountRequest{
		MaxResults:    cursor.MaxResults,
		NextPageToken: cursor.nextPageToken,
	}).Context(ctx).Do()
	if err != nil {
		return nil, err
	}
	if len(resp.Users) == 0 {
		return nil, iterator.Done
	}
	cursor.nextPageToken = resp.NextPageToken
	return toUserRecords(resp.Users), nil
}
1068394
func (s *HlsPackage) SetPlaylistWindowSeconds(v int64) *HlsPackage {
	s.PlaylistWindowSeconds = &v
	return s
}
244773
func (s *HlsManifestCreateOrUpdateParameters) SetPlaylistType(v string) *HlsManifestCreateOrUpdateParameters {
	s.PlaylistType = &v
	return s
}
291685
func (s *SearchResults) Next() (*SearchResults, error) {
	// get last timestamp
	var size = len(s.Posts)
	if size < 1 {
		return nil, NoNextPageError
	}
	lastPost := s.Posts[size-1].GetSelf()
	lastTs := lastPost.FeaturedTimestamp
	if lastTs < 1 {
		lastTs = lastPost.Timestamp
	}
	params := s.params
	params.Set("before", strconv.FormatUint(lastTs, 10))
	return TaggedSearch(s.client, params.Get("tag"), params)
}
508259
func (c *Client) NextTrackResults(s *SearchResult) error {
	if s.Tracks == nil || s.Tracks.Next == "" {
		return ErrNoMorePages
	}
	return c.get(s.Tracks.Next, s)
}
1163619
func (c *Client) PlaylistMove(name string, id, pos int) error {
	return c.Command("playlistmove %s %d %d", name, id, pos).OK()
}
443422
func (s *CreateJobInput) SetPlaylists(v []*CreateJobPlaylist) *CreateJobInput {
	s.Playlists = v
	return s
}
635909
func (c *Client) PlaylistContents(name string) ([]Attrs, error) {
	return c.Command("listplaylistinfo %s", name).AttrsList("file")
}
568237
func (s *IPServiceList) NextPage() (*IPServiceList, error) {
	if !s.HasNextPage() {
		return nil, Error{"No next page"}
	}

	return s.getPage(s.Meta.NextPageUri)
}