diff --git a/README.md b/README.md index cda1b7f9f7a..e491854c59d 100644 --- a/README.md +++ b/README.md @@ -20,12 +20,12 @@ yarn client:build # Testing clients -Go to the [`playground`](./playground) folder to test your client +The clients can be tested inside the [`playground`](./playground) folder ## JavaScript ```bash -cd playground/javascript && yarn start +yarn playground:js ``` # Troubleshooting diff --git a/clients/algoliasearch-client-javascript/client-search/apis.ts b/clients/algoliasearch-client-javascript/client-search/apis.ts index 886f8230504..862aa147ffb 100644 --- a/clients/algoliasearch-client-javascript/client-search/apis.ts +++ b/clients/algoliasearch-client-javascript/client-search/apis.ts @@ -1,16 +1,8 @@ export * from './searchApi'; import { SearchApi } from './searchApi'; -import * as http from 'http'; - -export class HttpError extends Error { - constructor(public response: http.IncomingMessage, public body: any, public statusCode?: number) { - super('HTTP request failed'); - this.name = 'HttpError'; - } -} - -export { RequestFile } from '../model/models'; export class searchClient extends SearchApi {} +export * from '../utils/errors'; + export const APIS = [SearchApi]; diff --git a/clients/algoliasearch-client-javascript/client-search/searchApi.ts b/clients/algoliasearch-client-javascript/client-search/searchApi.ts index 804d1da2b50..70284bea6fc 100644 --- a/clients/algoliasearch-client-javascript/client-search/searchApi.ts +++ b/clients/algoliasearch-client-javascript/client-search/searchApi.ts @@ -5,6 +5,7 @@ import { Headers, Host, Request, RequestOptions } from '../utils/types'; import { BatchObject } from '../model/batchObject'; import { BatchResponse } from '../model/batchResponse'; +import { ErrorBase } from '../model/errorBase'; import { MultipleQueriesObject } from '../model/multipleQueriesObject'; import { MultipleQueriesResponse } from '../model/multipleQueriesResponse'; import { SaveObjectResponse } from '../model/saveObjectResponse'; @@ -15,8 +16,6 @@ import { SearchResponse } from '../model/searchResponse'; import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models'; import { HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models'; -import { HttpError, RequestFile } from './apis'; - export enum SearchApiApiKeys { apiKey, appId, diff --git a/clients/algoliasearch-client-javascript/model/batchObject.ts b/clients/algoliasearch-client-javascript/model/batchObject.ts index 443d3201bb5..0a1428e699a 100644 --- a/clients/algoliasearch-client-javascript/model/batchObject.ts +++ b/clients/algoliasearch-client-javascript/model/batchObject.ts @@ -1,4 +1,3 @@ -import { RequestFile } from './models'; import { Operation } from './operation'; export class BatchObject { diff --git a/clients/algoliasearch-client-javascript/model/batchResponse.ts b/clients/algoliasearch-client-javascript/model/batchResponse.ts index f4effb83765..c5eeb8d6197 100644 --- a/clients/algoliasearch-client-javascript/model/batchResponse.ts +++ b/clients/algoliasearch-client-javascript/model/batchResponse.ts @@ -1,5 +1,3 @@ -import { RequestFile } from './models'; - export class BatchResponse { /** * taskID of the indexing task to wait for. diff --git a/clients/algoliasearch-client-javascript/model/modelError.ts b/clients/algoliasearch-client-javascript/model/errorBase.ts similarity index 64% rename from clients/algoliasearch-client-javascript/model/modelError.ts rename to clients/algoliasearch-client-javascript/model/errorBase.ts index 13fc1b89375..ab910b0cef0 100644 --- a/clients/algoliasearch-client-javascript/model/modelError.ts +++ b/clients/algoliasearch-client-javascript/model/errorBase.ts @@ -1,9 +1,8 @@ -import { RequestFile } from './models'; - /** * Error */ -export class ModelError extends null { +// export class ErrorBase extends null +export class ErrorBase { 'message'?: string; static discriminator: string | undefined = undefined; @@ -17,6 +16,6 @@ export class ModelError extends null { ]; static getAttributeTypeMap() { - return super.getAttributeTypeMap().concat(ModelError.attributeTypeMap); + return ErrorBase.attributeTypeMap; } } diff --git a/clients/algoliasearch-client-javascript/model/highlightResult.ts b/clients/algoliasearch-client-javascript/model/highlightResult.ts index de5d38781a0..d3101098fe7 100644 --- a/clients/algoliasearch-client-javascript/model/highlightResult.ts +++ b/clients/algoliasearch-client-javascript/model/highlightResult.ts @@ -1,5 +1,3 @@ -import { RequestFile } from './models'; - export class HighlightResult { /** * Markup text with occurrences highlighted. diff --git a/clients/algoliasearch-client-javascript/model/models.ts b/clients/algoliasearch-client-javascript/model/models.ts index fd9cb170bfb..edd74146def 100644 --- a/clients/algoliasearch-client-javascript/model/models.ts +++ b/clients/algoliasearch-client-javascript/model/models.ts @@ -2,8 +2,8 @@ import type { RequestOptions } from '../utils/types'; export * from './batchObject'; export * from './batchResponse'; +export * from './errorBase'; export * from './highlightResult'; -export * from './modelError'; export * from './multipleQueries'; export * from './multipleQueriesObject'; export * from './multipleQueriesResponse'; @@ -18,22 +18,10 @@ export * from './searchResponse'; export * from './searchResponseFacetsStats'; export * from './snippetResult'; -import * as fs from 'fs'; - -export interface RequestDetailedFile { - value: Buffer; - options?: { - filename?: string; - contentType?: string; - }; -} - -export type RequestFile = string | Buffer | fs.ReadStream | RequestDetailedFile; - import { BatchObject } from './batchObject'; import { BatchResponse } from './batchResponse'; +import { ErrorBase } from './errorBase'; import { HighlightResult } from './highlightResult'; -import { ModelError } from './modelError'; import { MultipleQueries } from './multipleQueries'; import { MultipleQueriesObject } from './multipleQueriesObject'; import { MultipleQueriesResponse } from './multipleQueriesResponse'; @@ -67,8 +55,8 @@ let enumsMap: { [index: string]: any } = { let typeMap: { [index: string]: any } = { BatchObject: BatchObject, BatchResponse: BatchResponse, + ErrorBase: ErrorBase, HighlightResult: HighlightResult, - ModelError: ModelError, MultipleQueries: MultipleQueries, MultipleQueriesObject: MultipleQueriesObject, MultipleQueriesResponse: MultipleQueriesResponse, diff --git a/clients/algoliasearch-client-javascript/model/multipleQueries.ts b/clients/algoliasearch-client-javascript/model/multipleQueries.ts index ec21e366b48..9acaadac44f 100644 --- a/clients/algoliasearch-client-javascript/model/multipleQueries.ts +++ b/clients/algoliasearch-client-javascript/model/multipleQueries.ts @@ -1,5 +1,3 @@ -import { RequestFile } from './models'; - export class MultipleQueries { /** * The Algolia index name diff --git a/clients/algoliasearch-client-javascript/model/multipleQueriesObject.ts b/clients/algoliasearch-client-javascript/model/multipleQueriesObject.ts index 35d55da74dc..c0936841330 100644 --- a/clients/algoliasearch-client-javascript/model/multipleQueriesObject.ts +++ b/clients/algoliasearch-client-javascript/model/multipleQueriesObject.ts @@ -1,4 +1,3 @@ -import { RequestFile } from './models'; import { MultipleQueries } from './multipleQueries'; export class MultipleQueriesObject { diff --git a/clients/algoliasearch-client-javascript/model/multipleQueriesResponse.ts b/clients/algoliasearch-client-javascript/model/multipleQueriesResponse.ts index dcf1fdf7d1e..334774a50ec 100644 --- a/clients/algoliasearch-client-javascript/model/multipleQueriesResponse.ts +++ b/clients/algoliasearch-client-javascript/model/multipleQueriesResponse.ts @@ -1,4 +1,3 @@ -import { RequestFile } from './models'; import { SearchResponse } from './searchResponse'; export class MultipleQueriesResponse { diff --git a/clients/algoliasearch-client-javascript/model/operation.ts b/clients/algoliasearch-client-javascript/model/operation.ts index 771fd8cd80a..2c008cdad59 100644 --- a/clients/algoliasearch-client-javascript/model/operation.ts +++ b/clients/algoliasearch-client-javascript/model/operation.ts @@ -1,5 +1,3 @@ -import { RequestFile } from './models'; - export class Operation { /** * type of operation diff --git a/clients/algoliasearch-client-javascript/model/rankingInfo.ts b/clients/algoliasearch-client-javascript/model/rankingInfo.ts index 60f0aac8be6..7af75621603 100644 --- a/clients/algoliasearch-client-javascript/model/rankingInfo.ts +++ b/clients/algoliasearch-client-javascript/model/rankingInfo.ts @@ -1,4 +1,3 @@ -import { RequestFile } from './models'; import { RankingInfoMatchedGeoLocation } from './rankingInfoMatchedGeoLocation'; export class RankingInfo { diff --git a/clients/algoliasearch-client-javascript/model/rankingInfoMatchedGeoLocation.ts b/clients/algoliasearch-client-javascript/model/rankingInfoMatchedGeoLocation.ts index 91b552ad448..58aab4d485f 100644 --- a/clients/algoliasearch-client-javascript/model/rankingInfoMatchedGeoLocation.ts +++ b/clients/algoliasearch-client-javascript/model/rankingInfoMatchedGeoLocation.ts @@ -1,5 +1,3 @@ -import { RequestFile } from './models'; - export class RankingInfoMatchedGeoLocation { /** * Latitude of the matched location. diff --git a/clients/algoliasearch-client-javascript/model/record.ts b/clients/algoliasearch-client-javascript/model/record.ts index 7400eda9919..e833f3e2aa6 100644 --- a/clients/algoliasearch-client-javascript/model/record.ts +++ b/clients/algoliasearch-client-javascript/model/record.ts @@ -1,4 +1,3 @@ -import { RequestFile } from './models'; import { HighlightResult } from './highlightResult'; import { RankingInfo } from './rankingInfo'; import { SnippetResult } from './snippetResult'; @@ -6,7 +5,8 @@ import { SnippetResult } from './snippetResult'; /** * A single record */ -export class Record extends null { +// export class Record extends null +export class Record { /** * Unique identifier of the object */ @@ -47,6 +47,6 @@ export class Record extends null { ]; static getAttributeTypeMap() { - return super.getAttributeTypeMap().concat(Record.attributeTypeMap); + return Record.attributeTypeMap; } } diff --git a/clients/algoliasearch-client-javascript/model/saveObjectResponse.ts b/clients/algoliasearch-client-javascript/model/saveObjectResponse.ts index 90020ef73aa..4761e6f28c0 100644 --- a/clients/algoliasearch-client-javascript/model/saveObjectResponse.ts +++ b/clients/algoliasearch-client-javascript/model/saveObjectResponse.ts @@ -1,5 +1,3 @@ -import { RequestFile } from './models'; - export class SaveObjectResponse { 'createdAt'?: string; /** diff --git a/clients/algoliasearch-client-javascript/model/searchParams.ts b/clients/algoliasearch-client-javascript/model/searchParams.ts index f3422011826..3728d484678 100644 --- a/clients/algoliasearch-client-javascript/model/searchParams.ts +++ b/clients/algoliasearch-client-javascript/model/searchParams.ts @@ -1,5 +1,3 @@ -import { RequestFile } from './models'; - export class SearchParams { /** * The text to search in the index. diff --git a/clients/algoliasearch-client-javascript/model/searchParamsString.ts b/clients/algoliasearch-client-javascript/model/searchParamsString.ts index d64b7587efc..968d23a198e 100644 --- a/clients/algoliasearch-client-javascript/model/searchParamsString.ts +++ b/clients/algoliasearch-client-javascript/model/searchParamsString.ts @@ -1,5 +1,3 @@ -import { RequestFile } from './models'; - export class SearchParamsString { 'params'?: string; diff --git a/clients/algoliasearch-client-javascript/model/searchResponse.ts b/clients/algoliasearch-client-javascript/model/searchResponse.ts index 8d36b775a8c..21e3c7853f4 100644 --- a/clients/algoliasearch-client-javascript/model/searchResponse.ts +++ b/clients/algoliasearch-client-javascript/model/searchResponse.ts @@ -1,4 +1,3 @@ -import { RequestFile } from './models'; import { Record } from './record'; import { SearchResponseFacetsStats } from './searchResponseFacetsStats'; diff --git a/clients/algoliasearch-client-javascript/model/searchResponseFacetsStats.ts b/clients/algoliasearch-client-javascript/model/searchResponseFacetsStats.ts index a9299069560..ff2f3a37ef5 100644 --- a/clients/algoliasearch-client-javascript/model/searchResponseFacetsStats.ts +++ b/clients/algoliasearch-client-javascript/model/searchResponseFacetsStats.ts @@ -1,5 +1,3 @@ -import { RequestFile } from './models'; - export class SearchResponseFacetsStats { /** * The minimum value in the result set. diff --git a/clients/algoliasearch-client-javascript/model/snippetResult.ts b/clients/algoliasearch-client-javascript/model/snippetResult.ts index bb590bd75e0..8b5b5091816 100644 --- a/clients/algoliasearch-client-javascript/model/snippetResult.ts +++ b/clients/algoliasearch-client-javascript/model/snippetResult.ts @@ -1,5 +1,3 @@ -import { RequestFile } from './models'; - export class SnippetResult { /** * Markup text with occurrences highlighted. diff --git a/clients/algoliasearch-client-javascript/utils/Requester.ts b/clients/algoliasearch-client-javascript/utils/Requester.ts index 61a8c2b24a9..1319da1bb1c 100644 --- a/clients/algoliasearch-client-javascript/utils/Requester.ts +++ b/clients/algoliasearch-client-javascript/utils/Requester.ts @@ -63,7 +63,7 @@ export class Requester { req.on('error', (error) => { clearTimeout(connectTimeout); - clearTimeout(responseTimeout as NodeJS.Timeout); + clearTimeout(responseTimeout!); resolve({ status: 0, content: error.message, isTimedOut: false }); }); diff --git a/clients/algoliasearch-client-javascript/utils/Transporter.ts b/clients/algoliasearch-client-javascript/utils/Transporter.ts index 8a6a096e2d2..ed8dd4dfeb8 100644 --- a/clients/algoliasearch-client-javascript/utils/Transporter.ts +++ b/clients/algoliasearch-client-javascript/utils/Transporter.ts @@ -144,7 +144,7 @@ export class Transporter { method, url: serializeUrl(host, request.path, queryParameters), connectTimeout: getTimeout(timeoutsCount, this.timeouts.connect), - responseTimeout: getTimeout(timeoutsCount, requestOptions.timeout as number), + responseTimeout: getTimeout(timeoutsCount, requestOptions.timeout ?? this.timeouts.read), }; /** diff --git a/clients/utils/javascript/Requester.ts b/clients/utils/javascript/Requester.ts index 61a8c2b24a9..1319da1bb1c 100644 --- a/clients/utils/javascript/Requester.ts +++ b/clients/utils/javascript/Requester.ts @@ -63,7 +63,7 @@ export class Requester { req.on('error', (error) => { clearTimeout(connectTimeout); - clearTimeout(responseTimeout as NodeJS.Timeout); + clearTimeout(responseTimeout!); resolve({ status: 0, content: error.message, isTimedOut: false }); }); diff --git a/clients/utils/javascript/Transporter.ts b/clients/utils/javascript/Transporter.ts index 8a6a096e2d2..ed8dd4dfeb8 100644 --- a/clients/utils/javascript/Transporter.ts +++ b/clients/utils/javascript/Transporter.ts @@ -144,7 +144,7 @@ export class Transporter { method, url: serializeUrl(host, request.path, queryParameters), connectTimeout: getTimeout(timeoutsCount, this.timeouts.connect), - responseTimeout: getTimeout(timeoutsCount, requestOptions.timeout as number), + responseTimeout: getTimeout(timeoutsCount, requestOptions.timeout ?? this.timeouts.read), }; /** diff --git a/package.json b/package.json index 97ebfface81..b5fa07c56e1 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "playground/javascript/" ], "scripts": { - "build:spec": "yarn swagger-cli bundle openapi_spec/spec.yml --outfile dist/openapi.yml --type yaml", + "build:spec": "yarn swagger-cli bundle specs/spec.yml --outfile dist/openapi.yml --type yaml", + "build:spec:json": "yarn swagger-cli bundle specs/spec.yml --outfile dist/openapi.json --type json", "clean": "rm -rf **/dist **/build **/node_modules", "client:build-js": "cd clients/algoliasearch-client-javascript/ && yarn install && yarn build && cd ../../", "client:build": "yarn client:build-js", diff --git a/playground/javascript/.env.example b/playground/.env.example similarity index 67% rename from playground/javascript/.env.example rename to playground/.env.example index c906f42033f..88ab91239e8 100644 --- a/playground/javascript/.env.example +++ b/playground/.env.example @@ -1,3 +1,6 @@ ALGOLIA_APPLICATION_ID="" ALGOLIA_ADMIN_KEY="" ALGOLIA_SEARCH_KEY="" + +SEARCH_INDEX="" +SEARCH_QUERY="" diff --git a/playground/javascript/app.ts b/playground/javascript/app.ts index 6d7edcde5e1..c20f5f2a629 100644 --- a/playground/javascript/app.ts +++ b/playground/javascript/app.ts @@ -1,11 +1,14 @@ -import { searchClient, HttpError } from 'algoliasearch-client-javascript'; +import { searchClient, ApiError } from 'algoliasearch-client-javascript'; import dotenv from 'dotenv'; -dotenv.config(); +dotenv.config({ path: '../.env' }); const appId = process.env.ALGOLIA_APPLICATION_ID || '**** APP_ID *****'; const apiKey = process.env.ALGOLIA_SEARCH_KEY || '**** SEARCH_API_KEY *****'; +const searchIndex = process.env.SEARCH_INDEX || 'test_index'; +const searchQuery = process.env.SEARCH_QUERY || 'test_query'; + // Init client with appId and apiKey const client = new searchClient(appId, apiKey); @@ -14,16 +17,16 @@ async function testMultiQueries() { const res = await client.multipleQueries({ requests: [ { - indexName: 'docsearch', - query: 'crawler', + indexName: searchIndex, + query: searchQuery, }, ], }); console.log(`[OK]`, res); } catch (e) { - if (e instanceof HttpError) { - return console.log(`[${e.statusCode} - ${e.response.statusMessage}]`, e.response); + if (e instanceof ApiError) { + return console.log(`[${e.status}] ${e.message}`, e.stackTrace); } console.log('[ERROR]', e); @@ -32,14 +35,14 @@ async function testMultiQueries() { async function testSearch() { try { - const res = await client.search('docsearch', { - query: 'crawler', + const res = await client.search(searchIndex, { + query: searchQuery, }); console.log(`[OK]`, res); } catch (e) { - if (e instanceof HttpError) { - return console.log(`[${e.statusCode} - ${e.response.statusMessage}]`, e.response); + if (e instanceof ApiError) { + return console.log(`[${e.status}] ${e.message}`, e.stackTrace); } console.log('[ERROR]', e); diff --git a/specs/responses/BadRequest.yml b/specs/responses/BadRequest.yml index b811bc1e78f..bd78840b4f5 100644 --- a/specs/responses/BadRequest.yml +++ b/specs/responses/BadRequest.yml @@ -2,4 +2,4 @@ description: Bad request or request arguments content: application/json: schema: - $ref: '../schemas/Error.yml' + $ref: '../schemas/ErrorBase.yml' diff --git a/specs/responses/IndexNotFound.yml b/specs/responses/IndexNotFound.yml index 73fd650f77a..a13beb85b1e 100644 --- a/specs/responses/IndexNotFound.yml +++ b/specs/responses/IndexNotFound.yml @@ -2,4 +2,4 @@ description: Index not found content: application/json: schema: - $ref: '../schemas/Error.yml' + $ref: '../schemas/ErrorBase.yml' diff --git a/specs/schemas/Error.yml b/specs/schemas/ErrorBase.yml similarity index 100% rename from specs/schemas/Error.yml rename to specs/schemas/ErrorBase.yml diff --git a/specs/schemas/Record.yml b/specs/schemas/Record.yml index a41bf93019b..564ef9bc6c9 100644 --- a/specs/schemas/Record.yml +++ b/specs/schemas/Record.yml @@ -14,7 +14,7 @@ record: _rankingInfo: $ref: '#/rankingInfo' _distinctSeqID: - type: number + type: integer # Props highlightResult: @@ -74,10 +74,12 @@ rankingInfo: additionalProperties: false properties: lat: - type: float + type: number + format: double description: 'Latitude of the matched location.' lng: - type: float + type: number + format: double description: 'Longitude of the matched location.' distance: type: integer diff --git a/specs/schemas/SearchParams.yml b/specs/schemas/SearchParams.yml index 12dea2e006b..10f642d6a8b 100644 --- a/specs/schemas/SearchParams.yml +++ b/specs/schemas/SearchParams.yml @@ -215,13 +215,11 @@ searchParams: items: type: number description: Search inside a rectangular area (in geo coordinates). - default: null insidePolygon: type: array items: type: number description: Search inside a polygon (in geo coordinates). - default: null ignorePlurals: type: string description: Treats singular, plurals, and other forms of declensions as matching terms. diff --git a/specs/schemas/SearchResponse.yml b/specs/schemas/SearchResponse.yml index 472f12b169a..ce5c41877de 100644 --- a/specs/schemas/SearchResponse.yml +++ b/specs/schemas/SearchResponse.yml @@ -101,7 +101,7 @@ searchResponse: type: string description: The query string that will be searched, after normalization. processingTimeMS: - type: number + type: integer description: Time the server took to process the request, in milliseconds. example: 20 query: diff --git a/templates/javascript/api-all.mustache b/templates/javascript/api-all.mustache index e1457d3dc9e..f3ed11450c5 100644 --- a/templates/javascript/api-all.mustache +++ b/templates/javascript/api-all.mustache @@ -8,18 +8,10 @@ import { {{ classname }} } from './{{ classFilename }}'; export * from './{{ classFilename }}Interface' {{/withInterfaces}} {{/apis}} -import * as http from 'http'; - -export class HttpError extends Error { - constructor (public response: http.IncomingMessage, public body: any, public statusCode?: number) { - super('HTTP request failed'); - this.name = 'HttpError'; - } -} - -export { RequestFile } from '../model/models'; export class searchClient extends SearchApi{} +export * from '../utils/errors'; + export const APIS = [{{#apis}}{{#operations}}{{ classname }}{{/operations}}{{^-last}}, {{/-last}}{{/apis}}]; {{/apiInfo}} diff --git a/templates/javascript/api-single.mustache b/templates/javascript/api-single.mustache index f191f90e9dd..5cc0362efd9 100644 --- a/templates/javascript/api-single.mustache +++ b/templates/javascript/api-single.mustache @@ -12,8 +12,6 @@ import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../mode import { HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models'; {{/hasAuthMethods}} -import { HttpError, RequestFile } from './apis'; - {{#operations}} {{#description}} /** diff --git a/templates/javascript/model.mustache b/templates/javascript/model.mustache index f96acdcaabb..bbb50e5cec9 100644 --- a/templates/javascript/model.mustache +++ b/templates/javascript/model.mustache @@ -1,6 +1,5 @@ {{#models}} {{#model}} -import { RequestFile } from './models'; {{#tsImports}} import { {{classname}} } from '{{filename}}'; {{/tsImports}} @@ -11,7 +10,11 @@ import { {{classname}} } from '{{filename}}'; */ {{/description}} {{^isEnum}} -export class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ +{{#parent}} +{{! TODO: Add this line back when we understand where parent come from, but for now it's breaking the code}} +// export class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}} +{{/parent}} +export class {{classname}} { {{#vars}} {{#description}} /** @@ -41,12 +44,7 @@ export class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ ]; static getAttributeTypeMap() { - {{#parent}} - return super.getAttributeTypeMap().concat({{classname}}.attributeTypeMap); - {{/parent}} - {{^parent}} return {{classname}}.attributeTypeMap; - {{/parent}} } {{/isArray}} } diff --git a/templates/javascript/models.mustache b/templates/javascript/models.mustache index 551e865c0ad..90757fbd556 100644 --- a/templates/javascript/models.mustache +++ b/templates/javascript/models.mustache @@ -8,18 +8,6 @@ export * from '{{{ classFilename }}}'; {{/model}} {{/models}} -import * as fs from 'fs'; - -export interface RequestDetailedFile { - value: Buffer; - options?: { - filename?: string; - contentType?: string; - } -} - -export type RequestFile = string | Buffer | fs.ReadStream | RequestDetailedFile; - {{! Object serialization only relevant if generating APIs, too }} {{#generateApis}}