Skip to content

Commit

Permalink
chore(internal): minor reformatting (#444)
Browse files Browse the repository at this point in the history
  • Loading branch information
Stainless Bot authored and stainless-app[bot] committed Jun 25, 2024
1 parent e04e3cf commit f224eff
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
9 changes: 6 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import * as Core from './core';
import * as Errors from './error';
import { type Agent } from './_shims/index';
import * as Uploads from './uploads';
import { type Agent } from './_shims/index';
import * as Core from '@anthropic-ai/sdk/core';
import * as API from '@anthropic-ai/sdk/resources/index';

export interface ClientOptions {
Expand Down Expand Up @@ -74,7 +74,9 @@ export interface ClientOptions {
defaultQuery?: Core.DefaultQuery;
}

/** API Client for interfacing with the Anthropic API. */
/**
* API Client for interfacing with the Anthropic API.
*/
export class Anthropic extends Core.APIClient {
apiKey: string | null;
authToken: string | null;
Expand Down Expand Up @@ -114,6 +116,7 @@ export class Anthropic extends Core.APIClient {
maxRetries: options.maxRetries,
fetch: options.fetch,
});

this._options = options;

this.apiKey = apiKey;
Expand Down
4 changes: 2 additions & 2 deletions src/resources/completions.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import * as Core from '@anthropic-ai/sdk/core';
import { APIPromise } from '@anthropic-ai/sdk/core';
import { APIResource } from '@anthropic-ai/sdk/resource';
import { APIPromise } from '@anthropic-ai/sdk/core';
import * as Core from '@anthropic-ai/sdk/core';
import * as CompletionsAPI from '@anthropic-ai/sdk/resources/completions';
import { Stream } from '@anthropic-ai/sdk/streaming';

Expand Down
7 changes: 4 additions & 3 deletions src/resources/messages.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import * as Core from '@anthropic-ai/sdk/core';
import { APIPromise } from '@anthropic-ai/sdk/core';
import { APIResource } from '@anthropic-ai/sdk/resource';
import { APIPromise } from '@anthropic-ai/sdk/core';
import * as Core from '@anthropic-ai/sdk/core';
import { MessageStream } from '@anthropic-ai/sdk/lib/MessageStream';
export { MessageStream } from '@anthropic-ai/sdk/lib/MessageStream';
import * as MessagesAPI from '@anthropic-ai/sdk/resources/messages';
import { Stream } from '@anthropic-ai/sdk/streaming';

export { MessageStream } from '@anthropic-ai/sdk/lib/MessageStream';

export class Messages extends APIResource {
/**
* Create a Message.
Expand Down
9 changes: 6 additions & 3 deletions tests/stringifyQuery.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { APIClient } from '@anthropic-ai/sdk/core';
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

const { stringifyQuery } = APIClient.prototype as any;
import { Anthropic } from '@anthropic-ai/sdk';

describe('APIClient.stringifyQuery', () => {
const { stringifyQuery } = Anthropic.prototype as any;

describe(stringifyQuery, () => {
for (const [input, expected] of [
[{ a: '1', b: 2, c: true }, 'a=1&b=2&c=true'],
[{ a: null, b: false, c: undefined }, 'a=&b=false'],
Expand All @@ -18,6 +20,7 @@ describe('APIClient.stringifyQuery', () => {
expect(stringifyQuery(input)).toEqual(expected);
});
}

for (const value of [[], {}, new Date()]) {
it(`${JSON.stringify(value)} -> <error>`, () => {
expect(() => stringifyQuery({ value })).toThrow(`Cannot stringify type ${typeof value}`);
Expand Down

0 comments on commit f224eff

Please sign in to comment.