// Next allows pagination after calling:
// User.Feed
// Params: ranked_content is set to "true" by default, you can set it to false by either passing "false" or false as parameter.
// returns false when list reach the end.
// if FeedMedia.Error() is ErrNoMore no problem have been occurred.
Next allows pagination after calling:
User.Feed
Params: ranked_content is set to "true" by default, you can set it to false by either passing "false" or false as parameter.
returns false when list reach the end.
if FeedMedia.Error() is ErrNoMore no problem have been occurred.
// Next allows pagination after calling : // User . Feed // Params : ranked_content is set to " true " by default you can set it to false by either passing " false " or false as parameter . // returns false when list reach the end . // if FeedMedia . Error () is ErrNoMore no problem have been occurred .
func (media *FeedMedia) Next(params ...interface{}) bool {
	if media.err != nil {
		return false
	}
	insta := media.inst
	endpoint := media.endpoint
	next := media.ID()
	ranked := "true"
	if media.uid != 0 {
		endpoint = fmt.Sprintf(endpoint, media.uid)
	}
	for _, param := range params {
		switch s := param.(type) {
		case string:
			if _, err := strconv.ParseBool(s); err == nil {
				ranked = s
			}
		case bool:
			if !s {
				ranked = "false"
			}
		}
	}
	body, err := insta.sendRequest(
		&reqOptions{
			Endpoint: endpoint,
			Query: map[string]string{
				"max_id":         next,
				"rank_token":     insta.rankToken,
				"min_timestamp":  media.timestamp,
				"ranked_content": ranked,
			},
		},
	)
	if err == nil {
		m := FeedMedia{}
		err = json.Unmarshal(body, &m)
		if err == nil {
			*media = m
			media.inst = insta
			media.endpoint = endpoint
			if m.NextID == 0 || !m.MoreAvailable {
				media.err = ErrNoMore
			}
			media.setValues()
			return true
		}
	}
	return false
}
func ( media * FeedMedia ) Next ( params ... interface { } ) bool { if media . err != nil { return false } insta := media . inst endpoint := media . endpoint next := media . ID ( ) ranked := " " if media . uid != 0 { endpoint = fmt . Sprintf ( endpoint , media . uid ) } for _ , param := range params { switch s := param . ( type ) { case string : if _ , err := strconv . ParseBool ( s ) ; err == nil { ranked = s } case bool : if ! s { ranked = " " } } } body , err := insta . sendRequest ( & reqOptions { Endpoint : endpoint , Query : map [ string ] string { " " : next , " " : insta . rankToken , " " : media . timestamp , " " : ranked , } , } , ) if err == nil { m := FeedMedia { } err = json . Unmarshal ( body , & m ) if err == nil { * media = m media . inst = insta media . endpoint = endpoint if m . NextID == 0 || ! m . MoreAvailable { media . err = ErrNoMore } media . setValues ( ) return true } } return false }
Next allows pagination after calling:
User.Feed
Params: ranked_content is set to "true" by default, you can set it to false by either passing "false" or false as parameter.
Next allows pagination after calling : User . Feed Params : ranked_content is set to " true " by default you can set it to false by either passing " false " or false as parameter .