104 return &attachment, nil |
103 return &attachment, nil |
105 } |
104 } |
106 |
105 |
107 // UpdateMedia updates the description and focal point of a media |
106 // UpdateMedia updates the description and focal point of a media |
108 // One of the description and focus arguments can be nil to not be updated. |
107 // One of the description and focus arguments can be nil to not be updated. |
109 func (mc *Client) UpdateMedia(mediaID int64, description, focus *string) (*Attachment, error) { |
108 func (mc *Client) UpdateMedia(mediaID ActivityID, description, focus *string) (*Attachment, error) { |
110 params := make(apiCallParams) |
109 params := make(apiCallParams) |
111 if description != nil { |
110 if description != nil { |
112 params["description"] = *description |
111 params["description"] = *description |
113 } |
112 } |
114 if focus != nil { |
113 if focus != nil { |
115 params["focus"] = *focus |
114 params["focus"] = *focus |
116 } |
115 } |
117 |
116 |
118 endPoint := "media/" + strconv.FormatInt(mediaID, 10) |
117 endPoint := "media/" + mediaID |
119 var attachment Attachment |
118 var attachment Attachment |
120 if err := mc.apiCall("v1/"+endPoint, rest.Put, params, nil, nil, &attachment); err != nil { |
119 if err := mc.apiCall("v1/"+endPoint, rest.Put, params, nil, nil, &attachment); err != nil { |
121 return nil, err |
120 return nil, err |
122 } |
121 } |
123 return &attachment, nil |
122 return &attachment, nil |