diff --git a/bin/typescript-jquery-all.sh b/bin/typescript-jquery-all.sh new file mode 100755 index 000000000000..7203fa099a55 --- /dev/null +++ b/bin/typescript-jquery-all.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +SCRIPT="$0" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=`dirname "$SCRIPT"`/.. + APP_DIR=`cd "${APP_DIR}"; pwd` +fi + +executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar" + +if [ ! -f "$executable" ] +then + mvn clean package +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" + +echo "Typescript jquery Petstore API client (default setting)" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l typescript-jquery -o samples/client/petstore/typescript-jquery/default" +java $JAVA_OPTS -jar $executable $ags + +echo "Typescript jquery Petstore API client with npm setting" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l typescript-jquery -c bin/typescript-petstore-npm.json -o samples/client/petstore/typescript-jquery/npm" +java $JAVA_OPTS -jar $executable $ags diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptJqueryClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptJqueryClientCodegen.java new file mode 100644 index 000000000000..eb3193447815 --- /dev/null +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptJqueryClientCodegen.java @@ -0,0 +1,110 @@ +package io.swagger.codegen.languages; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.text.SimpleDateFormat; +import java.util.Date; + +import io.swagger.codegen.CliOption; +import io.swagger.codegen.SupportingFile; +import io.swagger.models.properties.BooleanProperty; + +public class TypeScriptJqueryClientCodegen extends AbstractTypeScriptClientCodegen { + private static final Logger LOGGER = LoggerFactory.getLogger(TypeScriptNodeClientCodegen.class); + private static final SimpleDateFormat SNAPSHOT_SUFFIX_FORMAT = new SimpleDateFormat("yyyyMMddHHmm"); + + public static final String NPM_NAME = "npmName"; + public static final String NPM_VERSION = "npmVersion"; + public static final String NPM_REPOSITORY = "npmRepository"; + public static final String SNAPSHOT = "snapshot"; + + protected String npmName = null; + protected String npmVersion = "1.0.0"; + protected String npmRepository = null; + + public TypeScriptJqueryClientCodegen() { + super(); + outputFolder = "generated-code/typescript-jquery"; + embeddedTemplateDir = templateDir = "typescript-jquery"; + + this.cliOptions.add(new CliOption(NPM_NAME, "The name under which you want to publish generated npm package")); + this.cliOptions.add(new CliOption(NPM_VERSION, "The version of your npm package")); + this.cliOptions.add(new CliOption(NPM_REPOSITORY, "Use this property to set an url your private npmRepo in the package.json")); + this.cliOptions.add(new CliOption(SNAPSHOT, "When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm", BooleanProperty.TYPE).defaultValue(Boolean.FALSE.toString())); + } + + + @Override + public void processOpts() { + super.processOpts(); + supportingFiles.add(new SupportingFile("api.mustache", null, "api.ts")); + supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); + + LOGGER.warn("check additionals: " + additionalProperties.get(NPM_NAME)); + if(additionalProperties.containsKey(NPM_NAME)) { + addNpmPackageGeneration(); + } + } + + private void addNpmPackageGeneration() { + if(additionalProperties.containsKey(NPM_NAME)) { + this.setNpmName(additionalProperties.get(NPM_NAME).toString()); + } + + if (additionalProperties.containsKey(NPM_VERSION)) { + this.setNpmVersion(additionalProperties.get(NPM_VERSION).toString()); + } + + if (additionalProperties.containsKey(SNAPSHOT) && Boolean.valueOf(additionalProperties.get(SNAPSHOT).toString())) { + this.setNpmVersion(npmVersion + "-SNAPSHOT." + SNAPSHOT_SUFFIX_FORMAT.format(new Date())); + } + additionalProperties.put(NPM_VERSION, npmVersion); + + if (additionalProperties.containsKey(NPM_REPOSITORY)) { + this.setNpmRepository(additionalProperties.get(NPM_REPOSITORY).toString()); + } + + //Files for building our lib + supportingFiles.add(new SupportingFile("package.mustache", getPackageRootDirectory(), "package.json")); + supportingFiles.add(new SupportingFile("typings.mustache", getPackageRootDirectory(), "typings.json")); + supportingFiles.add(new SupportingFile("tsconfig.mustache", getPackageRootDirectory(), "tsconfig.json")); + } + + private String getPackageRootDirectory() { + String indexPackage = modelPackage.substring(0, Math.max(0, modelPackage.lastIndexOf('.'))); + return indexPackage.replace('.', File.separatorChar); + } + + @Override + public String getName() { + return "typescript-jquery"; + } + + @Override + public String getHelp() { + return "Generates a TypeScript jquery client library."; + } + + + public void setNpmName(String npmName) { + this.npmName = npmName; + } + + public void setNpmVersion(String npmVersion) { + this.npmVersion = npmVersion; + } + + public String getNpmVersion() { + return npmVersion; + } + + public String getNpmRepository() { + return npmRepository; + } + + public void setNpmRepository(String npmRepository) { + this.npmRepository = npmRepository; + } +} diff --git a/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig b/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig index 91d363e09653..ed87bdf2998d 100644 --- a/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig +++ b/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig @@ -52,6 +52,7 @@ io.swagger.codegen.languages.Swift3Codegen io.swagger.codegen.languages.TizenClientCodegen io.swagger.codegen.languages.TypeScriptAngular2ClientCodegen io.swagger.codegen.languages.TypeScriptAngularClientCodegen +io.swagger.codegen.languages.TypeScriptJqueryClientCodegen io.swagger.codegen.languages.TypeScriptNodeClientCodegen io.swagger.codegen.languages.TypeScriptFetchClientCodegen io.swagger.codegen.languages.AkkaScalaClientCodegen diff --git a/modules/swagger-codegen/src/main/resources/typescript-jquery/api.mustache b/modules/swagger-codegen/src/main/resources/typescript-jquery/api.mustache new file mode 100644 index 000000000000..9649528630ba --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/typescript-jquery/api.mustache @@ -0,0 +1,269 @@ +import * as $ from 'jquery'; + +let defaultBasePath = '{{basePath}}'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +/* tslint:disable:no-unused-variable */ + +{{#models}} +{{#model}} +{{#description}} + /** + * {{{description}}} + */ +{{/description}} +export class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ +{{#vars}} + {{#description}} + /** + * {{{description}}} + */ + {{/description}} + '{{name}}': {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}}; +{{/vars}} +} + +{{#hasEnums}} +export namespace {{classname}} { +{{#vars}} +{{#isEnum}} + export enum {{enumName}} { + {{#allowableValues}} + {{#enumVars}} + {{name}} = {{{value}}}{{^-last}},{{/-last}} + {{/enumVars}} + {{/allowableValues}} + } +{{/isEnum}} +{{/vars}} +} +{{/hasEnums}} +{{/model}} +{{/models}} + +export interface Authentication { + /** + * Apply authentication settings to header and query params. + */ + applyToRequest(requestOptions: JQueryAjaxSettings): void; +} + +export class HttpBasicAuth implements Authentication { + public username: string; + public password: string; + applyToRequest(requestOptions: any): void { + requestOptions.username = this.username; + requestOptions.password = this.password; + } +} + +export class ApiKeyAuth implements Authentication { + public apiKey: string; + + constructor(private location: string, private paramName: string) { + } + + applyToRequest(requestOptions: JQueryAjaxSettings): void { + requestOptions.headers[this.paramName] = this.apiKey; + } +} + +export class OAuth implements Authentication { + public accessToken: string; + + applyToRequest(requestOptions: JQueryAjaxSettings): void { + requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; + } +} + +export class VoidAuth implements Authentication { + public username: string; + public password: string; + applyToRequest(requestOptions: JQueryAjaxSettings): void { + // Do nothing + } +} + +{{#apiInfo}} +{{#apis}} +{{#operations}} +{{#description}} +/** +* {{&description}} +*/ +{{/description}} +export enum {{classname}}ApiKeys { +{{#authMethods}} +{{#isApiKey}} + {{name}}, +{{/isApiKey}} +{{/authMethods}} +} + +export class {{classname}} { + protected basePath = defaultBasePath; + protected defaultHeaders : any = {}; + + protected authentications = { + 'default': new VoidAuth(), +{{#authMethods}} +{{#isBasic}} + '{{name}}': new HttpBasicAuth(), +{{/isBasic}} +{{#isApiKey}} + '{{name}}': new ApiKeyAuth({{#isKeyInHeader}}'header'{{/isKeyInHeader}}{{^isKeyInHeader}}'query'{{/isKeyInHeader}}, '{{keyParamName}}'), +{{/isApiKey}} +{{#isOAuth}} + '{{name}}': new OAuth(), +{{/isOAuth}} +{{/authMethods}} + } + + constructor(basePath?: string); +{{#authMethods}} +{{#isBasic}} + constructor(username: string, password: string, basePath?: string); +{{/isBasic}} +{{/authMethods}} + constructor(basePathOrUsername: string, password?: string, basePath?: string) { + if (password) { +{{#authMethods}} +{{#isBasic}} + this.username = basePathOrUsername; + this.password = password +{{/isBasic}} +{{/authMethods}} + if (basePath) { + this.basePath = basePath; + } + } else { + if (basePathOrUsername) { + this.basePath = basePathOrUsername + } + } + } + + public setApiKey(key: {{classname}}ApiKeys, value: string) { + this.authentications[{{classname}}ApiKeys[key]].apiKey = value; + } +{{#authMethods}} +{{#isBasic}} + + set username(username: string) { + this.authentications.{{name}}.username = username; + } + + set password(password: string) { + this.authentications.{{name}}.password = password; + } +{{/isBasic}} +{{#isOAuth}} + + set accessToken(token: string) { + this.authentications.{{name}}.accessToken = token; + } +{{/isOAuth}} +{{/authMethods}} + private extendObj(objA: T2, objB: T2): T1|T2 { + for(let key in objB){ + if(objB.hasOwnProperty(key)){ + objA[key] = objB[key]; + } + } + return objA; + } + +{{#operation}} + /** + * {{summary}} + * {{notes}} + {{#allParams}}* @param {{paramName}} {{description}} + {{/allParams}}*/ + public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) : JQueryPromise<{ response: JQueryXHR; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }> { + let localVarPath = this.basePath + '{{path}}'{{#pathParams}} + .replace('{' + '{{baseName}}' + '}', String({{paramName}})){{/pathParams}}; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + +{{#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}}.'); + } +{{/required}}{{/allParams}} +{{#queryParams}} + if ({{paramName}} !== undefined) { + queryParameters['{{baseName}}'] = {{paramName}}; + } + +{{/queryParams}} + + localVarPath = localVarPath + "?" + $.param(queryParameters); + +{{#headerParams}} + headerParams['{{baseName}}'] = {{paramName}}; + +{{/headerParams}} + +{{^bodyParam}} + let reqHasFile = false; + let reqDict = {}; + let reqFormData = new FormData(); +{{#formParams}} +{{#isFile}} + reqHasFile = true; +{{/isFile}} + if ({{paramName}} !== undefined) { + reqFormData.append('{{baseName}}', {{paramName}}); + reqDict['{{baseName}}'] = {{paramName}}; + } + +{{/formParams}} +{{/bodyParam}} +{{#bodyParam}} + let reqDict = {{paramName}}; + let reqFormData = new FormData(); + reqFormData.append('{{paramName}}', {{paramName}}); +{{#isFile}} + let reqHasFile = true; +{{/isFile}} +{{^isFile}} + let reqHasFile = false; +{{/isFile}} +{{/bodyParam}} + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: '{{httpMethod}}', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + +{{#authMethods}} + this.authentications.{{name}}.applyToRequest(requestOptions); + +{{/authMethods}} + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: {{{returnType}}}, textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } +{{/operation}} +} +{{/operations}} +{{/apis}} +{{/apiInfo}} diff --git a/modules/swagger-codegen/src/main/resources/typescript-jquery/git_push.sh.mustache b/modules/swagger-codegen/src/main/resources/typescript-jquery/git_push.sh.mustache new file mode 100755 index 000000000000..e153ce23ecf4 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/typescript-jquery/git_push.sh.mustache @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="{{{gitUserId}}}" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="{{{gitRepoId}}}" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="{{{releaseNote}}}" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/modules/swagger-codegen/src/main/resources/typescript-jquery/package.mustache b/modules/swagger-codegen/src/main/resources/typescript-jquery/package.mustache new file mode 100644 index 000000000000..732777196fc2 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/typescript-jquery/package.mustache @@ -0,0 +1,22 @@ +{ + "name": "{{npmName}}", + "version": "{{npmVersion}}", + "description": "JQuery client for {{npmName}}", + "main": "api.js", + "scripts": { + "build": "tsc" + }, + "author": "Swagger Codegen Contributors", + "license": "MIT", + "dependencies": { + "bluebird": "^3.3.5", + "request": "^2.72.0" + }, + "devDependencies": { + "typescript": "^1.8.10", + "typings": "^0.8.1" + }{{#npmRepository}}, + "publishConfig":{ + "registry":"{{npmRepository}}" + }{{/npmRepository}} +} diff --git a/modules/swagger-codegen/src/main/resources/typescript-jquery/tsconfig.mustache b/modules/swagger-codegen/src/main/resources/typescript-jquery/tsconfig.mustache new file mode 100644 index 000000000000..1a3bd00183a3 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/typescript-jquery/tsconfig.mustache @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "module": "commonjs", + "noImplicitAny": false, + "suppressImplicitAnyIndexErrors": true, + "target": "{{#supportsES6}}ES6{{/supportsES6}}{{^supportsES6}}ES5{{/supportsES6}}", + "moduleResolution": "node", + "removeComments": true, + "sourceMap": true, + "noLib": false, + "declaration": true + }, + "files": [ + "api.ts", + "typings/main.d.ts" + ] +} + diff --git a/modules/swagger-codegen/src/main/resources/typescript-jquery/typings.mustache b/modules/swagger-codegen/src/main/resources/typescript-jquery/typings.mustache new file mode 100644 index 000000000000..76c4cc8e6af3 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/typescript-jquery/typings.mustache @@ -0,0 +1,10 @@ +{ + "ambientDependencies": { + "bluebird": "registry:dt/bluebird#2.0.0+20160319051630", + "core-js": "registry:dt/core-js#0.0.0+20160317120654", + "node": "registry:dt/node#4.0.0+20160423143914" + }, + "dependencies": { + "request": "registry:npm/request#2.69.0+20160304121250" + } +} \ No newline at end of file diff --git a/samples/client/petstore/typescript-jquery/default/.swagger-codegen-ignore b/samples/client/petstore/typescript-jquery/default/.swagger-codegen-ignore new file mode 100644 index 000000000000..c5fa491b4c55 --- /dev/null +++ b/samples/client/petstore/typescript-jquery/default/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/typescript-jquery/default/api.ts b/samples/client/petstore/typescript-jquery/default/api.ts new file mode 100644 index 000000000000..9491259901e3 --- /dev/null +++ b/samples/client/petstore/typescript-jquery/default/api.ts @@ -0,0 +1,1213 @@ +import * as $ from 'jquery'; + +let defaultBasePath = 'http://petstore.swagger.io/v2'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +/* tslint:disable:no-unused-variable */ + +export class Category { + 'id': number; + 'name': string; +} + +export class 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 class Pet { + 'id': number; + 'category': 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 class Tag { + 'id': number; + 'name': string; +} + +export class User { + 'id': number; + 'username': string; + 'firstName': string; + 'lastName': string; + 'email': string; + 'password': string; + 'phone': string; + /** + * User Status + */ + 'userStatus': number; +} + + +export interface Authentication { + /** + * Apply authentication settings to header and query params. + */ + applyToRequest(requestOptions: JQueryAjaxSettings): void; +} + +export class HttpBasicAuth implements Authentication { + public username: string; + public password: string; + applyToRequest(requestOptions: any): void { + requestOptions.username = this.username; + requestOptions.password = this.password; + } +} + +export class ApiKeyAuth implements Authentication { + public apiKey: string; + + constructor(private location: string, private paramName: string) { + } + + applyToRequest(requestOptions: JQueryAjaxSettings): void { + requestOptions.headers[this.paramName] = this.apiKey; + } +} + +export class OAuth implements Authentication { + public accessToken: string; + + applyToRequest(requestOptions: JQueryAjaxSettings): void { + requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; + } +} + +export class VoidAuth implements Authentication { + public username: string; + public password: string; + applyToRequest(requestOptions: JQueryAjaxSettings): void { + // Do nothing + } +} + +export enum PetApiApiKeys { + api_key, +} + +export class PetApi { + protected basePath = defaultBasePath; + protected defaultHeaders : any = {}; + + protected authentications = { + 'default': new VoidAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), + 'petstore_auth': new OAuth(), + } + + constructor(basePath?: string); + constructor(basePathOrUsername: string, password?: string, basePath?: string) { + if (password) { + if (basePath) { + this.basePath = basePath; + } + } else { + if (basePathOrUsername) { + this.basePath = basePathOrUsername + } + } + } + + public setApiKey(key: PetApiApiKeys, value: string) { + this.authentications[PetApiApiKeys[key]].apiKey = value; + } + + set accessToken(token: string) { + this.authentications.petstore_auth.accessToken = token; + } + private extendObj(objA: T2, objB: T2): T1|T2 { + for(let key in objB){ + if(objB.hasOwnProperty(key)){ + objA[key] = objB[key]; + } + } + return objA; + } + + /** + * Add a new pet to the store + * + * @param body Pet object that needs to be added to the store + */ + public addPet (body?: Pet) : JQueryPromise<{ response: JQueryXHR; body?: any; }> { + let localVarPath = this.basePath + '/pet'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqDict = body; + let reqFormData = new FormData(); + reqFormData.append('body', body); + let reqHasFile = false; + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'POST', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.petstore_auth.applyToRequest(requestOptions); + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: , textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * Deletes a pet + * + * @param petId Pet id to delete + * @param apiKey + */ + public deletePet (petId: number, apiKey?: string) : JQueryPromise<{ response: JQueryXHR; body?: any; }> { + let localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(petId)); + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, 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.'); + } + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + headerParams['api_key'] = apiKey; + + + let reqHasFile = false; + let reqDict = {}; + let reqFormData = new FormData(); + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'DELETE', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.petstore_auth.applyToRequest(requestOptions); + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: , textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * 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) : JQueryPromise<{ response: JQueryXHR; body: Array; }> { + let localVarPath = this.basePath + '/pet/findByStatus'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + + + if (status !== undefined) { + queryParameters['status'] = status; + } + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqHasFile = false; + let reqDict = {}; + let reqFormData = new FormData(); + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'GET', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.petstore_auth.applyToRequest(requestOptions); + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: Array, textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * 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) : JQueryPromise<{ response: JQueryXHR; body: Array; }> { + let localVarPath = this.basePath + '/pet/findByTags'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + + + if (tags !== undefined) { + queryParameters['tags'] = tags; + } + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqHasFile = false; + let reqDict = {}; + let reqFormData = new FormData(); + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'GET', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.petstore_auth.applyToRequest(requestOptions); + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: Array, textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * 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) : JQueryPromise<{ response: JQueryXHR; body: Pet; }> { + let localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(petId)); + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, 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.'); + } + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqHasFile = false; + let reqDict = {}; + let reqFormData = new FormData(); + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'GET', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.petstore_auth.applyToRequest(requestOptions); + + this.authentications.api_key.applyToRequest(requestOptions); + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: Pet, textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * Update an existing pet + * + * @param body Pet object that needs to be added to the store + */ + public updatePet (body?: Pet) : JQueryPromise<{ response: JQueryXHR; body?: any; }> { + let localVarPath = this.basePath + '/pet'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqDict = body; + let reqFormData = new FormData(); + reqFormData.append('body', body); + let reqHasFile = false; + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'PUT', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.petstore_auth.applyToRequest(requestOptions); + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: , textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * 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) : JQueryPromise<{ response: JQueryXHR; body?: any; }> { + let localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(petId)); + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, 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 updatePetWithForm.'); + } + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqHasFile = false; + let reqDict = {}; + let reqFormData = new FormData(); + if (name !== undefined) { + reqFormData.append('name', name); + reqDict['name'] = name; + } + + if (status !== undefined) { + reqFormData.append('status', status); + reqDict['status'] = status; + } + + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'POST', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.petstore_auth.applyToRequest(requestOptions); + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: , textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * 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) : JQueryPromise<{ response: JQueryXHR; body?: any; }> { + let localVarPath = this.basePath + '/pet/{petId}/uploadImage' + .replace('{' + 'petId' + '}', String(petId)); + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, 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 uploadFile.'); + } + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqHasFile = false; + let reqDict = {}; + let reqFormData = new FormData(); + if (additionalMetadata !== undefined) { + reqFormData.append('additionalMetadata', additionalMetadata); + reqDict['additionalMetadata'] = additionalMetadata; + } + + reqHasFile = true; + if (file !== undefined) { + reqFormData.append('file', file); + reqDict['file'] = file; + } + + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'POST', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.petstore_auth.applyToRequest(requestOptions); + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: , textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } +} +export enum StoreApiApiKeys { + api_key, +} + +export class StoreApi { + protected basePath = defaultBasePath; + protected defaultHeaders : any = {}; + + protected authentications = { + 'default': new VoidAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), + 'petstore_auth': new OAuth(), + } + + constructor(basePath?: string); + constructor(basePathOrUsername: string, password?: string, basePath?: string) { + if (password) { + if (basePath) { + this.basePath = basePath; + } + } else { + if (basePathOrUsername) { + this.basePath = basePathOrUsername + } + } + } + + public setApiKey(key: StoreApiApiKeys, value: string) { + this.authentications[StoreApiApiKeys[key]].apiKey = value; + } + + set accessToken(token: string) { + this.authentications.petstore_auth.accessToken = token; + } + private extendObj(objA: T2, objB: T2): T1|T2 { + for(let key in objB){ + if(objB.hasOwnProperty(key)){ + objA[key] = objB[key]; + } + } + return objA; + } + + /** + * 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) : JQueryPromise<{ response: JQueryXHR; body?: any; }> { + let localVarPath = this.basePath + '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', String(orderId)); + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, 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.'); + } + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqHasFile = false; + let reqDict = {}; + let reqFormData = new FormData(); + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'DELETE', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: , textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + */ + public getInventory () : JQueryPromise<{ response: JQueryXHR; body: { [key: string]: number; }; }> { + let localVarPath = this.basePath + '/store/inventory'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqHasFile = false; + let reqDict = {}; + let reqFormData = new FormData(); + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'GET', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.api_key.applyToRequest(requestOptions); + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: { [key: string]: number; }, textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * 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) : JQueryPromise<{ response: JQueryXHR; body: Order; }> { + let localVarPath = this.basePath + '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', String(orderId)); + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, 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.'); + } + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqHasFile = false; + let reqDict = {}; + let reqFormData = new FormData(); + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'GET', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: Order, textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * Place an order for a pet + * + * @param body order placed for purchasing the pet + */ + public placeOrder (body?: Order) : JQueryPromise<{ response: JQueryXHR; body: Order; }> { + let localVarPath = this.basePath + '/store/order'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqDict = body; + let reqFormData = new FormData(); + reqFormData.append('body', body); + let reqHasFile = false; + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'POST', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: Order, textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } +} +export enum UserApiApiKeys { + api_key, +} + +export class UserApi { + protected basePath = defaultBasePath; + protected defaultHeaders : any = {}; + + protected authentications = { + 'default': new VoidAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), + 'petstore_auth': new OAuth(), + } + + constructor(basePath?: string); + constructor(basePathOrUsername: string, password?: string, basePath?: string) { + if (password) { + if (basePath) { + this.basePath = basePath; + } + } else { + if (basePathOrUsername) { + this.basePath = basePathOrUsername + } + } + } + + public setApiKey(key: UserApiApiKeys, value: string) { + this.authentications[UserApiApiKeys[key]].apiKey = value; + } + + set accessToken(token: string) { + this.authentications.petstore_auth.accessToken = token; + } + private extendObj(objA: T2, objB: T2): T1|T2 { + for(let key in objB){ + if(objB.hasOwnProperty(key)){ + objA[key] = objB[key]; + } + } + return objA; + } + + /** + * Create user + * This can only be done by the logged in user. + * @param body Created user object + */ + public createUser (body?: User) : JQueryPromise<{ response: JQueryXHR; body?: any; }> { + let localVarPath = this.basePath + '/user'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqDict = body; + let reqFormData = new FormData(); + reqFormData.append('body', body); + let reqHasFile = false; + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'POST', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: , textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * Creates list of users with given input array + * + * @param body List of user object + */ + public createUsersWithArrayInput (body?: Array) : JQueryPromise<{ response: JQueryXHR; body?: any; }> { + let localVarPath = this.basePath + '/user/createWithArray'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqDict = body; + let reqFormData = new FormData(); + reqFormData.append('body', body); + let reqHasFile = false; + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'POST', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: , textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * Creates list of users with given input array + * + * @param body List of user object + */ + public createUsersWithListInput (body?: Array) : JQueryPromise<{ response: JQueryXHR; body?: any; }> { + let localVarPath = this.basePath + '/user/createWithList'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqDict = body; + let reqFormData = new FormData(); + reqFormData.append('body', body); + let reqHasFile = false; + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'POST', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: , textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * 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) : JQueryPromise<{ response: JQueryXHR; body?: any; }> { + let localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(username)); + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, 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.'); + } + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqHasFile = false; + let reqDict = {}; + let reqFormData = new FormData(); + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'DELETE', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: , textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public getUserByName (username: string) : JQueryPromise<{ response: JQueryXHR; body: User; }> { + let localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(username)); + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, 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.'); + } + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqHasFile = false; + let reqDict = {}; + let reqFormData = new FormData(); + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'GET', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: User, textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * 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) : JQueryPromise<{ response: JQueryXHR; body: string; }> { + let localVarPath = this.basePath + '/user/login'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + + + if (username !== undefined) { + queryParameters['username'] = username; + } + + if (password !== undefined) { + queryParameters['password'] = password; + } + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqHasFile = false; + let reqDict = {}; + let reqFormData = new FormData(); + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'GET', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: string, textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * Logs out current logged in user session + * + */ + public logoutUser () : JQueryPromise<{ response: JQueryXHR; body?: any; }> { + let localVarPath = this.basePath + '/user/logout'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqHasFile = false; + let reqDict = {}; + let reqFormData = new FormData(); + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'GET', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: , textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * 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) : JQueryPromise<{ response: JQueryXHR; body?: any; }> { + let localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(username)); + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, 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.'); + } + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqDict = body; + let reqFormData = new FormData(); + reqFormData.append('body', body); + let reqHasFile = false; + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'PUT', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: , textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } +} diff --git a/samples/client/petstore/typescript-jquery/default/git_push.sh b/samples/client/petstore/typescript-jquery/default/git_push.sh new file mode 100644 index 000000000000..ed374619b139 --- /dev/null +++ b/samples/client/petstore/typescript-jquery/default/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore/typescript-jquery/npm/.swagger-codegen-ignore b/samples/client/petstore/typescript-jquery/npm/.swagger-codegen-ignore new file mode 100644 index 000000000000..c5fa491b4c55 --- /dev/null +++ b/samples/client/petstore/typescript-jquery/npm/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/typescript-jquery/npm/api.ts b/samples/client/petstore/typescript-jquery/npm/api.ts new file mode 100644 index 000000000000..9491259901e3 --- /dev/null +++ b/samples/client/petstore/typescript-jquery/npm/api.ts @@ -0,0 +1,1213 @@ +import * as $ from 'jquery'; + +let defaultBasePath = 'http://petstore.swagger.io/v2'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +/* tslint:disable:no-unused-variable */ + +export class Category { + 'id': number; + 'name': string; +} + +export class 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 class Pet { + 'id': number; + 'category': 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 class Tag { + 'id': number; + 'name': string; +} + +export class User { + 'id': number; + 'username': string; + 'firstName': string; + 'lastName': string; + 'email': string; + 'password': string; + 'phone': string; + /** + * User Status + */ + 'userStatus': number; +} + + +export interface Authentication { + /** + * Apply authentication settings to header and query params. + */ + applyToRequest(requestOptions: JQueryAjaxSettings): void; +} + +export class HttpBasicAuth implements Authentication { + public username: string; + public password: string; + applyToRequest(requestOptions: any): void { + requestOptions.username = this.username; + requestOptions.password = this.password; + } +} + +export class ApiKeyAuth implements Authentication { + public apiKey: string; + + constructor(private location: string, private paramName: string) { + } + + applyToRequest(requestOptions: JQueryAjaxSettings): void { + requestOptions.headers[this.paramName] = this.apiKey; + } +} + +export class OAuth implements Authentication { + public accessToken: string; + + applyToRequest(requestOptions: JQueryAjaxSettings): void { + requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; + } +} + +export class VoidAuth implements Authentication { + public username: string; + public password: string; + applyToRequest(requestOptions: JQueryAjaxSettings): void { + // Do nothing + } +} + +export enum PetApiApiKeys { + api_key, +} + +export class PetApi { + protected basePath = defaultBasePath; + protected defaultHeaders : any = {}; + + protected authentications = { + 'default': new VoidAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), + 'petstore_auth': new OAuth(), + } + + constructor(basePath?: string); + constructor(basePathOrUsername: string, password?: string, basePath?: string) { + if (password) { + if (basePath) { + this.basePath = basePath; + } + } else { + if (basePathOrUsername) { + this.basePath = basePathOrUsername + } + } + } + + public setApiKey(key: PetApiApiKeys, value: string) { + this.authentications[PetApiApiKeys[key]].apiKey = value; + } + + set accessToken(token: string) { + this.authentications.petstore_auth.accessToken = token; + } + private extendObj(objA: T2, objB: T2): T1|T2 { + for(let key in objB){ + if(objB.hasOwnProperty(key)){ + objA[key] = objB[key]; + } + } + return objA; + } + + /** + * Add a new pet to the store + * + * @param body Pet object that needs to be added to the store + */ + public addPet (body?: Pet) : JQueryPromise<{ response: JQueryXHR; body?: any; }> { + let localVarPath = this.basePath + '/pet'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqDict = body; + let reqFormData = new FormData(); + reqFormData.append('body', body); + let reqHasFile = false; + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'POST', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.petstore_auth.applyToRequest(requestOptions); + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: , textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * Deletes a pet + * + * @param petId Pet id to delete + * @param apiKey + */ + public deletePet (petId: number, apiKey?: string) : JQueryPromise<{ response: JQueryXHR; body?: any; }> { + let localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(petId)); + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, 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.'); + } + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + headerParams['api_key'] = apiKey; + + + let reqHasFile = false; + let reqDict = {}; + let reqFormData = new FormData(); + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'DELETE', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.petstore_auth.applyToRequest(requestOptions); + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: , textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * 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) : JQueryPromise<{ response: JQueryXHR; body: Array; }> { + let localVarPath = this.basePath + '/pet/findByStatus'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + + + if (status !== undefined) { + queryParameters['status'] = status; + } + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqHasFile = false; + let reqDict = {}; + let reqFormData = new FormData(); + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'GET', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.petstore_auth.applyToRequest(requestOptions); + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: Array, textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * 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) : JQueryPromise<{ response: JQueryXHR; body: Array; }> { + let localVarPath = this.basePath + '/pet/findByTags'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + + + if (tags !== undefined) { + queryParameters['tags'] = tags; + } + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqHasFile = false; + let reqDict = {}; + let reqFormData = new FormData(); + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'GET', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.petstore_auth.applyToRequest(requestOptions); + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: Array, textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * 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) : JQueryPromise<{ response: JQueryXHR; body: Pet; }> { + let localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(petId)); + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, 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.'); + } + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqHasFile = false; + let reqDict = {}; + let reqFormData = new FormData(); + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'GET', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.petstore_auth.applyToRequest(requestOptions); + + this.authentications.api_key.applyToRequest(requestOptions); + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: Pet, textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * Update an existing pet + * + * @param body Pet object that needs to be added to the store + */ + public updatePet (body?: Pet) : JQueryPromise<{ response: JQueryXHR; body?: any; }> { + let localVarPath = this.basePath + '/pet'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqDict = body; + let reqFormData = new FormData(); + reqFormData.append('body', body); + let reqHasFile = false; + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'PUT', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.petstore_auth.applyToRequest(requestOptions); + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: , textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * 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) : JQueryPromise<{ response: JQueryXHR; body?: any; }> { + let localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', String(petId)); + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, 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 updatePetWithForm.'); + } + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqHasFile = false; + let reqDict = {}; + let reqFormData = new FormData(); + if (name !== undefined) { + reqFormData.append('name', name); + reqDict['name'] = name; + } + + if (status !== undefined) { + reqFormData.append('status', status); + reqDict['status'] = status; + } + + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'POST', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.petstore_auth.applyToRequest(requestOptions); + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: , textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * 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) : JQueryPromise<{ response: JQueryXHR; body?: any; }> { + let localVarPath = this.basePath + '/pet/{petId}/uploadImage' + .replace('{' + 'petId' + '}', String(petId)); + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, 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 uploadFile.'); + } + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqHasFile = false; + let reqDict = {}; + let reqFormData = new FormData(); + if (additionalMetadata !== undefined) { + reqFormData.append('additionalMetadata', additionalMetadata); + reqDict['additionalMetadata'] = additionalMetadata; + } + + reqHasFile = true; + if (file !== undefined) { + reqFormData.append('file', file); + reqDict['file'] = file; + } + + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'POST', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.petstore_auth.applyToRequest(requestOptions); + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: , textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } +} +export enum StoreApiApiKeys { + api_key, +} + +export class StoreApi { + protected basePath = defaultBasePath; + protected defaultHeaders : any = {}; + + protected authentications = { + 'default': new VoidAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), + 'petstore_auth': new OAuth(), + } + + constructor(basePath?: string); + constructor(basePathOrUsername: string, password?: string, basePath?: string) { + if (password) { + if (basePath) { + this.basePath = basePath; + } + } else { + if (basePathOrUsername) { + this.basePath = basePathOrUsername + } + } + } + + public setApiKey(key: StoreApiApiKeys, value: string) { + this.authentications[StoreApiApiKeys[key]].apiKey = value; + } + + set accessToken(token: string) { + this.authentications.petstore_auth.accessToken = token; + } + private extendObj(objA: T2, objB: T2): T1|T2 { + for(let key in objB){ + if(objB.hasOwnProperty(key)){ + objA[key] = objB[key]; + } + } + return objA; + } + + /** + * 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) : JQueryPromise<{ response: JQueryXHR; body?: any; }> { + let localVarPath = this.basePath + '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', String(orderId)); + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, 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.'); + } + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqHasFile = false; + let reqDict = {}; + let reqFormData = new FormData(); + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'DELETE', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: , textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + */ + public getInventory () : JQueryPromise<{ response: JQueryXHR; body: { [key: string]: number; }; }> { + let localVarPath = this.basePath + '/store/inventory'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqHasFile = false; + let reqDict = {}; + let reqFormData = new FormData(); + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'GET', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.api_key.applyToRequest(requestOptions); + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: { [key: string]: number; }, textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * 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) : JQueryPromise<{ response: JQueryXHR; body: Order; }> { + let localVarPath = this.basePath + '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', String(orderId)); + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, 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.'); + } + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqHasFile = false; + let reqDict = {}; + let reqFormData = new FormData(); + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'GET', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: Order, textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * Place an order for a pet + * + * @param body order placed for purchasing the pet + */ + public placeOrder (body?: Order) : JQueryPromise<{ response: JQueryXHR; body: Order; }> { + let localVarPath = this.basePath + '/store/order'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqDict = body; + let reqFormData = new FormData(); + reqFormData.append('body', body); + let reqHasFile = false; + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'POST', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: Order, textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } +} +export enum UserApiApiKeys { + api_key, +} + +export class UserApi { + protected basePath = defaultBasePath; + protected defaultHeaders : any = {}; + + protected authentications = { + 'default': new VoidAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), + 'petstore_auth': new OAuth(), + } + + constructor(basePath?: string); + constructor(basePathOrUsername: string, password?: string, basePath?: string) { + if (password) { + if (basePath) { + this.basePath = basePath; + } + } else { + if (basePathOrUsername) { + this.basePath = basePathOrUsername + } + } + } + + public setApiKey(key: UserApiApiKeys, value: string) { + this.authentications[UserApiApiKeys[key]].apiKey = value; + } + + set accessToken(token: string) { + this.authentications.petstore_auth.accessToken = token; + } + private extendObj(objA: T2, objB: T2): T1|T2 { + for(let key in objB){ + if(objB.hasOwnProperty(key)){ + objA[key] = objB[key]; + } + } + return objA; + } + + /** + * Create user + * This can only be done by the logged in user. + * @param body Created user object + */ + public createUser (body?: User) : JQueryPromise<{ response: JQueryXHR; body?: any; }> { + let localVarPath = this.basePath + '/user'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqDict = body; + let reqFormData = new FormData(); + reqFormData.append('body', body); + let reqHasFile = false; + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'POST', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: , textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * Creates list of users with given input array + * + * @param body List of user object + */ + public createUsersWithArrayInput (body?: Array) : JQueryPromise<{ response: JQueryXHR; body?: any; }> { + let localVarPath = this.basePath + '/user/createWithArray'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqDict = body; + let reqFormData = new FormData(); + reqFormData.append('body', body); + let reqHasFile = false; + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'POST', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: , textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * Creates list of users with given input array + * + * @param body List of user object + */ + public createUsersWithListInput (body?: Array) : JQueryPromise<{ response: JQueryXHR; body?: any; }> { + let localVarPath = this.basePath + '/user/createWithList'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqDict = body; + let reqFormData = new FormData(); + reqFormData.append('body', body); + let reqHasFile = false; + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'POST', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: , textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * 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) : JQueryPromise<{ response: JQueryXHR; body?: any; }> { + let localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(username)); + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, 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.'); + } + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqHasFile = false; + let reqDict = {}; + let reqFormData = new FormData(); + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'DELETE', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: , textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public getUserByName (username: string) : JQueryPromise<{ response: JQueryXHR; body: User; }> { + let localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(username)); + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, 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.'); + } + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqHasFile = false; + let reqDict = {}; + let reqFormData = new FormData(); + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'GET', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: User, textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * 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) : JQueryPromise<{ response: JQueryXHR; body: string; }> { + let localVarPath = this.basePath + '/user/login'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + + + if (username !== undefined) { + queryParameters['username'] = username; + } + + if (password !== undefined) { + queryParameters['password'] = password; + } + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqHasFile = false; + let reqDict = {}; + let reqFormData = new FormData(); + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'GET', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: string, textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * Logs out current logged in user session + * + */ + public logoutUser () : JQueryPromise<{ response: JQueryXHR; body?: any; }> { + let localVarPath = this.basePath + '/user/logout'; + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, this.defaultHeaders); + + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqHasFile = false; + let reqDict = {}; + let reqFormData = new FormData(); + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'GET', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: , textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } + /** + * 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) : JQueryPromise<{ response: JQueryXHR; body?: any; }> { + let localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', String(username)); + let queryParameters: any = {}; + let headerParams: any = this.extendObj({}, 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.'); + } + + + localVarPath = localVarPath + "?" + $.param(queryParameters); + + + let reqDict = body; + let reqFormData = new FormData(); + reqFormData.append('body', body); + let reqHasFile = false; + + let requestOptions: JQueryAjaxSettings = { + url: localVarPath, + type: 'PUT', + headers: headerParams, + processData: false + }; + + if (Object.keys(reqDict).length) { + requestOptions.data = reqHasFile ? reqFormData : JSON.stringify(reqDict); + requestOptions.contentType = reqHasFile ? false : 'application/json; charset=utf-8'; + } + + this.authentications.default.applyToRequest(requestOptions); + + let dfd = $.Deferred(); + $.ajax(requestOptions).then( + (data: , textStatus: string, jqXHR: JQueryXHR) => + dfd.resolve({ response: jqXHR, body: data }), + (xhr: JQueryXHR, textStatus: string, errorThrown: string) => + dfd.reject({ response: xhr, body: errorThrown }) + ); + return dfd.promise(); + } +} diff --git a/samples/client/petstore/typescript-jquery/npm/git_push.sh b/samples/client/petstore/typescript-jquery/npm/git_push.sh new file mode 100644 index 000000000000..ed374619b139 --- /dev/null +++ b/samples/client/petstore/typescript-jquery/npm/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore/typescript-jquery/npm/package.json b/samples/client/petstore/typescript-jquery/npm/package.json new file mode 100644 index 000000000000..89b35a0787a0 --- /dev/null +++ b/samples/client/petstore/typescript-jquery/npm/package.json @@ -0,0 +1,22 @@ +{ + "name": "@swagger/angular2-typescript-petstore", + "version": "0.0.1-SNAPSHOT.201703061507", + "description": "JQuery client for @swagger/angular2-typescript-petstore", + "main": "api.js", + "scripts": { + "build": "tsc" + }, + "author": "Swagger Codegen Contributors", + "license": "MIT", + "dependencies": { + "bluebird": "^3.3.5", + "request": "^2.72.0" + }, + "devDependencies": { + "typescript": "^1.8.10", + "typings": "^0.8.1" + }, + "publishConfig":{ + "registry":"https://skimdb.npmjs.com/registry" + } +} diff --git a/samples/client/petstore/typescript-jquery/npm/tsconfig.json b/samples/client/petstore/typescript-jquery/npm/tsconfig.json new file mode 100644 index 000000000000..2dd166566e97 --- /dev/null +++ b/samples/client/petstore/typescript-jquery/npm/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "module": "commonjs", + "noImplicitAny": false, + "suppressImplicitAnyIndexErrors": true, + "target": "ES5", + "moduleResolution": "node", + "removeComments": true, + "sourceMap": true, + "noLib": false, + "declaration": true + }, + "files": [ + "api.ts", + "typings/main.d.ts" + ] +} + diff --git a/samples/client/petstore/typescript-jquery/npm/typings.json b/samples/client/petstore/typescript-jquery/npm/typings.json new file mode 100644 index 000000000000..76c4cc8e6af3 --- /dev/null +++ b/samples/client/petstore/typescript-jquery/npm/typings.json @@ -0,0 +1,10 @@ +{ + "ambientDependencies": { + "bluebird": "registry:dt/bluebird#2.0.0+20160319051630", + "core-js": "registry:dt/core-js#0.0.0+20160317120654", + "node": "registry:dt/node#4.0.0+20160423143914" + }, + "dependencies": { + "request": "registry:npm/request#2.69.0+20160304121250" + } +} \ No newline at end of file