Skip to content

Commit 3f3c78b

Browse files
refactor: use type imports for type-only imports (#1159)
1 parent 9cfec57 commit 3f3c78b

39 files changed

+1267
-836
lines changed

Diff for: src/index.ts

+251-126
Large diffs are not rendered by default.

Diff for: src/resources/audio/audio.ts

+43-19
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
import { APIResource } from '../../resource';
4-
import * as AudioAPI from './audio';
54
import * as SpeechAPI from './speech';
5+
import { Speech, SpeechCreateParams, SpeechModel } from './speech';
66
import * as TranscriptionsAPI from './transcriptions';
7+
import {
8+
Transcription,
9+
TranscriptionCreateParams,
10+
TranscriptionCreateResponse,
11+
TranscriptionSegment,
12+
TranscriptionVerbose,
13+
TranscriptionWord,
14+
Transcriptions,
15+
} from './transcriptions';
716
import * as TranslationsAPI from './translations';
17+
import {
18+
Translation,
19+
TranslationCreateParams,
20+
TranslationCreateResponse,
21+
TranslationVerbose,
22+
Translations,
23+
} from './translations';
824

925
export class Audio extends APIResource {
1026
transcriptions: TranscriptionsAPI.Transcriptions = new TranscriptionsAPI.Transcriptions(this._client);
@@ -20,22 +36,30 @@ export type AudioModel = 'whisper-1';
2036
*/
2137
export type AudioResponseFormat = 'json' | 'text' | 'srt' | 'verbose_json' | 'vtt';
2238

23-
export namespace Audio {
24-
export import AudioModel = AudioAPI.AudioModel;
25-
export import AudioResponseFormat = AudioAPI.AudioResponseFormat;
26-
export import Transcriptions = TranscriptionsAPI.Transcriptions;
27-
export import Transcription = TranscriptionsAPI.Transcription;
28-
export import TranscriptionSegment = TranscriptionsAPI.TranscriptionSegment;
29-
export import TranscriptionVerbose = TranscriptionsAPI.TranscriptionVerbose;
30-
export import TranscriptionWord = TranscriptionsAPI.TranscriptionWord;
31-
export import TranscriptionCreateResponse = TranscriptionsAPI.TranscriptionCreateResponse;
32-
export import TranscriptionCreateParams = TranscriptionsAPI.TranscriptionCreateParams;
33-
export import Translations = TranslationsAPI.Translations;
34-
export import Translation = TranslationsAPI.Translation;
35-
export import TranslationVerbose = TranslationsAPI.TranslationVerbose;
36-
export import TranslationCreateResponse = TranslationsAPI.TranslationCreateResponse;
37-
export import TranslationCreateParams = TranslationsAPI.TranslationCreateParams;
38-
export import Speech = SpeechAPI.Speech;
39-
export import SpeechModel = SpeechAPI.SpeechModel;
40-
export import SpeechCreateParams = SpeechAPI.SpeechCreateParams;
39+
Audio.Transcriptions = Transcriptions;
40+
Audio.Translations = Translations;
41+
Audio.Speech = Speech;
42+
43+
export declare namespace Audio {
44+
export { type AudioModel as AudioModel, type AudioResponseFormat as AudioResponseFormat };
45+
46+
export {
47+
Transcriptions as Transcriptions,
48+
type Transcription as Transcription,
49+
type TranscriptionSegment as TranscriptionSegment,
50+
type TranscriptionVerbose as TranscriptionVerbose,
51+
type TranscriptionWord as TranscriptionWord,
52+
type TranscriptionCreateResponse as TranscriptionCreateResponse,
53+
type TranscriptionCreateParams as TranscriptionCreateParams,
54+
};
55+
56+
export {
57+
Translations as Translations,
58+
type Translation as Translation,
59+
type TranslationVerbose as TranslationVerbose,
60+
type TranslationCreateResponse as TranslationCreateResponse,
61+
type TranslationCreateParams as TranslationCreateParams,
62+
};
63+
64+
export { Speech as Speech, type SpeechModel as SpeechModel, type SpeechCreateParams as SpeechCreateParams };
4165
}

Diff for: src/resources/audio/index.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
export { AudioModel, AudioResponseFormat, Audio } from './audio';
4-
export { SpeechModel, SpeechCreateParams, Speech } from './speech';
3+
export { Audio, type AudioModel, type AudioResponseFormat } from './audio';
4+
export { Speech, type SpeechModel, type SpeechCreateParams } from './speech';
55
export {
6-
Transcription,
7-
TranscriptionSegment,
8-
TranscriptionVerbose,
9-
TranscriptionWord,
10-
TranscriptionCreateResponse,
11-
TranscriptionCreateParams,
126
Transcriptions,
7+
type Transcription,
8+
type TranscriptionSegment,
9+
type TranscriptionVerbose,
10+
type TranscriptionWord,
11+
type TranscriptionCreateResponse,
12+
type TranscriptionCreateParams,
1313
} from './transcriptions';
1414
export {
15-
Translation,
16-
TranslationVerbose,
17-
TranslationCreateResponse,
18-
TranslationCreateParams,
1915
Translations,
16+
type Translation,
17+
type TranslationVerbose,
18+
type TranslationCreateResponse,
19+
type TranslationCreateParams,
2020
} from './translations';

Diff for: src/resources/audio/speech.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import { APIResource } from '../../resource';
44
import * as Core from '../../core';
5-
import * as SpeechAPI from './speech';
65
import { type Response } from '../../_shims/index';
76

87
export class Speech extends APIResource {
@@ -49,7 +48,6 @@ export interface SpeechCreateParams {
4948
speed?: number;
5049
}
5150

52-
export namespace Speech {
53-
export import SpeechModel = SpeechAPI.SpeechModel;
54-
export import SpeechCreateParams = SpeechAPI.SpeechCreateParams;
51+
export declare namespace Speech {
52+
export { type SpeechModel as SpeechModel, type SpeechCreateParams as SpeechCreateParams };
5553
}

Diff for: src/resources/audio/transcriptions.ts

+9-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import { APIResource } from '../../resource';
44
import * as Core from '../../core';
5-
import * as TranscriptionsAPI from './transcriptions';
65
import * as AudioAPI from './audio';
76

87
export class Transcriptions extends APIResource {
@@ -190,11 +189,13 @@ export interface TranscriptionCreateParams {
190189
timestamp_granularities?: Array<'word' | 'segment'>;
191190
}
192191

193-
export namespace Transcriptions {
194-
export import Transcription = TranscriptionsAPI.Transcription;
195-
export import TranscriptionSegment = TranscriptionsAPI.TranscriptionSegment;
196-
export import TranscriptionVerbose = TranscriptionsAPI.TranscriptionVerbose;
197-
export import TranscriptionWord = TranscriptionsAPI.TranscriptionWord;
198-
export import TranscriptionCreateResponse = TranscriptionsAPI.TranscriptionCreateResponse;
199-
export import TranscriptionCreateParams = TranscriptionsAPI.TranscriptionCreateParams;
192+
export declare namespace Transcriptions {
193+
export {
194+
type Transcription as Transcription,
195+
type TranscriptionSegment as TranscriptionSegment,
196+
type TranscriptionVerbose as TranscriptionVerbose,
197+
type TranscriptionWord as TranscriptionWord,
198+
type TranscriptionCreateResponse as TranscriptionCreateResponse,
199+
type TranscriptionCreateParams as TranscriptionCreateParams,
200+
};
200201
}

Diff for: src/resources/audio/translations.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import { APIResource } from '../../resource';
44
import * as Core from '../../core';
5-
import * as TranslationsAPI from './translations';
65
import * as AudioAPI from './audio';
76
import * as TranscriptionsAPI from './transcriptions';
87

@@ -83,9 +82,11 @@ export interface TranslationCreateParams {
8382
temperature?: number;
8483
}
8584

86-
export namespace Translations {
87-
export import Translation = TranslationsAPI.Translation;
88-
export import TranslationVerbose = TranslationsAPI.TranslationVerbose;
89-
export import TranslationCreateResponse = TranslationsAPI.TranslationCreateResponse;
90-
export import TranslationCreateParams = TranslationsAPI.TranslationCreateParams;
85+
export declare namespace Translations {
86+
export {
87+
type Translation as Translation,
88+
type TranslationVerbose as TranslationVerbose,
89+
type TranslationCreateResponse as TranslationCreateResponse,
90+
type TranslationCreateParams as TranslationCreateParams,
91+
};
9192
}

Diff for: src/resources/batches.ts

+11-7
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,15 @@ export interface BatchCreateParams {
244244

245245
export interface BatchListParams extends CursorPageParams {}
246246

247-
export namespace Batches {
248-
export import Batch = BatchesAPI.Batch;
249-
export import BatchError = BatchesAPI.BatchError;
250-
export import BatchRequestCounts = BatchesAPI.BatchRequestCounts;
251-
export import BatchesPage = BatchesAPI.BatchesPage;
252-
export import BatchCreateParams = BatchesAPI.BatchCreateParams;
253-
export import BatchListParams = BatchesAPI.BatchListParams;
247+
Batches.BatchesPage = BatchesPage;
248+
249+
export declare namespace Batches {
250+
export {
251+
type Batch as Batch,
252+
type BatchError as BatchError,
253+
type BatchRequestCounts as BatchRequestCounts,
254+
BatchesPage as BatchesPage,
255+
type BatchCreateParams as BatchCreateParams,
256+
type BatchListParams as BatchListParams,
257+
};
254258
}

Diff for: src/resources/beta/assistants.ts

+20-17
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import { APIResource } from '../../resource';
44
import { isRequestOptions } from '../../core';
55
import * as Core from '../../core';
6-
import * as AssistantsAPI from './assistants';
76
import * as Shared from '../shared';
87
import * as ChatAPI from '../chat/chat';
98
import * as MessagesAPI from './threads/messages';
@@ -1396,20 +1395,24 @@ export interface AssistantListParams extends CursorPageParams {
13961395
order?: 'asc' | 'desc';
13971396
}
13981397

1399-
export namespace Assistants {
1400-
export import Assistant = AssistantsAPI.Assistant;
1401-
export import AssistantDeleted = AssistantsAPI.AssistantDeleted;
1402-
export import AssistantStreamEvent = AssistantsAPI.AssistantStreamEvent;
1403-
export import AssistantTool = AssistantsAPI.AssistantTool;
1404-
export import CodeInterpreterTool = AssistantsAPI.CodeInterpreterTool;
1405-
export import FileSearchTool = AssistantsAPI.FileSearchTool;
1406-
export import FunctionTool = AssistantsAPI.FunctionTool;
1407-
export import MessageStreamEvent = AssistantsAPI.MessageStreamEvent;
1408-
export import RunStepStreamEvent = AssistantsAPI.RunStepStreamEvent;
1409-
export import RunStreamEvent = AssistantsAPI.RunStreamEvent;
1410-
export import ThreadStreamEvent = AssistantsAPI.ThreadStreamEvent;
1411-
export import AssistantsPage = AssistantsAPI.AssistantsPage;
1412-
export import AssistantCreateParams = AssistantsAPI.AssistantCreateParams;
1413-
export import AssistantUpdateParams = AssistantsAPI.AssistantUpdateParams;
1414-
export import AssistantListParams = AssistantsAPI.AssistantListParams;
1398+
Assistants.AssistantsPage = AssistantsPage;
1399+
1400+
export declare namespace Assistants {
1401+
export {
1402+
type Assistant as Assistant,
1403+
type AssistantDeleted as AssistantDeleted,
1404+
type AssistantStreamEvent as AssistantStreamEvent,
1405+
type AssistantTool as AssistantTool,
1406+
type CodeInterpreterTool as CodeInterpreterTool,
1407+
type FileSearchTool as FileSearchTool,
1408+
type FunctionTool as FunctionTool,
1409+
type MessageStreamEvent as MessageStreamEvent,
1410+
type RunStepStreamEvent as RunStepStreamEvent,
1411+
type RunStreamEvent as RunStreamEvent,
1412+
type ThreadStreamEvent as ThreadStreamEvent,
1413+
AssistantsPage as AssistantsPage,
1414+
type AssistantCreateParams as AssistantCreateParams,
1415+
type AssistantUpdateParams as AssistantUpdateParams,
1416+
type AssistantListParams as AssistantListParams,
1417+
};
14151418
}

0 commit comments

Comments
 (0)