File tree 4 files changed +19
-1
lines changed
4 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ Methods:
82
82
- <code title =" get /files/{file_id} " >client.files.<a href =" ./src/resources/files.ts " >retrieve</a >(fileId) -> FileObject</code >
83
83
- <code title =" get /files " >client.files.<a href =" ./src/resources/files.ts " >list</a >({ ...params }) -> FileObjectsPage</code >
84
84
- <code title =" delete /files/{file_id} " >client.files.<a href =" ./src/resources/files.ts " >del</a >(fileId) -> FileDeleted</code >
85
+ - <code title =" get /files/{file_id}/content " >client.files.<a href =" ./src/resources/files.ts " >content</a >(fileId) -> Response</code >
85
86
- <code title =" get /files/{file_id}/content " >client.files.<a href =" ./src/resources/files.ts " >retrieveContent</a >(fileId) -> string</code >
86
87
- <code >client.files.<a href =" ./src/resources/files.ts " >waitForProcessing</a >(id, { pollInterval = 5000, maxWait = 30 _ 60 _ 1000 }) -> Promise< ; FileObject> ; </code >
87
88
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ This is a build produced from https://github.com/openai/openai-node – please g
15
15
Usage:
16
16
17
17
\`\`\` ts
18
- import OpenAI from "$( echo ' https://deno.land/x/openai@v4.16.2 /mod.ts' | sed -E s/@\. +\\ //@" $PACKAGE_VERSION " \\ //) ";
18
+ import OpenAI from "$( echo ' https://deno.land/x/openai@v4.17.0 /mod.ts' | sed -E s/@\. +\\ //@" $PACKAGE_VERSION " \\ //) ";
19
19
20
20
const client = new OpenAI();
21
21
\`\`\`
Original file line number Diff line number Diff line change 3
3
import * as Core from 'openai/core' ;
4
4
import { APIResource } from 'openai/resource' ;
5
5
import { isRequestOptions } from 'openai/core' ;
6
+ import { type Response } from 'openai/_shims/index' ;
6
7
import { sleep } from 'openai/core' ;
7
8
import { APIConnectionTimeoutError } from 'openai/error' ;
8
9
import * as FilesAPI from 'openai/resources/files' ;
@@ -58,6 +59,15 @@ export class Files extends APIResource {
58
59
/**
59
60
* Returns the contents of the specified file.
60
61
*/
62
+ content ( fileId : string , options ?: Core . RequestOptions ) : Core . APIPromise < Response > {
63
+ return this . get ( `/files/${ fileId } /content` , { ...options , __binaryResponse : true } ) ;
64
+ }
65
+
66
+ /**
67
+ * Returns the contents of the specified file.
68
+ *
69
+ * @deprecated The `.content()` method should be used instead
70
+ */
61
71
retrieveContent ( fileId : string , options ?: Core . RequestOptions ) : Core . APIPromise < string > {
62
72
return this . get ( `/files/${ fileId } /content` , {
63
73
...options ,
Original file line number Diff line number Diff line change @@ -91,6 +91,13 @@ describe('resource files', () => {
91
91
) ;
92
92
} ) ;
93
93
94
+ test ( 'content: request options instead of params are passed correctly' , async ( ) => {
95
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
96
+ await expect ( openai . files . content ( 'string' , { path : '/_stainless_unknown_path' } ) ) . rejects . toThrow (
97
+ OpenAI . NotFoundError ,
98
+ ) ;
99
+ } ) ;
100
+
94
101
test ( 'retrieveContent' , async ( ) => {
95
102
const responsePromise = openai . files . retrieveContent ( 'string' ) ;
96
103
const rawResponse = await responsePromise . asResponse ( ) ;
You can’t perform that action at this time.
0 commit comments