Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(internal): minor reformatting #444

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 2 additions & 2 deletions src/resources/messages.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 MessagesAPI from '@anthropic-ai/sdk/resources/messages';
import { Stream } from '@anthropic-ai/sdk/streaming';

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