File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -147,6 +147,25 @@ func (c *Client) ListFiles(ctx context.Context) (files FilesList, err error) {
147
147
return
148
148
}
149
149
150
+ // ListFilesForIDs Lists the files based on provided IDs.
151
+ // WARNING: This is an undocumented API, used by the OpenAI platform UI. Consider it a hack.
152
+ func (c * Client ) ListFilesForIDs (ctx context.Context , fileIDs []string ) (files FilesList , err error ) {
153
+ req , err := c .newRequest (ctx , http .MethodGet , c .fullURL ("/files" ))
154
+ if err != nil {
155
+ return
156
+ }
157
+
158
+ reqQuery := req .URL .Query ()
159
+ for _ , id := range fileIDs {
160
+ reqQuery .Add ("ids[]" , id )
161
+ }
162
+
163
+ req .URL .RawQuery = reqQuery .Encode ()
164
+
165
+ err = c .sendRequest (req , & files )
166
+ return
167
+ }
168
+
150
169
// GetFile Retrieves a file instance, providing basic information about the file
151
170
// such as the file name and purpose.
152
171
func (c * Client ) GetFile (ctx context.Context , fileID string ) (file File , err error ) {
You can’t perform that action at this time.
0 commit comments