diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java
index 2853c1b379b..18c6f72e9cb 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java
@@ -3,6 +3,8 @@
import java.io.File;
import io.swagger.codegen.SupportingFile;
+import io.swagger.codegen.CodegenParameter;
+import io.swagger.models.properties.Property;
public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCodegen {
@@ -19,7 +21,10 @@ public String getHelp() {
@Override
public void processOpts() {
super.processOpts();
- supportingFiles.add(new SupportingFile("api.d.mustache", apiPackage().replace('.', File.separatorChar), "api.d.ts"));
+ supportingFiles.add(new SupportingFile("models.mustache", modelPackage().replace('.', File.separatorChar), "models.ts"));
+ supportingFiles.add(new SupportingFile("apis.mustache", apiPackage().replace('.', File.separatorChar), "api.ts"));
+ supportingFiles.add(new SupportingFile("index.mustache", getIndexDirectory(), "index.ts"));
+ supportingFiles.add(new SupportingFile("api.module.mustache", getIndexDirectory(), "api.module.ts"));
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
supportingFiles.add(new SupportingFile("gitignore", "", ".gitignore"));
@@ -29,9 +34,56 @@ public TypeScriptAngularClientCodegen() {
super();
outputFolder = "generated-code/typescript-angular";
modelTemplateFiles.put("model.mustache", ".ts");
- apiTemplateFiles.put("api.mustache", ".ts");
+ apiTemplateFiles.put("api.mustache", ".ts");
embeddedTemplateDir = templateDir = "typescript-angular";
- apiPackage = "API.Client";
- modelPackage = "API.Client";
+ apiPackage = "api";
+ modelPackage = "model";
}
+
+ @Override
+ public String getSwaggerType(Property p) {
+ String swaggerType = super.getSwaggerType(p);
+ if(isLanguagePrimitive(swaggerType) || isLanguageGenericType(swaggerType)) {
+ return swaggerType;
+ }
+ return addModelPrefix(swaggerType);
+ }
+
+ @Override
+ public void postProcessParameter(CodegenParameter parameter) {
+ super.postProcessParameter(parameter);
+ parameter.dataType = addModelPrefix(parameter.dataType);
+ }
+
+ private String getIndexDirectory() {
+ String indexPackage = modelPackage.substring(0, Math.max(0, modelPackage.lastIndexOf('.')));
+ return indexPackage.replace('.', File.separatorChar);
+ }
+
+ private String addModelPrefix(String swaggerType) {
+ String type = null;
+ if (typeMapping.containsKey(swaggerType)) {
+ type = typeMapping.get(swaggerType);
+ } else {
+ type = swaggerType;
+ }
+
+ if (!isLanguagePrimitive(type) && !isLanguageGenericType(type)) {
+ type = "models." + swaggerType;
+ }
+ return type;
+ }
+
+ private boolean isLanguagePrimitive(String type) {
+ return languageSpecificPrimitives.contains(type);
+ }
+
+ private boolean isLanguageGenericType(String type) {
+ for (String genericType: languageGenericTypes) {
+ if (type.startsWith(genericType + "<")) {
+ return true;
+ }
+ }
+ return false;
+ }
}
diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/api.d.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/api.d.mustache
deleted file mode 100644
index a8bf1c58267..00000000000
--- a/modules/swagger-codegen/src/main/resources/typescript-angular/api.d.mustache
+++ /dev/null
@@ -1,13 +0,0 @@
-{{#models}}
-{{#model}}
-///
-{{/model}}
-{{/models}}
-
-{{#apiInfo}}
-{{#apis}}
-{{#operations}}
-///
-{{/operations}}
-{{/apis}}
-{{/apiInfo}}
diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/api.module.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/api.module.mustache
new file mode 100644
index 00000000000..1b01079af8c
--- /dev/null
+++ b/modules/swagger-codegen/src/main/resources/typescript-angular/api.module.mustache
@@ -0,0 +1,13 @@
+import * as api from './api/api';
+import * as angular from 'angular';
+
+{{#apiInfo}}
+const apiModule = angular.module('api', [])
+{{#apis}}
+{{#operations}}
+.service('{{classname}}', api.{{classname}})
+{{/operations}}
+{{/apis}}
+
+export default apiModule;
+{{/apiInfo}}
\ No newline at end of file
diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/api.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/api.mustache
index cf6665e7937..f73752f7df5 100644
--- a/modules/swagger-codegen/src/main/resources/typescript-angular/api.mustache
+++ b/modules/swagger-codegen/src/main/resources/typescript-angular/api.mustache
@@ -1,89 +1,85 @@
{{>licenseInfo}}
-///
+import * as models from '../model/models';
/* tslint:disable:no-unused-variable member-ordering */
{{#operations}}
-namespace {{package}} {
- 'use strict';
-
{{#description}}
- /**
- * {{&description}}
- */
+/**
+ * {{&description}}
+ */
{{/description}}
- export class {{classname}} {
- protected basePath = '{{basePath}}';
- public defaultHeaders : any = {};
+export class {{classname}} {
+ protected basePath = '{{basePath}}';
+ public defaultHeaders : any = {};
- static $inject: string[] = ['$http', '$httpParamSerializer', 'basePath'];
+ static $inject: string[] = ['$http', '$httpParamSerializer', 'basePath'];
- constructor(protected $http: ng.IHttpService, protected $httpParamSerializer?: (d: any) => any, basePath?: string) {
- if (basePath !== undefined) {
- this.basePath = basePath;
- }
+ constructor(protected $http: ng.IHttpService, protected $httpParamSerializer?: (d: any) => any, basePath?: string) {
+ if (basePath !== undefined) {
+ this.basePath = basePath;
}
+ }
{{#operation}}
- /**
- * {{summary}}
- * {{notes}}
- {{#allParams}}* @param {{paramName}} {{description}}
- {{/allParams}}*/
- public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}extraHttpRequestParams?: any ) : ng.IHttpPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}{}{{/returnType}}> {
- const localVarPath = this.basePath + '{{path}}'{{#pathParams}}
- .replace('{' + '{{baseName}}' + '}', String({{paramName}})){{/pathParams}};
+ /**
+ * {{summary}}
+ * {{notes}}
+ {{#allParams}}* @param {{paramName}} {{description}}
+ {{/allParams}}*/
+ public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}extraHttpRequestParams?: any ) : ng.IHttpPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}{}{{/returnType}}> {
+ const localVarPath = this.basePath + '{{path}}'{{#pathParams}}
+ .replace('{' + '{{baseName}}' + '}', String({{paramName}})){{/pathParams}};
- let queryParameters: any = {};
- let headerParams: any = (Object).assign({}, this.defaultHeaders);
+ let queryParameters: any = {};
+ let headerParams: any = (Object).assign({}, this.defaultHeaders);
{{#hasFormParams}}
- let formParams: any = {};
+ let formParams: any = {};
{{/hasFormParams}}
{{#allParams}}
{{#required}}
- // verify required parameter '{{paramName}}' is not null or undefined
- if ({{paramName}} === null || {{paramName}} === undefined) {
- throw new Error('Required parameter {{paramName}} was null or undefined when calling {{nickname}}.');
- }
+ // verify required parameter '{{paramName}}' is not null or undefined
+ if ({{paramName}} === null || {{paramName}} === undefined) {
+ throw new Error('Required parameter {{paramName}} was null or undefined when calling {{nickname}}.');
+ }
{{/required}}
{{/allParams}}
{{#queryParams}}
- if ({{paramName}} !== undefined) {
- queryParameters['{{baseName}}'] = {{paramName}};
- }
+ if ({{paramName}} !== undefined) {
+ queryParameters['{{baseName}}'] = {{paramName}};
+ }
{{/queryParams}}
{{#headerParams}}
- headerParams['{{baseName}}'] = {{paramName}};
+ headerParams['{{baseName}}'] = {{paramName}};
{{/headerParams}}
{{#hasFormParams}}
- headerParams['Content-Type'] = 'application/x-www-form-urlencoded';
+ headerParams['Content-Type'] = 'application/x-www-form-urlencoded';
{{/hasFormParams}}
{{#formParams}}
- formParams['{{baseName}}'] = {{paramName}};
+ formParams['{{baseName}}'] = {{paramName}};
{{/formParams}}
- let httpRequestParams: ng.IRequestConfig = {
- method: '{{httpMethod}}',
- url: localVarPath,
- {{#bodyParam}}data: {{paramName}},
- {{/bodyParam}}
- {{#hasFormParams}}data: this.$httpParamSerializer(formParams),
- {{/hasFormParams}}
- params: queryParameters,
- headers: headerParams
- };
-
- if (extraHttpRequestParams) {
- httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
- }
+ let httpRequestParams: ng.IRequestConfig = {
+ method: '{{httpMethod}}',
+ url: localVarPath,
+ {{#bodyParam}}data: {{paramName}},
+ {{/bodyParam}}
+ {{#hasFormParams}}data: this.$httpParamSerializer(formParams),
+ {{/hasFormParams}}
+ params: queryParameters,
+ headers: headerParams
+ };
- return this.$http(httpRequestParams);
+ if (extraHttpRequestParams) {
+ httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
}
-{{/operation}}
+
+ return this.$http(httpRequestParams);
}
+{{/operation}}
}
-{{/operations}}
+{{/operations}}
\ No newline at end of file
diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/apis.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/apis.mustache
new file mode 100644
index 00000000000..85522cf6c58
--- /dev/null
+++ b/modules/swagger-codegen/src/main/resources/typescript-angular/apis.mustache
@@ -0,0 +1,9 @@
+{{#apiInfo}}
+{{#apis}}
+{{#operations}}
+export * from './{{ classname }}';
+import { {{ classname }} } from './{{ classname }}';
+{{/operations}}
+{{/apis}}
+export const APIS = [ {{#apis}}{{#operations}}{{ classname }}, {{/operations}}{{/apis}}];
+{{/apiInfo}}
\ No newline at end of file
diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/index.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/index.mustache
new file mode 100644
index 00000000000..557365516ad
--- /dev/null
+++ b/modules/swagger-codegen/src/main/resources/typescript-angular/index.mustache
@@ -0,0 +1,2 @@
+export * from './api/api';
+export * from './model/models';
\ No newline at end of file
diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/model.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/model.mustache
index 56732788f62..f1bded256c0 100644
--- a/modules/swagger-codegen/src/main/resources/typescript-angular/model.mustache
+++ b/modules/swagger-codegen/src/main/resources/typescript-angular/model.mustache
@@ -1,43 +1,38 @@
{{>licenseInfo}}
-///
-
-namespace {{package}} {
- 'use strict';
+import * as models from './models';
{{#models}}
{{#model}}
{{#description}}
- /**
- * {{{description}}}
- */
+/**
+ * {{{description}}}
+ */
{{/description}}
- export interface {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{
+export interface {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{
{{#vars}}
{{#description}}
- /**
- * {{{description}}}
- */
+ /**
+ * {{{description}}}
+ */
{{/description}}
- "{{name}}"{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}};
-
+ "{{name}}"{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}};
{{/vars}}
- }
+}
{{#hasEnums}}
- export namespace {{classname}} {
+export namespace {{classname}} {
{{#vars}}
{{#isEnum}}
- export enum {{enumName}} {
- {{#allowableValues}}
- {{#enumVars}}
- {{{name}}} = {{{value}}}{{^-last}},{{/-last}}
- {{/enumVars}}
- {{/allowableValues}}
- }
+ export enum {{enumName}} {
+ {{#allowableValues}}
+ {{#enumVars}}
+ {{{name}}} = {{{value}}}{{^-last}},{{/-last}}
+ {{/enumVars}}
+ {{/allowableValues}}
+ }
{{/isEnum}}
{{/vars}}
- }
+}
{{/hasEnums}}
{{/model}}
{{/models}}
-}
diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/models.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/models.mustache
new file mode 100644
index 00000000000..ace053bd55b
--- /dev/null
+++ b/modules/swagger-codegen/src/main/resources/typescript-angular/models.mustache
@@ -0,0 +1,5 @@
+{{#models}}
+{{#model}}
+export * from './{{{ classname }}}';
+{{/model}}
+{{/models}}
diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular/TypeScriptAngularModelTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular/TypeScriptAngularModelTest.java
index b7dacc22357..438d9c8c488 100644
--- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular/TypeScriptAngularModelTest.java
+++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/typescript/typescriptangular/TypeScriptAngularModelTest.java
@@ -118,10 +118,10 @@ public void complexPropertyTest() {
final CodegenProperty property1 = cm.vars.get(0);
Assert.assertEquals(property1.baseName, "children");
- Assert.assertEquals(property1.datatype, "Children");
+ Assert.assertEquals(property1.datatype, "models.Children");
Assert.assertEquals(property1.name, "children");
Assert.assertEquals(property1.defaultValue, "null");
- Assert.assertEquals(property1.baseType, "Children");
+ Assert.assertEquals(property1.baseType, "models.Children");
Assert.assertFalse(property1.required);
Assert.assertTrue(property1.isNotContainer);
}
@@ -142,8 +142,8 @@ public void complexListPropertyTest() {
final CodegenProperty property1 = cm.vars.get(0);
Assert.assertEquals(property1.baseName, "children");
- Assert.assertEquals(property1.complexType, "Children");
- Assert.assertEquals(property1.datatype, "Array");
+ Assert.assertEquals(property1.complexType, "models.Children");
+ Assert.assertEquals(property1.datatype, "Array");
Assert.assertEquals(property1.name, "children");
Assert.assertEquals(property1.baseType, "Array");
Assert.assertFalse(property1.required);
@@ -177,6 +177,6 @@ public void mapModelTest() {
Assert.assertEquals(cm.description, "a map model");
Assert.assertEquals(cm.vars.size(), 0);
Assert.assertEquals(cm.imports.size(), 1);
- Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Children")).size(), 1);
+ Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("models.Children")).size(), 1);
}
}
diff --git a/samples/client/petstore/typescript-angular/API/Client/InlineResponse200.ts b/samples/client/petstore/typescript-angular/API/Client/InlineResponse200.ts
deleted file mode 100644
index 079eac61bc6..00000000000
--- a/samples/client/petstore/typescript-angular/API/Client/InlineResponse200.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-///
-
-namespace API.Client {
- 'use strict';
-
- export interface InlineResponse200 {
-
- "tags"?: Array;
-
- "id": number;
-
- "category"?: any;
-
- /**
- * pet status in the store
- */
- "status"?: InlineResponse200.StatusEnum;
-
- "name"?: string;
-
- "photoUrls"?: Array;
- }
-
- export namespace InlineResponse200 {
-
- export enum StatusEnum {
- available = 'available',
- pending = 'pending',
- sold = 'sold'
- }
- }
-}
diff --git a/samples/client/petstore/typescript-angular/API/Client/Model200Response.ts b/samples/client/petstore/typescript-angular/API/Client/Model200Response.ts
deleted file mode 100644
index ef34114f4a3..00000000000
--- a/samples/client/petstore/typescript-angular/API/Client/Model200Response.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-///
-
-namespace API.Client {
- 'use strict';
-
- export interface Model200Response {
-
- "name"?: number;
- }
-
-}
diff --git a/samples/client/petstore/typescript-angular/API/Client/ModelReturn.ts b/samples/client/petstore/typescript-angular/API/Client/ModelReturn.ts
deleted file mode 100644
index c147566cf47..00000000000
--- a/samples/client/petstore/typescript-angular/API/Client/ModelReturn.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-///
-
-namespace API.Client {
- 'use strict';
-
- export interface ModelReturn {
-
- "return"?: number;
- }
-
-}
diff --git a/samples/client/petstore/typescript-angular/API/Client/Name.ts b/samples/client/petstore/typescript-angular/API/Client/Name.ts
deleted file mode 100644
index 9277422d52f..00000000000
--- a/samples/client/petstore/typescript-angular/API/Client/Name.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-///
-
-namespace API.Client {
- 'use strict';
-
- export interface Name {
-
- "name"?: number;
- }
-
-}
diff --git a/samples/client/petstore/typescript-angular/API/Client/PetApi.ts b/samples/client/petstore/typescript-angular/API/Client/PetApi.ts
deleted file mode 100644
index 625b5adbce9..00000000000
--- a/samples/client/petstore/typescript-angular/API/Client/PetApi.ts
+++ /dev/null
@@ -1,272 +0,0 @@
-/**
- * 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
- *
- * OpenAPI spec version: 1.0.0
- * Contact: apiteam@wordnik.com
- *
- * 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.
- */
-
-///
-
-/* tslint:disable:no-unused-variable member-ordering */
-
-namespace API.Client {
- 'use strict';
-
- export class PetApi {
- protected basePath = 'http://petstore.swagger.io/v2';
- public defaultHeaders : any = {};
-
- static $inject: string[] = ['$http', '$httpParamSerializer', 'basePath'];
-
- constructor(protected $http: ng.IHttpService, protected $httpParamSerializer?: (d: any) => any, basePath?: string) {
- if (basePath !== undefined) {
- this.basePath = basePath;
- }
- }
-
- /**
- * Add a new pet to the store
- *
- * @param body Pet object that needs to be added to the store
- */
- public addPet (body?: Pet, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
- const localVarPath = this.basePath + '/pet';
-
- let queryParameters: any = {};
- let headerParams: any = (Object).assign({}, this.defaultHeaders);
- let httpRequestParams: ng.IRequestConfig = {
- method: 'POST',
- url: localVarPath,
- data: body,
- params: queryParameters,
- headers: headerParams
- };
-
- if (extraHttpRequestParams) {
- httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
- }
-
- return this.$http(httpRequestParams);
- }
- /**
- * Deletes a pet
- *
- * @param petId Pet id to delete
- * @param apiKey
- */
- public deletePet (petId: number, apiKey?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
- const localVarPath = this.basePath + '/pet/{petId}'
- .replace('{' + 'petId' + '}', String(petId));
-
- let queryParameters: any = {};
- let headerParams: any = (Object).assign({}, this.defaultHeaders);
- // verify required parameter 'petId' is not null or undefined
- if (petId === null || petId === undefined) {
- throw new Error('Required parameter petId was null or undefined when calling deletePet.');
- }
- headerParams['api_key'] = apiKey;
-
- let httpRequestParams: ng.IRequestConfig = {
- method: 'DELETE',
- url: localVarPath,
- params: queryParameters,
- headers: headerParams
- };
-
- if (extraHttpRequestParams) {
- httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
- }
-
- return this.$http(httpRequestParams);
- }
- /**
- * Finds Pets by status
- * 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 ) : ng.IHttpPromise> {
- const localVarPath = this.basePath + '/pet/findByStatus';
-
- let queryParameters: any = {};
- let headerParams: any = (Object).assign({}, this.defaultHeaders);
- if (status !== undefined) {
- queryParameters['status'] = status;
- }
-
- let httpRequestParams: ng.IRequestConfig = {
- method: 'GET',
- url: localVarPath,
- params: queryParameters,
- headers: headerParams
- };
-
- if (extraHttpRequestParams) {
- httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
- }
-
- return this.$http(httpRequestParams);
- }
- /**
- * 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
- */
- public findPetsByTags (tags?: Array, extraHttpRequestParams?: any ) : ng.IHttpPromise> {
- const localVarPath = this.basePath + '/pet/findByTags';
-
- let queryParameters: any = {};
- let headerParams: any = (Object).assign({}, this.defaultHeaders);
- if (tags !== undefined) {
- queryParameters['tags'] = tags;
- }
-
- let httpRequestParams: ng.IRequestConfig = {
- method: 'GET',
- url: localVarPath,
- params: queryParameters,
- headers: headerParams
- };
-
- if (extraHttpRequestParams) {
- httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
- }
-
- return this.$http(httpRequestParams);
- }
- /**
- * 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
- */
- public getPetById (petId: number, extraHttpRequestParams?: any ) : ng.IHttpPromise {
- const localVarPath = this.basePath + '/pet/{petId}'
- .replace('{' + 'petId' + '}', String(petId));
-
- let queryParameters: any = {};
- let headerParams: any = (Object).assign({}, this.defaultHeaders);
- // verify required parameter 'petId' is not null or undefined
- if (petId === null || petId === undefined) {
- throw new Error('Required parameter petId was null or undefined when calling getPetById.');
- }
- let httpRequestParams: ng.IRequestConfig = {
- method: 'GET',
- url: localVarPath,
- params: queryParameters,
- headers: headerParams
- };
-
- if (extraHttpRequestParams) {
- httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
- }
-
- return this.$http(httpRequestParams);
- }
- /**
- * Update an existing pet
- *
- * @param body Pet object that needs to be added to the store
- */
- public updatePet (body?: Pet, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
- const localVarPath = this.basePath + '/pet';
-
- let queryParameters: any = {};
- let headerParams: any = (Object).assign({}, this.defaultHeaders);
- let httpRequestParams: ng.IRequestConfig = {
- method: 'PUT',
- url: localVarPath,
- data: body,
- params: queryParameters,
- headers: headerParams
- };
-
- if (extraHttpRequestParams) {
- httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
- }
-
- return this.$http(httpRequestParams);
- }
- /**
- * Updates a pet in the store with form data
- *
- * @param petId ID of pet that needs to be updated
- * @param name Updated name of the pet
- * @param status Updated status of the pet
- */
- public updatePetWithForm (petId: string, name?: string, status?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
- const localVarPath = this.basePath + '/pet/{petId}'
- .replace('{' + 'petId' + '}', String(petId));
-
- let queryParameters: any = {};
- let headerParams: any = (Object).assign({}, this.defaultHeaders);
- let formParams: any = {};
-
- // verify required parameter 'petId' is not null or undefined
- if (petId === null || petId === undefined) {
- throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.');
- }
- headerParams['Content-Type'] = 'application/x-www-form-urlencoded';
-
- formParams['name'] = name;
-
- formParams['status'] = status;
-
- let httpRequestParams: ng.IRequestConfig = {
- method: 'POST',
- url: localVarPath,
- data: this.$httpParamSerializer(formParams),
- params: queryParameters,
- headers: headerParams
- };
-
- if (extraHttpRequestParams) {
- httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
- }
-
- return this.$http(httpRequestParams);
- }
- /**
- * uploads an image
- *
- * @param petId ID of pet to update
- * @param additionalMetadata Additional data to pass to server
- * @param file file to upload
- */
- public uploadFile (petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
- const localVarPath = this.basePath + '/pet/{petId}/uploadImage'
- .replace('{' + 'petId' + '}', String(petId));
-
- let queryParameters: any = {};
- let headerParams: any = (Object).assign({}, this.defaultHeaders);
- let formParams: any = {};
-
- // verify required parameter 'petId' is not null or undefined
- if (petId === null || petId === undefined) {
- throw new Error('Required parameter petId was null or undefined when calling uploadFile.');
- }
- headerParams['Content-Type'] = 'application/x-www-form-urlencoded';
-
- formParams['additionalMetadata'] = additionalMetadata;
-
- formParams['file'] = file;
-
- let httpRequestParams: ng.IRequestConfig = {
- method: 'POST',
- url: localVarPath,
- data: this.$httpParamSerializer(formParams),
- params: queryParameters,
- headers: headerParams
- };
-
- if (extraHttpRequestParams) {
- httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
- }
-
- return this.$http(httpRequestParams);
- }
- }
-}
diff --git a/samples/client/petstore/typescript-angular/API/Client/SpecialModelName.ts b/samples/client/petstore/typescript-angular/API/Client/SpecialModelName.ts
deleted file mode 100644
index 550ab8cd008..00000000000
--- a/samples/client/petstore/typescript-angular/API/Client/SpecialModelName.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-///
-
-namespace API.Client {
- 'use strict';
-
- export interface SpecialModelName {
-
- "$Special[propertyName]"?: number;
- }
-
-}
diff --git a/samples/client/petstore/typescript-angular/API/Client/StoreApi.ts b/samples/client/petstore/typescript-angular/API/Client/StoreApi.ts
deleted file mode 100644
index 779eaad3338..00000000000
--- a/samples/client/petstore/typescript-angular/API/Client/StoreApi.ts
+++ /dev/null
@@ -1,135 +0,0 @@
-/**
- * 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
- *
- * OpenAPI spec version: 1.0.0
- * Contact: apiteam@wordnik.com
- *
- * 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.
- */
-
-///
-
-/* tslint:disable:no-unused-variable member-ordering */
-
-namespace API.Client {
- 'use strict';
-
- export class StoreApi {
- protected basePath = 'http://petstore.swagger.io/v2';
- public defaultHeaders : any = {};
-
- static $inject: string[] = ['$http', '$httpParamSerializer', 'basePath'];
-
- constructor(protected $http: ng.IHttpService, protected $httpParamSerializer?: (d: any) => any, basePath?: string) {
- if (basePath !== undefined) {
- this.basePath = basePath;
- }
- }
-
- /**
- * Delete purchase order by ID
- * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
- * @param orderId ID of the order that needs to be deleted
- */
- public deleteOrder (orderId: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
- const localVarPath = this.basePath + '/store/order/{orderId}'
- .replace('{' + 'orderId' + '}', String(orderId));
-
- let queryParameters: any = {};
- let headerParams: any = (Object).assign({}, this.defaultHeaders);
- // verify required parameter 'orderId' is not null or undefined
- if (orderId === null || orderId === undefined) {
- throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.');
- }
- let httpRequestParams: ng.IRequestConfig = {
- method: 'DELETE',
- url: localVarPath,
- params: queryParameters,
- headers: headerParams
- };
-
- if (extraHttpRequestParams) {
- httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
- }
-
- return this.$http(httpRequestParams);
- }
- /**
- * Returns pet inventories by status
- * Returns a map of status codes to quantities
- */
- public getInventory (extraHttpRequestParams?: any ) : ng.IHttpPromise<{ [key: string]: number; }> {
- const localVarPath = this.basePath + '/store/inventory';
-
- let queryParameters: any = {};
- let headerParams: any = (Object).assign({}, this.defaultHeaders);
- let httpRequestParams: ng.IRequestConfig = {
- method: 'GET',
- url: localVarPath,
- params: queryParameters,
- headers: headerParams
- };
-
- if (extraHttpRequestParams) {
- httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
- }
-
- return this.$http(httpRequestParams);
- }
- /**
- * Find purchase order by ID
- * 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 ) : ng.IHttpPromise {
- const localVarPath = this.basePath + '/store/order/{orderId}'
- .replace('{' + 'orderId' + '}', String(orderId));
-
- let queryParameters: any = {};
- let headerParams: any = (Object).assign({}, this.defaultHeaders);
- // verify required parameter 'orderId' is not null or undefined
- if (orderId === null || orderId === undefined) {
- throw new Error('Required parameter orderId was null or undefined when calling getOrderById.');
- }
- let httpRequestParams: ng.IRequestConfig = {
- method: 'GET',
- url: localVarPath,
- params: queryParameters,
- headers: headerParams
- };
-
- if (extraHttpRequestParams) {
- httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
- }
-
- return this.$http(httpRequestParams);
- }
- /**
- * Place an order for a pet
- *
- * @param body order placed for purchasing the pet
- */
- public placeOrder (body?: Order, extraHttpRequestParams?: any ) : ng.IHttpPromise {
- const localVarPath = this.basePath + '/store/order';
-
- let queryParameters: any = {};
- let headerParams: any = (Object).assign({}, this.defaultHeaders);
- let httpRequestParams: ng.IRequestConfig = {
- method: 'POST',
- url: localVarPath,
- data: body,
- params: queryParameters,
- headers: headerParams
- };
-
- if (extraHttpRequestParams) {
- httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
- }
-
- return this.$http(httpRequestParams);
- }
- }
-}
diff --git a/samples/client/petstore/typescript-angular/API/Client/UserApi.ts b/samples/client/petstore/typescript-angular/API/Client/UserApi.ts
deleted file mode 100644
index 083bb57f4a8..00000000000
--- a/samples/client/petstore/typescript-angular/API/Client/UserApi.ts
+++ /dev/null
@@ -1,245 +0,0 @@
-/**
- * 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
- *
- * OpenAPI spec version: 1.0.0
- * Contact: apiteam@wordnik.com
- *
- * 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.
- */
-
-///
-
-/* tslint:disable:no-unused-variable member-ordering */
-
-namespace API.Client {
- 'use strict';
-
- export class UserApi {
- protected basePath = 'http://petstore.swagger.io/v2';
- public defaultHeaders : any = {};
-
- static $inject: string[] = ['$http', '$httpParamSerializer', 'basePath'];
-
- constructor(protected $http: ng.IHttpService, protected $httpParamSerializer?: (d: any) => any, basePath?: string) {
- if (basePath !== undefined) {
- this.basePath = basePath;
- }
- }
-
- /**
- * Create user
- * This can only be done by the logged in user.
- * @param body Created user object
- */
- public createUser (body?: User, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
- const localVarPath = this.basePath + '/user';
-
- let queryParameters: any = {};
- let headerParams: any = (Object).assign({}, this.defaultHeaders);
- let httpRequestParams: ng.IRequestConfig = {
- method: 'POST',
- url: localVarPath,
- data: body,
- params: queryParameters,
- headers: headerParams
- };
-
- if (extraHttpRequestParams) {
- httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
- }
-
- return this.$http(httpRequestParams);
- }
- /**
- * Creates list of users with given input array
- *
- * @param body List of user object
- */
- public createUsersWithArrayInput (body?: Array, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
- const localVarPath = this.basePath + '/user/createWithArray';
-
- let queryParameters: any = {};
- let headerParams: any = (Object).assign({}, this.defaultHeaders);
- let httpRequestParams: ng.IRequestConfig = {
- method: 'POST',
- url: localVarPath,
- data: body,
- params: queryParameters,
- headers: headerParams
- };
-
- if (extraHttpRequestParams) {
- httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
- }
-
- return this.$http(httpRequestParams);
- }
- /**
- * Creates list of users with given input array
- *
- * @param body List of user object
- */
- public createUsersWithListInput (body?: Array, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
- const localVarPath = this.basePath + '/user/createWithList';
-
- let queryParameters: any = {};
- let headerParams: any = (Object).assign({}, this.defaultHeaders);
- let httpRequestParams: ng.IRequestConfig = {
- method: 'POST',
- url: localVarPath,
- data: body,
- params: queryParameters,
- headers: headerParams
- };
-
- if (extraHttpRequestParams) {
- httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
- }
-
- return this.$http(httpRequestParams);
- }
- /**
- * Delete user
- * This can only be done by the logged in user.
- * @param username The name that needs to be deleted
- */
- public deleteUser (username: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
- const localVarPath = this.basePath + '/user/{username}'
- .replace('{' + 'username' + '}', String(username));
-
- let queryParameters: any = {};
- let headerParams: any = (Object).assign({}, this.defaultHeaders);
- // 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 deleteUser.');
- }
- let httpRequestParams: ng.IRequestConfig = {
- method: 'DELETE',
- url: localVarPath,
- params: queryParameters,
- headers: headerParams
- };
-
- if (extraHttpRequestParams) {
- httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
- }
-
- return this.$http(httpRequestParams);
- }
- /**
- * Get user by user name
- *
- * @param username The name that needs to be fetched. Use user1 for testing.
- */
- public getUserByName (username: string, extraHttpRequestParams?: any ) : ng.IHttpPromise {
- const localVarPath = this.basePath + '/user/{username}'
- .replace('{' + 'username' + '}', String(username));
-
- let queryParameters: any = {};
- let headerParams: any = (Object).assign({}, this.defaultHeaders);
- // 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 getUserByName.');
- }
- let httpRequestParams: ng.IRequestConfig = {
- method: 'GET',
- url: localVarPath,
- params: queryParameters,
- headers: headerParams
- };
-
- if (extraHttpRequestParams) {
- httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
- }
-
- return this.$http(httpRequestParams);
- }
- /**
- * Logs user into the system
- *
- * @param username The user name for login
- * @param password The password for login in clear text
- */
- public loginUser (username?: string, password?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise {
- const localVarPath = this.basePath + '/user/login';
-
- let queryParameters: any = {};
- let headerParams: any = (Object).assign({}, this.defaultHeaders);
- if (username !== undefined) {
- queryParameters['username'] = username;
- }
-
- if (password !== undefined) {
- queryParameters['password'] = password;
- }
-
- let httpRequestParams: ng.IRequestConfig = {
- method: 'GET',
- url: localVarPath,
- params: queryParameters,
- headers: headerParams
- };
-
- if (extraHttpRequestParams) {
- httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
- }
-
- return this.$http(httpRequestParams);
- }
- /**
- * Logs out current logged in user session
- *
- */
- public logoutUser (extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
- const localVarPath = this.basePath + '/user/logout';
-
- let queryParameters: any = {};
- let headerParams: any = (Object).assign({}, this.defaultHeaders);
- let httpRequestParams: ng.IRequestConfig = {
- method: 'GET',
- url: localVarPath,
- params: queryParameters,
- headers: headerParams
- };
-
- if (extraHttpRequestParams) {
- httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
- }
-
- return this.$http(httpRequestParams);
- }
- /**
- * Updated user
- * This can only be done by the logged in user.
- * @param username name that need to be deleted
- * @param body Updated user object
- */
- public updateUser (username: string, body?: User, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
- const localVarPath = this.basePath + '/user/{username}'
- .replace('{' + 'username' + '}', String(username));
-
- let queryParameters: any = {};
- let headerParams: any = (Object).assign({}, this.defaultHeaders);
- // 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 updateUser.');
- }
- let httpRequestParams: ng.IRequestConfig = {
- method: 'PUT',
- url: localVarPath,
- data: body,
- params: queryParameters,
- headers: headerParams
- };
-
- if (extraHttpRequestParams) {
- httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
- }
-
- return this.$http(httpRequestParams);
- }
- }
-}
diff --git a/samples/client/petstore/typescript-angular/API/Client/api.d.ts b/samples/client/petstore/typescript-angular/API/Client/api.d.ts
deleted file mode 100644
index f2a86d96e96..00000000000
--- a/samples/client/petstore/typescript-angular/API/Client/api.d.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-///
-///
-///
-///
-///
-
-///
-///
-///
diff --git a/samples/client/petstore/typescript-angular/api.module.ts b/samples/client/petstore/typescript-angular/api.module.ts
new file mode 100644
index 00000000000..825758a0792
--- /dev/null
+++ b/samples/client/petstore/typescript-angular/api.module.ts
@@ -0,0 +1,9 @@
+import * as api from './api/api';
+import * as angular from 'angular';
+
+const apiModule = angular.module('api', [])
+.service('PetApi', api.PetApi)
+.service('StoreApi', api.StoreApi)
+.service('UserApi', api.UserApi)
+
+export default apiModule;
diff --git a/samples/client/petstore/typescript-angular/api/PetApi.ts b/samples/client/petstore/typescript-angular/api/PetApi.ts
new file mode 100644
index 00000000000..887f87a1be9
--- /dev/null
+++ b/samples/client/petstore/typescript-angular/api/PetApi.ts
@@ -0,0 +1,268 @@
+/**
+ * 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
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@wordnik.com
+ *
+ * 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 '../model/models';
+
+/* tslint:disable:no-unused-variable member-ordering */
+
+export class PetApi {
+ protected basePath = 'http://petstore.swagger.io/v2';
+ public defaultHeaders : any = {};
+
+ static $inject: string[] = ['$http', '$httpParamSerializer', 'basePath'];
+
+ constructor(protected $http: ng.IHttpService, protected $httpParamSerializer?: (d: any) => any, basePath?: string) {
+ if (basePath !== undefined) {
+ this.basePath = basePath;
+ }
+ }
+
+ /**
+ * Add a new pet to the store
+ *
+ * @param body Pet object that needs to be added to the store
+ */
+ public addPet (body?: models.Pet, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
+ const localVarPath = this.basePath + '/pet';
+
+ let queryParameters: any = {};
+ let headerParams: any = (Object).assign({}, this.defaultHeaders);
+ let httpRequestParams: ng.IRequestConfig = {
+ method: 'POST',
+ url: localVarPath,
+ data: body,
+ params: queryParameters,
+ headers: headerParams
+ };
+
+ if (extraHttpRequestParams) {
+ httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
+ }
+
+ return this.$http(httpRequestParams);
+ }
+ /**
+ * Deletes a pet
+ *
+ * @param petId Pet id to delete
+ * @param apiKey
+ */
+ public deletePet (petId: number, apiKey?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
+ const localVarPath = this.basePath + '/pet/{petId}'
+ .replace('{' + 'petId' + '}', String(petId));
+
+ let queryParameters: any = {};
+ let headerParams: any = (Object).assign({}, this.defaultHeaders);
+ // verify required parameter 'petId' is not null or undefined
+ if (petId === null || petId === undefined) {
+ throw new Error('Required parameter petId was null or undefined when calling deletePet.');
+ }
+ headerParams['api_key'] = apiKey;
+
+ let httpRequestParams: ng.IRequestConfig = {
+ method: 'DELETE',
+ url: localVarPath,
+ params: queryParameters,
+ headers: headerParams
+ };
+
+ if (extraHttpRequestParams) {
+ httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
+ }
+
+ return this.$http(httpRequestParams);
+ }
+ /**
+ * Finds Pets by status
+ * 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 ) : ng.IHttpPromise> {
+ const localVarPath = this.basePath + '/pet/findByStatus';
+
+ let queryParameters: any = {};
+ let headerParams: any = (Object).assign({}, this.defaultHeaders);
+ if (status !== undefined) {
+ queryParameters['status'] = status;
+ }
+
+ let httpRequestParams: ng.IRequestConfig = {
+ method: 'GET',
+ url: localVarPath,
+ params: queryParameters,
+ headers: headerParams
+ };
+
+ if (extraHttpRequestParams) {
+ httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
+ }
+
+ return this.$http(httpRequestParams);
+ }
+ /**
+ * 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
+ */
+ public findPetsByTags (tags?: Array, extraHttpRequestParams?: any ) : ng.IHttpPromise> {
+ const localVarPath = this.basePath + '/pet/findByTags';
+
+ let queryParameters: any = {};
+ let headerParams: any = (Object).assign({}, this.defaultHeaders);
+ if (tags !== undefined) {
+ queryParameters['tags'] = tags;
+ }
+
+ let httpRequestParams: ng.IRequestConfig = {
+ method: 'GET',
+ url: localVarPath,
+ params: queryParameters,
+ headers: headerParams
+ };
+
+ if (extraHttpRequestParams) {
+ httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
+ }
+
+ return this.$http(httpRequestParams);
+ }
+ /**
+ * 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
+ */
+ public getPetById (petId: number, extraHttpRequestParams?: any ) : ng.IHttpPromise {
+ const localVarPath = this.basePath + '/pet/{petId}'
+ .replace('{' + 'petId' + '}', String(petId));
+
+ let queryParameters: any = {};
+ let headerParams: any = (Object).assign({}, this.defaultHeaders);
+ // verify required parameter 'petId' is not null or undefined
+ if (petId === null || petId === undefined) {
+ throw new Error('Required parameter petId was null or undefined when calling getPetById.');
+ }
+ let httpRequestParams: ng.IRequestConfig = {
+ method: 'GET',
+ url: localVarPath,
+ params: queryParameters,
+ headers: headerParams
+ };
+
+ if (extraHttpRequestParams) {
+ httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
+ }
+
+ return this.$http(httpRequestParams);
+ }
+ /**
+ * Update an existing pet
+ *
+ * @param body Pet object that needs to be added to the store
+ */
+ public updatePet (body?: models.Pet, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
+ const localVarPath = this.basePath + '/pet';
+
+ let queryParameters: any = {};
+ let headerParams: any = (Object).assign({}, this.defaultHeaders);
+ let httpRequestParams: ng.IRequestConfig = {
+ method: 'PUT',
+ url: localVarPath,
+ data: body,
+ params: queryParameters,
+ headers: headerParams
+ };
+
+ if (extraHttpRequestParams) {
+ httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
+ }
+
+ return this.$http(httpRequestParams);
+ }
+ /**
+ * Updates a pet in the store with form data
+ *
+ * @param petId ID of pet that needs to be updated
+ * @param name Updated name of the pet
+ * @param status Updated status of the pet
+ */
+ public updatePetWithForm (petId: string, name?: string, status?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
+ const localVarPath = this.basePath + '/pet/{petId}'
+ .replace('{' + 'petId' + '}', String(petId));
+
+ let queryParameters: any = {};
+ let headerParams: any = (Object).assign({}, this.defaultHeaders);
+ let formParams: any = {};
+
+ // verify required parameter 'petId' is not null or undefined
+ if (petId === null || petId === undefined) {
+ throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.');
+ }
+ headerParams['Content-Type'] = 'application/x-www-form-urlencoded';
+
+ formParams['name'] = name;
+
+ formParams['status'] = status;
+
+ let httpRequestParams: ng.IRequestConfig = {
+ method: 'POST',
+ url: localVarPath,
+ data: this.$httpParamSerializer(formParams),
+ params: queryParameters,
+ headers: headerParams
+ };
+
+ if (extraHttpRequestParams) {
+ httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
+ }
+
+ return this.$http(httpRequestParams);
+ }
+ /**
+ * uploads an image
+ *
+ * @param petId ID of pet to update
+ * @param additionalMetadata Additional data to pass to server
+ * @param file file to upload
+ */
+ public uploadFile (petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
+ const localVarPath = this.basePath + '/pet/{petId}/uploadImage'
+ .replace('{' + 'petId' + '}', String(petId));
+
+ let queryParameters: any = {};
+ let headerParams: any = (Object).assign({}, this.defaultHeaders);
+ let formParams: any = {};
+
+ // verify required parameter 'petId' is not null or undefined
+ if (petId === null || petId === undefined) {
+ throw new Error('Required parameter petId was null or undefined when calling uploadFile.');
+ }
+ headerParams['Content-Type'] = 'application/x-www-form-urlencoded';
+
+ formParams['additionalMetadata'] = additionalMetadata;
+
+ formParams['file'] = file;
+
+ let httpRequestParams: ng.IRequestConfig = {
+ method: 'POST',
+ url: localVarPath,
+ data: this.$httpParamSerializer(formParams),
+ params: queryParameters,
+ headers: headerParams
+ };
+
+ if (extraHttpRequestParams) {
+ httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
+ }
+
+ return this.$http(httpRequestParams);
+ }
+}
diff --git a/samples/client/petstore/typescript-angular/api/StoreApi.ts b/samples/client/petstore/typescript-angular/api/StoreApi.ts
new file mode 100644
index 00000000000..efb81af53df
--- /dev/null
+++ b/samples/client/petstore/typescript-angular/api/StoreApi.ts
@@ -0,0 +1,131 @@
+/**
+ * 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
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@wordnik.com
+ *
+ * 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 '../model/models';
+
+/* tslint:disable:no-unused-variable member-ordering */
+
+export class StoreApi {
+ protected basePath = 'http://petstore.swagger.io/v2';
+ public defaultHeaders : any = {};
+
+ static $inject: string[] = ['$http', '$httpParamSerializer', 'basePath'];
+
+ constructor(protected $http: ng.IHttpService, protected $httpParamSerializer?: (d: any) => any, basePath?: string) {
+ if (basePath !== undefined) {
+ this.basePath = basePath;
+ }
+ }
+
+ /**
+ * Delete purchase order by ID
+ * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
+ * @param orderId ID of the order that needs to be deleted
+ */
+ public deleteOrder (orderId: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
+ const localVarPath = this.basePath + '/store/order/{orderId}'
+ .replace('{' + 'orderId' + '}', String(orderId));
+
+ let queryParameters: any = {};
+ let headerParams: any = (Object).assign({}, this.defaultHeaders);
+ // verify required parameter 'orderId' is not null or undefined
+ if (orderId === null || orderId === undefined) {
+ throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.');
+ }
+ let httpRequestParams: ng.IRequestConfig = {
+ method: 'DELETE',
+ url: localVarPath,
+ params: queryParameters,
+ headers: headerParams
+ };
+
+ if (extraHttpRequestParams) {
+ httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
+ }
+
+ return this.$http(httpRequestParams);
+ }
+ /**
+ * Returns pet inventories by status
+ * Returns a map of status codes to quantities
+ */
+ public getInventory (extraHttpRequestParams?: any ) : ng.IHttpPromise<{ [key: string]: number; }> {
+ const localVarPath = this.basePath + '/store/inventory';
+
+ let queryParameters: any = {};
+ let headerParams: any = (Object).assign({}, this.defaultHeaders);
+ let httpRequestParams: ng.IRequestConfig = {
+ method: 'GET',
+ url: localVarPath,
+ params: queryParameters,
+ headers: headerParams
+ };
+
+ if (extraHttpRequestParams) {
+ httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
+ }
+
+ return this.$http(httpRequestParams);
+ }
+ /**
+ * Find purchase order by ID
+ * 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 ) : ng.IHttpPromise {
+ const localVarPath = this.basePath + '/store/order/{orderId}'
+ .replace('{' + 'orderId' + '}', String(orderId));
+
+ let queryParameters: any = {};
+ let headerParams: any = (Object).assign({}, this.defaultHeaders);
+ // verify required parameter 'orderId' is not null or undefined
+ if (orderId === null || orderId === undefined) {
+ throw new Error('Required parameter orderId was null or undefined when calling getOrderById.');
+ }
+ let httpRequestParams: ng.IRequestConfig = {
+ method: 'GET',
+ url: localVarPath,
+ params: queryParameters,
+ headers: headerParams
+ };
+
+ if (extraHttpRequestParams) {
+ httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
+ }
+
+ return this.$http(httpRequestParams);
+ }
+ /**
+ * Place an order for a pet
+ *
+ * @param body order placed for purchasing the pet
+ */
+ public placeOrder (body?: models.Order, extraHttpRequestParams?: any ) : ng.IHttpPromise {
+ const localVarPath = this.basePath + '/store/order';
+
+ let queryParameters: any = {};
+ let headerParams: any = (Object).assign({}, this.defaultHeaders);
+ let httpRequestParams: ng.IRequestConfig = {
+ method: 'POST',
+ url: localVarPath,
+ data: body,
+ params: queryParameters,
+ headers: headerParams
+ };
+
+ if (extraHttpRequestParams) {
+ httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
+ }
+
+ return this.$http(httpRequestParams);
+ }
+}
diff --git a/samples/client/petstore/typescript-angular/api/UserApi.ts b/samples/client/petstore/typescript-angular/api/UserApi.ts
new file mode 100644
index 00000000000..15689b0c82d
--- /dev/null
+++ b/samples/client/petstore/typescript-angular/api/UserApi.ts
@@ -0,0 +1,241 @@
+/**
+ * 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
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@wordnik.com
+ *
+ * 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 '../model/models';
+
+/* tslint:disable:no-unused-variable member-ordering */
+
+export class UserApi {
+ protected basePath = 'http://petstore.swagger.io/v2';
+ public defaultHeaders : any = {};
+
+ static $inject: string[] = ['$http', '$httpParamSerializer', 'basePath'];
+
+ constructor(protected $http: ng.IHttpService, protected $httpParamSerializer?: (d: any) => any, basePath?: string) {
+ if (basePath !== undefined) {
+ this.basePath = basePath;
+ }
+ }
+
+ /**
+ * Create user
+ * This can only be done by the logged in user.
+ * @param body Created user object
+ */
+ public createUser (body?: models.User, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
+ const localVarPath = this.basePath + '/user';
+
+ let queryParameters: any = {};
+ let headerParams: any = (Object).assign({}, this.defaultHeaders);
+ let httpRequestParams: ng.IRequestConfig = {
+ method: 'POST',
+ url: localVarPath,
+ data: body,
+ params: queryParameters,
+ headers: headerParams
+ };
+
+ if (extraHttpRequestParams) {
+ httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
+ }
+
+ return this.$http(httpRequestParams);
+ }
+ /**
+ * Creates list of users with given input array
+ *
+ * @param body List of user object
+ */
+ public createUsersWithArrayInput (body?: Array, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
+ const localVarPath = this.basePath + '/user/createWithArray';
+
+ let queryParameters: any = {};
+ let headerParams: any = (Object).assign({}, this.defaultHeaders);
+ let httpRequestParams: ng.IRequestConfig = {
+ method: 'POST',
+ url: localVarPath,
+ data: body,
+ params: queryParameters,
+ headers: headerParams
+ };
+
+ if (extraHttpRequestParams) {
+ httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
+ }
+
+ return this.$http(httpRequestParams);
+ }
+ /**
+ * Creates list of users with given input array
+ *
+ * @param body List of user object
+ */
+ public createUsersWithListInput (body?: Array, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
+ const localVarPath = this.basePath + '/user/createWithList';
+
+ let queryParameters: any = {};
+ let headerParams: any = (Object).assign({}, this.defaultHeaders);
+ let httpRequestParams: ng.IRequestConfig = {
+ method: 'POST',
+ url: localVarPath,
+ data: body,
+ params: queryParameters,
+ headers: headerParams
+ };
+
+ if (extraHttpRequestParams) {
+ httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
+ }
+
+ return this.$http(httpRequestParams);
+ }
+ /**
+ * Delete user
+ * This can only be done by the logged in user.
+ * @param username The name that needs to be deleted
+ */
+ public deleteUser (username: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
+ const localVarPath = this.basePath + '/user/{username}'
+ .replace('{' + 'username' + '}', String(username));
+
+ let queryParameters: any = {};
+ let headerParams: any = (Object).assign({}, this.defaultHeaders);
+ // 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 deleteUser.');
+ }
+ let httpRequestParams: ng.IRequestConfig = {
+ method: 'DELETE',
+ url: localVarPath,
+ params: queryParameters,
+ headers: headerParams
+ };
+
+ if (extraHttpRequestParams) {
+ httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
+ }
+
+ return this.$http(httpRequestParams);
+ }
+ /**
+ * Get user by user name
+ *
+ * @param username The name that needs to be fetched. Use user1 for testing.
+ */
+ public getUserByName (username: string, extraHttpRequestParams?: any ) : ng.IHttpPromise {
+ const localVarPath = this.basePath + '/user/{username}'
+ .replace('{' + 'username' + '}', String(username));
+
+ let queryParameters: any = {};
+ let headerParams: any = (Object).assign({}, this.defaultHeaders);
+ // 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 getUserByName.');
+ }
+ let httpRequestParams: ng.IRequestConfig = {
+ method: 'GET',
+ url: localVarPath,
+ params: queryParameters,
+ headers: headerParams
+ };
+
+ if (extraHttpRequestParams) {
+ httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
+ }
+
+ return this.$http(httpRequestParams);
+ }
+ /**
+ * Logs user into the system
+ *
+ * @param username The user name for login
+ * @param password The password for login in clear text
+ */
+ public loginUser (username?: string, password?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise {
+ const localVarPath = this.basePath + '/user/login';
+
+ let queryParameters: any = {};
+ let headerParams: any = (Object).assign({}, this.defaultHeaders);
+ if (username !== undefined) {
+ queryParameters['username'] = username;
+ }
+
+ if (password !== undefined) {
+ queryParameters['password'] = password;
+ }
+
+ let httpRequestParams: ng.IRequestConfig = {
+ method: 'GET',
+ url: localVarPath,
+ params: queryParameters,
+ headers: headerParams
+ };
+
+ if (extraHttpRequestParams) {
+ httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
+ }
+
+ return this.$http(httpRequestParams);
+ }
+ /**
+ * Logs out current logged in user session
+ *
+ */
+ public logoutUser (extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
+ const localVarPath = this.basePath + '/user/logout';
+
+ let queryParameters: any = {};
+ let headerParams: any = (Object).assign({}, this.defaultHeaders);
+ let httpRequestParams: ng.IRequestConfig = {
+ method: 'GET',
+ url: localVarPath,
+ params: queryParameters,
+ headers: headerParams
+ };
+
+ if (extraHttpRequestParams) {
+ httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
+ }
+
+ return this.$http(httpRequestParams);
+ }
+ /**
+ * Updated user
+ * This can only be done by the logged in user.
+ * @param username name that need to be deleted
+ * @param body Updated user object
+ */
+ public updateUser (username: string, body?: models.User, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
+ const localVarPath = this.basePath + '/user/{username}'
+ .replace('{' + 'username' + '}', String(username));
+
+ let queryParameters: any = {};
+ let headerParams: any = (Object).assign({}, this.defaultHeaders);
+ // 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 updateUser.');
+ }
+ let httpRequestParams: ng.IRequestConfig = {
+ method: 'PUT',
+ url: localVarPath,
+ data: body,
+ params: queryParameters,
+ headers: headerParams
+ };
+
+ if (extraHttpRequestParams) {
+ httpRequestParams = (Object).assign(httpRequestParams, extraHttpRequestParams);
+ }
+
+ return this.$http(httpRequestParams);
+ }
+}
diff --git a/samples/client/petstore/typescript-angular/api/api.ts b/samples/client/petstore/typescript-angular/api/api.ts
new file mode 100644
index 00000000000..0d1e9f047fd
--- /dev/null
+++ b/samples/client/petstore/typescript-angular/api/api.ts
@@ -0,0 +1,7 @@
+export * from './PetApi';
+import { PetApi } from './PetApi';
+export * from './StoreApi';
+import { StoreApi } from './StoreApi';
+export * from './UserApi';
+import { UserApi } from './UserApi';
+export const APIS = [ PetApi, StoreApi, UserApi, ];
diff --git a/samples/client/petstore/typescript-angular/index.ts b/samples/client/petstore/typescript-angular/index.ts
new file mode 100644
index 00000000000..557365516ad
--- /dev/null
+++ b/samples/client/petstore/typescript-angular/index.ts
@@ -0,0 +1,2 @@
+export * from './api/api';
+export * from './model/models';
\ No newline at end of file
diff --git a/samples/client/petstore/typescript-angular/API/Client/Category.ts b/samples/client/petstore/typescript-angular/model/Category.ts
similarity index 76%
rename from samples/client/petstore/typescript-angular/API/Client/Category.ts
rename to samples/client/petstore/typescript-angular/model/Category.ts
index 072eecdd58b..57ac55012d1 100644
--- a/samples/client/petstore/typescript-angular/API/Client/Category.ts
+++ b/samples/client/petstore/typescript-angular/model/Category.ts
@@ -10,16 +10,10 @@
* Do not edit the class manually.
*/
-///
-
-namespace API.Client {
- 'use strict';
-
- export interface Category {
- "id"?: number;
-
- "name"?: string;
-
- }
+import * as models from './models';
+export interface Category {
+ "id"?: number;
+ "name"?: string;
}
+
diff --git a/samples/client/petstore/typescript-angular/API/Client/Order.ts b/samples/client/petstore/typescript-angular/model/Order.ts
similarity index 50%
rename from samples/client/petstore/typescript-angular/API/Client/Order.ts
rename to samples/client/petstore/typescript-angular/model/Order.ts
index cff3486ef6c..d559f06efe6 100644
--- a/samples/client/petstore/typescript-angular/API/Client/Order.ts
+++ b/samples/client/petstore/typescript-angular/model/Order.ts
@@ -10,34 +10,24 @@
* Do not edit the class manually.
*/
-///
-
-namespace API.Client {
- 'use strict';
-
- export interface Order {
- "id"?: number;
-
- "petId"?: number;
-
- "quantity"?: number;
-
- "shipDate"?: Date;
-
- /**
- * Order Status
- */
- "status"?: Order.StatusEnum;
-
- "complete"?: boolean;
-
- }
+import * as models from './models';
+
+export interface Order {
+ "id"?: number;
+ "petId"?: number;
+ "quantity"?: number;
+ "shipDate"?: Date;
+ /**
+ * Order Status
+ */
+ "status"?: Order.StatusEnum;
+ "complete"?: boolean;
+}
- export namespace Order {
- export enum StatusEnum {
- Placed = 'placed',
- Approved = 'approved',
- Delivered = 'delivered'
- }
+export namespace Order {
+ export enum StatusEnum {
+ Placed = 'placed',
+ Approved = 'approved',
+ Delivered = 'delivered'
}
}
diff --git a/samples/client/petstore/typescript-angular/API/Client/Pet.ts b/samples/client/petstore/typescript-angular/model/Pet.ts
similarity index 50%
rename from samples/client/petstore/typescript-angular/API/Client/Pet.ts
rename to samples/client/petstore/typescript-angular/model/Pet.ts
index 587ac1eb9f0..ebf8cb345ab 100644
--- a/samples/client/petstore/typescript-angular/API/Client/Pet.ts
+++ b/samples/client/petstore/typescript-angular/model/Pet.ts
@@ -10,34 +10,24 @@
* Do not edit the class manually.
*/
-///
-
-namespace API.Client {
- 'use strict';
-
- export interface Pet {
- "id"?: number;
-
- "category"?: Category;
-
- "name": string;
-
- "photoUrls": Array;
-
- "tags"?: Array;
-
- /**
- * pet status in the store
- */
- "status"?: Pet.StatusEnum;
-
- }
+import * as models from './models';
+
+export interface Pet {
+ "id"?: number;
+ "category"?: models.Category;
+ "name": string;
+ "photoUrls": Array;
+ "tags"?: Array;
+ /**
+ * pet status in the store
+ */
+ "status"?: Pet.StatusEnum;
+}
- export namespace Pet {
- export enum StatusEnum {
- Available = 'available',
- Pending = 'pending',
- Sold = 'sold'
- }
+export namespace Pet {
+ export enum StatusEnum {
+ Available = 'available',
+ Pending = 'pending',
+ Sold = 'sold'
}
}
diff --git a/samples/client/petstore/typescript-angular/API/Client/Tag.ts b/samples/client/petstore/typescript-angular/model/Tag.ts
similarity index 76%
rename from samples/client/petstore/typescript-angular/API/Client/Tag.ts
rename to samples/client/petstore/typescript-angular/model/Tag.ts
index db86127ca7c..3c6c7e14f8f 100644
--- a/samples/client/petstore/typescript-angular/API/Client/Tag.ts
+++ b/samples/client/petstore/typescript-angular/model/Tag.ts
@@ -10,16 +10,10 @@
* Do not edit the class manually.
*/
-///
-
-namespace API.Client {
- 'use strict';
-
- export interface Tag {
- "id"?: number;
-
- "name"?: string;
-
- }
+import * as models from './models';
+export interface Tag {
+ "id"?: number;
+ "name"?: string;
}
+
diff --git a/samples/client/petstore/typescript-angular/API/Client/User.ts b/samples/client/petstore/typescript-angular/model/User.ts
similarity index 57%
rename from samples/client/petstore/typescript-angular/API/Client/User.ts
rename to samples/client/petstore/typescript-angular/model/User.ts
index 71caf720c5a..b4671197abf 100644
--- a/samples/client/petstore/typescript-angular/API/Client/User.ts
+++ b/samples/client/petstore/typescript-angular/model/User.ts
@@ -10,31 +10,19 @@
* Do not edit the class manually.
*/
-///
-
-namespace API.Client {
- 'use strict';
-
- export interface User {
- "id"?: number;
-
- "username"?: string;
-
- "firstName"?: string;
-
- "lastName"?: string;
-
- "email"?: string;
-
- "password"?: string;
-
- "phone"?: string;
-
- /**
- * User Status
- */
- "userStatus"?: number;
-
- }
-
+import * as models from './models';
+
+export interface User {
+ "id"?: number;
+ "username"?: string;
+ "firstName"?: string;
+ "lastName"?: string;
+ "email"?: string;
+ "password"?: string;
+ "phone"?: string;
+ /**
+ * User Status
+ */
+ "userStatus"?: number;
}
+
diff --git a/samples/client/petstore/typescript-angular/model/models.ts b/samples/client/petstore/typescript-angular/model/models.ts
new file mode 100644
index 00000000000..92dac02846c
--- /dev/null
+++ b/samples/client/petstore/typescript-angular/model/models.ts
@@ -0,0 +1,5 @@
+export * from './Category';
+export * from './Order';
+export * from './Pet';
+export * from './Tag';
+export * from './User';
diff --git a/samples/client/petstore/typescript-angular/tsconfig.json b/samples/client/petstore/typescript-angular/tsconfig.json
index 9bf11bd4cee..86be0964e31 100644
--- a/samples/client/petstore/typescript-angular/tsconfig.json
+++ b/samples/client/petstore/typescript-angular/tsconfig.json
@@ -5,15 +5,7 @@
"out": "client.js"
},
"files": [
- "API/Client/Category.ts",
- "API/Client/Pet.ts",
- "API/Client/StoreApi.ts",
- "API/Client/User.ts",
- "API/Client/api.d.ts",
- "API/Client/Order.ts",
- "API/Client/PetApi.ts",
- "API/Client/Tag.ts",
- "API/Client/UserApi.ts",
+ "./index.ts",
"typings/tsd.d.ts"
]
}