From 5d07088c689e78b34c5dbb7279df7566f8548c72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=C5=ADlo=20Ebermann?= Date: Sat, 17 Jun 2017 13:29:40 +0200 Subject: [PATCH] Change all sample-generators for typescript-angular2-* to use the YAML version. --- bin/typescript-angular2-petstore-all.sh | 2 +- ...typescript-angular2-petstore-interfaces.sh | 2 +- bin/typescript-angular2-petstore-with-npm.sh | 2 +- bin/typescript-angular2-petstore.sh | 2 +- .../with-interfaces/api/PetApi.ts | 98 ++++++++++--------- .../with-interfaces/api/PetApiInterface.ts | 20 ++-- .../with-interfaces/api/StoreApi.ts | 31 +++--- .../with-interfaces/api/StoreApiInterface.ts | 8 +- .../with-interfaces/api/UserApi.ts | 80 +++++++++------ .../with-interfaces/api/UserApiInterface.ts | 14 +-- .../with-interfaces/model/ApiResponse.ts | 25 +++++ .../with-interfaces/model/Category.ts | 7 +- .../with-interfaces/model/Order.ts | 7 +- .../with-interfaces/model/Pet.ts | 7 +- .../with-interfaces/model/Tag.ts | 7 +- .../with-interfaces/model/User.ts | 7 +- .../with-interfaces/model/models.ts | 1 + 17 files changed, 195 insertions(+), 125 deletions(-) create mode 100644 samples/client/petstore/typescript-angular2/with-interfaces/model/ApiResponse.ts diff --git a/bin/typescript-angular2-petstore-all.sh b/bin/typescript-angular2-petstore-all.sh index 0a4ee7080d5..1c805738b52 100755 --- a/bin/typescript-angular2-petstore-all.sh +++ b/bin/typescript-angular2-petstore-all.sh @@ -36,5 +36,5 @@ ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml java $JAVA_OPTS -jar $executable $ags echo "Typescript Petstore API client (with interfaces generated)" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l typescript-angular2 -o samples/client/petstore/typescript-angular2/with-interfaces -D withInterfaces=true" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-angular2 -o samples/client/petstore/typescript-angular2/with-interfaces -D withInterfaces=true" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-angular2-petstore-interfaces.sh b/bin/typescript-angular2-petstore-interfaces.sh index 12b3228a619..8fc81f13d68 100755 --- a/bin/typescript-angular2-petstore-interfaces.sh +++ b/bin/typescript-angular2-petstore-interfaces.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l typescript-angular2 -o samples/client/petstore/typescript-angular2/with-interfaces -D withInterfaces=true" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-angular2 -o samples/client/petstore/typescript-angular2/with-interfaces -D withInterfaces=true" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-angular2-petstore-with-npm.sh b/bin/typescript-angular2-petstore-with-npm.sh index 305a3e0b39d..0b96d7bd732 100755 --- a/bin/typescript-angular2-petstore-with-npm.sh +++ b/bin/typescript-angular2-petstore-with-npm.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l typescript-angular2 -c bin/typescript-petstore-npm.json -o samples/client/petstore/typescript-angular2/npm" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-angular2 -c bin/typescript-petstore-npm.json -o samples/client/petstore/typescript-angular2/npm" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-angular2-petstore.sh b/bin/typescript-angular2-petstore.sh index f26dd0f668f..dbb00a91344 100755 --- a/bin/typescript-angular2-petstore.sh +++ b/bin/typescript-angular2-petstore.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l typescript-angular2 -o samples/client/petstore/typescript-angular2/default" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-angular2 -o samples/client/petstore/typescript-angular2/default" java $JAVA_OPTS -jar $executable $ags diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/api/PetApi.ts b/samples/client/petstore/typescript-angular2/with-interfaces/api/PetApi.ts index b23d131cca1..5cb93a2d987 100644 --- a/samples/client/petstore/typescript-angular2/with-interfaces/api/PetApi.ts +++ b/samples/client/petstore/typescript-angular2/with-interfaces/api/PetApi.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -47,7 +47,7 @@ export class PetApi implements PetApiInterface { * * @param body Pet object that needs to be added to the store */ - public addPet(body?: models.Pet, extraHttpRequestParams?: any): Observable<{}> { + public addPet(body: models.Pet, extraHttpRequestParams?: any): Observable<{}> { return this.addPetWithHttpInfo(body, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { @@ -80,7 +80,7 @@ export class PetApi implements PetApiInterface { * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter */ - public findPetsByStatus(status?: Array, extraHttpRequestParams?: any): Observable> { + public findPetsByStatus(status: Array, extraHttpRequestParams?: any): Observable> { return this.findPetsByStatusWithHttpInfo(status, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { @@ -96,7 +96,7 @@ export class PetApi implements PetApiInterface { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by */ - public findPetsByTags(tags?: Array, extraHttpRequestParams?: any): Observable> { + public findPetsByTags(tags: Array, extraHttpRequestParams?: any): Observable> { return this.findPetsByTagsWithHttpInfo(tags, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { @@ -109,8 +109,8 @@ export class PetApi implements PetApiInterface { /** * Find pet by ID - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched + * Returns a single pet + * @param petId ID of pet to return */ public getPetById(petId: number, extraHttpRequestParams?: any): Observable { return this.getPetByIdWithHttpInfo(petId, extraHttpRequestParams) @@ -128,7 +128,7 @@ export class PetApi implements PetApiInterface { * * @param body Pet object that needs to be added to the store */ - public updatePet(body?: models.Pet, extraHttpRequestParams?: any): Observable<{}> { + public updatePet(body: models.Pet, extraHttpRequestParams?: any): Observable<{}> { return this.updatePetWithHttpInfo(body, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { @@ -146,7 +146,7 @@ export class PetApi implements PetApiInterface { * @param name Updated name of the pet * @param status Updated status of the pet */ - public updatePetWithForm(petId: string, name?: string, status?: string, extraHttpRequestParams?: any): Observable<{}> { + public updatePetWithForm(petId: number, name?: string, status?: string, extraHttpRequestParams?: any): Observable<{}> { return this.updatePetWithFormWithHttpInfo(petId, name, status, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { @@ -164,7 +164,7 @@ export class PetApi implements PetApiInterface { * @param additionalMetadata Additional data to pass to server * @param file file to upload */ - public uploadFile(petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any): Observable<{}> { + public uploadFile(petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any): Observable { return this.uploadFileWithHttpInfo(petId, additionalMetadata, file, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { @@ -181,11 +181,15 @@ export class PetApi implements PetApiInterface { * * @param body Pet object that needs to be added to the store */ - public addPetWithHttpInfo(body?: models.Pet, extraHttpRequestParams?: any): Observable { + public addPetWithHttpInfo(body: models.Pet, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/pet'; let queryParameters = new URLSearchParams(); let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling addPet.'); + } // to determine the Content-Type header let consumes: string[] = [ 'application/json', @@ -194,8 +198,8 @@ export class PetApi implements PetApiInterface { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; // authentication (petstore_auth) required @@ -250,8 +254,8 @@ export class PetApi implements PetApiInterface { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; // authentication (petstore_auth) required @@ -282,15 +286,17 @@ export class PetApi implements PetApiInterface { * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter */ - public findPetsByStatusWithHttpInfo(status?: Array, extraHttpRequestParams?: any): Observable { + public findPetsByStatusWithHttpInfo(status: Array, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/pet/findByStatus'; let queryParameters = new URLSearchParams(); let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 + // verify required parameter 'status' is not null or undefined + if (status === null || status === undefined) { + throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.'); + } if (status) { - status.forEach((element) => { - queryParameters.append('status', element); - }) + queryParameters.set('status', status.join(COLLECTION_FORMATS['csv'])); } // to determine the Content-Type header @@ -299,8 +305,8 @@ export class PetApi implements PetApiInterface { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; // authentication (petstore_auth) required @@ -331,15 +337,17 @@ export class PetApi implements PetApiInterface { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by */ - public findPetsByTagsWithHttpInfo(tags?: Array, extraHttpRequestParams?: any): Observable { + public findPetsByTagsWithHttpInfo(tags: Array, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/pet/findByTags'; let queryParameters = new URLSearchParams(); let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 + // verify required parameter 'tags' is not null or undefined + if (tags === null || tags === undefined) { + throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.'); + } if (tags) { - tags.forEach((element) => { - queryParameters.append('tags', element); - }) + queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv'])); } // to determine the Content-Type header @@ -348,8 +356,8 @@ export class PetApi implements PetApiInterface { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; // authentication (petstore_auth) required @@ -377,8 +385,8 @@ export class PetApi implements PetApiInterface { /** * Find pet by ID - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched + * Returns a single pet + * @param petId ID of pet to return */ public getPetByIdWithHttpInfo(petId: number, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/pet/${petId}' @@ -396,8 +404,8 @@ export class PetApi implements PetApiInterface { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; // authentication (api_key) required @@ -405,15 +413,6 @@ export class PetApi implements PetApiInterface { headers.set('api_key', this.configuration.apiKey); } - // authentication (petstore_auth) required - // oauth required - if (this.configuration.accessToken) { - let accessToken = typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; - headers.set('Authorization', 'Bearer ' + accessToken); - } - let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, @@ -433,11 +432,15 @@ export class PetApi implements PetApiInterface { * * @param body Pet object that needs to be added to the store */ - public updatePetWithHttpInfo(body?: models.Pet, extraHttpRequestParams?: any): Observable { + public updatePetWithHttpInfo(body: models.Pet, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/pet'; let queryParameters = new URLSearchParams(); let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling updatePet.'); + } // to determine the Content-Type header let consumes: string[] = [ 'application/json', @@ -446,8 +449,8 @@ export class PetApi implements PetApiInterface { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; // authentication (petstore_auth) required @@ -483,7 +486,7 @@ export class PetApi implements PetApiInterface { * @param name Updated name of the pet * @param status Updated status of the pet */ - public updatePetWithFormWithHttpInfo(petId: string, name?: string, status?: string, extraHttpRequestParams?: any): Observable { + public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/pet/${petId}' .replace('${' + 'petId' + '}', String(petId)); @@ -502,8 +505,8 @@ export class PetApi implements PetApiInterface { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; // authentication (petstore_auth) required @@ -566,8 +569,7 @@ export class PetApi implements PetApiInterface { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/json' ]; // authentication (petstore_auth) required diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/api/PetApiInterface.ts b/samples/client/petstore/typescript-angular2/with-interfaces/api/PetApiInterface.ts index d41a6388274..3f7c04d27db 100644 --- a/samples/client/petstore/typescript-angular2/with-interfaces/api/PetApiInterface.ts +++ b/samples/client/petstore/typescript-angular2/with-interfaces/api/PetApiInterface.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -28,7 +28,7 @@ export interface PetApiInterface { * * @param body Pet object that needs to be added to the store */ - addPet(body?: models.Pet, extraHttpRequestParams?: any): Observable<{}>; + addPet(body: models.Pet, extraHttpRequestParams?: any): Observable<{}>; /** * Deletes a pet @@ -43,19 +43,19 @@ export interface PetApiInterface { * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter */ - findPetsByStatus(status?: Array, extraHttpRequestParams?: any): Observable>; + findPetsByStatus(status: Array, extraHttpRequestParams?: any): Observable>; /** * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by */ - findPetsByTags(tags?: Array, extraHttpRequestParams?: any): Observable>; + findPetsByTags(tags: Array, extraHttpRequestParams?: any): Observable>; /** * Find pet by ID - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched + * Returns a single pet + * @param petId ID of pet to return */ getPetById(petId: number, extraHttpRequestParams?: any): Observable; @@ -64,7 +64,7 @@ export interface PetApiInterface { * * @param body Pet object that needs to be added to the store */ - updatePet(body?: models.Pet, extraHttpRequestParams?: any): Observable<{}>; + updatePet(body: models.Pet, extraHttpRequestParams?: any): Observable<{}>; /** * Updates a pet in the store with form data @@ -73,7 +73,7 @@ export interface PetApiInterface { * @param name Updated name of the pet * @param status Updated status of the pet */ - updatePetWithForm(petId: string, name?: string, status?: string, extraHttpRequestParams?: any): Observable<{}>; + updatePetWithForm(petId: number, name?: string, status?: string, extraHttpRequestParams?: any): Observable<{}>; /** * uploads an image @@ -82,6 +82,6 @@ export interface PetApiInterface { * @param additionalMetadata Additional data to pass to server * @param file file to upload */ - uploadFile(petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any): Observable<{}>; + uploadFile(petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any): Observable; } diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/api/StoreApi.ts b/samples/client/petstore/typescript-angular2/with-interfaces/api/StoreApi.ts index dcefb6f6b28..a9e78e0bc41 100644 --- a/samples/client/petstore/typescript-angular2/with-interfaces/api/StoreApi.ts +++ b/samples/client/petstore/typescript-angular2/with-interfaces/api/StoreApi.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -78,7 +78,7 @@ export class StoreApi implements StoreApiInterface { * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched */ - public getOrderById(orderId: string, extraHttpRequestParams?: any): Observable { + public getOrderById(orderId: number, extraHttpRequestParams?: any): Observable { return this.getOrderByIdWithHttpInfo(orderId, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { @@ -94,7 +94,7 @@ export class StoreApi implements StoreApiInterface { * * @param body order placed for purchasing the pet */ - public placeOrder(body?: models.Order, extraHttpRequestParams?: any): Observable { + public placeOrder(body: models.Order, extraHttpRequestParams?: any): Observable { return this.placeOrderWithHttpInfo(body, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { @@ -127,8 +127,8 @@ export class StoreApi implements StoreApiInterface { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -160,8 +160,7 @@ export class StoreApi implements StoreApiInterface { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/json' ]; // authentication (api_key) required @@ -188,7 +187,7 @@ export class StoreApi implements StoreApiInterface { * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched */ - public getOrderByIdWithHttpInfo(orderId: string, extraHttpRequestParams?: any): Observable { + public getOrderByIdWithHttpInfo(orderId: number, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/store/order/${orderId}' .replace('${' + 'orderId' + '}', String(orderId)); @@ -204,8 +203,8 @@ export class StoreApi implements StoreApiInterface { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -227,19 +226,23 @@ export class StoreApi implements StoreApiInterface { * * @param body order placed for purchasing the pet */ - public placeOrderWithHttpInfo(body?: models.Order, extraHttpRequestParams?: any): Observable { + public placeOrderWithHttpInfo(body: models.Order, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/store/order'; let queryParameters = new URLSearchParams(); let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling placeOrder.'); + } // to determine the Content-Type header let consumes: string[] = [ ]; // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; headers.set('Content-Type', 'application/json'); diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/api/StoreApiInterface.ts b/samples/client/petstore/typescript-angular2/with-interfaces/api/StoreApiInterface.ts index e8fe0eb9a82..ca2476d8210 100644 --- a/samples/client/petstore/typescript-angular2/with-interfaces/api/StoreApiInterface.ts +++ b/samples/client/petstore/typescript-angular2/with-interfaces/api/StoreApiInterface.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -41,13 +41,13 @@ export interface StoreApiInterface { * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched */ - getOrderById(orderId: string, extraHttpRequestParams?: any): Observable; + getOrderById(orderId: number, extraHttpRequestParams?: any): Observable; /** * Place an order for a pet * * @param body order placed for purchasing the pet */ - placeOrder(body?: models.Order, extraHttpRequestParams?: any): Observable; + placeOrder(body: models.Order, extraHttpRequestParams?: any): Observable; } diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/api/UserApi.ts b/samples/client/petstore/typescript-angular2/with-interfaces/api/UserApi.ts index b8738b0e463..d8d426fd7d1 100644 --- a/samples/client/petstore/typescript-angular2/with-interfaces/api/UserApi.ts +++ b/samples/client/petstore/typescript-angular2/with-interfaces/api/UserApi.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -47,7 +47,7 @@ export class UserApi implements UserApiInterface { * This can only be done by the logged in user. * @param body Created user object */ - public createUser(body?: models.User, extraHttpRequestParams?: any): Observable<{}> { + public createUser(body: models.User, extraHttpRequestParams?: any): Observable<{}> { return this.createUserWithHttpInfo(body, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { @@ -63,7 +63,7 @@ export class UserApi implements UserApiInterface { * * @param body List of user object */ - public createUsersWithArrayInput(body?: Array, extraHttpRequestParams?: any): Observable<{}> { + public createUsersWithArrayInput(body: Array, extraHttpRequestParams?: any): Observable<{}> { return this.createUsersWithArrayInputWithHttpInfo(body, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { @@ -79,7 +79,7 @@ export class UserApi implements UserApiInterface { * * @param body List of user object */ - public createUsersWithListInput(body?: Array, extraHttpRequestParams?: any): Observable<{}> { + public createUsersWithListInput(body: Array, extraHttpRequestParams?: any): Observable<{}> { return this.createUsersWithListInputWithHttpInfo(body, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { @@ -128,7 +128,7 @@ export class UserApi implements UserApiInterface { * @param username The user name for login * @param password The password for login in clear text */ - public loginUser(username?: string, password?: string, extraHttpRequestParams?: any): Observable { + public loginUser(username: string, password: string, extraHttpRequestParams?: any): Observable { return this.loginUserWithHttpInfo(username, password, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { @@ -160,7 +160,7 @@ export class UserApi implements UserApiInterface { * @param username name that need to be deleted * @param body Updated user object */ - public updateUser(username: string, body?: models.User, extraHttpRequestParams?: any): Observable<{}> { + public updateUser(username: string, body: models.User, extraHttpRequestParams?: any): Observable<{}> { return this.updateUserWithHttpInfo(username, body, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { @@ -177,19 +177,23 @@ export class UserApi implements UserApiInterface { * This can only be done by the logged in user. * @param body Created user object */ - public createUserWithHttpInfo(body?: models.User, extraHttpRequestParams?: any): Observable { + public createUserWithHttpInfo(body: models.User, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/user'; let queryParameters = new URLSearchParams(); let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling createUser.'); + } // to determine the Content-Type header let consumes: string[] = [ ]; // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; headers.set('Content-Type', 'application/json'); @@ -214,19 +218,23 @@ export class UserApi implements UserApiInterface { * * @param body List of user object */ - public createUsersWithArrayInputWithHttpInfo(body?: Array, extraHttpRequestParams?: any): Observable { + public createUsersWithArrayInputWithHttpInfo(body: Array, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/user/createWithArray'; let queryParameters = new URLSearchParams(); let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling createUsersWithArrayInput.'); + } // to determine the Content-Type header let consumes: string[] = [ ]; // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; headers.set('Content-Type', 'application/json'); @@ -251,19 +259,23 @@ export class UserApi implements UserApiInterface { * * @param body List of user object */ - public createUsersWithListInputWithHttpInfo(body?: Array, extraHttpRequestParams?: any): Observable { + public createUsersWithListInputWithHttpInfo(body: Array, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/user/createWithList'; let queryParameters = new URLSearchParams(); let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling createUsersWithListInput.'); + } // to determine the Content-Type header let consumes: string[] = [ ]; // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; headers.set('Content-Type', 'application/json'); @@ -304,8 +316,8 @@ export class UserApi implements UserApiInterface { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -343,8 +355,8 @@ export class UserApi implements UserApiInterface { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -367,11 +379,19 @@ export class UserApi implements UserApiInterface { * @param username The user name for login * @param password The password for login in clear text */ - public loginUserWithHttpInfo(username?: string, password?: string, extraHttpRequestParams?: any): Observable { + public loginUserWithHttpInfo(username: string, password: string, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/user/login'; let queryParameters = new URLSearchParams(); let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling loginUser.'); + } + // verify required parameter 'password' is not null or undefined + if (password === null || password === undefined) { + throw new Error('Required parameter password was null or undefined when calling loginUser.'); + } if (username !== undefined) { queryParameters.set('username', username); } @@ -386,8 +406,8 @@ export class UserApi implements UserApiInterface { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -419,8 +439,8 @@ export class UserApi implements UserApiInterface { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -443,7 +463,7 @@ export class UserApi implements UserApiInterface { * @param username name that need to be deleted * @param body Updated user object */ - public updateUserWithHttpInfo(username: string, body?: models.User, extraHttpRequestParams?: any): Observable { + public updateUserWithHttpInfo(username: string, body: models.User, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/user/${username}' .replace('${' + 'username' + '}', String(username)); @@ -453,14 +473,18 @@ export class UserApi implements UserApiInterface { if (username === null || username === undefined) { throw new Error('Required parameter username was null or undefined when calling updateUser.'); } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling updateUser.'); + } // to determine the Content-Type header let consumes: string[] = [ ]; // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; headers.set('Content-Type', 'application/json'); diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/api/UserApiInterface.ts b/samples/client/petstore/typescript-angular2/with-interfaces/api/UserApiInterface.ts index c882866c1c1..067befa18e7 100644 --- a/samples/client/petstore/typescript-angular2/with-interfaces/api/UserApiInterface.ts +++ b/samples/client/petstore/typescript-angular2/with-interfaces/api/UserApiInterface.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -28,21 +28,21 @@ export interface UserApiInterface { * This can only be done by the logged in user. * @param body Created user object */ - createUser(body?: models.User, extraHttpRequestParams?: any): Observable<{}>; + createUser(body: models.User, extraHttpRequestParams?: any): Observable<{}>; /** * Creates list of users with given input array * * @param body List of user object */ - createUsersWithArrayInput(body?: Array, extraHttpRequestParams?: any): Observable<{}>; + createUsersWithArrayInput(body: Array, extraHttpRequestParams?: any): Observable<{}>; /** * Creates list of users with given input array * * @param body List of user object */ - createUsersWithListInput(body?: Array, extraHttpRequestParams?: any): Observable<{}>; + createUsersWithListInput(body: Array, extraHttpRequestParams?: any): Observable<{}>; /** * Delete user @@ -64,7 +64,7 @@ export interface UserApiInterface { * @param username The user name for login * @param password The password for login in clear text */ - loginUser(username?: string, password?: string, extraHttpRequestParams?: any): Observable; + loginUser(username: string, password: string, extraHttpRequestParams?: any): Observable; /** * Logs out current logged in user session @@ -78,6 +78,6 @@ export interface UserApiInterface { * @param username name that need to be deleted * @param body Updated user object */ - updateUser(username: string, body?: models.User, extraHttpRequestParams?: any): Observable<{}>; + updateUser(username: string, body: models.User, extraHttpRequestParams?: any): Observable<{}>; } diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/model/ApiResponse.ts b/samples/client/petstore/typescript-angular2/with-interfaces/model/ApiResponse.ts new file mode 100644 index 00000000000..f86e84f93a3 --- /dev/null +++ b/samples/client/petstore/typescript-angular2/with-interfaces/model/ApiResponse.ts @@ -0,0 +1,25 @@ +/** + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import * as models from './models'; + +/** + * Describes the result of uploading an image resource + */ +export interface ApiResponse { + code?: number; + + type?: string; + + message?: string; + +} diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/model/Category.ts b/samples/client/petstore/typescript-angular2/with-interfaces/model/Category.ts index ffdacd4f707..254c3003c89 100644 --- a/samples/client/petstore/typescript-angular2/with-interfaces/model/Category.ts +++ b/samples/client/petstore/typescript-angular2/with-interfaces/model/Category.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -12,6 +12,9 @@ import * as models from './models'; +/** + * A category for a pet + */ export interface Category { id?: number; diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/model/Order.ts b/samples/client/petstore/typescript-angular2/with-interfaces/model/Order.ts index 9c47071c5b6..2b6c7aeebd6 100644 --- a/samples/client/petstore/typescript-angular2/with-interfaces/model/Order.ts +++ b/samples/client/petstore/typescript-angular2/with-interfaces/model/Order.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -12,6 +12,9 @@ import * as models from './models'; +/** + * An order for a pets from the pet store + */ export interface Order { id?: number; diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/model/Pet.ts b/samples/client/petstore/typescript-angular2/with-interfaces/model/Pet.ts index d64dc809e53..b878cadb905 100644 --- a/samples/client/petstore/typescript-angular2/with-interfaces/model/Pet.ts +++ b/samples/client/petstore/typescript-angular2/with-interfaces/model/Pet.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -12,6 +12,9 @@ import * as models from './models'; +/** + * A pet for sale in the pet store + */ export interface Pet { id?: number; diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/model/Tag.ts b/samples/client/petstore/typescript-angular2/with-interfaces/model/Tag.ts index 8a3b99ae9ca..8cbdc4fa145 100644 --- a/samples/client/petstore/typescript-angular2/with-interfaces/model/Tag.ts +++ b/samples/client/petstore/typescript-angular2/with-interfaces/model/Tag.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -12,6 +12,9 @@ import * as models from './models'; +/** + * A tag for a pet + */ export interface Tag { id?: number; diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/model/User.ts b/samples/client/petstore/typescript-angular2/with-interfaces/model/User.ts index 43d00f7b318..fbf75dfe28e 100644 --- a/samples/client/petstore/typescript-angular2/with-interfaces/model/User.ts +++ b/samples/client/petstore/typescript-angular2/with-interfaces/model/User.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -12,6 +12,9 @@ import * as models from './models'; +/** + * A User who is purchasing from the pet store + */ export interface User { id?: number; diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/model/models.ts b/samples/client/petstore/typescript-angular2/with-interfaces/model/models.ts index 92dac02846c..f53c1dd42bd 100644 --- a/samples/client/petstore/typescript-angular2/with-interfaces/model/models.ts +++ b/samples/client/petstore/typescript-angular2/with-interfaces/model/models.ts @@ -1,3 +1,4 @@ +export * from './ApiResponse'; export * from './Category'; export * from './Order'; export * from './Pet';