Repository: stripe/stripe-go (go)

Issue:
Files.New is broken
### Describe the bug

When posting file via stripe-go Files.New we get an error:

Unrecognized request URL (POST: /v1/files). Please see https://stripe.com/docs or we can help at https://support.stripe.com/.

It looks like stripe-go is using api.stripe.com instead of files.stripe.com as documented.

### To Reproduce

Call Files.New() with a file to upload.

### Expected behavior

To upload file.

### Code snippets

```Go
In https://github.com/stripe/stripe-go/blob/master/file/client.go line 44:

err = c.B.CallMultipart(http.MethodPost, "/v1/files", c.Key, boundary, bodyBuffer, &params.Params, file)

should be:

err = c.BUploads.CallMultipart(http.MethodPost, "/v1/files", c.Key, boundary, bodyBuffer, &params.Params, file)
```


### OS

All

### Go version

go1.20.5

### stripe-go version

v75.4.0

### API version

2023-08-16

### Additional context

_No response_

Pull request:
Bugfix: point files.New back to files.stripe.com
Fixes #1734.

This regressed in #1699 (go v75).

Patch:
diff --git a/file/client.go b/file/client.go
index 6e950b78..88987089 100644
--- a/file/client.go
+++ b/file/client.go
@@ -41,7 +41,7 @@ func (c Client) New(params *stripe.FileParams) (*stripe.File, error) {
 	}
 
 	file := &stripe.File{}
-	err = c.B.CallMultipart(http.MethodPost, "/v1/files", c.Key, boundary, bodyBuffer, &params.Params, file)
+	err = c.BUploads.CallMultipart(http.MethodPost, "/v1/files", c.Key, boundary, bodyBuffer, &params.Params, file)
 
 	return file, err
 }


Test patch:
diff --git a/example/generated_examples_test.go b/example/generated_examples_test.go
index 4354e6d3..124d1e59 100644
--- a/example/generated_examples_test.go
+++ b/example/generated_examples_test.go
@@ -1,4 +1,9 @@
+//
+//
 // File generated from our OpenAPI spec
+//
+//
+
 package example
 
 import (
diff --git a/file/client_test.go b/file/client_test.go
index 3c1fce75..8d44ddd7 100644
--- a/file/client_test.go
+++ b/file/client_test.go
@@ -12,11 +12,13 @@ package file
 //
 
 import (
+	"bytes"
 	"os"
 	"testing"
 
 	assert "github.com/stretchr/testify/require"
 	stripe "github.com/stripe/stripe-go/v75"
+	"github.com/stripe/stripe-go/v75/form"
 	_ "github.com/stripe/stripe-go/v75/testing"
 )
 
@@ -41,6 +43,33 @@ func TestFileList(t *testing.T) {
 	assert.NotNil(t, i.FileList())
 }
 
+type testBackend struct {
+	calledMultipart bool
+}
+
+func (b *testBackend) Call(method, path, key string, params stripe.ParamsContainer, v stripe.LastResponseSetter) error {
+	return nil
+}
+func (b *testBackend) CallStreaming(method, path, key string, params stripe.ParamsContainer, v stripe.StreamingLastResponseSetter) error {
+	return nil
+}
+func (b *testBackend) CallRaw(method, path, key string, body *form.Values, params *stripe.Params, v stripe.LastResponseSetter) error {
+	return nil
+}
+func (b *testBackend) CallMultipart(method, path, key, boundary string, body *bytes.Buffer, params *stripe.Params, v stripe.LastResponseSetter) error {
+	b.calledMultipart = true
+	return nil
+}
+func (b *testBackend) SetMaxNetworkRetries(maxNetworkRetries int64) {}
+func TestFileBackend(t *testing.T) {
+	orig := stripe.GetBackend(stripe.UploadsBackend)
+	b := &testBackend{calledMultipart: false}
+	stripe.SetBackend(stripe.UploadsBackend, b)
+	fileParams := &stripe.FileParams{}
+	New(fileParams)
+	assert.Equal(t, b.calledMultipart, true)
+	stripe.SetBackend(stripe.UploadsBackend, orig)
+}
 func TestFileNew(t *testing.T) {
 	f, err := os.Open("test_data.pdf")
 	if err != nil {