Skip to content

Commit

Permalink
fix media response (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
narayana-plivo authored Jun 7, 2024
1 parent c199fcb commit 137f458
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Change Log
## [7.49.2](https://github.com/plivo/plivo-go/tree/v7.49.2) (2024-06-07)
**Bug Fix - List and Get Media object url fix**
- Fixed the media_url response value

## [7.49.1](https://github.com/plivo/plivo-go/tree/v7.49.1) (2024-05-28)
**Feature - Filter support for AppName in ListApplication API**
Expand Down
2 changes: 1 addition & 1 deletion baseclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/google/go-querystring/query"
)

const sdkVersion = "7.49.1"
const sdkVersion = "7.49.2"

const lookupBaseUrl = "lookup.plivo.com"

Expand Down
18 changes: 9 additions & 9 deletions media.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ type Media struct {
MediaID string `json:"media_id,omitempty" url:"media_id,omitempty"`
Size int `json:"size,omitempty" url:"size,omitempty"`
UploadTime string `json:"upload_time,omitempty" url:"upload_time,omitempty"`
URL string `json:"url,omitempty" url:"url,omitempty"`
URL string `json:"media_url,omitempty" url:"media_url,omitempty"`
}

//Media related information
// Media related information
type MediaUploadResponse struct {
ContentType string `json:"content_type,omitempty" url:"content_type,omitempty"`
FileName string `json:"file_name,omitempty" url:"file_name,omitempty"`
Expand All @@ -42,7 +42,7 @@ type MediaUploadResponse struct {
ErrorCode int `json:"error_code,omitempty" url:"error_code,omitempty"`
}

//Meta data information
// Meta data information
type MediaMeta struct {
Previous *string
Next *string
Expand All @@ -51,7 +51,7 @@ type MediaMeta struct {
Limit int `json:"limit,omitempty" url:"limit,omitempty"`
}

//Media upload response to client
// Media upload response to client
type MediaResponseBody struct {
Media []MediaUploadResponse `json:"objects" url:"objects"`
ApiID string `json:"api_id" url:"api_id"`
Expand All @@ -64,18 +64,18 @@ type BaseListMediaResponse struct {
Media []Media `json:"objects" url:"objects"`
}

//Input param to upload media
// Input param to upload media
type MediaUpload struct {
UploadFiles []Files
}

//Information about files
// Information about files
type Files struct {
FilePath string
ContentType string
}

//Media list metadata
// Media list metadata
type MediaListParams struct {
Limit int `url:"limit,omitempty"`
Offset int `url:"offset,omitempty"`
Expand All @@ -87,7 +87,7 @@ func escapeQuotes(s string) string {
return quoteEscaper.Replace(s)
}

//Upload the media to plivo api, use media id for sending MMS
// Upload the media to plivo api, use media id for sending MMS
func (service *MediaService) Upload(params MediaUpload) (response *MediaResponseBody, err error) {
payload := &bytes.Buffer{}
writer := multipart.NewWriter(payload)
Expand Down Expand Up @@ -144,7 +144,7 @@ func (service *MediaService) Get(media_id string) (response *Media, err error) {
return resp, nil
}

//List all the media information
// List all the media information
func (service *MediaService) List(param MediaListParams) (response *BaseListMediaResponse, err error) {
req, err := service.client.NewRequest("GET", param, "Media")
if err != nil {
Expand Down

0 comments on commit 137f458

Please sign in to comment.