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

new response type for usertaggedfeed #98

Merged
merged 3 commits into from
Mar 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions goinsta.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,17 @@ func (insta *Instagram) UserFeed(userID int64, maxID, minTimestamp string) (resp
}

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

body, err := insta.sendRequest(&reqOptions{
Endpoint: fmt.Sprintf("usertags/%d/feed/", userID),
Query: map[string]string{
"max_id": maxID,
"max_id": maxid,
"rank_token": insta.Informations.RankToken,
"min_timestamp": minTimestamp,
"ranked_content": "true",
Expand Down
4 changes: 2 additions & 2 deletions goinsta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ func TestUserTaggedFeed(t *testing.T) {
t.Skip("Empty username or password , Skipping ...")
}

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

_, err := insta.UserTaggedFeed(17644112, "25025320", "25025320") // ID from elonmusk
_, err := insta.UserTaggedFeed(17644112, 25035320, "25025320") // ID from elonmusk
if err != nil {
t.Fatal(err)
return
Expand Down
13 changes: 13 additions & 0 deletions response/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,19 @@ type DirectThread struct {
} `json:"thread"`
}

type UserTaggedFeedResponse struct {
Status string `json:"status"`
NumResults int `json:"num_results"`
AutoLoadMoreEnabled bool `json:"auto_load_more_enabled"`
Items []Item `json:"items"`
MoreAvailable bool `json:"more_available"`
NextMaxID int64 `json:"next_max_id"`
TotalCount int `json:"total_count"`
RequiresReview bool `json:"requires_review"`
// maybe this is photos waiting for review?
// NewPhotos []interface{} `json:"new_photos"`
}

// UserFeedResponse contains user feeds
type UserFeedResponse struct {
Status string `json:"status"`
Expand Down