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

Commit aa351f0

Browse files
Sean Liaoahmdrz
Sean Liao
authored andcommitted
new response type for usertaggedfeed (#98)
* change UserTaggedFeed return to new type with int64 next_max_id and extra fields * change test case * change int -> int64 for next_max_id
1 parent 341591d commit aa351f0

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

goinsta.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -273,13 +273,17 @@ func (insta *Instagram) UserFeed(userID int64, maxID, minTimestamp string) (resp
273273
}
274274

275275
// UserTaggedFeed - Returns the feed for medua a given user is tagged in
276-
func (insta *Instagram) UserTaggedFeed(userID int64, maxID, minTimestamp string) (response.UserFeedResponse, error) {
277-
resp := response.UserFeedResponse{}
276+
func (insta *Instagram) UserTaggedFeed(userID, maxID int64, minTimestamp string) (response.UserTaggedFeedResponse, error) {
277+
resp := response.UserTaggedFeedResponse{}
278+
maxid := ""
279+
if maxID != 0 {
280+
maxid = string(maxID)
281+
}
278282

279283
body, err := insta.sendRequest(&reqOptions{
280284
Endpoint: fmt.Sprintf("usertags/%d/feed/", userID),
281285
Query: map[string]string{
282-
"max_id": maxID,
286+
"max_id": maxid,
283287
"rank_token": insta.Informations.RankToken,
284288
"min_timestamp": minTimestamp,
285289
"ranked_content": "true",

goinsta_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ func TestUserTaggedFeed(t *testing.T) {
505505
t.Skip("Empty username or password , Skipping ...")
506506
}
507507

508-
_, err := insta.UserTaggedFeed(17644112, "", "") // ID from elonmusk
508+
_, err := insta.UserTaggedFeed(17644112, 0, "") // ID from elonmusk
509509
if err != nil {
510510
t.Fatal(err)
511511
return
@@ -519,7 +519,7 @@ func TestUserTaggedFeedWithMaxIDAndTimestamp(t *testing.T) {
519519
t.Skip("Empty username or password , Skipping ...")
520520
}
521521

522-
_, err := insta.UserTaggedFeed(17644112, "25025320", "25025320") // ID from elonmusk
522+
_, err := insta.UserTaggedFeed(17644112, 25035320, "25025320") // ID from elonmusk
523523
if err != nil {
524524
t.Fatal(err)
525525
return

response/types.go

+13
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,19 @@ type DirectThread struct {
431431
} `json:"thread"`
432432
}
433433

434+
type UserTaggedFeedResponse struct {
435+
Status string `json:"status"`
436+
NumResults int `json:"num_results"`
437+
AutoLoadMoreEnabled bool `json:"auto_load_more_enabled"`
438+
Items []Item `json:"items"`
439+
MoreAvailable bool `json:"more_available"`
440+
NextMaxID int64 `json:"next_max_id"`
441+
TotalCount int `json:"total_count"`
442+
RequiresReview bool `json:"requires_review"`
443+
// maybe this is photos waiting for review?
444+
// NewPhotos []interface{} `json:"new_photos"`
445+
}
446+
434447
// UserFeedResponse contains user feeds
435448
type UserFeedResponse struct {
436449
Status string `json:"status"`

0 commit comments

Comments
 (0)