Skip to content

Commit dcb01cc

Browse files
chore(api): delete deprecated method (#208)
1 parent bf8afc3 commit dcb01cc

File tree

3 files changed

+0
-40
lines changed

3 files changed

+0
-40
lines changed

api.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ Params Types:
9595

9696
Response Types:
9797

98-
- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#FileContent">FileContent</a>
9998
- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#FileDeleted">FileDeleted</a>
10099
- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#FileObject">FileObject</a>
101100

@@ -106,7 +105,6 @@ Methods:
106105
- <code title="get /files">client.Files.<a href="https://pkg.go.dev/github.com/openai/openai-go#FileService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#FileListParams">FileListParams</a>) (<a href="https://pkg.go.dev/github.com/openai/openai-go/packages/pagination">pagination</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/packages/pagination#CursorPage">CursorPage</a>[<a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#FileObject">FileObject</a>], <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
107106
- <code title="delete /files/{file_id}">client.Files.<a href="https://pkg.go.dev/github.com/openai/openai-go#FileService.Delete">Delete</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, fileID <a href="https://pkg.go.dev/builtin#string">string</a>) (<a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#FileDeleted">FileDeleted</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
108107
- <code title="get /files/{file_id}/content">client.Files.<a href="https://pkg.go.dev/github.com/openai/openai-go#FileService.Content">Content</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, fileID <a href="https://pkg.go.dev/builtin#string">string</a>) (http.Response, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
109-
- <code title="get /files/{file_id}/content">client.Files.<a href="https://pkg.go.dev/github.com/openai/openai-go#FileService.GetContent">GetContent</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, fileID <a href="https://pkg.go.dev/builtin#string">string</a>) (<a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#FileContent">FileContent</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
110108

111109
# Images
112110

file.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -128,22 +128,6 @@ func (r *FileService) Content(ctx context.Context, fileID string, opts ...option
128128
return
129129
}
130130

131-
// Returns the contents of the specified file.
132-
//
133-
// Deprecated: The `.content()` method should be used instead
134-
func (r *FileService) GetContent(ctx context.Context, fileID string, opts ...option.RequestOption) (res *FileContent, err error) {
135-
opts = append(r.Options[:], opts...)
136-
if fileID == "" {
137-
err = errors.New("missing required file_id parameter")
138-
return
139-
}
140-
path := fmt.Sprintf("files/%s/content", fileID)
141-
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
142-
return
143-
}
144-
145-
type FileContent = string
146-
147131
type FileDeleted struct {
148132
ID string `json:"id,required"`
149133
Deleted bool `json:"deleted,required"`

file_test.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -146,25 +146,3 @@ func TestFileContent(t *testing.T) {
146146
t.Fatalf("return value not %s: %s", "abc", b)
147147
}
148148
}
149-
150-
func TestFileGetContent(t *testing.T) {
151-
baseURL := "http://localhost:4010"
152-
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
153-
baseURL = envURL
154-
}
155-
if !testutil.CheckTestServer(t, baseURL) {
156-
return
157-
}
158-
client := openai.NewClient(
159-
option.WithBaseURL(baseURL),
160-
option.WithAPIKey("My API Key"),
161-
)
162-
_, err := client.Files.GetContent(context.TODO(), "file_id")
163-
if err != nil {
164-
var apierr *openai.Error
165-
if errors.As(err, &apierr) {
166-
t.Log(string(apierr.DumpRequest(true)))
167-
}
168-
t.Fatalf("err should be nil: %s", err.Error())
169-
}
170-
}

0 commit comments

Comments
 (0)