// Next function allows pagination over notifications.
//
// See example: examples/activity/recent.go
436651
func (act *MineActivity) Next() bool {
	if act.err != nil {
		return false
	}
	insta := act.inst
	body, err := insta.sendRequest(
		&reqOptions{
			Endpoint: urlActivityRecent,
			Query: map[string]string{
				"max_id": strconv.FormatInt(act.NextID, 10),
			},
			IsPost: false,
		},
	)
	if err == nil {
		act2 := MineActivity{}
		err = json.Unmarshal(body, &act2)
		if err == nil {
			*act = act2
			act.inst = insta
			if len(act.Stories) == 0 || act.NextID == 0 {
				act.err = ErrNoMore
			}
			return true
		}
	}
	act.err = err
	return false
}
225597
func (iter *iteratorSingle) Next() error {
	err := iter.sc.Next()
	if err != nil {
		iter.op = 0
		iter.k = nil
		iter.v = nil

		// we DO want to return ErrIteratorDone here
		return err
	}

	iter.op, iter.k, iter.v = iter.sc.Current()
	if iter.op != OperationDel ||
		iter.iteratorOptions.IncludeDeletions {
		return nil
	}

	return iter.Next()
}
177010
func (iter *DeleteListIterator) Next() bool {
	if len(iter.objects) > 0 {
		iter.objects = iter.objects[1:]
	}

	if len(iter.objects) == 0 && iter.Paginator.Next() {
		iter.objects = iter.Paginator.Page().(*s3.ListObjectsOutput).Contents
	}

	return len(iter.objects) > 0
}
829862
func (it *Optional) Next(ctx context.Context) bool {
	clog.Errorf("Nexting an un-nextable iterator: %T", it)
	return false
}
938777
func (bg *Writer) Next() (int, error) {
	if bg.closed {
		return 0, ErrClosed
	}
	if err := bg.Error(); err != nil {
		return 0, err
	}

	return bg.active.next, nil
}
410419
func (m *FilePager) Next() schema.Message {
	if m.ConnScanner == nil {
		m.NextScanner()
	}
	for {
		if m.closed {
			return nil
		} else if m.ConnScanner == nil {
			m.closed = true
			return nil
		}
		msg := m.ConnScanner.Next()
		if msg == nil {
			// Kind of crap api, side-effect method? uck
			_, err := m.NextScanner()
			if err != nil {
				if err == iterator.Done {
					// Truly was last file in partition
					m.closed = true
					return nil
				} else {
					u.Errorf("unexpected end of scan %v", err)
					return nil
				}
			}

			// now that we have a new scanner, lets try again
			if m.ConnScanner != nil {
				msg = m.ConnScanner.Next()
			}
		}

		m.rowct++
		return msg
	}
}
735728
func (c *C) Next() {
	c.index++
	s := int8(len(c.handlers))
	if c.index < s {
		c.handlers[c.index](c)
	}
}
132878
func (d *Defer) Next() *Defer {
	if d.link == nil {
		return nil
	}
	d.link.load()
	if d.link.SP < d.SP {
		d.link.Unreadable = errSPDecreased
	}
	return d.link
}
416647
func (f *FollowerList) Next() (*FollowerList, error) {
	limit := f.limit
	if limit < 1 {
		limit = uint(len(f.Followers))
	}
	offset := f.offset + limit
	if uint32(offset) >= f.Total || len(f.Followers) < 1 {
		return nil, NoNextPageError
	}
	return GetFollowers(f.client, f.name, offset, limit)
}
414074
func (r *responseIterator) Next() flux.Result {
	res := r.response.Results[r.resultIdx]
	r.resultIdx++
	return newQueryResult(&res)
}
1327272
func (l Links) NextPage() (int, error) {
	if l.Next == "" {
		return 0, nil
	}
	return pageForURL(l.Next)
}
568237
func (s *IPServiceList) NextPage() (*IPServiceList, error) {
	if !s.HasNextPage() {
		return nil, Error{"No next page"}
	}

	return s.getPage(s.Meta.NextPageUri)
}
764023
func (r *Request) nextPageTokens() []interface{} {
	if r.Operation.Paginator == nil {
		return nil
	}
	if r.Operation.TruncationToken != "" {
		tr, _ := awsutil.ValuesAtPath(r.Data, r.Operation.TruncationToken)
		if len(tr) == 0 {
			return nil
		}

		switch v := tr[0].(type) {
		case *bool:
			if !aws.BoolValue(v) {
				return nil
			}
		case bool:
			if v == false {
				return nil
			}
		}
	}

	tokens := []interface{}{}
	tokenAdded := false
	for _, outToken := range r.Operation.OutputTokens {
		vs, _ := awsutil.ValuesAtPath(r.Data, outToken)
		if len(vs) == 0 {
			tokens = append(tokens, nil)
			continue
		}
		v := vs[0]

		switch tv := v.(type) {
		case *string:
			if len(aws.StringValue(tv)) == 0 {
				tokens = append(tokens, nil)
				continue
			}
		case string:
			if len(tv) == 0 {
				tokens = append(tokens, nil)
				continue
			}
		}

		tokenAdded = true
		tokens = append(tokens, v)
	}
	if !tokenAdded {
		return nil
	}

	return tokens
}
1369954
func (d *OneToOneEnvelope) Next() *events.Envelope {
	data := d.d.Next()
	return (*events.Envelope)(data)
}
1374503
func (m *LexTokenPager) Next() lex.Token {
	m.lexNext()
	m.cursor++
	if m.cursor+1 > len(m.tokens) {
		//u.Warnf("Next() CRAP? increment cursor: %v of %v %v", m.cursor, len(m.tokens))
		return eoft
	}
	return m.tokens[m.cursor-1]
}
595511
func (it *LinksTo) Next(ctx context.Context) bool {
	for {
		graph.NextLogIn(it)
		it.runstats.Next += 1
		if it.nextIt.Next(ctx) {
			it.runstats.ContainsNext += 1
			it.result = it.nextIt.Result()
			return graph.NextLogOut(it, true)
		}

		// If there's an error in the 'next' iterator, we save it and we're done.
		it.err = it.nextIt.Err()
		if it.err != nil {
			return false
		}

		// Subiterator is empty, get another one
		if !it.primaryIt.Next(ctx) {
			// Possibly save error
			it.err = it.primaryIt.Err()

			// We're out of nodes in our subiterator, so we're done as well.
			return graph.NextLogOut(it, false)
		}
		it.nextIt.Close()
		it.nextIt = it.qs.QuadIterator(it.dir, it.primaryIt.Result())

		// Continue -- return the first in the next set.
	}
}
127029
func (qc *QueryCatcher) Next() (*tabletenv.LogStats, error) {
	event, err := qc.catcher.next()
	if err != nil {
		return nil, err
	}
	return event.(*tabletenv.LogStats), nil
}