Skip to content
This repository was archived by the owner on Aug 25, 2023. It is now read-only.

Commit b4cd0fb

Browse files
committed
[Add] Optional argument to modify query options
1 parent 218c406 commit b4cd0fb

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

media.go

+13-8
Original file line numberDiff line numberDiff line change
@@ -741,28 +741,33 @@ func (media *FeedMedia) ID() string {
741741
//
742742
// returns false when list reach the end.
743743
// if FeedMedia.Error() is ErrNoMore no problem have been occurred.
744-
func (media *FeedMedia) Next() bool {
744+
func (media *FeedMedia) Next(args ...map[string]string) bool {
745745
if media.err != nil {
746746
return false
747747
}
748-
749748
insta := media.inst
750749
endpoint := media.endpoint
751750
next := media.ID()
752751

753752
if media.uid != 0 {
754753
endpoint = fmt.Sprintf(endpoint, media.uid)
755754
}
755+
query := map[string]string{
756+
"max_id": next,
757+
"rank_token": insta.rankToken,
758+
"min_timestamp": media.timestamp,
759+
"ranked_content": "true",
760+
}
761+
for _, arg := range args {
762+
for key, value := range arg {
763+
query[key] = value
764+
}
765+
}
756766

757767
body, err := insta.sendRequest(
758768
&reqOptions{
759769
Endpoint: endpoint,
760-
Query: map[string]string{
761-
"max_id": next,
762-
"rank_token": insta.rankToken,
763-
"min_timestamp": media.timestamp,
764-
"ranked_content": "true",
765-
},
770+
Query: query,
766771
},
767772
)
768773
if err == nil {

0 commit comments

Comments
 (0)