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

Commit

Permalink
Fixed highlights error
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrr committed Jun 2, 2018
1 parent b9b6726 commit 00a7f39
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 24 deletions.
27 changes: 18 additions & 9 deletions media.go
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,11 @@ func (media *StoryMedia) Seen() error {
}
*/

type trayRequest struct {
Name string `json:"name"`
Value string `json:"value"`
}

// Sync function is used when Highlight must be sync.
// Highlight must be sync when User.Highlights does not return any object inside StoryMedia slice.
//
Expand All @@ -556,18 +561,22 @@ func (media *StoryMedia) Seen() error {
// This function updates StoryMedia.Items
func (media *StoryMedia) Sync() error {
insta := media.inst
/*
query := []trayRequest{
{"SUPPORTED_SDK_VERSIONS", "9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0"},
{"FACE_TRACKER_VERSION", "9"},
{"segmentation", "segmentation_enabled"},
{"COMPRESSION", "ETC2_COMPRESSION"},
}
*/
query := []trayRequest{
{"SUPPORTED_SDK_VERSIONS", "9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0"},
{"FACE_TRACKER_VERSION", "10"},
{"segmentation", "segmentation_enabled"},
{"COMPRESSION", "ETC2_COMPRESSION"},
}
qjson, err := json.Marshal(query)
if err != nil {
return err
}

id := media.Pk.(string)
data, err := insta.prepareData(
map[string]interface{}{
"user_ids": []string{id},
"user_ids": []string{id},
"supported_capabilities_new": b2s(qjson),
},
)
if err != nil {
Expand Down
27 changes: 12 additions & 15 deletions users.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,23 +405,20 @@ func (user *User) Stories() *StoryMedia {
//
// See example: examples/user/highlights.go
func (user *User) Highlights() ([]StoryMedia, error) {
/*
TODO
query := []struct {
Name string `json:"name"`
Value string `json:"value"`
}{
{"SUPPORTED_SDK_VERSIONS", "9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0"},
{"FACE_TRACKER_VERSION", "9"},
{"segmentation", "segmentation_enabled"},
{"COMPRESSION", "ETC2_COMPRESSION"},
}
*/
//data, err := json.Marshal(query)
query := []trayRequest{
{"SUPPORTED_SDK_VERSIONS", "9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0"},
{"FACE_TRACKER_VERSION", "10"},
{"segmentation", "segmentation_enabled"},
{"COMPRESSION", "ETC2_COMPRESSION"},
}
data, err := json.Marshal(query)
if err != nil {
return nil, err
}
body, err := user.inst.sendRequest(
&reqOptions{
Endpoint: fmt.Sprintf(urlUserHighlights, user.ID),
Connection: "keep-alive",
Endpoint: fmt.Sprintf(urlUserHighlights, user.ID),
Query: generateSignature(b2s(data)),
},
)
if err == nil {
Expand Down

0 comments on commit 00a7f39

Please sign in to comment.