@@ -178,14 +178,14 @@ type UploadFileV2Parameters struct {
178178 Channel string
179179 ThreadTimestamp string
180180 AltTxt string
181- SnippetText string
181+ SnippetType string
182182}
183183
184184type GetUploadURLExternalParameters struct {
185- AltText string
185+ AltTxt string
186186 FileSize int
187187 FileName string
188- SnippetText string
188+ SnippetType string
189189}
190190
191191type GetUploadURLExternalResponse struct {
@@ -194,7 +194,7 @@ type GetUploadURLExternalResponse struct {
194194 SlackResponse
195195}
196196
197- type uploadToURLParameters struct {
197+ type UploadToURLParameters struct {
198198 UploadURL string
199199 Reader io.Reader
200200 File string
@@ -375,15 +375,23 @@ func (api *Client) ListFilesContext(ctx context.Context, params ListFilesParamet
375375
376376// UploadFile uploads a file.
377377//
378- // Deprecated: Use [Client.UploadFileV2] instead. This will stop functioning on March 11, 2025.
378+ // Deprecated: Use [Client.UploadFileV2] instead.
379+ //
380+ // Per Slack Changelog, specifically [https://api.slack.com/changelog#entry-march_2025_1](this entry),
381+ // this will stop functioning on November 12, 2025.
382+ //
379383// For more details, see: https://api.slack.com/methods/files.upload#markdown
380384func (api * Client ) UploadFile (params FileUploadParameters ) (file * File , err error ) {
381385 return api .UploadFileContext (context .Background (), params )
382386}
383387
384388// UploadFileContext uploads a file and setting a custom context.
385389//
386- // Deprecated: Use [Client.UploadFileV2Context] instead. This will stop functioning on March 11, 2025.
390+ // Deprecated: Use [Client.UploadFileV2Context] instead.
391+ //
392+ // Per Slack Changelog, specifically [https://api.slack.com/changelog#entry-march_2025_1](this entry),
393+ // this will stop functioning on November 12, 2025.
394+ //
387395// For more details, see: https://api.slack.com/methods/files.upload#markdown
388396func (api * Client ) UploadFileContext (ctx context.Context , params FileUploadParameters ) (file * File , err error ) {
389397 // Test if user token is valid. This helps because client.Do doesn't like this for some reason. XXX: More
@@ -529,11 +537,11 @@ func (api *Client) GetUploadURLExternalContext(ctx context.Context, params GetUp
529537 "filename" : {params .FileName },
530538 "length" : {strconv .Itoa (params .FileSize )},
531539 }
532- if params .AltText != "" {
533- values .Add ("initial_comment " , params .AltText )
540+ if params .AltTxt != "" {
541+ values .Add ("alt_txt " , params .AltTxt )
534542 }
535- if params .SnippetText != "" {
536- values .Add ("thread_ts " , params .SnippetText )
543+ if params .SnippetType != "" {
544+ values .Add ("snippet_type " , params .SnippetType )
537545 }
538546 response := & GetUploadURLExternalResponse {}
539547 err := api .postMethod (ctx , "files.getUploadURLExternal" , values , response )
@@ -544,8 +552,9 @@ func (api *Client) GetUploadURLExternalContext(ctx context.Context, params GetUp
544552 return response , response .Err ()
545553}
546554
547- // uploadToURL uploads the file to the provided URL using post method
548- func (api * Client ) uploadToURL (ctx context.Context , params uploadToURLParameters ) (err error ) {
555+ // UploadToURL uploads the file to the provided URL using post method
556+ // This is not a Slack API method, but a helper function to upload files to the URL
557+ func (api * Client ) UploadToURL (ctx context.Context , params UploadToURLParameters ) (err error ) {
549558 values := url.Values {}
550559 if params .Content != "" {
551560 contentReader := strings .NewReader (params .Content )
@@ -565,6 +574,7 @@ func (api *Client) CompleteUploadExternalContext(ctx context.Context, params Com
565574 if err != nil {
566575 return nil , err
567576 }
577+
568578 values := url.Values {
569579 "token" : {api .token },
570580 "files" : {string (filesBytes )},
@@ -611,16 +621,16 @@ func (api *Client) UploadFileV2Context(ctx context.Context, params UploadFileV2P
611621 }
612622
613623 u , err := api .GetUploadURLExternalContext (ctx , GetUploadURLExternalParameters {
614- AltText : params .AltTxt ,
624+ AltTxt : params .AltTxt ,
615625 FileName : params .Filename ,
616626 FileSize : params .FileSize ,
617- SnippetText : params .SnippetText ,
627+ SnippetType : params .SnippetType ,
618628 })
619629 if err != nil {
620630 return nil , err
621631 }
622632
623- err = api .uploadToURL (ctx , uploadToURLParameters {
633+ err = api .UploadToURL (ctx , UploadToURLParameters {
624634 UploadURL : u .UploadURL ,
625635 Reader : params .Reader ,
626636 File : params .File ,
0 commit comments