Skip to content

Commit

Permalink
added UploadMedia with mediaBodyRequest struct
Browse files Browse the repository at this point in the history
  • Loading branch information
Allan-Nava authored Sep 30, 2024
1 parent 34bc6d9 commit a8b30ff
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
11 changes: 6 additions & 5 deletions meta/fb/api_content.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ In caso di azione eseguita correttamente, l'app riceve una risposta JSON con l'I
}
*/
func (s *fbService) UploadMedia(fileUrl, pageId, title, description string) (*UploadMediaResponse, error) {
params := make(map[string]string)
params["access_token"] = s.accessToken
params["title"] = title
params["description"] = description
params["file_url"] = fileUrl
params := &mediaBodyRequest{
AccessToken: s.accessToken,
Title: title,
Description: description,
FileUrl: fileUrl,
}
//
resp, err := s.restyPostWithQueryParams(apiUploadMediaUrl(pageId), nil, params)

Check failure on line 33 in meta/fb/api_content.go

View workflow job for this annotation

GitHub Actions / build (1.19.x)

cannot use params (variable of type *mediaBodyRequest) as type map[string]string in argument to s.restyPostWithQueryParams

Check failure on line 33 in meta/fb/api_content.go

View workflow job for this annotation

GitHub Actions / build (1.20.x)

cannot use params (variable of type *mediaBodyRequest) as map[string]string value in argument to s.restyPostWithQueryParams

Check failure on line 33 in meta/fb/api_content.go

View workflow job for this annotation

GitHub Actions / build (1.20.x)

cannot use params (variable of type *mediaBodyRequest) as map[string]string value in argument to s.restyPostWithQueryParams

Check failure on line 33 in meta/fb/api_content.go

View workflow job for this annotation

GitHub Actions / build (1.21.x)

cannot use params (variable of type *mediaBodyRequest) as map[string]string value in argument to s.restyPostWithQueryParams

Check failure on line 33 in meta/fb/api_content.go

View workflow job for this annotation

GitHub Actions / build (1.21.x)

cannot use params (variable of type *mediaBodyRequest) as map[string]string value in argument to s.restyPostWithQueryParams

Check failure on line 33 in meta/fb/api_content.go

View workflow job for this annotation

GitHub Actions / build (1.22.x)

cannot use params (variable of type *mediaBodyRequest) as map[string]string value in argument to s.restyPostWithQueryParams

Check failure on line 33 in meta/fb/api_content.go

View workflow job for this annotation

GitHub Actions / build (1.22.x)

cannot use params (variable of type *mediaBodyRequest) as map[string]string value in argument to s.restyPostWithQueryParams
if err != nil {
Expand Down
7 changes: 6 additions & 1 deletion meta/fb/request_content.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
package fb

// https://developers.facebook.com/docs/graph-api/guides/upload

type mediaBodyRequest struct {
AccessToken string `json:"access_token"`
Title string `json:"title"`
Description string `json:"description"`
FileUrl string `json:"file_url"`
}
2 changes: 0 additions & 2 deletions meta/fb/response_content.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package fb


/*
{
"id": "upload:<UPLOAD_SESSION_ID>"
}
*/

type UploadMediaResponse struct {
ID string `json:"id"`
}

0 comments on commit a8b30ff

Please sign in to comment.