Codebase list golang-github-nlopes-slack / 83acb40
Add share/revoke methods for files Norberto Lopes 8 years ago
1 changed file(s) with 26 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
239239 return nil
240240
241241 }
242
243 // RevokeFilePublicURL disables public/external sharing for a file
244 func (api *Client) RevokeFilePublicURL(fileID string) (*File, error) {
245 values := url.Values{
246 "token": {api.config.token},
247 "file": {fileID},
248 }
249 response, err := fileRequest("files.revokePublicURL", values, api.debug)
250 if err != nil {
251 return nil, err
252 }
253 return &response.File, nil
254 }
255
256 // ShareFilePublicURL enabled public/external sharing for a file
257 func (api *Client) ShareFilePublicURL(fileID string) (*File, []Comment, *Paging, error) {
258 values := url.Values{
259 "token": {api.config.token},
260 "file": {fileID},
261 }
262 response, err := fileRequest("files.sharedPublicURL", values, api.debug)
263 if err != nil {
264 return nil, nil, nil, err
265 }
266 return &response.File, response.Comments, &response.Paging, nil
267 }