File tree Expand file tree Collapse file tree 5 files changed +30
-15
lines changed Expand file tree Collapse file tree 5 files changed +30
-15
lines changed Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ Methods:
119
119
- <code title =" get /v1/messages/batches " >client.messages.batches.<a href =" ./src/resources/messages/batches.ts " >list</a >({ ...params }) -> MessageBatchesPage</code >
120
120
- <code title =" delete /v1/messages/batches/{message_batch_id} " >client.messages.batches.<a href =" ./src/resources/messages/batches.ts " >delete</a >(messageBatchId) -> DeletedMessageBatch</code >
121
121
- <code title =" post /v1/messages/batches/{message_batch_id}/cancel " >client.messages.batches.<a href =" ./src/resources/messages/batches.ts " >cancel</a >(messageBatchId) -> MessageBatch</code >
122
- - <code title =" get /v1/messages/batches/{message_batch_id}/results " >client.messages.batches.<a href =" ./src/resources/messages/batches.ts " >results</a >(messageBatchId) -> JSONLDecoder & lt ; MessageBatchIndividualResponse& gt ; </code >
122
+ - <code title =" get /v1/messages/batches/{message_batch_id}/results " >client.messages.batches.<a href =" ./src/resources/messages/batches.ts " >results</a >(messageBatchId) -> MessageBatchIndividualResponse</code >
123
123
124
124
# Models
125
125
@@ -257,4 +257,4 @@ Methods:
257
257
- <code title =" get /v1/messages/batches?beta=true " >client.beta.messages.batches.<a href =" ./src/resources/beta/messages/batches.ts " >list</a >({ ...params }) -> BetaMessageBatchesPage</code >
258
258
- <code title =" delete /v1/messages/batches/{message_batch_id}?beta=true " >client.beta.messages.batches.<a href =" ./src/resources/beta/messages/batches.ts " >delete</a >(messageBatchId, { ...params }) -> BetaDeletedMessageBatch</code >
259
259
- <code title =" post /v1/messages/batches/{message_batch_id}/cancel?beta=true " >client.beta.messages.batches.<a href =" ./src/resources/beta/messages/batches.ts " >cancel</a >(messageBatchId, { ...params }) -> BetaMessageBatch</code >
260
- - <code title =" get /v1/messages/batches/{message_batch_id}/results?beta=true " >client.beta.messages.batches.<a href =" ./src/resources/beta/messages/batches.ts " >results</a >(messageBatchId, { ...params }) -> JSONLDecoder & lt ; BetaMessageBatchIndividualResponse& gt ; </code >
260
+ - <code title =" get /v1/messages/batches/{message_batch_id}/results?beta=true " >client.beta.messages.batches.<a href =" ./src/resources/beta/messages/batches.ts " >results</a >(messageBatchId, { ...params }) -> BetaMessageBatchIndividualResponse</code >
Original file line number Diff line number Diff line change 2
2
3
3
import { APIResource } from '../../../resource' ;
4
4
import { isRequestOptions } from '../../../core' ;
5
+ import { APIPromise } from '../../../core' ;
5
6
import * as Core from '../../../core' ;
6
7
import * as BetaAPI from '../beta' ;
7
8
import * as BetaMessagesAPI from './messages' ;
@@ -177,7 +178,7 @@ export class Batches extends APIResource {
177
178
*/
178
179
async results (
179
180
messageBatchId : string ,
180
- params ? : BatchResultsParams ,
181
+ params : BatchResultsParams | undefined = { } ,
181
182
options ?: Core . RequestOptions ,
182
183
) : Promise < JSONLDecoder < BetaMessageBatchIndividualResponse > > ;
183
184
async results (
@@ -209,9 +210,12 @@ export class Batches extends APIResource {
209
210
Accept : 'application/binary' ,
210
211
...options ?. headers ,
211
212
} ,
213
+ stream : true ,
212
214
__binaryResponse : true ,
213
215
} )
214
- . _thenUnwrap ( ( _ , props ) => JSONLDecoder . fromResponse ( props . response , props . controller ) ) ;
216
+ . _thenUnwrap ( ( _ , props ) => JSONLDecoder . fromResponse ( props . response , props . controller ) ) as APIPromise <
217
+ JSONLDecoder < BetaMessageBatchIndividualResponse >
218
+ > ;
215
219
}
216
220
}
217
221
Original file line number Diff line number Diff line change 2
2
3
3
import { APIResource } from '../../resource' ;
4
4
import { isRequestOptions } from '../../core' ;
5
+ import { APIPromise } from '../../core' ;
5
6
import * as Core from '../../core' ;
6
7
import * as Shared from '../shared' ;
7
8
import * as MessagesAPI from './messages' ;
@@ -119,7 +120,9 @@ export class Batches extends APIResource {
119
120
} ,
120
121
__binaryResponse : true ,
121
122
} )
122
- . _thenUnwrap ( ( _ , props ) => JSONLDecoder . fromResponse ( props . response , props . controller ) ) ;
123
+ . _thenUnwrap ( ( _ , props ) => JSONLDecoder . fromResponse ( props . response , props . controller ) ) as APIPromise <
124
+ JSONLDecoder < MessageBatchIndividualResponse >
125
+ > ;
123
126
}
124
127
}
125
128
Original file line number Diff line number Diff line change @@ -206,11 +206,15 @@ describe('resource batches', () => {
206
206
} ) ;
207
207
208
208
// Prism doesn't support JSONL responses yet
209
- test . skip ( 'results: request options instead of params are passed correctly' , async ( ) => {
210
- // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
211
- await expect (
212
- client . beta . messages . batches . results ( 'message_batch_id' , { path : '/_stainless_unknown_path' } ) ,
213
- ) . rejects . toThrow ( Anthropic . NotFoundError ) ;
209
+ test . skip ( 'results' , async ( ) => {
210
+ const responsePromise = client . beta . messages . batches . results ( 'message_batch_id' ) ;
211
+ const rawResponse = await responsePromise . asResponse ( ) ;
212
+ expect ( rawResponse ) . toBeInstanceOf ( Response ) ;
213
+ const response = await responsePromise ;
214
+ expect ( response ) . not . toBeInstanceOf ( Response ) ;
215
+ const dataAndResponse = await responsePromise . withResponse ( ) ;
216
+ expect ( dataAndResponse . data ) . toBe ( response ) ;
217
+ expect ( dataAndResponse . response ) . toBe ( rawResponse ) ;
214
218
} ) ;
215
219
216
220
// Prism doesn't support JSONL responses yet
Original file line number Diff line number Diff line change @@ -170,10 +170,14 @@ describe('resource batches', () => {
170
170
} ) ;
171
171
172
172
// Prism doesn't support JSONL responses yet
173
- test . skip ( 'results: request options instead of params are passed correctly' , async ( ) => {
174
- // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
175
- await expect (
176
- client . messages . batches . results ( 'message_batch_id' , { path : '/_stainless_unknown_path' } ) ,
177
- ) . rejects . toThrow ( Anthropic . NotFoundError ) ;
173
+ test . skip ( 'results' , async ( ) => {
174
+ const responsePromise = client . messages . batches . results ( 'message_batch_id' ) ;
175
+ const rawResponse = await responsePromise . asResponse ( ) ;
176
+ expect ( rawResponse ) . toBeInstanceOf ( Response ) ;
177
+ const response = await responsePromise ;
178
+ expect ( response ) . not . toBeInstanceOf ( Response ) ;
179
+ const dataAndResponse = await responsePromise . withResponse ( ) ;
180
+ expect ( dataAndResponse . data ) . toBe ( response ) ;
181
+ expect ( dataAndResponse . response ) . toBe ( rawResponse ) ;
178
182
} ) ;
179
183
} ) ;
You can’t perform that action at this time.
0 commit comments