Skip to content

Commit db5fffe

Browse files
feat(client): support results endpoint (#666)
1 parent 628b55e commit db5fffe

File tree

4 files changed

+33
-6
lines changed

4 files changed

+33
-6
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 21
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic-fd67aea6883f1ee9e46f31a42d3940f0acb1749e787055bd9b9f278b20fa53ec.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic-75f0573c3d6d79650bcbd8b1b4fcf93ce146d567afeb1061cd4afccf8d1d6799.yml

api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Methods:
8787
- <code title="get /v1/messages/batches">client.messages.batches.<a href="./src/resources/messages/batches.ts">list</a>({ ...params }) -> MessageBatchesPage</code>
8888
- <code title="delete /v1/messages/batches/{message_batch_id}">client.messages.batches.<a href="./src/resources/messages/batches.ts">delete</a>(messageBatchId) -> DeletedMessageBatch</code>
8989
- <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>
90-
- <code title="get /v1/messages/batches/{message_batch_id}/results">client.messages.batches.<a href="./src/resources/messages/batches.ts">results</a>(messageBatchId) -> JSONLDecoder\<MessageBatchIndividualResponse\></code>
90+
- <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>
9191

9292
# Models
9393

@@ -194,4 +194,4 @@ Methods:
194194
- <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>
195195
- <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>
196196
- <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>
197-
- <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\<MessageBatchIndividualResponse\></code>
197+
- <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>

tests/api-resources/beta/messages/batches.test.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,28 @@ describe('resource batches', () => {
190190
).rejects.toThrow(Anthropic.NotFoundError);
191191
});
192192

193-
test('results: request options instead of params are passed correctly', async () => {
193+
// Prism doesn't support JSONL responses yet
194+
test.skip('results', async () => {
195+
const responsePromise = client.beta.messages.batches.results('message_batch_id');
196+
const rawResponse = await responsePromise.asResponse();
197+
expect(rawResponse).toBeInstanceOf(Response);
198+
const response = await responsePromise;
199+
expect(response).not.toBeInstanceOf(Response);
200+
const dataAndResponse = await responsePromise.withResponse();
201+
expect(dataAndResponse.data).toBe(response);
202+
expect(dataAndResponse.response).toBe(rawResponse);
203+
});
204+
205+
// Prism doesn't support JSONL responses yet
206+
test.skip('results: request options instead of params are passed correctly', async () => {
194207
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
195208
await expect(
196209
client.beta.messages.batches.results('message_batch_id', { path: '/_stainless_unknown_path' }),
197210
).rejects.toThrow(Anthropic.NotFoundError);
198211
});
199212

200-
test('results: request options and params are passed correctly', async () => {
213+
// Prism doesn't support JSONL responses yet
214+
test.skip('results: request options and params are passed correctly', async () => {
201215
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
202216
await expect(
203217
client.beta.messages.batches.results(

tests/api-resources/messages/batches.test.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,20 @@ describe('resource batches', () => {
154154
).rejects.toThrow(Anthropic.NotFoundError);
155155
});
156156

157-
test('results: request options instead of params are passed correctly', async () => {
157+
// Prism doesn't support JSONL responses yet
158+
test.skip('results', async () => {
159+
const responsePromise = client.messages.batches.results('message_batch_id');
160+
const rawResponse = await responsePromise.asResponse();
161+
expect(rawResponse).toBeInstanceOf(Response);
162+
const response = await responsePromise;
163+
expect(response).not.toBeInstanceOf(Response);
164+
const dataAndResponse = await responsePromise.withResponse();
165+
expect(dataAndResponse.data).toBe(response);
166+
expect(dataAndResponse.response).toBe(rawResponse);
167+
});
168+
169+
// Prism doesn't support JSONL responses yet
170+
test.skip('results: request options instead of params are passed correctly', async () => {
158171
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
159172
await expect(
160173
client.messages.batches.results('message_batch_id', { path: '/_stainless_unknown_path' }),

0 commit comments

Comments
 (0)